possible fix for #21

This commit is contained in:
Ray Lothian 2018-08-20 16:11:47 +04:30
parent fdfc5c63df
commit 166e756a45
3 changed files with 9 additions and 2 deletions

View file

@ -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) {

View file

@ -42,6 +42,9 @@
<tr>
<td><textarea id="custom" rows="5" wrap="off"></textarea></td>
</tr>
<tr>
<td><label><input type="checkbox" id="cache"> Use caching to improve performance (recommended value is true). Uncheck this option only if you are using the custom mode and also you need the user-agent string to be altered from the provided list on every single request.</label></td>
</tr>
<tr>
<td><label><input type="checkbox" id="faqs"> Open FAQs page on updates</label></td>
</tr>

View file

@ -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(', ');