Commit Graph

1422 Commits

Author SHA1 Message Date
tophf
f5586a8f0d hide UpdatesOnly filter together with ApplyAll button 2017-04-18 14:59:59 +03:00
tophf
2304a8012c fix setupLivePrefs with multiple edit pages open 2017-04-18 12:47:24 +03:00
tophf
346245a847 code cosmetics: simplify importFromString a bit 2017-04-18 12:47:23 +03:00
tophf
a2faa9398a style backup: +revokeObjectURL +MIME-type 2017-04-18 12:47:23 +03:00
tophf
1651d52776 Construct DOM via $element instead of HTML string 2017-04-18 12:47:23 +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
0d6f7e0a4b popup: right-click / ctrl-click on a name opens editor 2017-04-18 12:47:14 +03:00
tophf
01d59192a3 Chrome 49 fixup for updateIcon 2017-04-18 12:47:03 +03:00
tophf
dca6aecd20 Show active NTP icon correctly on startup 2017-04-18 12:47:03 +03:00
tophf
b3b1d4a628 own page load microopt: reduce blocking on i18n
* localStorage cache is faster than chrome.i18n.get
* TreeWalker is faster than tHTML for removing extraneous whitespace
* simple for() is faster than for-of with [...iterable]
2017-04-18 12:47:02 +03:00
tophf
4eae87e606 own page load microopt: reduce blocking on prefs
postpone noncritical init stuff to window.load because first access to chrome API takes time to initialize API bindings
2017-04-18 12:47:02 +03:00
tophf
eccabb8f27 Fix even-odd rules on entries
* Now filtering is done in js
* Visible entries are always at the beginning of #installed
* Hidden entries are always at the end of #installed
* The code tries to minimize DOM reordering operations:
  * First pass only moves one hidden entry in hidden groups with odd number of items.
  * Second [full] pass runs after repaint.
2017-04-18 12:47:02 +03:00
tophf
1649a262cd Don't double-notify own pages 2017-04-18 12:46:39 +03:00
tophf
e8ec224dac manage: make #installed fill 100% width 2017-04-18 12:46:38 +03:00
tophf
aaa50d6b7b fixup for Chrome 49 without Symbol.iterator 2017-04-18 12:46:38 +03:00
tophf
e61a24b4e4 refactor install.js
* run_at: document_start
* MutationObserver to rebrand without flickering the original text
* reuse styleSectionsEqual
* don't proceed when orphaned
2017-04-18 12:46:38 +03:00
tophf
3961224f80 differentiate .update-done by doubling the checkmark 2017-04-18 12:46:38 +03:00
tophf
e21d65217a manage: show progress bar on update check 2017-04-18 12:46:38 +03:00
tophf
d8adb582c6 add missing favicons in-place instead of full rerendering 2017-04-18 12:46:38 +03:00
tophf
142666ac0f optionsUI: show progress bar and # of installed updates 2017-04-18 12:46:38 +03:00
tophf
ba02bc52a1 optionsUI: left padding in firefox is 6px 2017-04-18 12:46:37 +03:00
tophf
eb37b3e4ad optionsUI: center in opera correctly 2017-04-18 12:46:37 +03:00
tophf
bdcac21d7e optionsUI: group options and shorten labels 2017-04-18 12:46:37 +03:00
tophf
bec60f54ab fixup ccbccae2: add default CM theme entry for firefox 2017-04-18 12:46:37 +03:00
tophf
fa46a2c336 split filterStyles()
js engines don't like big functions (V8 often deoptimized the original filterStyles), it also makes sense to extract the less frequently executed code
2017-04-18 12:46:37 +03:00
tophf
dcfb8ad356 simplify/modularize styleSectionsEqual
+ 1.5x speedup thanks to checkedInB memoization
+ more strict type comparison
+ two-way array comparison (more correct, even if there's no practical difference)
2017-04-18 12:46:37 +03:00
tophf
db1dc0df7b simplify/modularize getApplicableSections 2017-04-18 12:46:37 +03:00
tophf
8f784a19d4 simplify saveStyle, invalidateCache 2017-04-18 12:46:37 +03:00
tophf
4bc27db3fc "backface-visibility: hidden" workaround for a browser bug 2017-04-18 12:46:36 +03:00
tophf
e6f2034e64 make import report messages localizable 2017-04-18 12:46:36 +03:00
tophf
470bc92da5 Add <all_urls> in permissions
We already have full access to all sites via our content script so this permission doesn't add anything new but we need it to be able to establish page connection via tabs.executeScript when the extension is installed, reloaded, re-enabled.

<all_urls> also allows file:// URLs unlike *://*/* used previously. Of course it requires the corresponding checkbox being enabled on chrome://extensions page.
2017-04-18 12:46:36 +03:00
tophf
ca911396a1 Don't use chrome://favicon
chrome://favicon doesn't indicate an icon is missing in any way, it simply shows a placeholder instead. It also doesn't extrapolate from sub-pages so `example.com` won't have a favicon even if `example.com/subpage` has one.
2017-04-18 12:46:36 +03:00
tophf
05c05ec6b9 manage: use chrome://favicon 2017-04-18 12:46:36 +03:00
tophf
c09ee38c9e rework enforceInputRange
* enforce only in onchange
* notify on valid input immediately
* highlight invalid values
2017-04-18 12:46:36 +03:00
tophf
3389812766 remove focus ring from <summary> 2017-04-18 12:46:36 +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
ce2492c305 manage: apply search filter to edited/updated styles 2017-04-18 12:46:35 +03:00
tophf
4f2ccbe6cb speedup import by bulk-updating DOM every 50 styles or 1 sec 2017-04-18 12:46:35 +03:00
tophf
1749057b91 Explainer for stylusUnavailableForURL message
We don't mention the G+ iframe on CWS stylable only when "Out of process iframes" feature is enabled which can be set manually via chrome://flags/#enable-site-per-process. It's still in development and is known to break some sites, which is why it's not enabled by default.
2017-04-18 12:46:35 +03:00
tophf
dad1d1fe5f get rid of switch-fallthrough; reuse requestStyles 2017-04-18 12:46:35 +03:00
tophf
80538a17f5 Report unreachable content script in popup
Chrome can't executeScript on file:// URLs even though we have <all_urls> in manifest.json so on such pages we'll display a warning in the popup. This should only happen when Stylus is [re]enabled/reloaded.
2017-04-18 12:46:35 +03:00
tophf
a93354de8c remove iframe observer
* documentElement may be overwritten right after iframe was initialized with contentDocument.write() and due to this change being external it's not reported in our existing rewrite observer so we enqueue an additional check using setTimeout(0).

* match_about_blank in manifest.json is back

* iframes with src = about: or javascript: don't have a proper URL when our content script runs so we get the real URL from the parent window

* minor refactoring
2017-04-18 12:46:35 +03:00
tophf
7ec41bcea1 apply: refactor observers 2017-04-18 12:46:35 +03:00
tophf
2468784eb3 csslint: fix crashing on unclosed calc() at eof 2017-04-18 12:46:34 +03:00
tophf
279149b8b8 refactor deepCopy & deepMerge 2017-04-18 12:46:34 +03:00
tophf
2086f10af4 prefs.set: deep compare 2017-04-18 12:46:34 +03:00
tophf
8c539dabd6 prefs.set: enforce value type based on defaults 2017-04-18 12:46:34 +03:00
tophf
97c5972348 prefs: keep up-to-date using prefChanged event 2017-04-18 12:46:34 +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