Commit Graph

619 Commits

Author SHA1 Message Date
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
9fd067c6e3 Switch editor to add style mode when id=nonexistentstyle 2017-04-18 12:43:29 +03:00
tophf
f746cb1581 Update lint report immediately on load 2017-04-18 12:43:29 +03:00
tophf
7a7c679811 Avoid flickering of editor header on load, also for manage<=>edit nav 2017-04-18 12:43:29 +03:00
tophf
8c7f7b81f8 Don't recreate editors after save 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
ba8301fdce Middle-click in popup on a style name to open the editor 2017-04-18 12:43:29 +03:00
tophf
b2e18177c3 Minimum Chrome version is 49 for ES6 stuff we use
Default function parameters were implemented in Chrome 49 and FF 15+
Stable Chrome is v57. One year has passed since v49.
2017-04-18 12:43:29 +03:00
tophf
f256f558dc IndexedDB getAll to read all styles in one op
Available since Chrome 48, FF44 (or FF27+ using dom.indexedDB.experimental flag)
2017-04-18 12:43:28 +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
df59fca29c Add match-highlighter of the word under cursor 2017-04-18 12:43:28 +03:00
tophf
b2e8bf02a9 CodeMirror 5.24
Notable change for css mode: Expose lineComment property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
2017-04-18 12:43:28 +03:00
tophf
df570dab9e Store SVG icons in a <symbol> collection
+preserve the page colors via fill:currentColor and opacity transition.
2017-04-18 12:43:28 +03:00
Jeremy Schomery
998aa2322d updating README.md; open a bug report to request translation merge 2017-04-18 08:46:55 +04:30
Jeremy Schomery
bc0c9cfe2a updating "de" locale. fixes #59 2017-04-18 08:38:07 +04:30
narcolepticinsomniac
f0eff5916f Merge pull request #58 from schomery/narcolepticinsomniac-icons
Switch info/external style link icons from img to svg
2017-03-31 22:05:25 -04:00
narcolepticinsomniac
e94f9d818e Get rid of text decoration in disabled styles
Fixes https://github.com/schomery/stylish-chrome/pull/58#issuecomment-290607298
2017-03-31 07:14:47 -04:00
narcolepticinsomniac
bab801f90b Correction 2017-03-30 23:00:35 -04:00
narcolepticinsomniac
df0f45dc06 Switch info/external style link icons from img to svg
Switched info to `i` and found a pretty nice external link icon imo. @tophf As for pixelation on the info icons, you mentioned maybe a lighter color would help. For all icons besides external links, I made them lighter with darker hovers. Besides a really high zoom, I never saw any issue to begin with, but let me know if they're alright. I also changed them to use their exact original dimensions, so maybe that helps.
2017-03-30 19:49:03 -04:00
tophf
4dd17c1caf Use "Stylish for Forefox" in styleToMozillaFormatHelp #33 2017-03-22 02:38:22 +03:00
narcolepticinsomniac
9dac68410d Handle popup overflow better
Max height is 600px for the popup, regardless of resolution (so says Google), so we can set the styles section to a max height in px and let the overflow scroll inside the div, instead of scrolling the whole popup. This way the other actions are always present at the bottom of the popup without needing to scroll to use them. I left a little breathing room for the rare instance when domain name in "write style for" is long enough to cause a line break, so there should never really be any overflow for the popup itself.

https://github.com/schomery/stylish-chrome/pull/50#issuecomment-287665085
2017-03-20 05:58:38 -04:00
tophf
ac2a1a1c48 Orphaned content script case self-destruction tweaks#2 for apply.js 2017-03-19 05:24:10 +03:00
tophf
b77823c365 Orphaned content script case self-destruction tweaks for apply.js 2017-03-19 04:59:28 +03:00
tophf
db560f3ede Orphaned content script case self-destruction for install.js 2017-03-19 04:58:16 +03:00
tophf
66a1c17847 Fix cascaded ternary condition 2017-03-19 02:00:03 +03:00
tophf
764cd1b6de Use the synced show-badge preference on startup 2017-03-19 01:57:19 +03:00
tophf
c815263671 moz-import: don't add an extra newline before the last line 2017-03-18 02:05:58 +03:00
tophf
3287b79f5e Support :any(), :-webkit-any(), :-moz-any() 2017-03-17 18:08:18 +03:00
tophf
4684016a47 Support @supports inside @-moz-document 2017-03-17 08:09:04 +03:00
Jeremy Schomery
ef8f507c50 Adding Opera to README.md 2017-03-16 18:31:03 +03:30
Jeremy Schomery
85a0ce52da Merge branch 'master' of github-jeremy:schomery/stylish-chrome 2017-03-16 17:17:00 +03:30
Jeremy Schomery
fbf4a0ea8a removing 'webRequest' and 'webRequestBlocking' permissions. fixes #48 2017-03-16 17:16:11 +03:30
Jeremy Schomery
0e6c5e35ac Path for configureCommands is chosen based on user's browser (Opera incomatibility) 2017-03-16 17:14:35 +03:30
tophf
71ea723728 Fixup 59e0f3f4: explicitly list our functions in self-destruct
Seems simpler and more robust. Otherwise Chrome spams console warnings about its webkit* aliases we touch.
2017-03-16 15:47:58 +03:00
Jeremy Schomery
1d30b19132 version 1.0.5 is ready 2017-03-16 15:24:27 +03:30
narcolepticinsomniac
f61e9774d6 Remove translation for changed message 2017-03-16 07:37:24 -04:00
narcolepticinsomniac
0b50d3603b Remove translation for changed message 2017-03-16 07:35:58 -04:00
tophf
7d5b9b8a34 New backup labels by narcolepticinsomniac 2017-03-16 13:32:13 +03:00
tophf
f86a6489ef Always try CS reinjection (safe since we ping first) 2017-03-16 13:32:13 +03:00
tophf
08509b8cc2 Support file drag-n-drop on the entire manage page 2017-03-16 13:32:13 +03:00
tophf
31a24717b4 Use chrome.tabs.query instead of 2-tier window+tabs 2017-03-16 13:32:13 +03:00
tophf
59e0f3f45e Self-destruct orphaned content scripts 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
e807d41eb7 Refactor manage::codeIsEqual -> storage::styleSectionsEqual 2017-03-16 13:32:12 +03:00
tophf
d49622dd27 Make exported styles JSON human-readable by indenting 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
narcolepticinsomniac
e2e64113fe Remove unnecessary text-indent 2017-03-16 01:15:58 -04:00
Jeremy Schomery
2fdbf321a1 fixes https://github.com/schomery/stylish-chrome/issues/43#issuecomment-286388663 2017-03-14 16:37:08 +03:30