ignore hosts option

This commit is contained in:
s2
2017-12-13 10:30:18 +01:00
parent 52e7e13957
commit bd501edba3
3 changed files with 18 additions and 6 deletions

View File

@@ -111,11 +111,16 @@ var updateAllColorsOnAllTabs = async () => {
if (tabs[i].status === 'complete') {
let t = getTabParent(tstTabs, tabs[i].id);
let options = await loadOptions();
browser.tabs.executeScript(tabs[i].id, {
code: '(' + changeIcon.toString() + ')' +
'("' + generateRandomColor(t.parentIndex) + '", "' + t.faviconUrl + '", ' + JSON.stringify(options) + ')'
});
let tabHost = new URL(tabs[i].url).host;
if (tabHost) {
tabHost = tabHost.toLowerCase();
}
if (!(options.ignore && options.ignore.split('\n').includes(tabHost))) {
browser.tabs.executeScript(tabs[i].id, {
code: '(' + changeIcon.toString() + ')' +
'("' + generateRandomColor(t.parentIndex) + '", "' + t.faviconUrl + '", ' + JSON.stringify(options) + ')'
});
}
}
if (tabs[i].children && tabs[i].children.length > 0) {

View File

@@ -26,6 +26,13 @@
</select>
</div>
<div class="panel-formElements-item browser-style">
<label for="ignore">Ignore hosts (one per line - ex.: google.com):</label>
</div>
<div class="panel-formElements-item browser-style">
<textarea id="ignore"></textarea>
</div>
</div>
</section>

View File

@@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', () => {
});
});
var list = document.querySelectorAll('select,input');
var list = document.querySelectorAll('select,input,textarea');
for (var i = 0; i < list.length; i++) {
list[i].addEventListener('change', (ev) => {
persistOptions();