From fa159cf84539a2f04c838dee006245f32e450ed9 Mon Sep 17 00:00:00 2001 From: narcolepticinsomniac Date: Fri, 24 Feb 2017 06:04:43 -0500 Subject: [PATCH] Options UI discoverability #34 --- manage.html | 10 ++++++++-- openOptions.js | 15 +++++++++++++++ popup.css | 3 +++ popup.html | 1 + popup.js | 16 ++++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 openOptions.js diff --git a/manage.html b/manage.html index c77f0a1c..5962ebbc 100644 --- a/manage.html +++ b/manage.html @@ -204,16 +204,22 @@

+
+

+ + +
-

Backup

- Larger files may take a moment, be patient.

+

+

+ diff --git a/openOptions.js b/openOptions.js new file mode 100644 index 00000000..c4c9d89a --- /dev/null +++ b/openOptions.js @@ -0,0 +1,15 @@ +document.querySelector('#manage-options-button').addEventListener("click", function() { + if (chrome.runtime.openOptionsPage) { + // Supported (Chrome 42+) + chrome.runtime.openOptionsPage(); + } else { + // Fallback + window.open(chrome.runtime.getURL('options/index.html')); + } +}); + +document.querySelector('#shortcuts-button').addEventListener("click", function() { + chrome.tabs.create({ + 'url': 'chrome://extensions/configureCommands' + }); +}); \ No newline at end of file diff --git a/popup.css b/popup.css index be5dd51b..11daa2e4 100644 --- a/popup.css +++ b/popup.css @@ -9,6 +9,9 @@ input[type=checkbox] { #no-styles { font-style: italic; } +#popup-shortcuts-button { + margin-left: 4px; +} .checker { display: inline; } diff --git a/popup.html b/popup.html index 8c78fda6..68760d89 100644 --- a/popup.html +++ b/popup.html @@ -45,6 +45,7 @@
+

diff --git a/popup.js b/popup.js index b1eeda5f..a9e1d2c2 100644 --- a/popup.js +++ b/popup.js @@ -207,3 +207,19 @@ document.getElementById("disableAll").addEventListener("change", function(event) installed.classList.toggle("disabled", prefs.get("disableAll")); }); setupLivePrefs(["disableAll"]); + +document.querySelector('#popup-options-button').addEventListener("click", function() { + if (chrome.runtime.openOptionsPage) { + // Supported (Chrome 42+) + chrome.runtime.openOptionsPage(); + } else { + // Fallback + window.open(chrome.runtime.getURL('options/index.html')); + } +}); + +document.querySelector('#popup-shortcuts-button').addEventListener("click", function() { + chrome.tabs.create({ + 'url': 'chrome://extensions/configureCommands' + }); +}); \ No newline at end of file