From 3c5cc141c47c6474c0dea9d1c0126faa722adf54 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 1 Apr 2017 01:49:51 +0300 Subject: [PATCH] manage: make #find-editor-styles a link; remove global options * "Find styles" is a link so we make it one, just like in the popup. * We have a dedicated global options UI so it makes no sense to subset only two of them on the manage page, moreover both options are unrelated to managing styles. --- manage.css | 15 +++++++++------ manage.html | 20 ++++---------------- manage.js | 12 +++++++----- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/manage.css b/manage.css index 9e0dbae0..0467d1df 100644 --- a/manage.css +++ b/manage.css @@ -142,26 +142,22 @@ summary { } /* 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; } @@ -171,13 +167,11 @@ summary { } /* Updates not available */ - .no-update .check-update { display: none; } /* Updates done */ - .update-done .check-update { display: none; } @@ -187,6 +181,11 @@ summary { animation: highlight 10s cubic-bezier(0,.82,.47,.98); } +#find-editor-styles { + display: block; + margin-top: .5em; +} + @keyframes highlight { from { background-color: rgba(128, 128, 128, .5); @@ -318,6 +317,10 @@ fieldset { display: inline-block; } + #find-editor-styles { + display: inline-block; + } + #backup { margin-right: 1em; } diff --git a/manage.html b/manage.html index 023f4532..36de7dbf 100644 --- a/manage.html +++ b/manage.html @@ -87,22 +87,10 @@

-
- - -
-
- - -
-
-

- - -

- -

-
+ + +

diff --git a/manage.js b/manage.js index d7094034..e53c61da 100644 --- a/manage.js +++ b/manage.js @@ -31,9 +31,7 @@ function initGlobalEvents() { $('#search').oninput = searchStyles; $('#manage-options-button').onclick = () => chrome.runtime.openOptionsPage(); $('#manage-shortcuts-button').onclick = configureCommands.open; - $('#editor-styles-button').onclick = () => openURL({ - url: 'https://userstyles.org/styles/browse/chrome-extension', - }); + $('#find-editor-styles').onclick = EntryOnClick.external; // focus search field on / key document.onkeypress = event => { @@ -55,8 +53,6 @@ function initGlobalEvents() { setupLivePrefs([ 'manage.onlyEnabled', 'manage.onlyEdited', - 'show-badge', - 'popup.stylesFirst' ]); [ @@ -127,6 +123,7 @@ function createStyleElement({style, name}) { if (style.url) { const homepage = template.styleHomepage.cloneNode(true); homepage.href = style.url; + homepage.onclick = EntryOnClick.external; styleName.appendChild(document.createTextNode(' ')); styleName.appendChild(homepage); } @@ -249,6 +246,11 @@ class EntryOnClick { } }); } + + static external(event) { + openURL({url: event.target.closest('a').href}); + event.preventDefault(); + } }