Commit Graph

2630 Commits

Author SHA1 Message Date
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
tophf
7f0fd4f6f6 chrome.extension.getURL is deprecated 2017-04-18 12:46:30 +03:00
tophf
f47b1438dd apply: do orphanCheck only on injection 2017-04-18 12:46:30 +03:00
tophf
59899b9395 explicitly use 'window' when getting its properties 2017-04-18 12:46:30 +03:00
tophf
1af1194e9f Declare EntryOnClick as an object: handleEvent 2017-04-18 12:46:30 +03:00
tophf
2875bb77d0 moz-import: trim empty lines at section start/end 2017-04-18 12:46:30 +03:00
tophf
0ceff44000 manage: use svg icons in messageBox() 2017-04-18 12:46:30 +03:00
tophf
8b2226936d popup: make the regexp problem indicator red 2017-04-18 12:46:30 +03:00
tophf
fa550d1ee6 manage: center the update status message vertically 2017-04-18 12:46:29 +03:00
tophf
071a4d6f26 applyStyleState: use a separate cache for disabled styles 2017-04-18 12:46:29 +03:00
tophf
494b23e3fd manage: add an ID to entries 2017-04-18 12:46:29 +03:00
tophf
ee93f8a876 Set openerTabId to return to original tab on closing 2017-04-18 12:46:29 +03:00
tophf
3d163df853 manage: open external links with openURL() 2017-04-18 12:46:29 +03:00
tophf
1cf904b135 polish popup/manage/edit css/svg/etc.
* restore the correct width of svg icons
* popup: use the standard formatting & SVG <symbol>
* popup .breadcrumbs hover highlight
* manage: black links, transitions; use <p> in #options; trim .homepage
* edit: move regexp tester info link to a template
2017-04-18 12:46:29 +03:00
tophf
67e606c3d5 SVG icon fixup: invoke onclick() directly 2017-04-18 12:46:29 +03:00
tophf
3c5cc141c4 manage: make #find-editor-styles a link; remove global options
* "Find styles" is a link so we make it one, just like in the popup.
* We have a dedicated global options UI so it makes no sense to subset only two of them on the manage page, moreover both options are unrelated to managing styles.
2017-04-18 12:46:29 +03:00
tophf
c32e968f63 Restore sync for popupWidth; mirror all prefs in localStorage; 2017-04-18 12:46:28 +03:00
tophf
26802e36df Optimize startup: coalesce & debounce prefs.set
Previously prefs.set broadcast many messages per each changed pref value to all open tabs, background page, popups. This lead to repeated and needless updates of various things like the toolbar icon, reapplying of styles, and whatnot. It could easily take more than 100ms on an average computer with many tabs open.

Now we debounce the broadcast & sync.set and coalesce all values in one object which is then sent just once per destination.
2017-04-18 12:46:28 +03:00
tophf
f8d13d8dec Remove code:false mode; show sloppy regexps in popup
* Now that our own pages retrieve the styles directly via getStylesSafe the only 0.001% of cases where code:false would be needed (the browser is starting up with some of the tabs showing our built-in pages like editor or manage) is not worth optimizing for.

* According to CSS4 @document specification the entire URL must match. Stylish-for-Chrome implemented it incorrectly since the very beginning. We detect styles that abuse the bug by finding the sections that would have been applied by Stylish but not by us as we follow the spec. Additionally we'll check for invalid regexps.
2017-04-18 12:46:28 +03:00