Commit Graph

44 Commits

Author SHA1 Message Date
eight
d2b36a168e Kill hidden globals 2018-10-10 23:05:20 +08:00
tophf
2a75159d2a USO bug workaround: collapse long URL vars
#195
2018-04-12 09:13:55 +03:00
tophf
d2cba96e10 refactor CSSLint
* reduce linting delay
* parse mozformat in worker
* allow empty functions in 'filter:' property
  https://drafts.fxtf.org/filter-effects/#supported-filter-functions
* support comma-separated list in :lang()
* strip vendor prefix in isLiteral()
2018-01-07 12:31:23 +03:00
tophf
3418ac9cb9 FF: support private/container tabs 2018-01-03 10:43:56 +03:00
Rob Garrison
5a07bbb1e3 Add manager sort block 2017-12-25 12:17:18 +03:00
tophf
d10e83d15c editor: rewrite global search/replace 2017-12-18 10:27:50 +03:00
tophf
2c47407afb eslintrc: allow shirt-circuit and ternary expressions 2017-12-18 10:27:50 +03:00
tophf
b9c6be1676 disable the useless no-unmodified-loop-condition rule 2017-12-11 04:46:33 +03:00
tophf
1c68ac1a3a initialize editor page fully in First Meaningful Paint frame
* previously it wasn't the case when colorpicker option was enabled
* the cost of always loading colorview is ~1ms for >200ms here
2017-12-08 06:20:56 +03:00
tophf
99cce55a8e ensure long words break before breaking the layout
supersedes 40075a0d
2017-12-07 23:21:27 +03:00
tophf
c0c60fb7a2 add a terse invocation syntax for $element and rename it to $create 2017-12-04 08:57:12 +03:00
tophf
978e5ca9f0 sendMessage()
Promise mode [default]:
  - rejects on receiving {__ERROR__: message} created by
    background.js::onRuntimeMessage
  - suppresses chrome.runtime.lastError
    by browserAction.setText which lacks a callback param in chrome API

Callback mode:
  - enabled by passing a second param
  - doesn't suppress chrome.runtime.lastError
2017-11-25 18:00:38 +03:00
tophf
94ed435e75 fixup d2b9b302: prevent setting version var to 'undefined' 2017-11-14 11:12:18 +03:00
tophf
68d72215a2 disable the useless "no-empty-function" warning 2017-11-14 09:52:51 +03:00
tophf
721dfc4787 export: create blob directly
fixes #211
2017-10-14 04:25:54 +03:00
Rob Garrison
417e3b5de3 Add eqeqeq definition to eslint 2017-07-16 13:07:21 -05:00
Rob Garrison
a1bec922ef Update eslint rules 2017-07-16 08:55:16 -05:00
Rob Garrison
57ff0b6cb7 Update eslint rule 2017-07-12 16:26:20 -05:00
tophf
5c1555c781 code cosmetics: fix some eslint complaints
Until https://github.com/eslint/eslint/issues/8594 is sorted out, we're switching to the old indent behavior (indent-legacy).
2017-07-09 12:22:45 +03:00
tophf
ece3822891 option to switch toolbar icon sets 2017-07-09 12:22:44 +03:00
tophf
358e8e034f code cosmetics: add invokeOrPostpone() 2017-06-27 15:15:49 +03:00
tophf
1c1a9f2804 fixup e199e1b3 for non-e10s FF: moar timeouts! 2017-06-27 12:55:47 +03:00
tophf
9163a856f6 lazify and fix refreshAllTabs 2017-06-27 12:39:51 +03:00
tophf
fba85b36cc promisify chrome.tabs.query as queryTabs() 2017-06-17 13:00:10 +03:00
tophf
738788f289 tweak no-unused-vars 2017-04-28 15:28:51 +03:00
tophf
fdc15d24d9 try to avoid setBadgeText errors 2017-04-23 23:05:35 +03:00
tophf
2e60af40f0 refactor bg updater; add prefs.subscribe() 2017-04-21 15:52:22 +03:00
tophf
aa5fc9f640 notify USO earlier in install.js by relaying xhr 2017-04-20 04:52:13 +03:00
tophf
a80c677b3e render at least 10 style entries on slower machines 2017-04-19 23:54:05 +03:00
tophf
1651d52776 Construct DOM via $element instead of HTML string 2017-04-18 12:47:23 +03:00
tophf
3b3ed6543e code cosmetics: RX_SUPPORTED_URLS -> URLS.supported 2017-04-18 12:47:19 +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
db83ce8dc3 demote getClickedStyle* to its local usage scope 2017-04-18 12:46:33 +03:00
tophf
2bb7d31042 fixups for Opera/Vivaldi/Firefox-compatibility 2017-04-18 12:46:32 +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
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
668e3a7b56 ignoreChromeError -> messaging; use it in editor's menu update 2017-04-18 12:46:27 +03:00
tophf
78c56352cb Cache compiled regexps 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
4936426fa3 dom.js: extract common DOM functions 2017-04-18 12:46:22 +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
34cd025487 Use Object.assign instead of shallowMerge 2017-03-16 13:32:12 +03:00
silverwind
508265b3fc
add ESLint and Editorconfig files 2017-02-09 17:20:48 +01:00