Commit Graph

69 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
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
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
Jeremy Schomery
0e6c5e35ac Path for configureCommands is chosen based on user's browser (Opera incomatibility) 2017-03-16 17:14:35 +03:30
Jeremy Schomery
b1582d508d popup resizes itself after style changes 2017-03-14 09:42:00 +03:30
Jeremy Schomery
708ff97723 new fix for https://github.com/schomery/stylish-chrome/issues/43#issuecomment-286154032 2017-03-13 22:56:43 +03:30
Jeremy Schomery
e109f882da based on https://github.com/schomery/stylish-chrome/issues/43#issuecomment-286154032 2017-03-13 19:48:16 +03:30
Jeremy Schomery
4f83aa1239 possible fix for https://github.com/schomery/stylish-chrome/issues/43#issuecomment-286142529 2017-03-13 19:18:00 +03:30
Jeremy Schomery
52d3387c6a based on https://github.com/schomery/stylish-chrome/issues/43#issuecomment-286102989 2017-03-13 17:11:01 +03:30
Jeremy Schomery
65845c6c6e replacing window.confirm 2017-03-13 16:28:35 +03:30
Jeremy Schomery
885bab9a03 moving popupWidth pref to localStorage base on https://github.com/schomery/stylish-chrome/issues/38#issuecomment-284693730 2017-03-08 16:41:26 +03:30
Jeremy Schomery
974aaee823 popup width is now adjustable 2017-03-06 23:47:32 +03:30
narcolepticinsomniac
9a2cab60dd Options UI discoverability and other fixes
#34
2017-02-28 18:57:03 -05:00
narcolepticinsomniac
fa159cf845 Options UI discoverability
#34
2017-02-24 06:04:43 -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
73218c399b Support ftp urls 2015-08-11 07:36:48 +03:00
tophf
4f61494e0d Move html templates to html file 2015-08-03 08:13:01 +03:00
tophf
c60a21cf12 New Tab Page: fixup for icon, badge, popup style list 2015-05-21 17:45:06 +03:00
tophf
4df61c4a21 Popup: autoclose after click on 'Edit' link 2015-05-14 20:33:27 +03:00
tophf
60381603db Popup: actually show newly installed styles
fixup 5b0d8fb
2015-05-13 23:15:46 +03:00
tophf
0b821463c8 Popup regression fix: handle disableAll checkbox in active popup
Apparently the original sender tab is excluded from
chrome.extension.sendMessage broadcast as of Chrome 44.
Even if it's a temporary bug the fixed method is okay.
2015-05-13 23:15:46 +03:00
tophf
e2bf12ac6d Popup regression fix: click style name to toggle the style 2015-05-13 23:15:45 +03:00
tophf
0e6f63951a Localization: embed in html, autorun, apply earlier 2015-05-01 13:33:01 +03:00
Jason
cf4da22a0a Make style names in popup toggle the styles 2015-04-08 14:14:16 -05:00
Jason
6c47b78763 Add left gutter to popup for checkboxes 2015-04-08 14:07:30 -05:00
tophf
5b0d8fbba0 Show a newly installed style in popups 2015-04-07 20:14:14 +03:00
tophf
d4382d3f08 Apply global changes to popups 2015-04-07 20:07:45 +03:00
tophf
2ed53db7ad Add Chrome shortcut keys; update popups on change
* hotkey to open Manage styles
* hotkey to enable/disable all styles

No default hotkeys are provided, to customize go to "Keyboard shortcuts" on the Extensions page
2015-03-25 18:04:51 +03:00
tophf
f0f5a28c46 fixup for checkbox pos; add wrapper & visual feedback 2015-03-24 20:27:13 +03:00
hideheader
f45a6506be Add 'Disable all styles' to popup 2015-03-24 20:21:19 +03:00
Jason
d74dd20931 Fix pop-up when dealing with newtab #80 2015-03-23 13:56:11 -05:00
tophf
8e6e1f97b2 Manager: "Edit" button re-uses existing tabs, shift-click opens a new window 2015-03-20 17:29:47 +03:00
hideheader
222f970d23 [option] List actions before styles in the popup
Styles are listed before actions by default. Actions are listed before
styles if `popup.stylesFirst` is false. A control for the option is shown
in "Manage" if `popup.stylesFirstUI` is true.
2015-03-14 21:35:45 -04:00
Jason Barnabe
83bcde6569 Merge pull request #61 from tophf/global-search-in-new
Edit style: more tweaks
2015-03-12 13:15:46 -05:00
tophf
f654cc734f Edit style: remember detached window position and size 2015-03-11 23:31:13 +03:00
hideheader
6ec65ab9e9 Use typed preference methods correctly
(1) `loadPrefs` was called with string instead of boolean
(2) Sense of boolean `popup.breadcrumbs.usePath` was inverted
(3) `loadPrefs` wasn't passing default to `getPrefs`
(4) `JSON.stringify(string)` added quotes to string
(5) Preferences `manage.enabledFirst`, `observer.observeFrameContent`, `observer.observeFrameLoad` aren't used
2015-03-07 02:53:33 -05:00
Jason Barnabe
56ad7e869b Merge pull request #55 from hideheader/new-style-links
Create new styles with `url-prefix()`
2015-03-06 19:49:37 -06:00
hideheader
279c5a2328 Create new styles with url-prefix()
`url-prefix()` is used ca. 100 times as often as `url()`.
2015-03-04 12:03:28 -05:00
hideheader
ab6130e619 Oops! One pull wasn't using the new prefs methods 2015-03-04 03:20:39 -05:00
Jason Barnabe
1920a5e890 Merge pull request #52 from tophf/reuse-ntp
Re-use an active new tab page for manager/editor
2015-03-03 20:58:19 -06:00
Jason Barnabe
ecb0c4d8b4 Merge pull request #48 from hideheader/preferences
Get and set typed preference values
2015-03-03 20:49:19 -06:00
9adefaf01e5bf6426d838cd20eae582d2b6ba647
98a71d2812 Re-use an active new tab page for manager/editor 2015-03-04 05:29:24 +03:00
Jason Barnabe
0fe0707e02 Merge pull request #37 from hideheader/new-style-links-grr
Support "breadcrumbs" new style links
2015-03-03 20:23:53 -06:00
hideheader
83acbaa77c A little to the left... no, more to the right... 2015-03-03 19:02:52 -05:00
hideheader
5fabfc4207 CSS + 'new style' code changes 2015-03-03 19:02:51 -05:00