+
+
+ + - + + + + + + +
+diff --git a/.eslintrc b/.eslintrc index 479e9a94..c32b677b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -34,6 +34,8 @@ globals: getType: true importStyles: true getActiveTabRealURL: true + openURL: true + onDOMready: true getDomains: true webSqlStorage: true notifyAllTabs: true diff --git a/background.js b/background.js index b7915c76..79940789 100644 --- a/background.js +++ b/background.js @@ -1,4 +1,4 @@ -/* globals wildcardAsRegExp, KEEP_CHANNEL_OPEN */ +/* globals openURL, wildcardAsRegExp, KEEP_CHANNEL_OPEN */ // This happens right away, sometimes so fast that the content script isn't even ready. That's // why the content script also asks for this stuff. @@ -149,21 +149,6 @@ chrome.tabs.onAttached.addListener(function(tabId, data) { }); }); -function openURL(options) { - chrome.tabs.query({currentWindow: true, url: options.url}, function(tabs) { - // switch to an existing tab with the requested url - if (tabs.length) { - chrome.tabs.highlight({windowId: tabs[0].windowId, tabs: tabs[0].index}, function (window) {}); - } else { - delete options.method; - getActiveTab(function(tab) { - // re-use an active new tab page - chrome.tabs[tab.url == "chrome://newtab/" ? "update" : "create"](options); - }); - } - }); -} - var codeMirrorThemes; getCodeMirrorThemes(function(themes) { codeMirrorThemes = themes; diff --git a/backup/fileSaveLoad.js b/backup/fileSaveLoad.js index 2c4736a7..89db6fc9 100644 --- a/backup/fileSaveLoad.js +++ b/backup/fileSaveLoad.js @@ -64,6 +64,7 @@ function importFromString(jsonString) { }); } else { refreshAllTabs().then(() => { + scrollTo(0, 0); setTimeout(alert, 100, numStyles + ' styles installed/updated'); resolve(numStyles); }); diff --git a/edit.html b/edit.html index 7cde2c7b..2d9e8d06 100644 --- a/edit.html +++ b/edit.html @@ -45,14 +45,15 @@ } /************ header ************/ #header { - height: calc(100vh - 30px); + width: 280px; + height: 100vh; overflow: auto; - width: 250px; position: fixed; top: 0; padding: 15px; border-right: 1px dashed #AAA; -webkit-box-shadow: 0 0 3rem -1.2rem black; + box-sizing: border-box; } #header h1 { margin-top: 0; diff --git a/edit.js b/edit.js index a17fabdb..a2043067 100644 --- a/edit.js +++ b/edit.js @@ -415,7 +415,7 @@ chrome.tabs.query({currentWindow: true}, function(tabs) { }); }); -getActiveTab(function(tab) { +getActiveTab().then(tab => { useHistoryBack = sessionStorageHash("manageStylesHistory").value[tab.id] == location.href; }); diff --git a/health.js b/health.js index 857e0736..727fa4ad 100644 --- a/health.js +++ b/health.js @@ -1,4 +1,4 @@ -healthCheck(); +setTimeout(healthCheck, 0); function healthCheck() { chrome.runtime.sendMessage({method: "healthCheck"}, function(ok) { diff --git a/manage.css b/manage.css new file mode 100644 index 00000000..b83669de --- /dev/null +++ b/manage.css @@ -0,0 +1,284 @@ +body { + margin: 0; + font: 12px arial, sans-serif; +} + +a, +a:visited { + color: inherit; + opacity: .75; + -webkit-transition: opacity 0.5s; +} + +a:hover, +a.homepage:hover { + opacity: .6; +} + +a.homepage { + opacity: 1; +} + +#header { + width: 280px; + height: 100vh; + position: fixed; + top: 0; + padding: 15px; + border-right: 1px dashed #AAA; + -webkit-box-shadow: 0 0 50px -18px black; + overflow: auto; + box-sizing: border-box; +} + +#header h1 { + margin-top: 0; +} + +#installed { + position: relative; + margin-left: 280px; +} + +.entry { + margin: 0; + padding: 1.25em 2em 1.5em; + border-top: 1px solid #ddd; +} + +.entry:first-child { + border-top: none; +} + +.svg-icon { + cursor: pointer; + vertical-align: middle; + margin-left: 0.3rem; + margin-right: 0.3rem; + margin-top: -4px; + transition: opacity .5s; + width: 16px; + height: 16px; + fill: currentColor; +} + +.style-name { + margin-top: .25em; +} + +.style-name a, .style-edit-link { + text-decoration: none; + color: inherit; +} + +.applies-to { + word-break: break-word; +} + +.applies-to, +.actions { + padding-left: 15px; + margin-bottom: 0; +} + +.applies-to > :first-child { + margin-right: .5ex; +} + +.applies-to .target:hover { + background-color: rgba(128, 128, 128, .15); +} + +.applies-to-extra { + display: inline; +} + +.applies-to-extra summary { + font-weight: bold; + cursor: pointer; + list-style-type: none; /* for FF, allegedly */ +} + +.applies-to-extra summary::-webkit-details-marker { + display: none; +} + +.disabled h2::after { + content: " (Disabled)"; +} + +.disabled { + opacity: 0.5; +} + +.disabled .disable { + display: none; +} + +.enabled .enable { + display: none; +} + +/* Default, no update buttons */ + +.update, +.check-update { + display: none; +} + +/* Check update button for things that can*/ + +*[style-update-url] .check-update { + display: inline; +} + +/* Update check in progress */ + +.checking-update .check-update { + display: none; +} + +/* Updates available */ + +.can-update .update { + display: inline; +} + +.can-update .check-update { + display: none; +} + +/* Updates not available */ + +.no-update .check-update { + display: none; +} + +/* Updates done */ + +.update-done .check-update { + display: none; +} + +.hidden { + display: none +} + +fieldset { + border-width: 1px; + border-radius: 6px; + margin: 1em 0; +} + +.enabled-only > .disabled, +.edited-only > [style-update-url] { + display: none; +} + +#search { + width: calc(100% - 4px); + margin: 0.25rem 4px 0; + border-radius: 0.25rem; + padding-left: 0.25rem; + border-width: 1px; +} + +#import ul { + margin-left: 0; + padding-left: 0; + list-style: none; +} + +#import li { + margin-bottom: .5em; +} + +#import pre { + background: #eee; + overflow: auto; + margin: 0 0 .5em 0; +} + +/* drag-n-drop on import button */ +.dropzone:after { + background-color: rgba(0, 0, 0, 0.7); + color: white; + left: 0; + top: 0; + right: 0; + bottom: 0; + z-index: 1000; + position: fixed; + padding: calc(50vh - 3em) calc(50vw - 5em); + content: attr(dragndrop-hint); + text-shadow: 1px 1px 10px black; + font-size: xx-large; + text-align: center; + animation: fadein 1s cubic-bezier(.03, .67, .08, .94); + animation-fill-mode: both; +} + +.fadeout.dropzone:after { + animation: fadeout .25s ease-in-out; + animation-fill-mode: both; +} + +@keyframes fadein { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes fadeout { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +@media (max-width: 675px) { + #header { + height: auto; + position: static; + width: auto; + border-right: none; + border-bottom: 1px dashed #AAA; + } + + #installed { + position: static; + margin-left: 0; + overflow: visible; + } + + #header h1, + #header h2, + #header h3, + #backup-message { + display: none; + } + + #header p, + #header fieldset div, + #backup { + display: inline-block; + } + + #backup { + margin-right: 1em; + } + + #backup p, + #header fieldset { + margin: 0; + } + + .entry { + margin: 0; + } +} diff --git a/manage.html b/manage.html index 6a5e4a15..ea2629d6 100644 --- a/manage.html +++ b/manage.html @@ -1,312 +1,128 @@ - +
- -- -
-- - -
-- - - -
-- -
-- - -
-