parent
58c7955c64
commit
04b8a981ef
@ -549,6 +549,26 @@
|
|||||||
"description": "Preferences/General",
|
"description": "Preferences/General",
|
||||||
"message": "Add new downloads paused, instead of starting them immediately"
|
"message": "Add new downloads paused, instead of starting them immediately"
|
||||||
},
|
},
|
||||||
|
"pref_button_type": {
|
||||||
|
"description": "label",
|
||||||
|
"message": "DownThemAll! button:"
|
||||||
|
},
|
||||||
|
"pref_button_type_dta": {
|
||||||
|
"description": "label",
|
||||||
|
"message": "DownThemAll! selection"
|
||||||
|
},
|
||||||
|
"pref_button_type_manager": {
|
||||||
|
"description": "label",
|
||||||
|
"message": "Open Manager"
|
||||||
|
},
|
||||||
|
"pref_button_type_popup": {
|
||||||
|
"description": "label",
|
||||||
|
"message": "Popup menu"
|
||||||
|
},
|
||||||
|
"pref_button_type_turbo": {
|
||||||
|
"description": "label",
|
||||||
|
"message": "OneClick!"
|
||||||
|
},
|
||||||
"pref_concurrent_downloads": {
|
"pref_concurrent_downloads": {
|
||||||
"description": "Preferences/Network",
|
"description": "Preferences/Network",
|
||||||
"message": "Concurrent downloads"
|
"message": "Concurrent downloads"
|
||||||
@ -557,10 +577,6 @@
|
|||||||
"description": "Preferences/General",
|
"description": "Preferences/General",
|
||||||
"message": "Show a notification when the queue finishes downloading"
|
"message": "Show a notification when the queue finishes downloading"
|
||||||
},
|
},
|
||||||
"pref_global_turbo": {
|
|
||||||
"description": "Preferences/General",
|
|
||||||
"message": "Browser button should be OneClick!"
|
|
||||||
},
|
|
||||||
"pref_hide_context": {
|
"pref_hide_context": {
|
||||||
"description": "Preferences/General",
|
"description": "Preferences/General",
|
||||||
"message": "Do not show general context menu items"
|
"message": "Do not show general context menu items"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"global-turbo": false,
|
"button-type": "popup",
|
||||||
"concurrent": 4,
|
"concurrent": 4,
|
||||||
"queue-notification": true,
|
"queue-notification": true,
|
||||||
"finish-notification": true,
|
"finish-notification": true,
|
||||||
|
@ -136,35 +136,6 @@ class Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
locale.then(() => {
|
locale.then(() => {
|
||||||
new class Action extends Handler {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.onClicked = this.onClicked.bind(this);
|
|
||||||
action.onClicked.addListener(this.onClicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
async onClicked(tab: {id: number}) {
|
|
||||||
if (!tab.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await this.processResults(
|
|
||||||
true,
|
|
||||||
await runContentJob(
|
|
||||||
tab, "/bundles/content-gather.js", {
|
|
||||||
type: "DTA:gather",
|
|
||||||
selectionOnly: false,
|
|
||||||
textLinks: await Prefs.get("text-links", true),
|
|
||||||
schemes: Array.from(ALLOWED_SCHEMES.values()),
|
|
||||||
transferable: TRANSFERABLE_PROPERTIES,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
console.error(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
const menuHandler = new class Menus extends Handler {
|
const menuHandler = new class Menus extends Handler {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -421,7 +392,7 @@ locale.then(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async enumulate(action: string) {
|
async emulate(action: string) {
|
||||||
const tab = await tabs.query({
|
const tab = await tabs.query({
|
||||||
active: true,
|
active: true,
|
||||||
currentWindow: true,
|
currentWindow: true,
|
||||||
@ -543,23 +514,25 @@ locale.then(() => {
|
|||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
Bus.on("do-regular", () => menuHandler.enumulate("DTARegular"));
|
new class Action extends Handler {
|
||||||
Bus.on("do-regular-all", () => menuHandler.enumulate("DTARegularAll"));
|
constructor() {
|
||||||
Bus.on("do-turbo", () => menuHandler.enumulate("DTATurbo"));
|
super();
|
||||||
Bus.on("do-turbo-all", () => menuHandler.enumulate("DTATurboAll"));
|
this.onClicked = this.onClicked.bind(this);
|
||||||
Bus.on("do-single", () => API.singleRegular(null));
|
action.onClicked.addListener(this.onClicked);
|
||||||
Bus.on("open-manager", () => openManager(true));
|
Prefs.get("button-type", false).then(v => this.adjust(v));
|
||||||
Bus.on("open-prefs", () => openPrefs());
|
Prefs.on("button-type", (prefs, key, value) => {
|
||||||
|
this.adjust(value);
|
||||||
function adjustAction(globalTurbo: boolean) {
|
|
||||||
action.setPopup({
|
|
||||||
popup: globalTurbo ? "" : "/windows/popup.html"
|
|
||||||
});
|
});
|
||||||
action.setIcon({
|
}
|
||||||
path: globalTurbo ? {
|
|
||||||
16: "/style/button-turbo.png",
|
adjust(type: string) {
|
||||||
32: "/style/button-turbo@2x.png",
|
action.setPopup({
|
||||||
} : {
|
popup: type !== "popup" ? "" : "/windows/popup.html"
|
||||||
|
});
|
||||||
|
let icons;
|
||||||
|
switch (type) {
|
||||||
|
case "popup":
|
||||||
|
icons = {
|
||||||
16: "/style/icon16.png",
|
16: "/style/icon16.png",
|
||||||
32: "/style/icon32.png",
|
32: "/style/icon32.png",
|
||||||
48: "/style/icon48.png",
|
48: "/style/icon48.png",
|
||||||
@ -567,10 +540,62 @@ locale.then(() => {
|
|||||||
96: "/style/icon96.png",
|
96: "/style/icon96.png",
|
||||||
128: "/style/icon128.png",
|
128: "/style/icon128.png",
|
||||||
256: "/style/icon256.png"
|
256: "/style/icon256.png"
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dta":
|
||||||
|
icons = {
|
||||||
|
16: "/style/button-regular.png",
|
||||||
|
32: "/style/button-regular@2x.png",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "turbo":
|
||||||
|
icons = {
|
||||||
|
16: "/style/button-turbo.png",
|
||||||
|
32: "/style/button-turbo@2x.png",
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "manager":
|
||||||
|
icons = {
|
||||||
|
16: "/style/button-manager.png",
|
||||||
|
32: "/style/button-manager@2x.png",
|
||||||
|
};
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
action.setIcon({path: icons});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onClicked() {
|
||||||
|
switch (await Prefs.get("button-type")) {
|
||||||
|
case "popup":
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dta":
|
||||||
|
menuHandler.emulate("DTARegular");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "turbo":
|
||||||
|
menuHandler.emulate("DTATurbo");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "manager":
|
||||||
|
menuHandler.emulate("DTAManager");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
|
||||||
|
Bus.on("do-regular", () => menuHandler.emulate("DTARegular"));
|
||||||
|
Bus.on("do-regular-all", () => menuHandler.emulate("DTARegularAll"));
|
||||||
|
Bus.on("do-turbo", () => menuHandler.emulate("DTATurbo"));
|
||||||
|
Bus.on("do-turbo-all", () => menuHandler.emulate("DTATurboAll"));
|
||||||
|
Bus.on("do-single", () => API.singleRegular(null));
|
||||||
|
Bus.on("open-manager", () => openManager(true));
|
||||||
|
Bus.on("open-prefs", () => openPrefs());
|
||||||
|
|
||||||
(async function init() {
|
(async function init() {
|
||||||
const urlBase = runtime.getURL("");
|
const urlBase = runtime.getURL("");
|
||||||
history.onVisited.addListener(({url}: {url: string}) => {
|
history.onVisited.addListener(({url}: {url: string}) => {
|
||||||
@ -610,10 +635,6 @@ locale.then(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 => {
|
||||||
|
@ -43,7 +43,14 @@
|
|||||||
<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>
|
<div id="pref-button-type">
|
||||||
|
<label data-i18n="pref-button-type"></label>
|
||||||
|
<label><input type="radio" name="pref-button-type" value="popup"> <span data-i18n="pref-button-type-popup"></span></label>
|
||||||
|
<label><input type="radio" name="pref-button-type" value="dta"> <span data-i18n="pref-button-type-dta"></span></label>
|
||||||
|
<label><input type="radio" name="pref-button-type" value="turbo"> <span data-i18n="pref-button-type-turbo"></span></label>
|
||||||
|
<label><input type="radio" name="pref-button-type" value="manager"> <span data-i18n="pref-button-type-manager"></span></label>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
<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>
|
||||||
<label><input type="checkbox" id="pref-sounds"> <span data-i18n="pref-sounds"></span></label>
|
<label><input type="checkbox" id="pref-sounds"> <span data-i18n="pref-sounds"></span></label>
|
||||||
<label><input type="checkbox" id="pref-hide-context"> <span data-i18n="pref-hide-context"></span></label>
|
<label><input type="checkbox" id="pref-hide-context"> <span data-i18n="pref-hide-context"></span></label>
|
||||||
|
@ -554,7 +554,6 @@ addEventListener("DOMContentLoaded", async () => {
|
|||||||
await localize(document.documentElement);
|
await localize(document.documentElement);
|
||||||
|
|
||||||
// General
|
// General
|
||||||
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-sounds", "sounds");
|
new BoolPref("pref-sounds", "sounds");
|
||||||
@ -565,6 +564,7 @@ addEventListener("DOMContentLoaded", async () => {
|
|||||||
new BoolPref("pref-add-paused", "add-paused");
|
new BoolPref("pref-add-paused", "add-paused");
|
||||||
new BoolPref("pref-show-urls", "show-urls");
|
new BoolPref("pref-show-urls", "show-urls");
|
||||||
new BoolPref("pref-remove-missing-on-init", "remove-missing-on-init");
|
new BoolPref("pref-remove-missing-on-init", "remove-missing-on-init");
|
||||||
|
new OptionPref("pref-button-type", "button-type");
|
||||||
new OptionPref("pref-conflict-action", "conflict-action");
|
new OptionPref("pref-conflict-action", "conflict-action");
|
||||||
|
|
||||||
$("#reset-confirmations").addEventListener("click", async () => {
|
$("#reset-confirmations").addEventListener("click", async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user