summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorhackademix2019-03-19 13:46:58 +0100
committerhackademix2019-03-19 13:46:58 +0100
commitea894393f16fd03e04f8343c37dd4f4aee9a24ad (patch)
tree26f846ea744bbfadda5e4e9696ef5c97293b3cc6 /src/ui
parentf04fbd790ea90fb771e5f4512f1bfcb186baaac5 (diff)
downloadnoscript-ea894393f16fd03e04f8343c37dd4f4aee9a24ad.tar.gz
noscript-ea894393f16fd03e04f8343c37dd4f4aee9a24ad.tar.xz
noscript-ea894393f16fd03e04f8343c37dd4f4aee9a24ad.zip
Improved popup initialization perceived speed.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/popup.css3
-rw-r--r--src/ui/ui.js41
2 files changed, 20 insertions, 24 deletions
diff --git a/src/ui/popup.css b/src/ui/popup.css
index ad5e3d0..ce96023 100644
--- a/src/ui/popup.css
+++ b/src/ui/popup.css
@@ -28,7 +28,7 @@ body {
background: transparent no-repeat center;
background-size: 100%;
transform: unset;
- transition: all 0.3s;
+ transition: transform 0.3s;
border: none;
display: block;
@@ -221,7 +221,6 @@ body {
background-position: left top;
background-repeat: no-repeat;
min-height: 3em;
- transition: height .5s;
font-size: 1.2em;
vertical-align: middle;
}
diff --git a/src/ui/ui.js b/src/ui/ui.js
index 46d9d7f..7e4d45d 100644
--- a/src/ui/ui.js
+++ b/src/ui/ui.js
@@ -316,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!
}