diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f006694c..1dddcfb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: '14' - run: npm install diff --git a/global.css b/global.css index 5cf9f3a2..4c52364f 100644 --- a/global.css +++ b/global.css @@ -1,7 +1,6 @@ -html#stylus #header *:not(#\0) { - /* This suppresses transitions on page open. - * WARNING! Must be the first rule here so dom.js can simply call deleteRule for index 0. - * Using an increased specificity to override sane selectors in user styles */ +html#stylus #header *:not(#\0transition-suppressor) { + /* This suppresses a bug in all? browsers: they apply transitions during page load. + * Using an increased specificity to override sane selectors in user styles. */ transition: none !important; } body { diff --git a/install-usercss/preinit.js b/install-usercss/preinit.js index 700c2809..6f37f2e0 100644 --- a/install-usercss/preinit.js +++ b/install-usercss/preinit.js @@ -19,7 +19,7 @@ const preinit = (() => { .catch(getData); } else { getData = PortDownloader(); - firstGet = getData({timer: false}); + firstGet = getData({force: true}); } function DirectDownloader() { diff --git a/js/color/color-view.js b/js/color/color-view.js index b4914cdc..c8143ecd 100644 --- a/js/color/color-view.js +++ b/js/color/color-view.js @@ -585,7 +585,22 @@ if (palette.size > 1 || nums && nums.length > 1) { const old = new Map((options.popup.palette || []).map(el => [el.__color, el])); for (const [color, data] of palette) { - res.push(old.get(color) || makePaletteSwatch(color, data, options.popup.paletteLine)); + const str = data.join(', '); + let el = old.get(color); + if (!el) { + el = document.createElement('div'); + el.__color = color; // also used in color-picker.js + el.className = COLORVIEW_SWATCH_CLASS; + el.style.setProperty(`--${COLORVIEW_SWATCH_CLASS}`, color); + } + if (el.__str !== str) { + el.__str = str; + // break down long lists: 10 per line + el.title = `${color}\n${options.popup.paletteLine} ${ + str.length > 50 ? str.replace(/([^,]+,\s){10}/g, '$&\n') : str + }`; + } + res.push(el); } res.push(Object.assign(document.createElement('span'), { className: 'colorpicker-palette-hint', @@ -596,17 +611,6 @@ return res; } - function makePaletteSwatch(color, nums, label) { - const s = nums.join(', '); - const el = document.createElement('div'); - el.className = COLORVIEW_SWATCH_CLASS; - el.style.cssText = COLORVIEW_SWATCH_CSS + color; - // break down long lists: 10 per line - el.title = `${color}\n${label} ${s.length > 50 ? s.replace(/([^,]+,\s){10}/g, '$&\n') : s}`; - el.__color = color; - return el; - } - function paletteCallback(el) { const {cm} = this; const lines = el.title.split('\n')[1].match(/\d+/g).map(Number); diff --git a/js/dom.js b/js/dom.js index ada2f408..d4111554 100644 --- a/js/dom.js +++ b/js/dom.js @@ -437,8 +437,16 @@ async function waitForSheet({ window.on('resize', () => debounce(addTooltipsToEllipsized, 100)); }); - // Using `load` event as we need transition bug suppressor active until everything loads - window.on('load', () => $('link[href^="global.css"]').sheet.deleteRule(0), {once: true}); + window.on('load', () => { + const {sheet} = $('link[href^="global.css"]'); + for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) { + // Not using \0 in the id as it's converted to \xFFFD, probably a bug + if (/#.transition-suppressor/.test(rule.selectorText)) { + sheet.deleteRule(i); + break; + } + } + }, {once: true}); function addFaviconFF() { const iconset = ['', 'light/'][prefs.get('iconset')] || ''; diff --git a/privacy-policy.md b/privacy-policy.md new file mode 100644 index 00000000..02fa1ac3 --- /dev/null +++ b/privacy-policy.md @@ -0,0 +1,9 @@ +# Privacy Policy + +Unlike other similar extensions, we don't find you to be all that interesting. Your questionable browsing history should remain between you and the NSA. Stylus collects nothing. Period. + +Again, **no data or personal information is collected by Stylus**. + +## Contact + +If you have any questions or suggestions regarding this privacy policy, do not hesitate to [contact us](stylus.openstyles@gmail.com). diff --git a/tools/test.js b/tools/test.js index 0134ac58..abee1c79 100644 --- a/tools/test.js +++ b/tools/test.js @@ -6,8 +6,8 @@ testGlobalCss(); function testGlobalCss() { const css = fs.readFileSync('global.css', {encoding: 'utf8'}); - const ERR = 'global.css: the first rule must be the transition suppressor'; - const RX_SUPPRESSOR = /^[^{}]+{\s*transition:\s*none\s*!\s*important/i; + const ERR = 'global.css: missing the transition suppressor rule'; + const RX_SUPPRESSOR = /[^{}]+#\\0transition-suppressor[^{}]+{\s*transition:\s*none\s*!\s*important/i; const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g; if (!RX_SUPPRESSOR.test(css.replace(RX_COMMENT, ''))) { console.error(ERR);