From ba27ea2c9dd6357fa242c7c222503b7c85ec22a0 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 13 Oct 2019 17:40:51 -0400 Subject: Center align context popup window buttons --- ext/bg/context.html | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/bg/context.html') diff --git a/ext/bg/context.html b/ext/bg/context.html index 51346838..843d3fd5 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -14,6 +14,7 @@ .btn-group { display: flex; + justify-content: center; margin-top: 10px; white-space: nowrap; } -- cgit v1.2.3 From d42a07dc0b722f77f64acf14ce818a2be532ea3f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 13 Oct 2019 18:23:59 -0400 Subject: Improve layout of context.html on Firefox Mobile --- ext/bg/context.html | 96 ++++++++++++++++++++++++++++++++++++++++++++++++---- ext/bg/js/context.js | 25 ++++++++++++-- 2 files changed, 111 insertions(+), 10 deletions(-) (limited to 'ext/bg/context.html') diff --git a/ext/bg/context.html b/ext/bg/context.html index 843d3fd5..07dead87 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -9,25 +9,107 @@ -
- +
+
+ +
+
+ + + +
-
- - - +
+

Yomichan

+ + + Search + + + Options + + + Help +
diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js index 0f88e9c0..a29f7aa7 100644 --- a/ext/bg/js/context.js +++ b/ext/bg/js/context.js @@ -17,10 +17,25 @@ */ +function showExtensionInfo() { + const node = document.getElementById('extension-info'); + if (node === null) { return; } + + const manifest = chrome.runtime.getManifest(); + node.textContent = `${manifest.name} v${manifest.version}`; +} + $(document).ready(utilAsync(() => { - $('#open-search').click(() => apiCommandExec('search')); - $('#open-options').click(() => apiCommandExec('options')); - $('#open-help').click(() => apiCommandExec('help')); + showExtensionInfo(); + + apiGetEnvironmentInfo().then(({browser}) => { + // Firefox mobile opens this page as a full webpage. + document.documentElement.dataset.mode = (browser === 'firefox-mobile' ? 'full' : 'mini'); + }); + + $('.action-open-search').click(() => apiCommandExec('search')); + $('.action-open-options').click(() => apiCommandExec('options')); + $('.action-open-help').click(() => apiCommandExec('help')); const optionsContext = { depth: 0, @@ -31,5 +46,9 @@ $(document).ready(utilAsync(() => { toggle.prop('checked', options.general.enable).change(); toggle.bootstrapToggle(); toggle.change(() => apiCommandExec('toggle')); + + const toggle2 = $('#enable-search2'); + toggle2.prop('checked', options.general.enable).change(); + toggle2.change(() => apiCommandExec('toggle')); }); })); -- cgit v1.2.3 From 693ffebbf77853d482dbe0e58f8363212ece809e Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 13 Oct 2019 18:38:17 -0400 Subject: Make the Options link the first link Better reflects importance in a top-down list. --- ext/bg/context.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/bg/context.html') diff --git a/ext/bg/context.html b/ext/bg/context.html index 07dead87..85203053 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -101,12 +101,12 @@ - - Search - Options + + Search + Help -- cgit v1.2.3 From 7abc7fd0e797f11bec98924b19653de6eea46c5f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 19 Oct 2019 22:54:58 -0400 Subject: Use links instead of buttons on context page --- ext/bg/context.html | 6 +++--- ext/bg/js/context.js | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'ext/bg/context.html') diff --git a/ext/bg/context.html b/ext/bg/context.html index 85203053..ace40656 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -91,9 +91,9 @@
- - - + + +
diff --git a/ext/bg/js/context.js b/ext/bg/js/context.js index a16c8769..8e1dbce6 100644 --- a/ext/bg/js/context.js +++ b/ext/bg/js/context.js @@ -25,9 +25,9 @@ function showExtensionInfo() { node.textContent = `${manifest.name} v${manifest.version}`; } -function setupButtonEvents(selector, command) { - $(selector) - .on('click', (e) => { +function setupButtonEvents(selector, command, url) { + const node = $(selector); + node.on('click', (e) => { if (e.button !== 0) { return; } apiCommandExec(command, {newTab: e.ctrlKey}); e.preventDefault(); @@ -37,6 +37,12 @@ function setupButtonEvents(selector, command) { apiCommandExec(command, {newTab: true}); e.preventDefault(); }); + + if (typeof url === 'string') { + node.attr('href', url); + node.attr('target', '_blank'); + node.attr('rel', 'noopener'); + } } $(document).ready(utilAsync(() => { @@ -47,8 +53,10 @@ $(document).ready(utilAsync(() => { document.documentElement.dataset.mode = (browser === 'firefox-mobile' ? 'full' : 'mini'); }); - setupButtonEvents('.action-open-search', 'search'); - setupButtonEvents('.action-open-options', 'options'); + const manifest = chrome.runtime.getManifest(); + + setupButtonEvents('.action-open-search', 'search', chrome.extension.getURL('/bg/search.html')); + setupButtonEvents('.action-open-options', 'options', chrome.extension.getURL(manifest.options_ui.page)); setupButtonEvents('.action-open-help', 'help'); const optionsContext = { -- cgit v1.2.3 From d7dc8ac9cddc95971f542c8e0b98e16f1f00645e Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 20 Oct 2019 10:30:44 -0400 Subject: Add tooltip about middle click behaviour --- ext/bg/context.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/bg/context.html') diff --git a/ext/bg/context.html b/ext/bg/context.html index ace40656..48fa463f 100644 --- a/ext/bg/context.html +++ b/ext/bg/context.html @@ -91,8 +91,8 @@
- - + +
-- cgit v1.2.3