Coding style fixes
This commit is contained in:
parent
3a6437cd98
commit
db7c8f4c3c
4 changed files with 22 additions and 25 deletions
|
@ -1386,11 +1386,11 @@ impl Setting {
|
|||
description,
|
||||
),
|
||||
Setting::Select { js_data_name, description, default_value, ref options } => format!(
|
||||
"<div class='setting-line'>\
|
||||
"<div class=\"setting-line\">\
|
||||
<div>{}</div>\
|
||||
<label class='select-wrapper'>\
|
||||
<select id='{}' autocomplete='off'>{}</select>\
|
||||
<img src='{}down-arrow{}.svg' alt='Select item'>\
|
||||
<label class=\"select-wrapper\">\
|
||||
<select id=\"{}\" autocomplete=\"off\">{}</select>\
|
||||
<img src=\"{}down-arrow{}.svg\" alt=\"Select item\">\
|
||||
</label>\
|
||||
</div>",
|
||||
description,
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
|
||||
.select-wrapper {
|
||||
float: right;
|
||||
|
||||
position: relative;
|
||||
|
||||
height: 27px;
|
||||
min-width: 25%;
|
||||
}
|
||||
|
@ -42,23 +40,18 @@
|
|||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
|
||||
background: none;
|
||||
border: 2px solid #ccc;
|
||||
padding-right: 28px;
|
||||
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.select-wrapper img {
|
||||
pointer-events: none;
|
||||
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
background: #ccc;
|
||||
|
||||
height: 100%;
|
||||
width: 28px;
|
||||
padding: 0px 4px;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
// Local js definitions:
|
||||
/* global getCurrentValue, updateLocalStorage */
|
||||
/* global getCurrentValue, updateLocalStorage, updateSystemTheme */
|
||||
|
||||
(function () {
|
||||
function changeSetting(settingName, value) {
|
||||
updateLocalStorage('rustdoc-' + settingName, value);
|
||||
updateLocalStorage("rustdoc-" + settingName, value);
|
||||
|
||||
switch (settingName) {
|
||||
case 'preferred-dark-theme':
|
||||
case 'preferred-light-theme':
|
||||
case 'use-system-theme':
|
||||
case "preferred-dark-theme":
|
||||
case "preferred-light-theme":
|
||||
case "use-system-theme":
|
||||
updateSystemTheme();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getSettingValue(settingName) {
|
||||
return getCurrentValue('rustdoc-' + settingName);
|
||||
return getCurrentValue("rustdoc-" + settingName);
|
||||
}
|
||||
|
||||
function setEvents() {
|
||||
|
@ -23,9 +23,10 @@
|
|||
toggles: document.getElementsByClassName("slider"),
|
||||
selects: document.getElementsByClassName("select-wrapper")
|
||||
};
|
||||
var i;
|
||||
|
||||
if (elems.toggles && elems.toggles.length > 0) {
|
||||
for (var i = 0; i < elems.toggles.length; ++i) {
|
||||
for (i = 0; i < elems.toggles.length; ++i) {
|
||||
var toggle = elems.toggles[i].previousElementSibling;
|
||||
var settingId = toggle.id;
|
||||
var settingValue = getSettingValue(settingId);
|
||||
|
@ -39,8 +40,8 @@
|
|||
}
|
||||
|
||||
if (elems.selects && elems.selects.length > 0) {
|
||||
for (var i = 0; i < elems.selects.length; ++i) {
|
||||
var select = elems.selects[i].getElementsByTagName('select')[0];
|
||||
for (i = 0; i < elems.selects.length; ++i) {
|
||||
var select = elems.selects[i].getElementsByTagName("select")[0];
|
||||
var settingId = select.id;
|
||||
var settingValue = getSettingValue(settingId);
|
||||
if (settingValue !== null) {
|
||||
|
|
|
@ -110,8 +110,8 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) {
|
|||
});
|
||||
if (found === true) {
|
||||
styleElem.href = newHref;
|
||||
// If this new value comes from a system setting or from the previously saved theme, no
|
||||
// need to save it.
|
||||
// If this new value comes from a system setting or from the previously
|
||||
// saved theme, no need to save it.
|
||||
if (saveTheme === true) {
|
||||
updateLocalStorage("rustdoc-theme", newTheme);
|
||||
}
|
||||
|
@ -182,7 +182,10 @@ if (getCurrentValue("rustdoc-use-system-theme") !== "false" && window.matchMedia
|
|||
// call the function to initialize the theme at least once!
|
||||
updateSystemTheme();
|
||||
} else {
|
||||
switchTheme(currentTheme, mainTheme,
|
||||
switchTheme(
|
||||
currentTheme,
|
||||
mainTheme,
|
||||
getCurrentValue("rustdoc-theme") || "light",
|
||||
false);
|
||||
false
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue