Commit Graph

158 Commits

Author SHA1 Message Date
tophf
26802e36df Optimize startup: coalesce & debounce prefs.set
Previously prefs.set broadcast many messages per each changed pref value to all open tabs, background page, popups. This lead to repeated and needless updates of various things like the toolbar icon, reapplying of styles, and whatnot. It could easily take more than 100ms on an average computer with many tabs open.

Now we debounce the broadcast & sync.set and coalesce all values in one object which is then sent just once per destination.
2017-04-18 12:46:28 +03:00
tophf
3876ffc671 Preserve selection/cursor after beautify-css 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
e384657668 Use our beautify-css-mod.js with more options 2017-04-18 12:46:27 +03:00
tophf
6be903e2ad Add UI for 'editor.matchHighlight' option 2017-04-18 12:46:27 +03:00
tophf
7ba276a821 regexp tester: autoupdate on tab navigations 2017-04-18 12:46:26 +03:00
tophf
c356fb9be5 Add regexp tester to the editor 2017-04-18 12:46:26 +03:00
tophf
ac4a420e2b ESLint: customize the rules; fix the issues 2017-04-18 12:46:23 +03:00
tophf
4bcfcb1503 Suppress out-of-order lint invocation errors 2017-04-18 12:46:22 +03:00
tophf
19f1490f0a Add context menu 'delete' in editor for browsers without it 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
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
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
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
tophf
c815263671 moz-import: don't add an extra newline before the last line 2017-03-18 02:05:58 +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
Jeremy Schomery
e2ce5669a2 adapting edit.js with the new csslint-worker.js (v1.0.4) 2017-02-08 17:23:38 +03:30
narcolepticinsomniac
ebacb7c5e6 Minor tweaks 2017-01-30 14:29:12 -05:00
Jason
a5e3a1e3dd Enabling a style overwrites 'Add Style' content with enabled style #174 2016-06-03 22:03:08 -05:00
Jason Barnabe
79bdfa9a86 Merge pull request #169 from tophf/import-style-globalsection-fix
Import style globalsection fix
2016-03-17 22:01:35 -05:00
Jason Barnabe
b24d7b8246 Merge pull request #168 from tophf/toggle-issues
Narrow-width editor on touchscreens: toggle lint report via click
2016-03-17 22:00:57 -05:00
Jason
7015eb1dc8 Handle saving styles with undefined applies tos #167 2016-03-16 21:44:17 -05:00
Jason
2973cac28f Switch to IndexedDB #167 2016-03-06 20:27:17 -06:00
tophf
ad8706e107 Editor: preserve intermediary global sections on import
Because the order of sections influences which rules will apply when several matching rules are present both in a global section and previously declared scoped one.
2016-02-04 18:26:02 +03:00
tophf
426b4d37ba Simplify getCodeMirrorForSection/getSectionForCodeMirror 2016-02-04 18:25:59 +03:00
tophf
08e35c6990 Narrow-width editor on touchscreens: toggle lint report via click 2016-02-01 17:13:14 +02: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
Jason Barnabe
8f10fc291e Merge pull request #157 from tophf/sync-settings
Sync prefs
2016-01-30 16:05:07 -06:00
Jason Barnabe
49f9b8a106 Merge pull request #164 from tophf/narrowedit-lintfix
Autohide lint report in narrow mode; show # of issues
2016-01-30 16:00:50 -06:00
tophf
b8bbcd01db Autohide lint report in narrow mode; show # of issues 2016-01-20 21:16:58 +03:00
tophf
3837ef5f62 Editor: focus the minidialog when switching find/replace
Previously, when a search minidialog was displayed and we pressed a hotkey to switch to another kind of minidialog (search -> replace, etc), the focus wasn't correctly preserved
2015-10-29 21:20:05 +03:00
tophf
7ca69e61da Editor: sticky .CodeMirror-active class for code boxes
It is retained when a child search/jump minidialog is focused unlike the built-in .CodeMirror-focused
2015-10-28 01:37:19 +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
2925c4af71 Editor: add missing var declaration 2015-09-21 14:59:13 +03:00
tophf
a7deb14931 Editor: don't spam in lint report for current line 2015-09-13 12:59:14 +03:00
tophf
5d52a7ec2e Editor: "findNext" after page load should call "find" 2015-09-01 10:54:56 +03:00
Jason Barnabe
718d2e0f86 Merge pull request #149 from tophf/dim-save-button
Editor: disable "Save" button when content is unmodified
2015-08-30 11:36:17 -05:00
tophf
256177844b Editor: disable "Save" button when content is unmodified 2015-08-30 19:16:41 +03:00
tophf
d2441213ef Don't use css calc with vw as it fails on Chrome 31
* Also makes showCodeMirrorPopup() size stylable
2015-08-28 19:45:15 +03:00
Jason Barnabe
0c30be4544 Merge pull request #132 from tophf/paste-mozilla
Editor: paste from Mozilla format
2015-08-24 17:23:54 -05:00
tophf
5802cc4ae6 refactor/deduplicate "#sections > div" handling 2015-08-24 08:16:23 +03:00
tophf
0ead2ef259 Editor: paste from Mozilla format; export in styled popup 2015-08-24 08:16:22 +03:00