diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 7b4ec9a..45186e2 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -212,5 +212,10 @@ "setting_hash_url_label": { "message": "Die Url zu der rules.hash Datei (Hash)", "description": "" + }, + + "setting_types_label": { + "message": "Request types (Expertenniveau)", + "description": "" } } diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 4a9de24..b8c1460 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -212,5 +212,10 @@ "setting_hash_url_label": { "message": "The url to the rules.hash file (hash)", "description": "" + }, + + "setting_types_label": { + "message": "Request types (expert level)", + "description": "" } } diff --git a/clearurls.js b/clearurls.js index a7c03ad..a046205 100644 --- a/clearurls.js +++ b/clearurls.js @@ -635,7 +635,7 @@ function start(items) */ browser.webRequest.onBeforeRequest.addListener( promise, - {urls: [""]}, + {urls: [""], types: getData("types")}, ["blocking"] ); }); @@ -724,6 +724,9 @@ function saveOnExit() case "log": json[key] = JSON.stringify(value); break; + case "types": + json[key] = value.toString(); + break; default: json[key] = value; } @@ -776,6 +779,9 @@ function setData(key, value) case "ruleURL": storage[key] = replaceOldGithubURLs(value); break; + case "types": + storage[key] = value.split(','); + break; default: storage[key] = value; } @@ -833,6 +839,7 @@ function initSettings() storage.badged_color = "ffa500"; storage.hashURL = "https://gitlab.com/KevinRoebert/ClearUrls/raw/master/data/rules.hash"; storage.ruleURL = "https://gitlab.com/KevinRoebert/ClearUrls/raw/master/data/data.json"; + storage.types = ["main_frame", "sub_frame", "xmlhttprequest"]; } /** diff --git a/core_js/settings.js b/core_js/settings.js index 7f8b785..52dfd07 100644 --- a/core_js/settings.js +++ b/core_js/settings.js @@ -43,12 +43,12 @@ function reset() */ function save() { - core(function (ref){ ref.setData('badged_color', $('input[name=badged_color]').val()); ref.setBadgedStatus(); ref.setData('ruleURL', $('input[name=rule_url]').val()); ref.setData('hashURL', $('input[name=hash_url]').val()); + ref.setData('types', $('input[name=types]').val()); ref.saveOnExit(); ref.reload(); }); @@ -75,6 +75,7 @@ function getData() settings.badged_color = ref.getData('badged_color'); settings.rule_url = ref.getData('ruleURL'); settings.hash_url = ref.getData('hashURL'); + settings.types = ref.getData('types'); }); } @@ -93,6 +94,8 @@ function setText() $('input[name=rule_url]').val(settings.rule_url); $('#hash_url_label').text(translate('setting_hash_url_label')); $('input[name=hash_url]').val(settings.hash_url); + $('#types_label').html(translate('setting_types_label')); + $('input[name=types]').val(settings.types); $('#save_settings_btn').text(translate('settings_html_save_button')); $('#save_settings_btn').prop('title', translate('settings_html_save_button_title')); } diff --git a/html/settings.html b/html/settings.html index 536cc1b..517dab2 100644 --- a/html/settings.html +++ b/html/settings.html @@ -57,6 +57,11 @@


+

+
+ +

+

diff --git a/manifest.json b/manifest.json index 6bc880a..7b1149d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ClearURLs", - "version": "1.3.3.8", + "version": "1.3.3.9", "author": "Kevin R.", "description": "Remove tracking elements form URLs.", "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls", @@ -46,6 +46,7 @@ }, "permissions": [ "*://*/*", + "", "webRequest", "webRequestBlocking", "storage",