1
Fork 0

Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus

Few fixes for multiple themes support feature

r? @QuietMisdreavus

Fixes #47695.
This commit is contained in:
bors 2018-01-25 06:12:06 +00:00
commit 4cf26f8a13
5 changed files with 48 additions and 24 deletions

View file

@ -74,10 +74,12 @@ r##"<!DOCTYPE html>
{sidebar} {sidebar}
</nav> </nav>
<button id="theme-picker"> <div class="theme-picker">
<img src="{root_path}brush.svg" width="18" alt="Pick another theme!"> <button id="theme-picker" aria-label="Pick another theme!">
<img src="{root_path}brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div> <div id="theme-choices"></div>
</button> </div>
<script src="{root_path}theme.js"></script> <script src="{root_path}theme.js"></script>
<nav class="sub"> <nav class="sub">
<form class="search-form js-only"> <form class="search-form js-only">

View file

@ -918,12 +918,12 @@ themePicker.onclick = function() {{
}} }}
}}; }};
[{}].forEach(function(item) {{ [{}].forEach(function(item) {{
var div = document.createElement('div'); var but = document.createElement('button');
div.innerHTML = item; but.innerHTML = item;
div.onclick = function(el) {{ but.onclick = function(el) {{
switchTheme(currentTheme, mainTheme, item); switchTheme(currentTheme, mainTheme, item);
}}; }};
themes.appendChild(div); themes.appendChild(but);
}}); }});
"#, themes.iter() "#, themes.iter()
.map(|s| format!("\"{}\"", s)) .map(|s| format!("\"{}\"", s))

View file

@ -1141,13 +1141,19 @@ kbd {
border: solid 1px; border: solid 1px;
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 -1px 0; box-shadow: inset 0 -1px 0;
cursor: default;
}
.theme-picker {
position: absolute;
left: 211px;
top: 19px;
} }
#theme-picker { #theme-picker {
position: absolute;
left: 211px;
top: 17px;
padding: 4px; padding: 4px;
width: 27px;
height: 29px;
border: 1px solid; border: 1px solid;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
@ -1156,21 +1162,28 @@ kbd {
#theme-choices { #theme-choices {
display: none; display: none;
position: absolute; position: absolute;
left: -1px; left: 0;
top: 30px; top: 28px;
border: 1px solid; border: 1px solid;
border-radius: 3px; border-radius: 3px;
z-index: 1; z-index: 1;
cursor: pointer;
} }
#theme-choices > div { #theme-choices > button {
border-top: 1px solid; border: none;
width: 100%;
padding: 4px; padding: 4px;
text-align: center; text-align: center;
background: rgba(0,0,0,0);
}
#theme-choices > button:not(:first-child) {
border-top: 1px solid;
} }
@media (max-width: 700px) { @media (max-width: 700px) {
#theme-picker { .theme-picker {
left: 109px; left: 109px;
top: 7px; top: 7px;
z-index: 1; z-index: 1;

View file

@ -197,7 +197,7 @@ a.test-arrow {
#help dt { #help dt {
border-color: #bfbfbf; border-color: #bfbfbf;
background: #fff; background: rgba(0,0,0,0);
color: black; color: black;
} }
@ -352,7 +352,7 @@ pre.ignore:hover, .information:hover + pre.ignore {
} }
kbd { kbd {
color: #444d56; color: #000;
background-color: #fafbfc; background-color: #fafbfc;
border-color: #d1d5da; border-color: #d1d5da;
border-bottom-color: #c6cbd1; border-bottom-color: #c6cbd1;
@ -364,16 +364,20 @@ kbd {
background: #f0f0f0; background: #f0f0f0;
} }
#theme-picker:hover, #theme-picker:focus {
border-color: #ffb900;
}
#theme-choices { #theme-choices {
border-color: #e0e0e0; border-color: #e0e0e0;
background-color: #353535; background-color: #353535;
} }
#theme-choices > div { #theme-choices > button:not(:first-child) {
border-top: #e0e0e0; border-top-color: #e0e0e0;
} }
#theme-choices > div:hover { #theme-choices > button:hover, #theme-choices > button:focus {
background-color: #444; background-color: #444;
} }

View file

@ -345,7 +345,7 @@ pre.ignore:hover, .information:hover + pre.ignore {
} }
kbd { kbd {
color: #444d56; color: #000;
background-color: #fafbfc; background-color: #fafbfc;
border-color: #d1d5da; border-color: #d1d5da;
border-bottom-color: #c6cbd1; border-bottom-color: #c6cbd1;
@ -354,6 +354,11 @@ kbd {
#theme-picker { #theme-picker {
border-color: #e0e0e0; border-color: #e0e0e0;
background-color: #fff;
}
#theme-picker:hover, #theme-picker:focus {
border-color: #717171;
} }
#theme-choices { #theme-choices {
@ -361,11 +366,11 @@ kbd {
background-color: #fff; background-color: #fff;
} }
#theme-choices > div { #theme-choices > button:not(:first-child) {
border-top: #e0e0e0; border-top-color: #e0e0e0;
} }
#theme-choices > div:hover { #theme-choices > button:hover, #theme-choices > button:focus {
background-color: #eee; background-color: #eee;
} }