Commit Graph

68 Commits

Author SHA1 Message Date
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
ce2492c305 manage: apply search filter to edited/updated styles 2017-04-18 12:46:35 +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
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
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
c061268aeb manage: fix & speedup createStyleElement a bit 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
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
494b23e3fd manage: add an ID to entries 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
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
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
tophf
55ac677d85 manage: fixup style search 2017-04-18 12:46:24 +03:00
tophf
2fb046e996 manage: import/update/add maintains sort order 2017-04-18 12:46:24 +03:00
tophf
ac4a420e2b ESLint: customize the rules; fix the issues 2017-04-18 12:46:23 +03:00
tophf
363f752934 Use messageBox in manage for confirm; partially revert c5741aff 2017-04-18 12:46:23 +03:00
tophf
4936426fa3 dom.js: extract common DOM functions 2017-04-18 12:46:22 +03:00
tophf
b51c264c8b confirmDelete: extract, refactor, use in manage 2017-04-18 12:46:22 +03:00
tophf
8bcd7f60c5 Restore implicit handleUpdate in saveStyle 2017-04-18 12:46:22 +03:00
tophf
b1c19bdf3d Import styles: show report with Undo button 2017-04-18 12:46:22 +03:00
tophf
a717e632c6 Expose tDocLoader.stop() to prevent unneeded observation 2017-04-18 12:43:30 +03:00
tophf
c1338e63d1 Highlight updated/saved style in manage page 2017-04-18 12:43:30 +03:00
tophf
2f4da37fdb Refactor and speed up popup & manager
Popup:
* Enforce 200-800px range for the popup width option

Manage:
* faster search via cachedStyles.byId
* faster restoration of search results on history nav
* style name is clickable and opens the editor
* animated highlight of style element on update/add/save
* expandable extra applies-to targets
* remember scroll position on normal history navigation
* boz-sizing in #header, also in editor
* applies-to targets use structured markup
* get*Tab*, enableStyle and deleteStyle are promisified
2017-04-18 12:43:29 +03:00
tophf
1dde91ea85 Global 'event' var is non-standard, FF doesn't support it 2017-04-18 12:43:29 +03:00
tophf
f4e689721a Improve style caching, cache requests too, add code:false mode
Previously, when a cache was invalidated and every tab/iframe issued a getStyles request, we previous needlessly accessed IndexedDB for each of these requests. It happened because 1) the global cachedStyles was created only at the end of the async DB-reading, 2) and each style record is retrieved asynchronously so the single threaded JS engine interleaved all these operations. It could easily span a few seconds when many tabs are open and you have like 100 styles.

Now, in getStyles: all requests issued while cachedStyles is being populated are queued and invoked at the end.

Now, in filterStyles: all requests are cached using the request's options combined in a string as a key. It also helps on each navigation because we monitor page loading process at different stages: before, when committed, history traversal, requesting applicable styles by a content script. Icon badge update also may issue a copy of the just issued request by one of the navigation listeners.

Now, the caches are invalidated smartly: style add/update/delete/toggle only purges filtering cache, and modifies style cache in-place without re-reading the entire IndexedDB.

Now, code:false mode for manage page that only needs style meta. It reduces the transferred message size 10-100 times thus reducing the overhead caused by to internal JSON-fication in the extensions API.

Also fast&direct getStylesSafe for own pages; code cosmetics
2017-04-18 12:43:28 +03:00
tophf
e807d41eb7 Refactor manage::codeIsEqual -> storage::styleSectionsEqual 2017-03-16 13:32:12 +03:00
tophf
38006847f7 Don't apply styles until import is finished 2017-03-16 13:32:12 +03:00
Jeremy Schomery
d6ec816ea9 adding options UI (fixes #22, #24) 2017-02-14 19:05:53 +03:30
narcolepticinsomniac
801c637d7e Update for backup 2017-01-30 14:22:28 -05:00
Jeremy Schomery
5623bca182 #1 follow up 2017-01-13 12:23:17 +03:30
Jeremy Schomery
c1ab447130 Removing sending info to Google Analytics 2017-01-11 15:34:44 +03:30
Jeremy Schomery
9582c65a84 import styles from Stylish extension 2017-01-11 15:25:38 +03:30
hideheader
3f46c60135 Updating from Style Manager failure
https://forum.userstyles.org/discussion/49688/chrome-my-userstyle-wont-get-updated
https://github.com/JasonBarnabe/stylish-chrome/issues/172

This is sufficient to make updates work again, but there are underlying problems.
2016-05-19 16:53:45 -04:00
Jason
5fb21f2816 Add opt-out for analytics and make it ping once per day 2016-03-23 21:38:15 -05:00
Jason
fa97a94494 Various performance improvements 2016-03-19 16:58:01 -05:00
Jason
2973cac28f Switch to IndexedDB #167 2016-03-06 20:27:17 -06:00
Jason
a01bdf7b5a chrome.extension.onMessage -> chrome.runtime.onMessage 2016-01-30 18:06:04 -06:00
Jason
d957cd1b3b chrome.extension.sendMessage -> chrome.runtime.sendMessage 2016-01-30 17:08:10 -06:00
tophf
d971bbda8a Remove unneeded "Pref" word from prefs methods 2015-10-15 00:34:47 +03:00
tophf
1f961b0993 Deprecate localStorage, refactor prefs 2015-10-15 00:34:46 +03:00
tophf
a9ff8c14f3 Fix jsonEquals() bug: actually compare the properties 2015-08-28 19:45:15 +03:00
tophf
4f61494e0d Move html templates to html file 2015-08-03 08:13:01 +03:00
tophf
67fe43e9a9 Editor: use history back for Back-To-Manage when appropriate 2015-06-10 17:18:13 +03:00