summaryrefslogtreecommitdiff
path: root/src/ui/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui.js')
-rw-r--r--src/ui/ui.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/ui/ui.js b/src/ui/ui.js
index 205d2a9..7e4d45d 100644
--- a/src/ui/ui.js
+++ b/src/ui/ui.js
@@ -41,6 +41,9 @@ var UI = (() => {
if (UI.local && !UI.local.debug) {
debug = () => {}; // be quiet!
}
+ if (UI.local) {
+ document.documentElement.classList.toggle("tor", !!UI.local.isTorBrowser);
+ }
resolve();
if (UI.onSettings) UI.onSettings();
await HighContrast.init();
@@ -313,33 +316,30 @@ var UI = (() => {
sizer.id = "presets-sizer";
sizer.appendChild(presets.cloneNode(true));
document.body.appendChild(sizer);
- setTimeout(async () => {
- let presetWidth = sizer.querySelector("input.preset").offsetWidth;
- let labelWidth = 0;
- for (let l of sizer.querySelectorAll("label.preset")) {
- let lw = l.offsetWidth;
- debug("lw", l.textContent, lw);
- if (lw > labelWidth) labelWidth = lw;
- }
-
- debug(`Preset: %s Label: %s`, presetWidth, labelWidth);
- labelWidth += 16;
- if (presetWidth < labelWidth) {
- for (let ss of document.styleSheets) {
- if (ss.href.endsWith("/ui.css")) {
- for (let r of ss.cssRules) {
- if (/input\.preset:checked.*min-width:/.test(r.cssText)) {
- r.style.minWidth = (labelWidth) + "px";
- break;
- }
+ let presetWidth = sizer.querySelector("input.preset").offsetWidth;
+ let labelWidth = 0;
+ for (let l of sizer.querySelectorAll("label.preset")) {
+ let lw = l.offsetWidth;
+ debug("lw", l.textContent, lw);
+ if (lw > labelWidth) labelWidth = lw;
+ }
+
+ debug(`Preset: %s Label: %s`, presetWidth, labelWidth);
+ labelWidth += 16;
+ if (presetWidth < labelWidth) {
+ for (let ss of document.styleSheets) {
+ if (ss.href.endsWith("/ui.css")) {
+ for (let r of ss.cssRules) {
+ if (/input\.preset:checked.*min-width:/.test(r.cssText)) {
+ r.style.minWidth = (labelWidth) + "px";
+ break;
}
}
}
}
+ }
- sizer.remove();
-
- }, 100);
+ sizer.remove();
UI.Sites.correctSize = () => {}; // just once, please!
}