commitd84c4dc3feAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 19:13:29 2018 +0800 Fix: remove unused comment commit46027120ecAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 19:09:06 2018 +0800 Add: handle styleUpdated message commitf85d4de39bAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 18:59:29 2018 +0800 Fix: handle styleAdded message in popup commit81f3e69574Author: eight <eight04@gmail.com> Date: Sun Oct 14 18:50:54 2018 +0800 Change: getStylesInfoByUrl -> getStylesByUrl commitf9dc04558fAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 18:48:20 2018 +0800 Fix: drop getStylesInfo commitfea04d591fAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 18:39:28 2018 +0800 Fix: remove unused ignoreChromeError commit2aff14e213Author: eight <eight04@gmail.com> Date: Sun Oct 14 18:09:53 2018 +0800 Fix: don't dup promisify in prefs commitd4ddfcc713Author: eight <eight04@gmail.com> Date: Sun Oct 14 17:56:16 2018 +0800 Change: drop .last and .rotate commit85e70491e4Author: eight <eight04@gmail.com> Date: Sun Oct 14 17:36:00 2018 +0800 Fix: unused renderIndex commit7acb131642Author: eight <eight04@gmail.com> Date: Sun Oct 14 17:32:49 2018 +0800 Fix: update title on input commita39405ac4cAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 17:17:20 2018 +0800 Fix: remove unused messages commit14c2fdbb58Author: eight <eight04@gmail.com> Date: Sun Oct 14 16:36:12 2018 +0800 Fix: dirty state for new added applies commitfb1b49b8bbAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 16:27:17 2018 +0800 Fix: minor commit2c2d849fa4Author: eight <eight04@gmail.com> Date: Sun Oct 14 16:20:14 2018 +0800 Fix: drop unused getCode commitf133c3e67aAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 16:18:14 2018 +0800 Fix: drop unused lastActive commit05a6208f5cAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 16:17:45 2018 +0800 Fix: minor commit05a87ed00fAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 15:58:33 2018 +0800 Fix: minor commit576f73f333Author: eight <eight04@gmail.com> Date: Sun Oct 14 03:03:35 2018 +0800 Fix: always register listeners commite93819deb4Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:58:49 2018 +0800 Fix: unused statement commit39b11685b4Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:54:29 2018 +0800 Fix: minor commit9dd3cd43c1Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:49:22 2018 +0800 Fix: don't reorder options commit90aadfd728Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:43:52 2018 +0800 Fix: drop __ERROR__ commit838c21e3b3Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:36:20 2018 +0800 Fix: use findStyle API commit93a4cdf595Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:34:05 2018 +0800 Add: findStyle API commit8e75871b9bAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 02:19:01 2018 +0800 Breaking: drop getStylesFallback commitad06551440Author: eight <eight04@gmail.com> Date: Sun Oct 14 02:16:48 2018 +0800 Fix: use dataurl to inject page script commitcb5cbb4d10Author: eight <eight04@gmail.com> Date: Sun Oct 14 01:39:50 2018 +0800 Fix: various commit53efd78b89Author: eight <eight04@gmail.com> Date: Sun Oct 14 01:12:57 2018 +0800 Update doc commit7d005f3eaaAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 01:09:22 2018 +0800 Change: kill style.reason commitfc53bed3deAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 00:56:04 2018 +0800 Fix: doo many indents commit14e321d258Author: eight <eight04@gmail.com> Date: Sun Oct 14 00:40:23 2018 +0800 Fix: don't update icon for popup and options commit01bdd529bcAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 00:39:17 2018 +0800 Fix: updateCount commitb9968830d3Author: eight <eight04@gmail.com> Date: Sun Oct 14 00:38:49 2018 +0800 Fix: don't send null value commitff3bf6f52dAuthor: eight <eight04@gmail.com> Date: Sun Oct 14 00:03:34 2018 +0800 Add: styleViaAPI updateCount commit39d21c3d29Author: eight <eight04@gmail.com> Date: Sat Oct 13 23:57:45 2018 +0800 Fix: broadcastError -> ignoreError commitecb622c93cAuthor: eight <eight04@gmail.com> Date: Sat Oct 13 21:29:06 2018 +0800 Fix: implement styleViaAPI commit7c3d49c005Author: eight <eight04@gmail.com> Date: Sat Oct 13 17:50:28 2018 +0800 Fix: ROOT may change in XML pages commit3fd8d937f3Author: eight <eight04@gmail.com> Date: Sat Oct 13 16:49:43 2018 +0800 Fix: various commit859afc8ee9Author: eight <eight04@gmail.com> Date: Sat Oct 13 16:39:54 2018 +0800 Enhance: don't cache enabled state commitfbe77a8d15Author: eight <eight04@gmail.com> Date: Sat Oct 13 16:15:07 2018 +0800 Fix: various commita4fc3e9162Author: eight <eight04@gmail.com> Date: Sat Oct 13 16:11:38 2018 +0800 Fix: various commit7e0eddeb8fAuthor: eight <eight04@gmail.com> Date: Sat Oct 13 15:58:31 2018 +0800 Fix: various commit8b4ab47d89Author: eight <eight04@gmail.com> Date: Sat Oct 13 15:20:10 2018 +0800 Add: some type hint commit7d340d62dcAuthor: eight <eight04@gmail.com> Date: Sat Oct 13 15:13:11 2018 +0800 Change: drop storage.js, some functions are moved to sections-util commitd286997d6aAuthor: eight <eight04@gmail.com> Date: Sat Oct 13 15:12:00 2018 +0800 Fix: minor commitd60db9dbefAuthor: eight <eight04@gmail.com> Date: Sat Oct 13 15:03:10 2018 +0800 Fix: minor commit43afa31fa0Author: eight <eight04@gmail.com> Date: Sat Oct 13 14:50:31 2018 +0800 Fix: update tab icon on forward/backward commitf08faea149Author: eight <eight04@gmail.com> Date: Sat Oct 13 13:50:03 2018 +0800 Fix: parallel import commit4d06435486Author: eight <eight04@gmail.com> Date: Fri Oct 12 23:32:03 2018 +0800 Add: importStyle API commitc55675912eAuthor: eight <eight04@gmail.com> Date: Fri Oct 12 23:14:46 2018 +0800 Fix: refactor import-export commit86ea846a89Author: eight <eight04@gmail.com> Date: Fri Oct 12 17:34:36 2018 +0800 Fix: search db is broken commit831ca07c2dAuthor: eight <eight04@gmail.com> Date: Fri Oct 12 17:29:35 2018 +0800 fixup! Add: implement sloppy regexp indicator commite67b7f4f36Author: eight <eight04@gmail.com> Date: Fri Oct 12 17:27:19 2018 +0800 Add: implement sloppy regexp indicator commit36e13f88f0Author: eight <eight04@gmail.com> Date: Fri Oct 12 16:59:23 2018 +0800 Add: return excluded/sloppy state in getStylesInfoByUrl commitf6ce78f55bAuthor: eight <eight04@gmail.com> Date: Fri Oct 12 16:39:47 2018 +0800 Fix: dead object commit5ae95a1ad9Author: eight <eight04@gmail.com> Date: Fri Oct 12 16:27:54 2018 +0800 Fix: don't reinit all editors on save commit1a5a206fe6Author: eight <eight04@gmail.com> Date: Fri Oct 12 16:18:40 2018 +0800 Refactor: pull out sections editor section commit8016346035Author: eight <eight04@gmail.com> Date: Fri Oct 12 15:30:35 2018 +0800 Fix: replaceStyle make style name undefined commitfa080d1913Author: eight <eight04@gmail.com> Date: Fri Oct 12 15:21:36 2018 +0800 Fix: catch csp error commite0b064115dAuthor: eight <eight04@gmail.com> Date: Fri Oct 12 15:03:00 2018 +0800 Fix: use a simple eval to execute page scripts commit405b7f8f06Author: eight <eight04@gmail.com> Date: Fri Oct 12 03:48:13 2018 +0800 Fix: removed unused API commit1b2c88f926Author: eight <eight04@gmail.com> Date: Fri Oct 12 03:46:51 2018 +0800 Fix: no need to access db commita8131fc9c5Author: eight <eight04@gmail.com> Date: Fri Oct 12 03:43:31 2018 +0800 Fix: remove unused methods commit3ae0c4dd13Author: eight <eight04@gmail.com> Date: Fri Oct 12 03:10:26 2018 +0800 Enhance: allow matcher to return verbose info commit0ea7ada48fAuthor: eight <eight04@gmail.com> Date: Fri Oct 12 02:02:14 2018 +0800 Fix: content script may load before the background is ready commit04c2d6bbf6Author: eight <eight04@gmail.com> Date: Fri Oct 12 01:49:52 2018 +0800 Fix: throw receiving end doesn't exist message commitf0c0bc4d6aAuthor: eight <eight04@gmail.com> Date: Fri Oct 12 01:11:17 2018 +0800 Fix: unwrap error commit4d42765d6cAuthor: eight <eight04@gmail.com> Date: Thu Oct 11 23:55:16 2018 +0800 fixup! Fix: match subdomain commit99626e4a48Author: eight <eight04@gmail.com> Date: Thu Oct 11 23:54:58 2018 +0800 Fix: match subdomain commita57b3b2716Author: eight <eight04@gmail.com> Date: Thu Oct 11 23:39:11 2018 +0800 Fix: firefox commit5cfea3933fAuthor: eight <eight04@gmail.com> Date: Thu Oct 11 22:46:34 2018 +0800 Add some comment to db.js commit25fd3a1c2bAuthor: eight <eight04@gmail.com> Date: Thu Oct 11 22:14:56 2018 +0800 Fix: remove unused prop commitbdae1c3697Author: eight <eight04@gmail.com> Date: Thu Oct 11 20:00:25 2018 +0800 Change: simpler styleCodeEmpty commitbd4a453f45Merge:c1bf9f59058c06Author: eight <eight04@gmail.com> Date: Thu Oct 11 19:49:37 2018 +0800 Merge branch 'dev-usercss-meta' into dev-exclusions commitc1bf9f57e9Author: eight <eight04@gmail.com> Date: Thu Oct 11 19:29:17 2018 +0800 Fix: minor commitfd5eeb4b81Author: eight <eight04@gmail.com> Date: Thu Oct 11 19:00:05 2018 +0800 Add: refresh on view commit3e38810a49Author: eight <eight04@gmail.com> Date: Thu Oct 11 18:13:24 2018 +0800 Fix: make sure icons are refreshed at startup commitc657d7e55cAuthor: eight <eight04@gmail.com> Date: Thu Oct 11 17:32:27 2018 +0800 Add: implement bug 461 commit7ed39ab6efAuthor: eight <eight04@gmail.com> Date: Thu Oct 11 15:42:44 2018 +0800 fixup! Add: icon-util commit30e494eda9Author: eight <eight04@gmail.com> Date: Thu Oct 11 15:42:23 2018 +0800 Add: icon-util commit510a886e14Author: eight <eight04@gmail.com> Date: Thu Oct 11 03:21:38 2018 +0800 Fix: exposeIframes commitc7f81662c4Author: eight <eight04@gmail.com> Date: Thu Oct 11 02:19:14 2018 +0800 Fix: autoCloseBrackets is true by default commitf3a103645dAuthor: eight <eight04@gmail.com> Date: Thu Oct 11 02:11:14 2018 +0800 Fix: various commitd4436cde20Author: eight <eight04@gmail.com> Date: Thu Oct 11 01:39:10 2018 +0800 Add: implement exposeIframe commit43db875fd8Author: eight <eight04@gmail.com> Date: Thu Oct 11 01:26:24 2018 +0800 Kill more globals commitdc491e9be3Author: eight <eight04@gmail.com> Date: Thu Oct 11 01:22:13 2018 +0800 Kill old storage, storage-dummy commitba64b95575Author: eight <eight04@gmail.com> Date: Thu Oct 11 00:54:38 2018 +0800 WIP: kill cachedStyles commit7eba890a21Merge:d2b36a181e4823Author: eight <eight04@gmail.com> Date: Wed Oct 10 23:15:14 2018 +0800 Merge branch 'dev-private-prefs' into dev-exclusions commitd2b36a168eAuthor: eight <eight04@gmail.com> Date: Wed Oct 10 23:05:20 2018 +0800 Kill hidden globals commit22d4767511Author: eight <eight04@gmail.com> Date: Wed Oct 10 19:23:34 2018 +0800 Fix: margin for deleted sections commit00687983f0Author: eight <eight04@gmail.com> Date: Wed Oct 10 18:21:07 2018 +0800 Fix: default value commitff6fd8cad3Author: eight <eight04@gmail.com> Date: Wed Oct 10 18:02:51 2018 +0800 Fix: default options commitc23f315c52Author: eight <eight04@gmail.com> Date: Wed Oct 10 17:40:07 2018 +0800 Refactor: use CodeMirror.defineOption commit4419c5dc1eAuthor: eight <eight04@gmail.com> Date: Wed Oct 10 16:32:39 2018 +0800 Change: kill editors, styleId commit6494985b50Author: eight <eight04@gmail.com> Date: Wed Oct 10 16:14:51 2018 +0800 Fix: various commit37e1f43f75Author: eight <eight04@gmail.com> Date: Wed Oct 10 15:04:03 2018 +0800 Fix: minor commitd26ce3238eAuthor: eight <eight04@gmail.com> Date: Wed Oct 10 14:49:37 2018 +0800 Add: codemirror-factory commit15a1f552f6Author: eight <eight04@gmail.com> Date: Wed Oct 10 12:08:35 2018 +0800 WIP: kill getSection commitba6159e067Author: eight <eight04@gmail.com> Date: Wed Oct 10 02:43:09 2018 +0800 WIP: edit page commitfd9ab5d6e5Author: eight <eight04@gmail.com> Date: Wed Oct 10 00:41:07 2018 +0800 Fix: switch to editor commit06e22d0d18Author: eight <eight04@gmail.com> Date: Tue Oct 9 23:38:29 2018 +0800 Change: add sections-editor commit30e8662946Author: eight <eight04@gmail.com> Date: Mon Oct 8 20:12:39 2018 +0800 Add: preview error commit47b2b4fc49Author: eight <eight04@gmail.com> Date: Mon Oct 8 18:38:01 2018 +0800 Add: livePreview.show commit7b5e7c96d5Author: eight <eight04@gmail.com> Date: Mon Oct 8 18:16:45 2018 +0800 Hook up live preview commit15efafff3cAuthor: eight <eight04@gmail.com> Date: Mon Oct 8 17:49:57 2018 +0800 Add: live preview commita38558ef78Author: eight <eight04@gmail.com> Date: Mon Oct 8 15:30:39 2018 +0800 WIP: make notifyAllTabs a noop commit582e9078afAuthor: eight <eight04@gmail.com> Date: Mon Oct 8 14:39:08 2018 +0800 Fix: inject all scripts commitf4651da8d8Author: eight <eight04@gmail.com> Date: Sun Oct 7 23:41:46 2018 +0800 Drop deleteStyle commit0489fb3b2fAuthor: eight <eight04@gmail.com> Date: Sun Oct 7 23:33:51 2018 +0800 Drop saveStyle commit02f471f077Author: eight <eight04@gmail.com> Date: Sun Oct 7 23:28:41 2018 +0800 Fix: usercss API commit057111b171Author: eight <eight04@gmail.com> Date: Sun Oct 7 22:59:31 2018 +0800 Update usercss API commit69cae02381Author: eight <eight04@gmail.com> Date: Sun Oct 7 21:40:29 2018 +0800 Drop getStyles commitc5d41529d9Author: eight <eight04@gmail.com> Date: Sun Oct 7 21:28:51 2018 +0800 Minor fixes commit5b3b4e680fAuthor: eight <eight04@gmail.com> Date: Sun Oct 7 21:20:39 2018 +0800 Add: navigator-util commitb5107b78a5Author: eight <eight04@gmail.com> Date: Sun Oct 7 01:42:43 2018 +0800 Add: broadcast messages with reasons commite7ef4948cdAuthor: eight <eight04@gmail.com> Date: Sat Oct 6 18:10:47 2018 +0800 Fix: observer is unavailable? commit1c635b5bc1Author: eight <eight04@gmail.com> Date: Sat Oct 6 17:47:43 2018 +0800 Drop requestStyles commit75f2561154Author: eight <eight04@gmail.com> Date: Sat Oct 6 16:38:04 2018 +0800 Fix: don't recreate element when style update in popup commit583ca31d97Author: eight <eight04@gmail.com> Date: Sat Oct 6 15:40:07 2018 +0800 fixup! Add: isCodeEmpty commit1cf6008514Author: eight <eight04@gmail.com> Date: Sat Oct 6 15:33:18 2018 +0800 Add: isCodeEmpty commit450cd60aebAuthor: eight <eight04@gmail.com> Date: Sat Oct 6 15:22:04 2018 +0800 Fix: ignore comment block commit196b6aac63Author: eight <eight04@gmail.com> Date: Sat Oct 6 15:16:00 2018 +0800 Fix: the return value of getSectionsByUrl is changed commit3122d28c1aAuthor: eight <eight04@gmail.com> Date: Sat Oct 6 15:14:05 2018 +0800 Fix: always use promise in API call commite594b8ccb1Author: eight <eight04@gmail.com> Date: Sat Oct 6 15:11:01 2018 +0800 Cache enabled state commit1f18b13a92Author: eight <eight04@gmail.com> Date: Sat Oct 6 13:48:46 2018 +0800 Add: match global sections commitfedf844dddAuthor: eight <eight04@gmail.com> Date: Sat Oct 6 13:45:37 2018 +0800 Add: getStylesInfoByUrl commit095998f07cAuthor: eight <eight04@gmail.com> Date: Sat Oct 6 13:27:58 2018 +0800 Change: switch to msg.js commitfa3127d988Author: eight <eight04@gmail.com> Date: Sat Oct 6 13:02:45 2018 +0800 Change: switch to msg.js commit05d582c726Author: eight <eight04@gmail.com> Date: Sat Oct 6 11:43:42 2018 +0800 Add: msg.sendBg commit171339f710Author: eight <eight04@gmail.com> Date: Sat Oct 6 04:39:48 2018 +0800 WIP: drop api.js commit3a618aca2aAuthor: eight <eight04@gmail.com> Date: Sat Oct 6 03:19:51 2018 +0800 WIP: use deepCopy commitbb1cb58024Author: eight <eight04@gmail.com> Date: Sat Oct 6 03:10:04 2018 +0800 WIP: msg.js commit2472e91f57Author: eight <eight04@gmail.com> Date: Fri Oct 5 21:28:19 2018 +0800 WIP: emitChangesToTabs commit34497ebe16Author: eight <eight04@gmail.com> Date: Fri Oct 5 18:47:52 2018 +0800 WIP: switch to API commitf1639cc33eAuthor: eight <eight04@gmail.com> Date: Fri Oct 5 01:03:40 2018 +0800 WIP: broadcastMessage commit81e4823f46Author: eight <eight04@gmail.com> Date: Thu Oct 4 19:39:59 2018 +0800 Debounce updateAllTabsIcon commitdc5f3e209fAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 19:34:36 2018 +0800 Fix: settings could be empty on the first install commit2328cf623aAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 19:34:22 2018 +0800 Change: start-firefox -> start commit7be6a1cba9Author: eight <eight04@gmail.com> Date: Thu Oct 4 19:24:35 2018 +0800 Add: applications commit630725196fAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 19:22:44 2018 +0800 fixup! Fix: update all icons when some prefs changed commit0d0e1b4dc0Author: eight <eight04@gmail.com> Date: Thu Oct 4 19:20:36 2018 +0800 Fix: update all icons when some prefs changed commit5c0288e9baAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 19:20:11 2018 +0800 fixup! Remove unused FIREFOX_NO_DOM_STORAGE commit56b737b65aAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 18:14:57 2018 +0800 Remove unused FIREFOX_NO_DOM_STORAGE commit829a134ed1Author: eight <eight04@gmail.com> Date: Thu Oct 4 18:10:53 2018 +0800 Fix: this -> prefs commitd35f92250eAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 18:08:19 2018 +0800 Fixme: styleViaAPI commit8a6e8ac03aAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 18:05:41 2018 +0800 Change: drop prefChanged, use prefs service commit10f9449144Author: eight <eight04@gmail.com> Date: Thu Oct 4 17:46:45 2018 +0800 Change: move setupLivePrefs to dom.js. Remove prefs.js dependencies commitdd2b8ed091Author: eight <eight04@gmail.com> Date: Thu Oct 4 17:18:38 2018 +0800 Fix: type error commit3af310c341Author: eight <eight04@gmail.com> Date: Thu Oct 4 17:09:26 2018 +0800 Fix: open-manager has no default value commit874a2da33eAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 17:04:23 2018 +0800 Enhance: make prefs use storage.sync commitc01f93f62cAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 15:57:02 2018 +0800 WIP commit6d32ffb76bAuthor: eight <eight04@gmail.com> Date: Thu Oct 4 12:46:19 2018 +0800 WIP commit0f148eac32Author: eight <eight04@gmail.com> Date: Thu Oct 4 03:35:07 2018 +0800 WIP commit282bdf7706Author: eight <eight04@gmail.com> Date: Wed Oct 3 20:24:06 2018 +0800 Fix: numbers are not compared correctly commit24b1eea8a4Merge:8a6011d5cbe8a8Author: eight <eight04@gmail.com> Date: Wed Oct 3 15:00:07 2018 +0800 Merge branch 'master' of https://github.com/openstyles/stylus into dev-exclusions commit5cbe8a8d78Author: eight <eight04@gmail.com> Date: Tue Oct 2 20:22:18 2018 +0800 Add: fetch style object from DB directly in the editor (#507) commit9058c06c54Author: eight <eight04@gmail.com> Date: Mon Oct 1 23:24:29 2018 +0800 Fix: bad API commit1f2d116aaeAuthor: eight <eight04@gmail.com> Date: Mon Oct 1 23:14:56 2018 +0800 Fix: use meta parser commit918e47b1edAuthor: eight <eight04@gmail.com> Date: Mon Oct 1 23:01:21 2018 +0800 Fix: emit update event if no fatal errors commit81a7bb9ac9Author: eight <eight04@gmail.com> Date: Mon Oct 1 22:56:25 2018 +0800 Add: editorWorker.metalint commitf47d57aea8Author: eight <eight04@gmail.com> Date: Mon Oct 1 22:49:16 2018 +0800 Change: use editorWorker.metalint commit5778d5c858Author: eight <eight04@gmail.com> Date: Mon Oct 1 22:39:01 2018 +0800 Change: editor-worker-body -> editor-worker commit268e1716b4Author: eight <eight04@gmail.com> Date: Mon Oct 1 22:38:06 2018 +0800 Change: switch to worker-util commitcc2980b647Author: eight <eight04@gmail.com> Date: Mon Oct 1 22:30:16 2018 +0800 Drop: parserlib-loader commit08adcb60f2Merge:6909c732fd531eAuthor: eight <eight04@gmail.com> Date: Mon Oct 1 22:29:39 2018 +0800 Merge branch 'master' into dev-usercss-meta commite4135ce35dAuthor: eight <eight04@gmail.com> Date: Fri Sep 28 11:57:34 2018 +0800 Fix: remove unused function commit39a6d1909fAuthor: eight <eight04@gmail.com> Date: Fri Sep 28 00:26:29 2018 +0800 Fix: prefs doesn't work in FF's private windows. Add web-ext. Drop prefs.readOnlyValues commit6909c73c69Author: eight <eight04@gmail.com> Date: Wed Sep 26 12:16:33 2018 +0800 Fix: minor commit79833d8bbaAuthor: eight <eight04@gmail.com> Date: Wed Sep 26 11:40:04 2018 +0800 Fix: a better way to draw list? commita849fd6ddaAuthor: eight <eight04@gmail.com> Date: Wed Sep 26 11:39:53 2018 +0800 Fix: missing placeholders commitd5ee31a080Author: eight <eight04@gmail.com> Date: Wed Sep 26 11:37:50 2018 +0800 Fix: a better way to draw character list? commit7b959af3e3Author: eight <eight04@gmail.com> Date: Wed Sep 26 11:30:10 2018 +0800 Update usercss-meta commitfefa987c4dAuthor: eight <eight04@gmail.com> Date: Wed Sep 26 10:37:28 2018 +0800 Change: sections-equal -> sections-util commit2abbf670d8Author: eight <eight04@gmail.com> Date: Wed Sep 26 10:37:14 2018 +0800 Fix: check err.code commit1fe0586b29Author: eight <eight04@gmail.com> Date: Wed Sep 26 10:33:02 2018 +0800 Add: i18n error message commitab0ef239cfAuthor: eight <eight04@gmail.com> Date: Wed Sep 26 09:34:57 2018 +0800 Change: move styleCodeEmpty to sections-util, load colorConverter in background worker commitd5ade807f0Author: eight <eight04@gmail.com> Date: Wed Sep 26 09:27:30 2018 +0800 Fix: display error message commit4f5337e51dAuthor: eight <eight04@gmail.com> Date: Wed Sep 26 09:26:55 2018 +0800 Fix: remove unused colorconverter commit29b8f51292Author: eight <eight04@gmail.com> Date: Tue Sep 25 23:21:44 2018 +0800 Fix: vars could be undefined commita7cfeb22e4Author: eight <eight04@gmail.com> Date: Tue Sep 25 22:54:40 2018 +0800 Fix: window is undefined commit9713c6a3beAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:56:38 2018 +0800 Fix: throw an error for unparsable color commit3c30bc3eb0Author: eight <eight04@gmail.com> Date: Tue Sep 25 21:55:55 2018 +0800 Fix: try to get error message commit3d32b0428bAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:38:40 2018 +0800 Fix: vars might be empty commit7d75dd8754Author: eight <eight04@gmail.com> Date: Tue Sep 25 21:18:39 2018 +0800 Add: meta-parser commita4df641b96Author: eight <eight04@gmail.com> Date: Tue Sep 25 21:18:18 2018 +0800 Enhance: set flag in parserlib so we don't need another loader commit8028a3529fAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:17:40 2018 +0800 Include util, worker-util in background commitba5d6cc31aAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:16:59 2018 +0800 Fix: use spread syntax in loadScript commitb853be13f8Author: eight <eight04@gmail.com> Date: Tue Sep 25 21:14:46 2018 +0800 Enhance: swith to usercss-meta (in worker) commita3e7915199Author: eight <eight04@gmail.com> Date: Tue Sep 25 21:11:54 2018 +0800 Fix: use promise API commit5d07a8cd4eAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:11:09 2018 +0800 Fix: buildMeta now returns a promise commita004bc3c7dAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:10:35 2018 +0800 Move styleCodeEmpty to util commit41ac66a137Author: eight <eight04@gmail.com> Date: Tue Sep 25 21:09:40 2018 +0800 Add: background worker commitffb13bf1dbAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 21:09:04 2018 +0800 Enhance: move moz-parser/meta-parser/usercss compiler to worker commit42e97ef153Author: eight <eight04@gmail.com> Date: Tue Sep 25 20:45:07 2018 +0800 Fix: display error on install page commit64aa9fcf53Author: eight <eight04@gmail.com> Date: Tue Sep 25 17:34:54 2018 +0800 Add: background worker commitb0e407e98fAuthor: eight <eight04@gmail.com> Date: Tue Sep 25 14:52:35 2018 +0800 Add: worker util commit7a24547e09Author: eight <eight04@gmail.com> Date: Tue Sep 25 00:01:18 2018 +0800 Add: usercss-meta commit8a6011de8cAuthor: Rob Garrison <wowmotty@gmail.com> Date: Sun Jul 22 09:15:09 2018 -0500 Attempt to update icon count commit4fcb1a88d7Author: Rob Garrison <wowmotty@gmail.com> Date: Sun Jul 15 13:44:29 2018 -0500 Fix empty exclusion storage error commitbfe54ab4c4Author: Rob Garrison <wowmotty@gmail.com> Date: Sun Jul 15 12:59:51 2018 -0500 Add tab communication commit983a7bc219Author: Rob Garrison <wowmotty@gmail.com> Date: Sun Jul 15 10:51:11 2018 -0500 Fix escaped regex example commit3950482f34Author: Rob Garrison <wowmotty@gmail.com> Date: Wed Apr 25 18:11:37 2018 -0500 Fix undefined error commite94c7edb38Author: Rob Garrison <wowmotty@gmail.com> Date: Wed Apr 25 17:09:45 2018 -0500 Attempt to fix popup exclusion issues commit2b4a1a5635Author: Rob Garrison <wowmotty@gmail.com> Date: Thu Apr 19 13:00:27 2018 -0500 Modify input method commit9f75b69cd8Author: Rob Garrison <wowmotty@gmail.com> Date: Wed Mar 7 11:54:05 2018 -0600 Include iframe urls in exclusion popup commit68dfa0153cAuthor: Rob Garrison <wowmotty@gmail.com> Date: Wed Jan 24 19:42:02 2018 -0600 Add style exclusions. Closes #113
331 lines
10 KiB
JavaScript
331 lines
10 KiB
JavaScript
/* global messageBox styleSectionsEqual getOwnTab API
|
|
tryJSONparse scrollElementIntoView $ $$ API $create t animateElement */
|
|
'use strict';
|
|
|
|
const STYLISH_DUMP_FILE_EXT = '.txt';
|
|
const STYLUS_BACKUP_FILE_EXT = '.json';
|
|
|
|
function importFromFile({fileTypeFilter, file} = {}) {
|
|
return new Promise(resolve => {
|
|
const fileInput = document.createElement('input');
|
|
if (file) {
|
|
readFile();
|
|
return;
|
|
}
|
|
fileInput.style.display = 'none';
|
|
fileInput.type = 'file';
|
|
fileInput.accept = fileTypeFilter || STYLISH_DUMP_FILE_EXT;
|
|
fileInput.acceptCharset = 'utf-8';
|
|
|
|
document.body.appendChild(fileInput);
|
|
fileInput.initialValue = fileInput.value;
|
|
fileInput.onchange = readFile;
|
|
fileInput.click();
|
|
|
|
function readFile() {
|
|
if (file || fileInput.value !== fileInput.initialValue) {
|
|
file = file || fileInput.files[0];
|
|
if (file.size > 100e6) {
|
|
console.warn("100MB backup? I don't believe you.");
|
|
importFromString('').then(resolve);
|
|
return;
|
|
}
|
|
document.body.style.cursor = 'wait';
|
|
const fReader = new FileReader();
|
|
fReader.onloadend = event => {
|
|
fileInput.remove();
|
|
const text = event.target.result;
|
|
const maybeUsercss = !/^[\s\r\n]*\[/.test(text) &&
|
|
(text.includes('==UserStyle==') || /==UserStyle==/i.test(text));
|
|
(!maybeUsercss ?
|
|
importFromString(text) :
|
|
getOwnTab().then(tab => {
|
|
tab.url = URL.createObjectURL(new Blob([text], {type: 'text/css'}));
|
|
return API.openUsercssInstallPage({direct: true, tab})
|
|
.then(() => URL.revokeObjectURL(tab.url));
|
|
})
|
|
).then(numStyles => {
|
|
document.body.style.cursor = '';
|
|
resolve(numStyles);
|
|
});
|
|
};
|
|
fReader.readAsText(file, 'utf-8');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function importFromString(jsonString) {
|
|
const json = tryJSONparse(jsonString);
|
|
if (!Array.isArray(json)) {
|
|
return Promise.reject(new Error('the backup is not a valid JSON file'));
|
|
}
|
|
let oldStyles;
|
|
let oldStylesById;
|
|
let oldStylesByName;
|
|
const stats = {
|
|
added: {names: [], ids: [], legend: 'importReportLegendAdded'},
|
|
unchanged: {names: [], ids: [], legend: 'importReportLegendIdentical'},
|
|
metaAndCode: {names: [], ids: [], legend: 'importReportLegendUpdatedBoth'},
|
|
metaOnly: {names: [], ids: [], legend: 'importReportLegendUpdatedMeta'},
|
|
codeOnly: {names: [], ids: [], legend: 'importReportLegendUpdatedCode'},
|
|
invalid: {names: [], legend: 'importReportLegendInvalid'},
|
|
};
|
|
|
|
return API.getAllStyles().then(styles => {
|
|
// make a copy of the current database, that may be used when we want to
|
|
// undo
|
|
oldStyles = styles;
|
|
oldStylesById = new Map(
|
|
oldStyles.map(style => [style.id, style]));
|
|
oldStylesByName = json.length && new Map(
|
|
oldStyles.map(style => [style.name.trim(), style]));
|
|
return Promise.all(json.map((item, i) => {
|
|
const info = analyze(item, i);
|
|
if (info) {
|
|
return API.importStyle(item)
|
|
.then(style => updateStats(style, info));
|
|
}
|
|
}));
|
|
})
|
|
.then(done);
|
|
|
|
function analyze(item, index) {
|
|
if (typeof item !== 'object' ||
|
|
!item ||
|
|
!item.name ||
|
|
!item.name.trim() ||
|
|
(item.sections && !Array.isArray(item.sections))) {
|
|
stats.invalid.names.push(`#${index}: ${limitString(item && item.name || '')}`);
|
|
return;
|
|
}
|
|
item.name = item.name.trim();
|
|
const byId = oldStylesById.get(item.id);
|
|
const byName = oldStylesByName.get(item.name);
|
|
oldStylesByName.delete(item.name);
|
|
let oldStyle;
|
|
if (byId) {
|
|
if (sameStyle(byId, item)) {
|
|
oldStyle = byId;
|
|
} else {
|
|
item.id = null;
|
|
}
|
|
}
|
|
if (!oldStyle && byName) {
|
|
item.id = byName.id;
|
|
oldStyle = byName;
|
|
}
|
|
const oldStyleKeys = oldStyle && Object.keys(oldStyle);
|
|
const metaEqual = oldStyleKeys &&
|
|
oldStyleKeys.length === Object.keys(item).length &&
|
|
oldStyleKeys.every(k => k === 'sections' || oldStyle[k] === item[k]);
|
|
const codeEqual = oldStyle && styleSectionsEqual(oldStyle, item);
|
|
if (metaEqual && codeEqual) {
|
|
stats.unchanged.names.push(oldStyle.name);
|
|
stats.unchanged.ids.push(oldStyle.id);
|
|
return;
|
|
}
|
|
return {oldStyle, metaEqual, codeEqual};
|
|
}
|
|
|
|
function sameStyle(oldStyle, newStyle) {
|
|
return oldStyle.name.trim() === newStyle.name.trim() ||
|
|
['updateUrl', 'originalMd5', 'originalDigest']
|
|
.some(field => oldStyle[field] && oldStyle[field] === newStyle[field]);
|
|
}
|
|
|
|
function updateStats(style, {oldStyle, metaEqual, codeEqual}) {
|
|
if (!oldStyle) {
|
|
stats.added.names.push(style.name);
|
|
stats.added.ids.push(style.id);
|
|
return;
|
|
}
|
|
if (!metaEqual && !codeEqual) {
|
|
stats.metaAndCode.names.push(reportNameChange(oldStyle, style));
|
|
stats.metaAndCode.ids.push(style.id);
|
|
return;
|
|
}
|
|
if (!codeEqual) {
|
|
stats.codeOnly.names.push(style.name);
|
|
stats.codeOnly.ids.push(style.id);
|
|
return;
|
|
}
|
|
stats.metaOnly.names.push(reportNameChange(oldStyle, style));
|
|
stats.metaOnly.ids.push(style.id);
|
|
}
|
|
|
|
function done() {
|
|
const numChanged = stats.metaAndCode.names.length +
|
|
stats.metaOnly.names.length +
|
|
stats.codeOnly.names.length +
|
|
stats.added.names.length;
|
|
const report = Object.keys(stats)
|
|
.filter(kind => stats[kind].names.length)
|
|
.map(kind => {
|
|
const {ids, names, legend} = stats[kind];
|
|
const listItemsWithId = (name, i) =>
|
|
$create('div', {dataset: {id: ids[i]}}, name);
|
|
const listItems = name =>
|
|
$create('div', name);
|
|
const block =
|
|
$create('details', {dataset: {id: kind}}, [
|
|
$create('summary',
|
|
$create('b', names.length + ' ' + t(legend))),
|
|
$create('small',
|
|
names.map(ids ? listItemsWithId : listItems)),
|
|
]);
|
|
return block;
|
|
});
|
|
scrollTo(0, 0);
|
|
messageBox({
|
|
title: t('importReportTitle'),
|
|
contents: report.length ? report : t('importReportUnchanged'),
|
|
buttons: [t('confirmClose'), numChanged && t('undo')],
|
|
onshow: bindClick,
|
|
})
|
|
.then(({button}) => {
|
|
if (button === 1) {
|
|
undo();
|
|
}
|
|
});
|
|
return Promise.resolve(numChanged);
|
|
}
|
|
|
|
function undo() {
|
|
const newIds = [
|
|
...stats.metaAndCode.ids,
|
|
...stats.metaOnly.ids,
|
|
...stats.codeOnly.ids,
|
|
...stats.added.ids,
|
|
];
|
|
let tasks = Promise.resolve();
|
|
for (const id of newIds) {
|
|
tasks = tasks.then(() => API.deleteStyle(id));
|
|
const oldStyle = oldStylesById.get(id);
|
|
if (oldStyle) {
|
|
tasks = tasks.then(() => API.importStyle(oldStyle));
|
|
}
|
|
}
|
|
// taskUI is superfast and updates style list only in this page,
|
|
// which should account for 99.99999999% of cases, supposedly
|
|
return tasks.then(() => messageBox({
|
|
title: t('importReportUndoneTitle'),
|
|
contents: newIds.length + ' ' + t('importReportUndone'),
|
|
buttons: [t('confirmClose')],
|
|
}));
|
|
}
|
|
|
|
function bindClick() {
|
|
const highlightElement = event => {
|
|
const styleElement = $('#style-' + event.target.dataset.id);
|
|
if (styleElement) {
|
|
scrollElementIntoView(styleElement);
|
|
animateElement(styleElement);
|
|
}
|
|
};
|
|
for (const block of $$('#message-box details')) {
|
|
if (block.dataset.id !== 'invalid') {
|
|
block.style.cursor = 'pointer';
|
|
block.onclick = highlightElement;
|
|
}
|
|
}
|
|
}
|
|
|
|
function limitString(s, limit = 100) {
|
|
return s.length <= limit ? s : s.substr(0, limit) + '...';
|
|
}
|
|
|
|
function reportNameChange(oldStyle, newStyle) {
|
|
return newStyle.name !== oldStyle.name
|
|
? oldStyle.name + ' —> ' + newStyle.name
|
|
: oldStyle.name;
|
|
}
|
|
}
|
|
|
|
|
|
$('#file-all-styles').onclick = () => {
|
|
API.getAllStyles().then(styles => {
|
|
// https://crbug.com/714373
|
|
document.documentElement.appendChild(
|
|
$create('iframe', {
|
|
onload() {
|
|
const text = JSON.stringify(styles, null, '\t');
|
|
const type = 'application/json';
|
|
this.onload = null;
|
|
this.contentDocument.body.appendChild(
|
|
$create('a', {
|
|
href: URL.createObjectURL(new Blob([text], {type})),
|
|
download: generateFileName(),
|
|
type,
|
|
})
|
|
).dispatchEvent(new MouseEvent('click'));
|
|
},
|
|
// we can't use display:none as some browsers are ignoring such iframes
|
|
style: `
|
|
all: unset;
|
|
width: 0;
|
|
height: 0;
|
|
position: fixed;
|
|
opacity: 0;
|
|
border: none;
|
|
`.replace(/;/g, '!important;'),
|
|
})
|
|
);
|
|
// we don't remove the iframe or the object URL because the browser may show
|
|
// a download dialog and we don't know how long it'll take until the user confirms it
|
|
// (some browsers like Vivaldi can't download if we revoke the URL)
|
|
});
|
|
|
|
function generateFileName() {
|
|
const today = new Date();
|
|
const dd = ('0' + today.getDate()).substr(-2);
|
|
const mm = ('0' + (today.getMonth() + 1)).substr(-2);
|
|
const yyyy = today.getFullYear();
|
|
return `stylus-${yyyy}-${mm}-${dd}${STYLUS_BACKUP_FILE_EXT}`;
|
|
}
|
|
};
|
|
|
|
|
|
$('#unfile-all-styles').onclick = () => {
|
|
importFromFile({fileTypeFilter: STYLUS_BACKUP_FILE_EXT});
|
|
};
|
|
|
|
Object.assign(document.body, {
|
|
ondragover(event) {
|
|
const hasFiles = event.dataTransfer.types.includes('Files');
|
|
event.dataTransfer.dropEffect = hasFiles || event.target.type === 'search' ? 'copy' : 'none';
|
|
this.classList.toggle('dropzone', hasFiles);
|
|
if (hasFiles) {
|
|
event.preventDefault();
|
|
clearTimeout(this.fadeoutTimer);
|
|
this.classList.remove('fadeout');
|
|
}
|
|
},
|
|
ondragend() {
|
|
animateElement(this, {className: 'fadeout', removeExtraClasses: ['dropzone']}).then(() => {
|
|
this.style.animationDuration = '';
|
|
});
|
|
},
|
|
ondragleave(event) {
|
|
try {
|
|
// in Firefox event.target could be XUL browser and hence there is no permission to access it
|
|
if (event.target === this) {
|
|
this.ondragend();
|
|
}
|
|
} catch (e) {
|
|
this.ondragend();
|
|
}
|
|
},
|
|
ondrop(event) {
|
|
this.ondragend();
|
|
if (event.dataTransfer.files.length) {
|
|
event.preventDefault();
|
|
if ($('#only-updates input').checked) {
|
|
$('#only-updates input').click();
|
|
}
|
|
importFromFile({file: event.dataTransfer.files[0]});
|
|
}
|
|
},
|
|
});
|