Commit Graph

2598 Commits

Author SHA1 Message Date
tophf
bec60f54ab fixup ccbccae2: add default CM theme entry for firefox 2017-04-18 12:46:37 +03:00
tophf
fa46a2c336 split filterStyles()
js engines don't like big functions (V8 often deoptimized the original filterStyles), it also makes sense to extract the less frequently executed code
2017-04-18 12:46:37 +03:00
tophf
dcfb8ad356 simplify/modularize styleSectionsEqual
+ 1.5x speedup thanks to checkedInB memoization
+ more strict type comparison
+ two-way array comparison (more correct, even if there's no practical difference)
2017-04-18 12:46:37 +03:00
tophf
db1dc0df7b simplify/modularize getApplicableSections 2017-04-18 12:46:37 +03:00
tophf
8f784a19d4 simplify saveStyle, invalidateCache 2017-04-18 12:46:37 +03:00
tophf
4bc27db3fc "backface-visibility: hidden" workaround for a browser bug 2017-04-18 12:46:36 +03:00
tophf
e6f2034e64 make import report messages localizable 2017-04-18 12:46:36 +03:00
tophf
470bc92da5 Add <all_urls> in permissions
We already have full access to all sites via our content script so this permission doesn't add anything new but we need it to be able to establish page connection via tabs.executeScript when the extension is installed, reloaded, re-enabled.

<all_urls> also allows file:// URLs unlike *://*/* used previously. Of course it requires the corresponding checkbox being enabled on chrome://extensions page.
2017-04-18 12:46:36 +03:00
tophf
ca911396a1 Don't use chrome://favicon
chrome://favicon doesn't indicate an icon is missing in any way, it simply shows a placeholder instead. It also doesn't extrapolate from sub-pages so `example.com` won't have a favicon even if `example.com/subpage` has one.
2017-04-18 12:46:36 +03:00
tophf
05c05ec6b9 manage: use chrome://favicon 2017-04-18 12:46:36 +03:00
tophf
c09ee38c9e rework enforceInputRange
* enforce only in onchange
* notify on valid input immediately
* highlight invalid values
2017-04-18 12:46:36 +03:00
tophf
3389812766 remove focus ring from <summary> 2017-04-18 12:46:36 +03:00
tophf
42f7b11bac broadcast only meta for styleUpdated/styleAdded
apply/popup/manage use only meta for these two methods,
editor may need the full code but can fetch it directly,
so we send just the meta to avoid spamming lots of tabs with huge styles
2017-04-18 12:46:36 +03:00
tophf
ce2492c305 manage: apply search filter to edited/updated styles 2017-04-18 12:46:35 +03:00
tophf
4f2ccbe6cb speedup import by bulk-updating DOM every 50 styles or 1 sec 2017-04-18 12:46:35 +03:00
tophf
1749057b91 Explainer for stylusUnavailableForURL message
We don't mention the G+ iframe on CWS stylable only when "Out of process iframes" feature is enabled which can be set manually via chrome://flags/#enable-site-per-process. It's still in development and is known to break some sites, which is why it's not enabled by default.
2017-04-18 12:46:35 +03:00
tophf
dad1d1fe5f get rid of switch-fallthrough; reuse requestStyles 2017-04-18 12:46:35 +03:00
tophf
80538a17f5 Report unreachable content script in popup
Chrome can't executeScript on file:// URLs even though we have <all_urls> in manifest.json so on such pages we'll display a warning in the popup. This should only happen when Stylus is [re]enabled/reloaded.
2017-04-18 12:46:35 +03:00
tophf
a93354de8c remove iframe observer
* documentElement may be overwritten right after iframe was initialized with contentDocument.write() and due to this change being external it's not reported in our existing rewrite observer so we enqueue an additional check using setTimeout(0).

* match_about_blank in manifest.json is back

* iframes with src = about: or javascript: don't have a proper URL when our content script runs so we get the real URL from the parent window

* minor refactoring
2017-04-18 12:46:35 +03:00
tophf
7ec41bcea1 apply: refactor observers 2017-04-18 12:46:35 +03:00
tophf
2468784eb3 csslint: fix crashing on unclosed calc() at eof 2017-04-18 12:46:34 +03:00
tophf
279149b8b8 refactor deepCopy & deepMerge 2017-04-18 12:46:34 +03:00
tophf
2086f10af4 prefs.set: deep compare 2017-04-18 12:46:34 +03:00
tophf
8c539dabd6 prefs.set: enforce value type based on defaults 2017-04-18 12:46:34 +03:00
tophf
97c5972348 prefs: keep up-to-date using prefChanged event 2017-04-18 12:46:34 +03:00
tophf
5c8d1950a7 Isolate storage.js in background context
To prevent cross-page leaks we need to create/copy prefs and cachedStyles inside the background page context.

* storage.js is now used only in the background page

* messaging.js now contains less bg-specific methods and more common methods. Added saveStyleSafe, deleteStyleSafe which automatically invoke onRuntimeMessage of the current page or just handleUpdate/handleDelete when notify:false

* prefs.js with 'prefs' for background and UI pages: separate objects because a UI page may load before the background page and it can read prefs from localStorage/sync/defaults
2017-04-18 12:46:34 +03:00
tophf
7f6d3e241a speedup: don't animate elements during import 2017-04-18 12:46:34 +03:00
tophf
b61dc4184b fixup: import report onclick 2017-04-18 12:46:33 +03:00
tophf
257fda4d1d updateIcon: use the old flow to avoid "no tab" errors 2017-04-18 12:46:33 +03:00
tophf
5a61ac2f18 fixup for CodeMirror failing on keyMap=""
This should not happen *normally* but a user may edit chrome.storage manually etc.
2017-04-18 12:46:33 +03:00
tophf
7084dd1223 createStyleElement speedup: reuse the template 2017-04-18 12:46:33 +03:00
tophf
8bec1d61bd manage: save scrollY in onbeforeunload (less buggy) 2017-04-18 12:46:33 +03:00
tophf
1df76c6929 options: localize the title 2017-04-18 12:46:33 +03:00
tophf
db83ce8dc3 demote getClickedStyle* to its local usage scope 2017-04-18 12:46:33 +03:00
tophf
eb0c57d716 manage: @media (max-width: 800px) for .newUI 2017-04-18 12:46:32 +03:00
tophf
2a7231a887 manage: update state tooltips; add filter option
* update state is shown in tooltips that fade out in 10 sec except for .update-problem and .can-update
* when updates are found a filtering option is revealed; when it's checked only entries with updates are shown; when all updates are installed the option automatically hides
2017-04-18 12:46:32 +03:00
tophf
311d036dee manage: remove .updatable after updating a style 2017-04-18 12:46:32 +03:00
tophf
2bb7d31042 fixups for Opera/Vivaldi/Firefox-compatibility 2017-04-18 12:46:32 +03:00
tophf
c8e8b94d28 popup: invoke openURL explicitly 2017-04-18 12:46:32 +03:00
tophf
ff84e924fa polyfill DOM enumerables for Chrome 49 2017-04-18 12:46:32 +03:00
tophf
1ded89969b localization: don't recheck on DOMContentLoaded 2017-04-18 12:46:32 +03:00
tophf
a889ac6413 templates: compress inter-tag whitespace
to reduce number of DOM nodes by 25%
2017-04-18 12:46:32 +03:00
tophf
fcb149ae21 limit broadcast area of prefChanged in notifyAllTabs 2017-04-18 12:46:31 +03:00
tophf
4d143a03dc Apply styles to XML documents 2017-04-18 12:46:31 +03:00
tophf
c061268aeb manage: fix & speedup createStyleElement a bit 2017-04-18 12:46:31 +03:00
tophf
e31def4b8e manage: "(Disabled)" name postfix is now localizable 2017-04-18 12:46:31 +03:00
tophf
f147b409df embed SVG to help buggy Chrome's GC
Chrome doesn't garbage-collect (or even leaks) SVG <symbol> referenced via <use> so we'll embed the code directly on manage and popup pages where dozens/hundreds of svgs are displayed.
2017-04-18 12:46:31 +03:00
tophf
4f5e56bc55 manage: don't flicker newUI sub-options 2017-04-18 12:46:31 +03:00
tophf
e3b461a9e8 manage: add new UI option
* align svg icons to pixel grid
* globalize enforceInputRange() and use it in manage
* 1 installed.onclick instead of 1000+ local ones
2017-04-18 12:46:31 +03:00
tophf
efd3e9ef6c options: use live prefs + reset button 2017-04-18 12:46:30 +03:00