Commit Graph

2536 Commits

Author SHA1 Message Date
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
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