Egalize menu and popup

This commit is contained in:
Nils Maier 2019-08-25 22:59:39 +02:00
parent d6539c5f96
commit 801eaa819b
4 changed files with 52 additions and 2 deletions

View File

@ -16,7 +16,7 @@ import { _ } from "./i18n";
const MAX_BATCH = 10000;
export const API = new class {
export const API = new class API {
async filter(arr: any, type: number) {
return await (await filters()).filterItemsByType(arr, type);
}

View File

@ -234,6 +234,48 @@ const menuHandler = new class Menus extends Handler {
contexts: ["all", "browser_action", "tools_menu"],
type: "separator"
});
menus.create({
id: "DTARegularAll",
contexts: ["all", "browser_action", "tools_menu"],
icons: {
16: "/style/button-regular.png",
32: "/style/button-regular@2x.png",
},
title: _("dta-regular-all"),
});
menus.create({
id: "DTATurboAll",
contexts: ["all", "browser_action", "tools_menu"],
icons: {
16: "/style/button-turbo.png",
32: "/style/button-turbo@2x.png",
},
title: _("dta-turbo-all"),
});
const sep2ctx = menus.ACTION_MENU_TOP_LEVEL_LIMIT === 6 ?
["all", "tools_menu"] :
["all", "browser_action", "tools_menu"];
menus.create({
id: "sep-2",
contexts: sep2ctx,
type: "separator"
});
menus.create({
id: "DTAAdd",
contexts: ["all", "browser_action", "tools_menu"],
icons: {
16: "/style/add.svg",
32: "/style/add.svg",
64: "/style/add.svg",
128: "/style/add.svg",
},
title: _("add-download"),
});
menus.create({
id: "sep-3",
contexts: ["all", "browser_action", "tools_menu"],
type: "separator"
});
menus.create({
id: "DTAManager",
contexts: ["all", "browser_action", "tools_menu"],
@ -396,6 +438,10 @@ const menuHandler = new class Menus extends Handler {
return await this.findSingleItem(tab, info.srcUrl, true);
}
onClickedDTAAdd() {
API.singleRegular(null);
}
async onClickedDTAManager() {
await openManager();
}

4
style/add.svg Executable file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 16 16" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
<path d="m8 0a8 8 0 0 0-8 8 8 8 0 0 0 8 8 8 8 0 0 0 8-8 8 8 0 0 0-8-8zm-1.5 3h3v3.5h3.5v3h-3.5v3.5h-3v-3.5h-3.5v-3h3.5v-3.5z" fill="#000080" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -81,7 +81,7 @@
<li class="sep">
<hr>
</li>
<li id="single" data-action="do-ingle">
<li id="single" data-action="do-single">
<span class="icon icon-add"></span>
<span data-i18n="add-download"></span>
</li>