parent
a9a811d96b
commit
c7c111e1c0
@ -457,6 +457,10 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"message": "Browser button should be OneClick!"
|
"message": "Browser button should be OneClick!"
|
||||||
},
|
},
|
||||||
|
"pref-hide-context": {
|
||||||
|
"description": "",
|
||||||
|
"message": "Do not show general context menu items"
|
||||||
|
},
|
||||||
"pref-manager-tooltip": {
|
"pref-manager-tooltip": {
|
||||||
"description": "",
|
"description": "",
|
||||||
"message": "Show tooltips in Manager tabs"
|
"message": "Show tooltips in Manager tabs"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"open-manager-on-queue": true,
|
"open-manager-on-queue": true,
|
||||||
"text-links": true,
|
"text-links": true,
|
||||||
"add-paused": false,
|
"add-paused": false,
|
||||||
|
"hide-context": false,
|
||||||
"conflict-action": "uniquify",
|
"conflict-action": "uniquify",
|
||||||
"nagging": 0,
|
"nagging": 0,
|
||||||
"nagging-next": 6,
|
"nagging-next": 6,
|
||||||
|
@ -139,7 +139,14 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.onClicked = this.onClicked.bind(this);
|
this.onClicked = this.onClicked.bind(this);
|
||||||
menus.create({
|
const alls = new Map<string, string[]>();
|
||||||
|
const mcreate = (options: any) => {
|
||||||
|
if (options.contexts.includes("all")) {
|
||||||
|
alls.set(options.id, options.contexts);
|
||||||
|
}
|
||||||
|
return menus.create(options);
|
||||||
|
};
|
||||||
|
mcreate({
|
||||||
id: "DTARegular",
|
id: "DTARegular",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -148,7 +155,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.regular"),
|
title: _("dta.regular"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTATurbo",
|
id: "DTATurbo",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -157,7 +164,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.turbo"),
|
title: _("dta.turbo"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTARegularLink",
|
id: "DTARegularLink",
|
||||||
contexts: ["link"],
|
contexts: ["link"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -166,7 +173,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.regular.link"),
|
title: _("dta.regular.link"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTATurboLink",
|
id: "DTATurboLink",
|
||||||
contexts: ["link"],
|
contexts: ["link"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -175,7 +182,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.turbo.link"),
|
title: _("dta.turbo.link"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTARegularImage",
|
id: "DTARegularImage",
|
||||||
contexts: ["image"],
|
contexts: ["image"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -184,7 +191,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.regular.image"),
|
title: _("dta.regular.image"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTATurboImage",
|
id: "DTATurboImage",
|
||||||
contexts: ["image"],
|
contexts: ["image"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -193,7 +200,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.turbo.image"),
|
title: _("dta.turbo.image"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTARegularMedia",
|
id: "DTARegularMedia",
|
||||||
contexts: ["video", "audio"],
|
contexts: ["video", "audio"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -202,7 +209,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.regular.media"),
|
title: _("dta.regular.media"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTATurboMedia",
|
id: "DTATurboMedia",
|
||||||
contexts: ["video", "audio"],
|
contexts: ["video", "audio"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -211,7 +218,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.turbo.media"),
|
title: _("dta.turbo.media"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTARegularSelection",
|
id: "DTARegularSelection",
|
||||||
contexts: ["selection"],
|
contexts: ["selection"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -220,7 +227,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.regular.selection"),
|
title: _("dta.regular.selection"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTATurboSelection",
|
id: "DTATurboSelection",
|
||||||
contexts: ["selection"],
|
contexts: ["selection"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -229,12 +236,12 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta.turbo.selection"),
|
title: _("dta.turbo.selection"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "sep-1",
|
id: "sep-1",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
type: "separator"
|
type: "separator"
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTARegularAll",
|
id: "DTARegularAll",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -243,7 +250,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("dta-regular-all"),
|
title: _("dta-regular-all"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTATurboAll",
|
id: "DTATurboAll",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -255,12 +262,12 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
const sep2ctx = menus.ACTION_MENU_TOP_LEVEL_LIMIT === 6 ?
|
const sep2ctx = menus.ACTION_MENU_TOP_LEVEL_LIMIT === 6 ?
|
||||||
["all", "tools_menu"] :
|
["all", "tools_menu"] :
|
||||||
["all", "browser_action", "tools_menu"];
|
["all", "browser_action", "tools_menu"];
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "sep-2",
|
id: "sep-2",
|
||||||
contexts: sep2ctx,
|
contexts: sep2ctx,
|
||||||
type: "separator"
|
type: "separator"
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTAAdd",
|
id: "DTAAdd",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -271,12 +278,12 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("add-download"),
|
title: _("add-download"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "sep-3",
|
id: "sep-3",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
type: "separator"
|
type: "separator"
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTAManager",
|
id: "DTAManager",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -285,7 +292,7 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("manager.short"),
|
title: _("manager.short"),
|
||||||
});
|
});
|
||||||
menus.create({
|
mcreate({
|
||||||
id: "DTAPrefs",
|
id: "DTAPrefs",
|
||||||
contexts: ["all", "browser_action", "tools_menu"],
|
contexts: ["all", "browser_action", "tools_menu"],
|
||||||
icons: {
|
icons: {
|
||||||
@ -296,6 +303,29 @@ const menuHandler = new class Menus extends Handler {
|
|||||||
},
|
},
|
||||||
title: _("prefs.short"),
|
title: _("prefs.short"),
|
||||||
});
|
});
|
||||||
|
Object.freeze(alls);
|
||||||
|
|
||||||
|
const adjustMenus = (v: boolean) => {
|
||||||
|
for (const [id, contexts] of alls.entries()) {
|
||||||
|
const adjusted = v ?
|
||||||
|
contexts.filter(e => e !== "all") :
|
||||||
|
contexts;
|
||||||
|
menus.update(id, {
|
||||||
|
contexts: adjusted
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Prefs.get("hide-context", false).then((v: boolean) => {
|
||||||
|
// This is the initial load, so no need to adjust when visible already
|
||||||
|
if (!v) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
adjustMenus(v);
|
||||||
|
});
|
||||||
|
Prefs.on("hide-context", (prefs, key, value: boolean) => {
|
||||||
|
adjustMenus(value);
|
||||||
|
});
|
||||||
|
|
||||||
menus.onClicked.addListener(this.onClicked);
|
menus.onClicked.addListener(this.onClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
<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>
|
||||||
|
<label><input type="checkbox" id="pref-hide-context"> <span data-i18n="pref-hide-context"></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>
|
||||||
<button id="reset-layout" data-i18n="reset-layouts"></button>
|
<button id="reset-layout" data-i18n="reset-layouts"></button>
|
||||||
|
@ -550,6 +550,7 @@ addEventListener("DOMContentLoaded", () => {
|
|||||||
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-hide-context", "hide-context");
|
||||||
new BoolPref("pref-tooltip", "tooltip");
|
new BoolPref("pref-tooltip", "tooltip");
|
||||||
new BoolPref("pref-open-manager-on-queue", "open-manager-on-queue");
|
new BoolPref("pref-open-manager-on-queue", "open-manager-on-queue");
|
||||||
new BoolPref("pref-text-links", "text-links");
|
new BoolPref("pref-text-links", "text-links");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user