Commit Graph

188 Commits

Author SHA1 Message Date
tophf
565f23fa6e editor: add double-click to resize grip 2017-06-28 12:41:34 +03:00
tophf
9ffc525391 editor: horizontal resize grip 2017-06-28 12:40:19 +03:00
tophf
9299972a34 editor: highlight style entry upon "back to manage" 2017-06-27 23:16:03 +03:00
tophf
028ac1d299 editor: convert string to int; fixes #102 2017-06-21 22:05:21 +03:00
tophf
2240a0895e editor: autocomplete on typing 2017-06-18 17:04:14 +03:00
tophf
f603d9b61f simplify html for editor options: reuse the id 2017-06-18 15:47:15 +03:00
tophf
3128c7f063 editor: keep 's-resize' cursor over code box 2017-06-18 12:28:39 +03:00
tophf
c4f871b4ed editor: use MouseEvent.pageY in resizeGrip 2017-06-18 12:27:00 +03:00
tophf
fba85b36cc promisify chrome.tabs.query as queryTabs() 2017-06-17 13:00:10 +03:00
tophf
2e86c95842 csslint: fire startdocument on { 2017-06-10 12:43:26 +03:00
tophf
d36489216c Don't save maximized editor window size&pos
This fixes the bug with reloading the editor tab in a maximized state: previously the window was losing its state.

Assuming a detached editor window normally is expected to have a smaller size and custom position, the user may occasionally maximize it for convenience, in which case we don't save its size and position.

Even if this assumption is wrong, it's easy to manually resize the window to fill the entire screen so that the size/position are remembered.
2017-06-06 16:44:16 +03:00
tophf
4559162d45 Alt-Enter in the editor to toggle&save the style 2017-06-06 10:56:49 +03:00
tophf
ddc5cc0ccf beautify: option for indenting conditional blocks 2017-05-27 11:42:54 +03:00
tophf
ebd6b54e45 Enable linting in newly created styles 2017-05-17 06:15:43 +03:00
Jeremy Schomery
ab63f028eb a few Firefox related compatibility fixes 2017-05-14 15:56:51 +04:30
tophf
ee86ef3037 optionsUI: add 'editor.contextDelete' 2017-04-29 19:56:37 +03:00
tophf
135423860d setupLivePrefs() now automatically finds the elements
To make an element a live pref discoverable by setupLivePrefs() just use the corresponding pref's id as the element's HTML id attribute.
2017-04-21 19:39:34 +03:00
tophf
c52b8c453f refactor background.js
* use runtime.onInstalled to open FAQ
* extract refreshAllTabs (now it may call applyOnMessage for own tab)
* extract getCodeMirrorThemes and use localStorage to cache the names
* put one-time init stuff inside blocks to help GC
2017-04-21 14:16:56 +03:00
tophf
6f74cb8b29 event.keyCode doesn't work in Firefox 2017-04-18 22:05:18 +03:00
tophf
3b3ed6543e code cosmetics: RX_SUPPORTED_URLS -> URLS.supported 2017-04-18 12:47:19 +03:00
tophf
021f50015b restore editor window size when reopened via Ctrl-Shift-T 2017-04-18 12:47:19 +03:00
tophf
42f7b11bac broadcast only meta for styleUpdated/styleAdded
apply/popup/manage use only meta for these two methods,
editor may need the full code but can fetch it directly,
so we send just the meta to avoid spamming lots of tabs with huge styles
2017-04-18 12:46:36 +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
5a61ac2f18 fixup for CodeMirror failing on keyMap=""
This should not happen *normally* but a user may edit chrome.storage manually etc.
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
7f0fd4f6f6 chrome.extension.getURL is deprecated 2017-04-18 12:46:30 +03:00
tophf
59899b9395 explicitly use 'window' when getting its properties 2017-04-18 12:46:30 +03:00
tophf
2875bb77d0 moz-import: trim empty lines at section start/end 2017-04-18 12:46:30 +03:00
tophf
1cf904b135 polish popup/manage/edit css/svg/etc.
* restore the correct width of svg icons
* popup: use the standard formatting & SVG <symbol>
* popup .breadcrumbs hover highlight
* manage: black links, transitions; use <p> in #options; trim .homepage
* edit: move regexp tester info link to a template
2017-04-18 12:46:29 +03:00
tophf
67e606c3d5 SVG icon fixup: invoke onclick() directly 2017-04-18 12:46:29 +03:00
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