Commit Graph

150 Commits

Author SHA1 Message Date
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
tophf
55c48d62fc Editor: escape html in CSSLint report, limit message length 2015-08-07 17:19:09 +03:00
Jason Barnabe
7f0557df57 Merge pull request #143 from tophf/fixes
Fixes
2015-08-04 22:37:17 -05:00
tophf
78fea74a0e Editor: update CSSLint report ASAP once an issue is fixed 2015-08-03 19:34:47 +03:00
tophf
cb366cf9d7 fixup 1ad9200: don't overwrite the initial lint delay 2015-08-03 18:54:03 +03:00
tophf
ea18ae2c89 Editor: avoid flicker of "Edit style" heading on load 2015-08-03 08:13:01 +03:00
tophf
4f61494e0d Move html templates to html file 2015-08-03 08:13:01 +03:00
tophf
20141b7bfa Editor: add global-replace/replaceAll commands
* Collateral fix: correctly restore openDialog() after Esc
* refactor html templates
2015-08-03 08:12:39 +03:00
tophf
1ad92001c0 Editor: less obtrusive CSSLint reporting in header, wait ~5s
* Keep the old timeout after page init ~500ms
* Immediately show the report in onbeforeunload and save
2015-08-02 18:11:15 +03:00