diff --git a/src/platform.ts b/src/platform.ts index 8fc3501..5b002bb 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -164,28 +164,11 @@ export class Platform { } static async getValue(key: string, def: T) { - const isinls = ('__pee__' + key) in localStorage; - let ret: T; - if (isinls) { - let it = localStorage.getItem('__pee__' + key); - if (it === "undefined") - it = null; - ret = { ...def, ...JSON.parse(it || '{}') } as T; - } else - ret = def; - - if (execution_mode != "userscript") { - if (isinls) { - delete localStorage[('__pee__' + key)]; - await chrome.storage.local.set({ - [key]: JSON.stringify(ret) - }); - } else { - const d = await chrome.storage.local.get([key]); - if (typeof d[key] == "string") - return { ...def, ...(await JSON.parse('' + d[key] || '{}')) } as T; - } - } + const ret = def; + + const d = await chrome.storage.local.get([key]); + if (typeof d[key] == "string") + return { ...def, ...(await JSON.parse('' + d[key] || '{}')) } as T; return ret; } diff --git a/src/stores.ts b/src/stores.ts index de116c8..6b34ba1 100644 --- a/src/stores.ts +++ b/src/stores.ts @@ -14,10 +14,7 @@ const localSet = (key: string, value: any) => { if (execution_mode == "worker") { return; } - if (execution_mode != "userscript") - chrome.storage.local.set({ [key]: JSON.stringify(value) }); - else - localStorage.setItem('__pee__' + key, JSON.stringify(value)); + chrome.storage.local.set({ [key]: JSON.stringify(value) }); }; export const initial_settings = { diff --git a/src/websites/index.ts b/src/websites/index.ts index d8b7740..cb3ff0e 100644 --- a/src/websites/index.ts +++ b/src/websites/index.ts @@ -100,7 +100,7 @@ export const FoolFuuka: QueryProcessor = { export const KChan: QueryProcessor = { getFileThumbnail: post => post.querySelector('figure.uploadCell')!, getPost: (post) => post.querySelector('.innerPost')!, - postsWithFiles: (h) => [...(h || document).querySelectorAll('.postCell:has(figure)')], + postsWithFiles: (h) => ([...(h || document).querySelectorAll('.postCell')] as HTMLElement[]).filter(p => p.querySelector('figure')), settingsHost: () => document.getElementById("navOptionsSpanThread") as any, catalogControlHost: () => document.getElementById("divTools") as HTMLDivElement, getImageLink: async function* (post: HTMLElement) {