Allow the browserAction button to be turbo again

Closes #13
This commit is contained in:
Nils Maier 2019-08-25 21:18:30 +02:00
parent d98c4e318a
commit af8b05d20c
3 changed files with 19 additions and 3 deletions

View File

@ -119,7 +119,7 @@ new class Action extends Handler {
} }
try { try {
await this.processResults( await this.processResults(
await Prefs.get("global-turbo"), true,
await runContentJob( await runContentJob(
tab, "/bundles/content-gather.js", { tab, "/bundles/content-gather.js", {
type: "DTA:gather", type: "DTA:gather",
@ -413,8 +413,24 @@ Bus.on("do-single", () => API.singleRegular(null));
Bus.on("open-manager", () => openManager(true)); Bus.on("open-manager", () => openManager(true));
Bus.on("open-prefs", () => openPrefs()); Bus.on("open-prefs", () => openPrefs());
function adjustAction(globalTurbo: boolean) {
action.setPopup({
popup: globalTurbo ? "" : null
});
action.setIcon({
path: globalTurbo ? {
16: "/style/button-turbo.png",
32: "/style/button-turbo@2x.png",
} : null
});
}
(async function init() { (async function init() {
await Prefs.set("last-run", new Date()); await Prefs.set("last-run", new Date());
Prefs.get("global-turbo", false).then(v => adjustAction(v));
Prefs.on("global-turbo", (prefs, key, value) => {
adjustAction(value);
});
await filters(); await filters();
await getManager(); await getManager();
})().catch(ex => { })().catch(ex => {

View File

@ -43,7 +43,7 @@
<article id="tab-general" class="tab"> <article id="tab-general" class="tab">
<fieldset> <fieldset>
<legend data-i18n="pref.ui">UI</legend> <legend data-i18n="pref.ui">UI</legend>
<!--<label><input type="checkbox" id="pref-global-turbo"> <span data-i18n="pref-global-turbo">Global turbo</span></label>--> <label><input type="checkbox" id="pref-global-turbo"> <span data-i18n="pref-global-turbo">Global turbo</span></label>
<label><input type="checkbox" id="pref-finish-notification"> <span data-i18n="pref-finish-notification"></span></label> <label><input type="checkbox" id="pref-finish-notification"> <span data-i18n="pref-finish-notification"></span></label>
<div style="margin-top: 1em;"> <div style="margin-top: 1em;">
<button id="reset-confirmations" data-i18n="reset-confirmations"></button> <button id="reset-confirmations" data-i18n="reset-confirmations"></button>

View File

@ -545,7 +545,7 @@ addEventListener("DOMContentLoaded", () => {
localize(document.documentElement); localize(document.documentElement);
// General // General
//new BoolPref("pref-global-turbo", "global-turbo"); new BoolPref("pref-global-turbo", "global-turbo");
new BoolPref("pref-queue-notification", "queue-notification"); new BoolPref("pref-queue-notification", "queue-notification");
new BoolPref("pref-finish-notification", "finish-notification"); new BoolPref("pref-finish-notification", "finish-notification");
new BoolPref("pref-tooltip", "tooltip"); new BoolPref("pref-tooltip", "tooltip");