possible fix for #21
This commit is contained in:
parent
fdfc5c63df
commit
166e756a45
3 changed files with 9 additions and 2 deletions
|
@ -13,7 +13,8 @@ var prefs = {
|
||||||
whitelist: [],
|
whitelist: [],
|
||||||
custom: {},
|
custom: {},
|
||||||
mode: 'blacklist',
|
mode: 'blacklist',
|
||||||
color: '#ffa643'
|
color: '#ffa643',
|
||||||
|
cache: true
|
||||||
};
|
};
|
||||||
chrome.storage.local.get(prefs, ps => {
|
chrome.storage.local.get(prefs, ps => {
|
||||||
Object.assign(prefs, ps);
|
Object.assign(prefs, ps);
|
||||||
|
@ -188,7 +189,7 @@ function match({url, tabId}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var onBeforeSendHeaders = ({tabId, url, requestHeaders, type}) => {
|
var onBeforeSendHeaders = ({tabId, url, requestHeaders, type}) => {
|
||||||
if (type === 'main_frame') {
|
if (type === 'main_frame' || prefs.cache === false) {
|
||||||
cache[tabId] = match({url, tabId});
|
cache[tabId] = match({url, tabId});
|
||||||
}
|
}
|
||||||
if (cache[tabId] === true) {
|
if (cache[tabId] === true) {
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><textarea id="custom" rows="5" wrap="off"></textarea></td>
|
<td><textarea id="custom" rows="5" wrap="off"></textarea></td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td><label><input type="checkbox" id="faqs"> Open FAQs page on updates</label></td>
|
<td><label><input type="checkbox" id="faqs"> Open FAQs page on updates</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -30,6 +30,7 @@ function save() {
|
||||||
|
|
||||||
chrome.storage.local.set({
|
chrome.storage.local.set({
|
||||||
faqs: document.getElementById('faqs').checked,
|
faqs: document.getElementById('faqs').checked,
|
||||||
|
cache: document.getElementById('cache').checked,
|
||||||
blacklist: prepare(document.getElementById('blacklist').value),
|
blacklist: prepare(document.getElementById('blacklist').value),
|
||||||
whitelist: prepare(document.getElementById('whitelist').value),
|
whitelist: prepare(document.getElementById('whitelist').value),
|
||||||
custom,
|
custom,
|
||||||
|
@ -43,12 +44,14 @@ function save() {
|
||||||
function restore() {
|
function restore() {
|
||||||
chrome.storage.local.get({
|
chrome.storage.local.get({
|
||||||
faqs: true,
|
faqs: true,
|
||||||
|
cache: true,
|
||||||
mode: 'blacklist',
|
mode: 'blacklist',
|
||||||
whitelist: [],
|
whitelist: [],
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
custom: {}
|
custom: {}
|
||||||
}, prefs => {
|
}, prefs => {
|
||||||
document.getElementById('faqs').checked = prefs.faqs;
|
document.getElementById('faqs').checked = prefs.faqs;
|
||||||
|
document.getElementById('cache').checked = prefs.cache;
|
||||||
document.querySelector(`[name="mode"][value="${prefs.mode}"`).checked = true;
|
document.querySelector(`[name="mode"][value="${prefs.mode}"`).checked = true;
|
||||||
document.getElementById('blacklist').value = prefs.blacklist.join(', ');
|
document.getElementById('blacklist').value = prefs.blacklist.join(', ');
|
||||||
document.getElementById('whitelist').value = prefs.whitelist.join(', ');
|
document.getElementById('whitelist').value = prefs.whitelist.join(', ');
|
||||||
|
|
Loading…
Reference in a new issue