Commit Graph

40 Commits

Author SHA1 Message Date
tophf
64c830caa9 webNavigation.onReferenceFragmentUpdated instead of tabs.onUpdated
Also send a Do-It-Yourself to our built-in pages to fetch the styles directly which is faster because IPC messaging JSON-ifies everything internally
2017-04-18 12:46:25 +03:00
tophf
d32ad30f8f webNavigation.getFrame may return null on overridden pages, fix a3401b05 2017-04-18 12:46:25 +03:00
tophf
54ab65989d Simplify configureCommands; focus an existing tab
Instead of isolating the deoptimization trigger:
https://github.com/petkaantonov/bluebird/wiki/Optimization-killers
2017-04-18 12:46:25 +03:00
tophf
1166fd9d3b openURL fix for opera:// URLs 2017-04-18 12:46:24 +03:00
tophf
a2ea1bb1d9 openURL: handle urls with # 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
657db366c9 openURL: refactor to open/switch to URL 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
a6c3424b53 Move images into a separate directory 2017-04-18 12:46:22 +03:00
tophf
80130797ce Refactor contextMenus and commands 2017-04-18 12:43:30 +03:00
tophf
07bee69359 Fix deoptimization triggers 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
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
66a1c17847 Fix cascaded ternary condition 2017-03-19 02:00:03 +03:00
Jeremy Schomery
0e6c5e35ac Path for configureCommands is chosen based on user's browser (Opera incomatibility) 2017-03-16 17:14:35 +03:30
tophf
31a24717b4 Use chrome.tabs.query instead of 2-tier window+tabs 2017-03-16 13:32:13 +03:00
tophf
e658255c36 Reinject content scripts on install/update/enabling the extension
The injection code also runs outside of onInstalled event so we check first if a content script belonging to our execution context "generation" is already injected. This can happen on browser startup: the background page is loaded in several seconds after the normal web page tabs are loaded with our content script(s) already injected. The check itself is simply a "ping" message to each tab that should return true if the content script is alive and kicking.
2017-03-16 13:32:12 +03:00
tophf
34cd025487 Use Object.assign instead of shallowMerge 2017-03-16 13:32:12 +03:00
tophf
913df00f35 Don't notify normal tabs if style contents hasn't changed 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
tophf
6b49afaa48 Apply enable/disable state of style to popup itself 2017-03-14 15:18:58 +03:00
Jeremy Schomery
d6ec816ea9 adding options UI (fixes #22, #24) 2017-02-14 19:05:53 +03:30
narcolepticinsomniac
152b1de7e9 Differentiate icon for "global disabled" and "no active styles" 2017-02-13 05:26:54 -05:00
narcolepticinsomniac
a6a34307d8 Add files via upload 2017-02-03 09:02:37 -05:00
Jeremy Schomery
1094ddb6bb dark background color for badge number, #14 2017-02-03 17:01:41 +03:30
tophf
e15449435c Use 16/32px icon in new MD toolbar 2016-08-22 14:09:20 +03:00
Jason
d957cd1b3b chrome.extension.sendMessage -> chrome.runtime.sendMessage 2016-01-30 17:08:10 -06:00
tophf
6fa6982e8e Check if the tab is closed when trying to set its icon 2015-10-15 00:34:48 +03: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
a3401b0572 Simplify getActiveTabRealURL: main frame is always 0 2015-07-26 05:24:46 +03:00
tophf
126ec0e11d Use transparent badge color when not in disableAll state
Works because Chrome *overlays* user-specified badge color onto its own default color.
2015-05-21 18:39:39 +03:00
tophf
c60a21cf12 New Tab Page: fixup for icon, badge, popup style list 2015-05-21 17:45:06 +03:00
tophf
f765934316 Dim toolbar icon on unstyled tabs, regenerate icons 2015-05-21 17:38:02 +03:00
tophf
d4382d3f08 Apply global changes to popups 2015-04-07 20:07:45 +03:00
hideheader
f54a70fe07 Replace localStorage calls with prefs calls 2015-03-03 18:36:18 -05:00
Jason Barnabe
90ae3b8d88 fix missing badge text after style install 2014-02-07 21:49:08 -06:00
Jason Barnabe
ecc3bf18a9 issue #4 Add option to hide number of enabled styles in active tab from toolbar icon 2014-02-07 20:04:06 -06:00
Jason Barnabe
9270dc1596 issue 44 Stop using deprecated Chrome APIs 2012-08-19 20:14:33 -05:00
Jason Barnabe
b019038f57 initial commit 2012-04-15 20:56:12 -05:00