From 166e756a45326f110bf85e6655449ed40d4d7bbc Mon Sep 17 00:00:00 2001 From: Ray Lothian Date: Mon, 20 Aug 2018 16:11:47 +0430 Subject: [PATCH] possible fix for #21 --- common.js | 5 +++-- data/options/index.html | 3 +++ data/options/index.js | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common.js b/common.js index e9e5583..cc0da00 100644 --- a/common.js +++ b/common.js @@ -13,7 +13,8 @@ var prefs = { whitelist: [], custom: {}, mode: 'blacklist', - color: '#ffa643' + color: '#ffa643', + cache: true }; chrome.storage.local.get(prefs, ps => { Object.assign(prefs, ps); @@ -188,7 +189,7 @@ function match({url, tabId}) { } var onBeforeSendHeaders = ({tabId, url, requestHeaders, type}) => { - if (type === 'main_frame') { + if (type === 'main_frame' || prefs.cache === false) { cache[tabId] = match({url, tabId}); } if (cache[tabId] === true) { diff --git a/data/options/index.html b/data/options/index.html index 506254f..6d3e285 100644 --- a/data/options/index.html +++ b/data/options/index.html @@ -42,6 +42,9 @@ + + + diff --git a/data/options/index.js b/data/options/index.js index 4b33f26..4fbf0bc 100644 --- a/data/options/index.js +++ b/data/options/index.js @@ -30,6 +30,7 @@ function save() { chrome.storage.local.set({ faqs: document.getElementById('faqs').checked, + cache: document.getElementById('cache').checked, blacklist: prepare(document.getElementById('blacklist').value), whitelist: prepare(document.getElementById('whitelist').value), custom, @@ -43,12 +44,14 @@ function save() { function restore() { chrome.storage.local.get({ faqs: true, + cache: true, mode: 'blacklist', whitelist: [], blacklist: [], custom: {} }, prefs => { document.getElementById('faqs').checked = prefs.faqs; + document.getElementById('cache').checked = prefs.cache; document.querySelector(`[name="mode"][value="${prefs.mode}"`).checked = true; document.getElementById('blacklist').value = prefs.blacklist.join(', '); document.getElementById('whitelist').value = prefs.whitelist.join(', ');