Version 1.9.4
This commit is contained in:
		
							parent
							
								
									deb7648d61
								
							
						
					
					
						commit
						84c069331f
					
				
							
								
								
									
										21
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| 
						 | 
					@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
 | 
				
			||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 | 
					The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 | 
				
			||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 | 
					and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## [1.9.4] - 2019-11-24
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Compatibility note
 | 
				
			||||||
 | 
					- Require Firefox >= 55
 | 
				
			||||||
 | 
					- Require Chrome >= 22
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Fixed
 | 
				
			||||||
 | 
					- Fixed toolbar icon on startup [#102](https://gitlab.com/KevinRoebert/ClearUrls/issues/102)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Added
 | 
				
			||||||
 | 
					- Added option to disable/allow domain blocking [#294](https://gitlab.com/KevinRoebert/ClearUrls/issues/294)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Changed
 | 
				
			||||||
 | 
					- Some refactoring
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## [1.9.3.1] - 2019-11-15
 | 
					## [1.9.3.1] - 2019-11-15
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Compatibility note
 | 
					### Compatibility note
 | 
				
			||||||
| 
						 | 
					@ -31,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 | 
				
			||||||
### Fixed
 | 
					### Fixed
 | 
				
			||||||
- Fixed [#290](https://gitlab.com/KevinRoebert/ClearUrls/issues/290)
 | 
					- Fixed [#290](https://gitlab.com/KevinRoebert/ClearUrls/issues/290)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Changed
 | 
					### Changed
 | 
				
			||||||
- Updated some strings of Italian translation by [@gioxx](https://gitlab.com/gioxx)
 | 
					- Updated some strings of Italian translation by [@gioxx](https://gitlab.com/gioxx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Added
 | 
					### Added
 | 
				
			||||||
| 
						 | 
					@ -60,7 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 | 
				
			||||||
- Fixed [#241](https://gitlab.com/KevinRoebert/ClearUrls/issues/241)
 | 
					- Fixed [#241](https://gitlab.com/KevinRoebert/ClearUrls/issues/241)
 | 
				
			||||||
- Possible fix for [#203](https://gitlab.com/KevinRoebert/ClearUrls/issues/203)
 | 
					- Possible fix for [#203](https://gitlab.com/KevinRoebert/ClearUrls/issues/203)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Changed
 | 
					### Changed
 | 
				
			||||||
- Refactoring
 | 
					- Refactoring
 | 
				
			||||||
- Changed background script loading sequence to prevent that required functions are not yet loaded.
 | 
					- Changed background script loading sequence to prevent that required functions are not yet loaded.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +104,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 | 
				
			||||||
- Require Firefox >= 55
 | 
					- Require Firefox >= 55
 | 
				
			||||||
- Require Chrome >= 22
 | 
					- Require Chrome >= 22
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Changed
 | 
					### Changed
 | 
				
			||||||
- Force redirects only on main frames
 | 
					- Force redirects only on main frames
 | 
				
			||||||
- Added google link fix script, to avoid the sub frame permission for force redirection on google
 | 
					- Added google link fix script, to avoid the sub frame permission for force redirection on google
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -286,7 +286,7 @@
 | 
				
			||||||
        "description": "Diese Zeichenfolge wird als Titel auf der Hinweisseite für blockierte Seiten verwendet."
 | 
					        "description": "Diese Zeichenfolge wird als Titel auf der Hinweisseite für blockierte Seiten verwendet."
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "blocked_html_body": {
 | 
					    "blocked_html_body": {
 | 
				
			||||||
        "message": "Diese Seite wurde vom <b>ClearURLs</b> Add-On blockiert, weil wir sie als Werbe- bzw. Trackingservice identifiziert haben. Um diese Seite zu besuchen, müssen Sie das Add-On temporär deaktivieren. Dann können Sie auf den untenstehenden Button klicken, um die Seite aufzurufen.",
 | 
					        "message": "Diese Seite wurde vom <b>ClearURLs</b> Add-On blockiert, weil wir sie als Werbe- bzw. Trackingservice identifiziert haben. Um diese Seite zu besuchen, müssen Sie das Add-On temporär deaktivieren oder in den Einstellungen von ClearURLs das Domain-Blocking deaktivieren. Dann können Sie auf den untenstehenden Button klicken, um die Seite aufzurufen.",
 | 
				
			||||||
        "description": "Diese Zeichenfolge wird als Mengentext auf der Hinweisseite für blockierte Seiten verwendet."
 | 
					        "description": "Diese Zeichenfolge wird als Mengentext auf der Hinweisseite für blockierte Seiten verwendet."
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "blocked_html_button": {
 | 
					    "blocked_html_button": {
 | 
				
			||||||
| 
						 | 
					@ -304,5 +304,13 @@
 | 
				
			||||||
    "watchdog": {
 | 
					    "watchdog": {
 | 
				
			||||||
        "message": "[ClearURLs]: Der Watchdog hat ein Problem festgestellt. ClearURLs wird neugestartet.",
 | 
					        "message": "[ClearURLs]: Der Watchdog hat ein Problem festgestellt. ClearURLs wird neugestartet.",
 | 
				
			||||||
        "description": "Diese Zeichenkette wird als Text für den Watchdog verwendet."
 | 
					        "description": "Diese Zeichenkette wird als Text für den Watchdog verwendet."
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "domain_blocking_enabled": {
 | 
				
			||||||
 | 
					        "message": "Erlaube Domain-Blocking (Kann zu Problemen auf Seiten führen, die AdBlocker nicht erlauben)",
 | 
				
			||||||
 | 
					        "description": "Diese Zeichenkette wird als Beschreibung für das Domain-Blocking verwendet."
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "domain_blocking_enabled_title": {
 | 
				
			||||||
 | 
					        "message": "Erlaube Domain-Blocking (Kann zu Problemen auf Seiten führen, die AdBlocker nicht erlauben)",
 | 
				
			||||||
 | 
					        "description": "Diese Zeichenkette wird als Titel für das Domain-Blocking verwendet."
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -286,7 +286,7 @@
 | 
				
			||||||
        "description": "This string is used as title on the blocked site page."
 | 
					        "description": "This string is used as title on the blocked site page."
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "blocked_html_body": {
 | 
					    "blocked_html_body": {
 | 
				
			||||||
        "message": "This site was blocked by the <b>ClearURLs</b> Add-on, because we identify this site as an advertising and/or tracking service. To visit this site, you must temporarily deactivate the Add-on. After deactivating ClearURLs you can click on the button below to load the page.",
 | 
					        "message": "This site was blocked by the <b>ClearURLs</b> Add-on, because we identify this site as an advertising and/or tracking service. To visit this site, you must temporarily deactivate the Add-on or disable domain blocking in the ClearURLs settings. After this you can click on the button below to load the page.",
 | 
				
			||||||
        "description": "This string is used as body on the blocked site page."
 | 
					        "description": "This string is used as body on the blocked site page."
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "blocked_html_button": {
 | 
					    "blocked_html_button": {
 | 
				
			||||||
| 
						 | 
					@ -304,5 +304,13 @@
 | 
				
			||||||
    "watchdog": {
 | 
					    "watchdog": {
 | 
				
			||||||
        "message": "[ClearURLs]: The watchdog has detected a problem. ClearURLs is restarted.",
 | 
					        "message": "[ClearURLs]: The watchdog has detected a problem. ClearURLs is restarted.",
 | 
				
			||||||
        "description": "This string is used as text for the watchdog"
 | 
					        "description": "This string is used as text for the watchdog"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "domain_blocking_enabled": {
 | 
				
			||||||
 | 
					        "message": "Allow domain blocking (Can lead to problems on pages that do not allow AdBlocker)",
 | 
				
			||||||
 | 
					        "description": "This string is used as label for the domain blocking switch"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "domain_blocking_enabled_title": {
 | 
				
			||||||
 | 
					        "message": "Allow domain blocking (Can lead to problems on pages that do not allow AdBlocker)",
 | 
				
			||||||
 | 
					        "description": "This string is used as title for the domain blocking switch"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,7 +170,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) {
 | 
				
			||||||
        url = finalURL.replace(new RegExp("\\?&"), "?").replace(new RegExp("#&"), "#");
 | 
					        url = finalURL.replace(new RegExp("\\?&"), "?").replace(new RegExp("#&"), "#");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (provider.isCaneling()) {
 | 
					    if (provider.isCaneling() && storage.domainBlocking) {
 | 
				
			||||||
        if (!quiet) pushToLog(pureUrl, pureUrl, translate('log_domain_blocked'));
 | 
					        if (!quiet) pushToLog(pureUrl, pureUrl, translate('log_domain_blocked'));
 | 
				
			||||||
        if (badges[tabid] == null) {
 | 
					        if (badges[tabid] == null) {
 | 
				
			||||||
            badges[tabid] = 0;
 | 
					            badges[tabid] = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,65 +32,6 @@ var loggingStatus;
 | 
				
			||||||
var statisticsStatus;
 | 
					var statisticsStatus;
 | 
				
			||||||
var currentURL;
 | 
					var currentURL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getData()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["globalCounter"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        globalCounter = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["globalurlcounter"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        globalurlcounter = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["globalStatus"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        globalStatus = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["badgedStatus"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        badgedStatus = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["hashStatus"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        hashStatus = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["loggingStatus"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        loggingStatus = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["statisticsStatus"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        statisticsStatus = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getCurrentURL",
 | 
					 | 
				
			||||||
        params: []
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        currentURL = data.response;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
* Initialize the UI.
 | 
					* Initialize the UI.
 | 
				
			||||||
*
 | 
					*
 | 
				
			||||||
| 
						 | 
					@ -240,7 +181,15 @@ function resetGlobalCounter(){
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(document).ready(function(){
 | 
					$(document).ready(function(){
 | 
				
			||||||
    getData().then(() => {
 | 
					    loadData("globalCounter")
 | 
				
			||||||
 | 
					        .then(() => loadData("globalurlcounter"))
 | 
				
			||||||
 | 
					        .then(() => loadData("globalStatus"))
 | 
				
			||||||
 | 
					        .then(() => loadData("badgedStatus"))
 | 
				
			||||||
 | 
					        .then(() => loadData("hashStatus"))
 | 
				
			||||||
 | 
					        .then(() => loadData("loggingStatus"))
 | 
				
			||||||
 | 
					        .then(() => loadData("statisticsStatus"))
 | 
				
			||||||
 | 
					        .then(() => loadData("getCurrentURL", "currentURL"))
 | 
				
			||||||
 | 
					        .then(() => {
 | 
				
			||||||
            init();
 | 
					            init();
 | 
				
			||||||
            $('#reset_counter_btn').on("click", resetGlobalCounter);
 | 
					            $('#reset_counter_btn').on("click", resetGlobalCounter);
 | 
				
			||||||
            changeSwitchButton("globalStatus", "globalStatus");
 | 
					            changeSwitchButton("globalStatus", "globalStatus");
 | 
				
			||||||
| 
						 | 
					@ -252,7 +201,6 @@ $(document).ready(function(){
 | 
				
			||||||
            $('#cleaning_tools').attr('href', browser.extension.getURL('./html/cleaningTool.html'));
 | 
					            $('#cleaning_tools').attr('href', browser.extension.getURL('./html/cleaningTool.html'));
 | 
				
			||||||
            setText();
 | 
					            setText();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -299,6 +247,25 @@ function injectText(id, attribute, tooltip = "")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Loads data from storage and saves into local variable.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param name data name
 | 
				
			||||||
 | 
					 * @param varName variable name
 | 
				
			||||||
 | 
					 * @returns {Promise<data>} requested data
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					async function loadData(name, varName=name) {
 | 
				
			||||||
 | 
					    return new Promise((resolve, reject) => {
 | 
				
			||||||
 | 
					        browser.runtime.sendMessage({
 | 
				
			||||||
 | 
					            function: "getData",
 | 
				
			||||||
 | 
					            params: [name]
 | 
				
			||||||
 | 
					        }).then(data => {
 | 
				
			||||||
 | 
					            this[varName] = data.response;
 | 
				
			||||||
 | 
					            resolve(data);
 | 
				
			||||||
 | 
					        }, handleError);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
* Translate a string with the i18n API.
 | 
					* Translate a string with the i18n API.
 | 
				
			||||||
*
 | 
					*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,45 +78,23 @@ function reset()
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
function save()
 | 
					function save()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					    saveData("badged_color", $('input[name=badged_color]').val())
 | 
				
			||||||
        function: "setData",
 | 
					        .then(() => saveData("ruleURL", $('input[name=ruleURL]').val()))
 | 
				
			||||||
        params: ["badged_color", $('input[name=badged_color]').val()]
 | 
					        .then(() => saveData("hashURL", $('input[name=hashURL]').val()))
 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					        .then(() => saveData("types", $('input[name=types]').val()))
 | 
				
			||||||
 | 
					        .then(() => saveData("logLimit", $('input[name=logLimit]').val()))
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					        .then(() => browser.runtime.sendMessage({
 | 
				
			||||||
            function: "setBadgedStatus",
 | 
					            function: "setBadgedStatus",
 | 
				
			||||||
            params: []
 | 
					            params: []
 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					        }), handleError)
 | 
				
			||||||
 | 
					        .then(() => browser.runtime.sendMessage({
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "setData",
 | 
					 | 
				
			||||||
        params: ["ruleURL", $('input[name=rule_url]').val()]
 | 
					 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "setData",
 | 
					 | 
				
			||||||
        params: ["hashURL", $('input[name=hash_url]').val()]
 | 
					 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "setData",
 | 
					 | 
				
			||||||
        params: ["types", $('input[name=types]').val()]
 | 
					 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "setData",
 | 
					 | 
				
			||||||
        params: ["logLimit", $('input[name=logLimit]').val()]
 | 
					 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
            function: "saveOnExit",
 | 
					            function: "saveOnExit",
 | 
				
			||||||
            params: []
 | 
					            params: []
 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					        }), handleError)
 | 
				
			||||||
 | 
					        .then(() => browser.runtime.sendMessage({
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
            function: "reload",
 | 
					            function: "reload",
 | 
				
			||||||
            params: []
 | 
					            params: []
 | 
				
			||||||
    }).then(handleResponse, handleError);
 | 
					        }), handleError);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -135,66 +113,69 @@ function translate(string, ...placeholders)
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
function getData()
 | 
					function getData()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					    loadData("badged_color")
 | 
				
			||||||
        function: "getData",
 | 
					        .then(() => loadData("ruleURL"))
 | 
				
			||||||
        params: ["badged_color"]
 | 
					        .then(() => loadData("hashURL"))
 | 
				
			||||||
    }).then((data) => handleResponseData(data, "badged_color", "badged_color"), handleError);
 | 
					        .then(() => loadData("types"))
 | 
				
			||||||
 | 
					        .then(() => loadData("logLimit"))
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					        .then(logData => {
 | 
				
			||||||
        function: "getData",
 | 
					            if(logData.response === undefined || logData.response === -1) {
 | 
				
			||||||
        params: ["ruleURL"]
 | 
					 | 
				
			||||||
    }).then((data) => handleResponseData(data, "rule_url", "rule_url"), handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["hashURL"]
 | 
					 | 
				
			||||||
    }).then((data) => handleResponseData(data, "hash_url", "hash_url"), handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["types"]
 | 
					 | 
				
			||||||
    }).then((data) => handleResponseData(data, "types", "types"), handleError);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
        function: "getData",
 | 
					 | 
				
			||||||
        params: ["logLimit"]
 | 
					 | 
				
			||||||
    }).then((data) => {
 | 
					 | 
				
			||||||
        handleResponseData(data, "logLimit", "logLimit");
 | 
					 | 
				
			||||||
        if(data.response === undefined || data.response === -1) {
 | 
					 | 
				
			||||||
                $('#logLimit_label').text(translate('setting_log_limit_label', "∞"));
 | 
					                $('#logLimit_label').text(translate('setting_log_limit_label', "∞"));
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
            $('#logLimit_label').text(translate('setting_log_limit_label', data.response));
 | 
					                $('#logLimit_label').text(translate('setting_log_limit_label', logData.response));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
    }, handleError);
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    browser.runtime.sendMessage({
 | 
					    loadData("contextMenuEnabled")
 | 
				
			||||||
        function: "getData",
 | 
					        .then(() => loadData("historyListenerEnabled"))
 | 
				
			||||||
        params: ["contextMenuEnabled"]
 | 
					        .then(() => loadData("localHostsSkipping"))
 | 
				
			||||||
    }).then((data) => {
 | 
					        .then(() => loadData("referralMarketing"))
 | 
				
			||||||
        handleResponseData(data, "contextMenuEnabled", "contextMenuEnabled");
 | 
					        .then(() => loadData("domainBlocking"))
 | 
				
			||||||
        browser.runtime.sendMessage({
 | 
					        .then(() => {
 | 
				
			||||||
            function: "getData",
 | 
					 | 
				
			||||||
            params: ["historyListenerEnabled"]
 | 
					 | 
				
			||||||
        }).then((data) => {
 | 
					 | 
				
			||||||
            handleResponseData(data, "historyListenerEnabled", "historyListenerEnabled");
 | 
					 | 
				
			||||||
            browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
                function: "getData",
 | 
					 | 
				
			||||||
                params: ["localHostsSkipping"]
 | 
					 | 
				
			||||||
            }).then((data) => {
 | 
					 | 
				
			||||||
                handleResponseData(data, "localHostsSkipping", "localHostsSkipping");
 | 
					 | 
				
			||||||
                browser.runtime.sendMessage({
 | 
					 | 
				
			||||||
                    function: "getData",
 | 
					 | 
				
			||||||
                    params: ["referralMarketing"]
 | 
					 | 
				
			||||||
                }).then((data) => {
 | 
					 | 
				
			||||||
                    handleResponseData(data, "referralMarketing", "referralMarketing");
 | 
					 | 
				
			||||||
                    changeSwitchButton("contextMenuEnabled", "contextMenuEnabled");
 | 
					 | 
				
			||||||
                    changeSwitchButton("historyListenerEnabled", "historyListenerEnabled");
 | 
					 | 
				
			||||||
            changeSwitchButton("localHostsSkipping", "localHostsSkipping");
 | 
					            changeSwitchButton("localHostsSkipping", "localHostsSkipping");
 | 
				
			||||||
 | 
					            changeSwitchButton("historyListenerEnabled", "historyListenerEnabled");
 | 
				
			||||||
 | 
					            changeSwitchButton("contextMenuEnabled", "contextMenuEnabled");
 | 
				
			||||||
            changeSwitchButton("referralMarketing", "referralMarketing");
 | 
					            changeSwitchButton("referralMarketing", "referralMarketing");
 | 
				
			||||||
 | 
					            changeSwitchButton("domainBlocking", "domainBlocking");
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Loads data from storage and saves into local variable.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param name data/variable name
 | 
				
			||||||
 | 
					 * @returns {Promise<data>} requested data
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					async function loadData(name) {
 | 
				
			||||||
 | 
					    return new Promise((resolve, reject) => {
 | 
				
			||||||
 | 
					        browser.runtime.sendMessage({
 | 
				
			||||||
 | 
					            function: "getData",
 | 
				
			||||||
 | 
					            params: [name]
 | 
				
			||||||
 | 
					        }).then(data => {
 | 
				
			||||||
 | 
					            settings[name] = data.response;
 | 
				
			||||||
 | 
					            $('input[name='+name+']').val(data.response);
 | 
				
			||||||
 | 
					            resolve(data);
 | 
				
			||||||
        }, handleError);
 | 
					        }, handleError);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Saves data to storage.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @param key key of the data that should be saved
 | 
				
			||||||
 | 
					 * @param data data that should be saved
 | 
				
			||||||
 | 
					 * @returns {Promise<message>} message from background script
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					async function saveData(key, data) {
 | 
				
			||||||
 | 
					    return new Promise((resolve, reject) => {
 | 
				
			||||||
 | 
					        browser.runtime.sendMessage({
 | 
				
			||||||
 | 
					            function: "setData",
 | 
				
			||||||
 | 
					            params: [key, data]
 | 
				
			||||||
 | 
					        }).then(message => {
 | 
				
			||||||
 | 
					            handleResponse(message);
 | 
				
			||||||
 | 
					            resolve(message);
 | 
				
			||||||
        }, handleError);
 | 
					        }, handleError);
 | 
				
			||||||
        }, handleError);
 | 
					    });
 | 
				
			||||||
    }, handleError);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -220,6 +201,7 @@ function setText()
 | 
				
			||||||
    $('#import_settings_btn_text').text(translate('setting_html_import_button'));
 | 
					    $('#import_settings_btn_text').text(translate('setting_html_import_button'));
 | 
				
			||||||
    $('#import_settings_btn').prop('title', translate('setting_html_import_button_title'));
 | 
					    $('#import_settings_btn').prop('title', translate('setting_html_import_button_title'));
 | 
				
			||||||
    injectText("referral_marketing_enabled", "referral_marketing_enabled");
 | 
					    injectText("referral_marketing_enabled", "referral_marketing_enabled");
 | 
				
			||||||
 | 
					    injectText("domain_blocking_enabled", "domain_blocking_enabled");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -267,18 +249,6 @@ function importSettings(evt) {
 | 
				
			||||||
    fileReader.readAsText(file);
 | 
					    fileReader.readAsText(file);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Handle the response from the storage and saves the data.
 | 
					 | 
				
			||||||
 * @param  {JSON-Object} data Data JSON-Object
 | 
					 | 
				
			||||||
 * @param varName
 | 
					 | 
				
			||||||
 * @param inputID
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
function handleResponseData(data, varName, inputID)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    settings[varName] = data.response;
 | 
					 | 
				
			||||||
    $('input[name='+inputID+']').val(data.response);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function handleResponse(message) {
 | 
					function handleResponse(message) {
 | 
				
			||||||
    console.log(`Message from the background script:  ${message.response}`);
 | 
					    console.log(`Message from the background script:  ${message.response}`);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -106,6 +106,9 @@ function genesis() {
 | 
				
			||||||
        // Start the clearurls.js
 | 
					        // Start the clearurls.js
 | 
				
			||||||
        start();
 | 
					        start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Set correct icon on startup
 | 
				
			||||||
 | 
					        changeIcon();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Start the context_menu
 | 
					        // Start the context_menu
 | 
				
			||||||
        contextMenuStart();
 | 
					        contextMenuStart();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -205,6 +208,7 @@ function initSettings() {
 | 
				
			||||||
    storage.localHostsSkipping = true;
 | 
					    storage.localHostsSkipping = true;
 | 
				
			||||||
    storage.referralMarketing = false;
 | 
					    storage.referralMarketing = false;
 | 
				
			||||||
    storage.logLimit = -1;
 | 
					    storage.logLimit = -1;
 | 
				
			||||||
 | 
					    storage.domainBlocking = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (getBrowser() === "Firefox") {
 | 
					    if (getBrowser() === "Firefox") {
 | 
				
			||||||
        storage.types = ["font", "image", "imageset", "main_frame", "media", "object", "object_subrequest", "other", "script", "stylesheet", "sub_frame", "websocket", "xbl", "xml_dtd", "xmlhttprequest", "xslt"];
 | 
					        storage.types = ["font", "image", "imageset", "main_frame", "media", "object", "object_subrequest", "other", "script", "stylesheet", "sub_frame", "websocket", "xbl", "xml_dtd", "xmlhttprequest", "xslt"];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,12 +99,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
                <br />
 | 
					                <br />
 | 
				
			||||||
                <p>
 | 
					                <p>
 | 
				
			||||||
                    <label id="rule_url_label"></label><br />
 | 
					                    <label id="rule_url_label"></label><br />
 | 
				
			||||||
                    <input type="url" id="rule_url" value="" name="rule_url" class="form-control" />
 | 
					                    <input type="url" id="ruleURL" value="" name="ruleURL" class="form-control" />
 | 
				
			||||||
                </p>
 | 
					                </p>
 | 
				
			||||||
                <br />
 | 
					                <br />
 | 
				
			||||||
                <p>
 | 
					                <p>
 | 
				
			||||||
                    <label id="hash_url_label"></label><br />
 | 
					                    <label id="hash_url_label"></label><br />
 | 
				
			||||||
                    <input type="url" id="hash_url" value="" name="hash_url" class="form-control" />
 | 
					 | 
				
			||||||
                </p>
 | 
					                </p>
 | 
				
			||||||
                <br />
 | 
					                <br />
 | 
				
			||||||
                <p>
 | 
					                <p>
 | 
				
			||||||
| 
						 | 
					@ -118,9 +117,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
                </p>
 | 
					                </p>
 | 
				
			||||||
                <br />
 | 
					                <br />
 | 
				
			||||||
                <p>
 | 
					                <p>
 | 
				
			||||||
                    <label id="context_menu_enabled" style="font-weight: bold;"></label><br />
 | 
					                    <label id="domain_blocking_enabled" style="font-weight: bold;"></label><br />
 | 
				
			||||||
                    <label class="switch">
 | 
					                    <label class="switch">
 | 
				
			||||||
                        <input type="checkbox" id="contextMenuEnabled">
 | 
					                        <input type="checkbox" id="domainBlocking">
 | 
				
			||||||
                        <span class="slider round"></span>
 | 
					                        <span class="slider round"></span>
 | 
				
			||||||
                    </label>
 | 
					                    </label>
 | 
				
			||||||
                </p>
 | 
					                </p>
 | 
				
			||||||
| 
						 | 
					@ -141,6 +140,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
                    </label>
 | 
					                    </label>
 | 
				
			||||||
                </p>
 | 
					                </p>
 | 
				
			||||||
                <br />
 | 
					                <br />
 | 
				
			||||||
 | 
					                <p>
 | 
				
			||||||
 | 
					                    <label id="context_menu_enabled" style="font-weight: bold;"></label><br />
 | 
				
			||||||
 | 
					                    <label class="switch">
 | 
				
			||||||
 | 
					                        <input type="checkbox" id="contextMenuEnabled">
 | 
				
			||||||
 | 
					                        <span class="slider round"></span>
 | 
				
			||||||
 | 
					                    </label>
 | 
				
			||||||
 | 
					                </p>
 | 
				
			||||||
 | 
					                <br />
 | 
				
			||||||
                <p>
 | 
					                <p>
 | 
				
			||||||
                    <label id="referral_marketing_enabled" style="font-weight: bold;"></label><br />
 | 
					                    <label id="referral_marketing_enabled" style="font-weight: bold;"></label><br />
 | 
				
			||||||
                    <label class="switch">
 | 
					                    <label class="switch">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    "manifest_version": 2,
 | 
					    "manifest_version": 2,
 | 
				
			||||||
    "name": "ClearURLs",
 | 
					    "name": "ClearURLs",
 | 
				
			||||||
    "version": "1.9.3.1",
 | 
					    "version": "1.9.4",
 | 
				
			||||||
    "author": "Kevin Röbert",
 | 
					    "author": "Kevin Röbert",
 | 
				
			||||||
    "description": "Remove tracking elements from URLs.",
 | 
					    "description": "Remove tracking elements from URLs.",
 | 
				
			||||||
    "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",
 | 
					    "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user