Select the proper turbo list

This commit is contained in:
Nils Maier 2019-08-25 20:53:20 +02:00
parent 26cd8e8a00
commit 176060183e
2 changed files with 9 additions and 5 deletions

View File

@ -91,10 +91,14 @@ export const API = new class {
if (!this.sanity(links, media)) { if (!this.sanity(links, media)) {
return false; return false;
} }
const selected = makeUniqueItems([ const type = await Prefs.get("last-type", "links");
await API.filter(links, TYPE_LINK), const items = await (async () => {
await API.filter(media, TYPE_MEDIA), if (type === "links") {
]); return await API.filter(links, TYPE_LINK);
}
return await API.filter(media, TYPE_MEDIA);
})();
const selected = makeUniqueItems([items]);
if (!selected.length) { if (!selected.length) {
return await this.regular(links, media); return await this.regular(links, media);
} }

View File

@ -99,7 +99,7 @@ function transfer(e: any, other: any) {
} }
export function makeUniqueItems(items: any, mapping?: Function) { export function makeUniqueItems(items: any[][], mapping?: Function) {
const known = new Map(); const known = new Map();
const unique = []; const unique = [];
for (const itemlist of items) { for (const itemlist of items) {