Version 1.2.2.20

I hope it fixes Bug #60
This commit is contained in:
Kevin Röbert 2018-06-16 21:06:51 +02:00
parent e58acecf7e
commit 06a8665688
3 changed files with 87 additions and 84 deletions

View File

@ -340,59 +340,33 @@ function start(items)
var changes = false; var changes = false;
var cancel = false; var cancel = false;
if(provider.matchURL(url)) /*
* Expand the url by provider redirections. So no tracking on
* url redirections form sites to sites.
*/
var re = provider.getRedirection(url);
if(re !== null)
{ {
/* url = decodeURIComponent(re);
* Expand the url by provider redirections. So no tracking on //Log the action
* url redirections form sites to sites. pushToLog(request.url, re, translate('log_redirect'));
*/
var re = provider.getRedirection(url); return {
if(re !== null) "redirect": true,
"url": url
};
}
for (var i = 0; i < rules.length; i++) {
var beforReplace = url;
url = url.replace(new RegExp(rules[i], "gi"), "");
if(beforReplace != url)
{ {
url = decodeURIComponent(re);
//Log the action //Log the action
pushToLog(request.url, re, translate('log_redirect')); pushToLog(beforReplace, url, rules[i]);
return {
"redirect": true,
"url": url
};
}
for (var i = 0; i < rules.length; i++) {
var beforReplace = url;
url = url.replace(new RegExp(rules[i], "gi"), "");
if(beforReplace != url)
{
//Log the action
pushToLog(beforReplace, url, rules[i]);
if(badges[tabid] == null)
{
badges[tabid] = 0;
}
increaseURLCounter();
if(!checkOSAndroid())
{
if(storage.badgedStatus) {
browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid});
}
else
{
browser.browserAction.setBadgeText({text: "", tabId: tabid});
}
}
changes = true;
}
}
if(provider.isCaneling()){
pushToLog(request.url, request.url, translate('log_domain_blocked'));
if(badges[tabid] == null) if(badges[tabid] == null)
{ {
badges[tabid] = 0; badges[tabid] = 0;
@ -411,20 +385,40 @@ function start(items)
} }
} }
cancel = true; changes = true;
}
}
if(provider.isCaneling()){
pushToLog(request.url, request.url, translate('log_domain_blocked'));
if(badges[tabid] == null)
{
badges[tabid] = 0;
} }
return { increaseURLCounter();
"changes": changes,
"url": url, if(!checkOSAndroid())
"cancel": cancel {
}; if(storage.badgedStatus) {
} browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid});
else { }
return { else
"changes": false {
}; browser.browserAction.setBadgeText({text: "", tabId: tabid});
}
}
cancel = true;
} }
return {
"changes": changes,
"url": url,
"cancel": cancel
};
} }
/** /**
@ -467,7 +461,14 @@ function start(items)
* Call for every provider the removeFieldsFormURL method. * Call for every provider the removeFieldsFormURL method.
*/ */
for (var i = 0; i < providers.length; i++) { for (var i = 0; i < providers.length; i++) {
result = removeFieldsFormURL(providers[i], request); let match = providers[i].matchURL(request.url);
if(match == providers[i].matchURL(request.url));
if(match)
{
result = removeFieldsFormURL(providers[i], request);
}
/* /*
* Expand urls and bypass tracking. * Expand urls and bypass tracking.
@ -609,8 +610,8 @@ function start(items)
} }
/** /**
* Save every minute the temporary data to the disk. * Save every minute the temporary data to the disk.
*/ */
setInterval(saveOnExit, 60000); setInterval(saveOnExit, 60000);
/** /**
@ -628,8 +629,8 @@ function setBadgedStatus()
} }
/** /**
* Change the icon. * Change the icon.
*/ */
function changeIcon() function changeIcon()
{ {
if(storage.globalStatus){ if(storage.globalStatus){
@ -655,9 +656,9 @@ function checkOSAndroid()
} }
/** /**
* Increase by {number} the GlobalURLCounter * Increase by {number} the GlobalURLCounter
* @param {int} number * @param {int} number
*/ */
function increaseGlobalURLCounter(number) function increaseGlobalURLCounter(number)
{ {
if(storage.statisticsStatus) if(storage.statisticsStatus)
@ -667,8 +668,8 @@ function increaseGlobalURLCounter(number)
} }
/** /**
* Increase by one the URLCounter * Increase by one the URLCounter
*/ */
function increaseURLCounter() function increaseURLCounter()
{ {
if(storage.statisticsStatus) if(storage.statisticsStatus)
@ -741,8 +742,8 @@ function setData(key, value)
break; break;
case "hashURL": case "hashURL":
case "ruleURL": case "ruleURL":
storage[key] = replaceOldGithubURLs(value); storage[key] = replaceOldGithubURLs(value);
break; break;
default: default:
storage[key] = value; storage[key] = value;
} }
@ -783,8 +784,8 @@ function initStorage(items)
} }
/** /**
* Set default values for the settings. * Set default values for the settings.
*/ */
function initSettings() function initSettings()
{ {
storage.ClearURLsData = []; storage.ClearURLsData = [];
@ -803,25 +804,25 @@ function initSettings()
} }
/** /**
* Reloads the extension. * Reloads the extension.
*/ */
function reload() function reload()
{ {
browser.runtime.reload(); browser.runtime.reload();
} }
/** /**
* Replace the old GitHub URLs with the * Replace the old GitHub URLs with the
* new GitLab URLs. * new GitLab URLs.
*/ */
function replaceOldGithubURLs(url) function replaceOldGithubURLs(url)
{ {
switch (url) { switch (url) {
case "https://raw.githubusercontent.com/KevinRoebert/ClearUrls/master/data/rules.hash?flush_cache=true": case "https://raw.githubusercontent.com/KevinRoebert/ClearUrls/master/data/rules.hash?flush_cache=true":
return "https://gitlab.com/KevinRoebert/ClearUrls/raw/master/data/rules.hash"; return "https://gitlab.com/KevinRoebert/ClearUrls/raw/master/data/rules.hash";
case "https://raw.githubusercontent.com/KevinRoebert/ClearUrls/master/data/data.json?flush_cache=true": case "https://raw.githubusercontent.com/KevinRoebert/ClearUrls/master/data/data.json?flush_cache=true":
return "https://gitlab.com/KevinRoebert/ClearUrls/raw/master/data/data.json"; return "https://gitlab.com/KevinRoebert/ClearUrls/raw/master/data/data.json";
default: default:
return url; return url;
} }
} }

View File

@ -59,7 +59,9 @@
"je=[^\\/|\\?|&]*(\\/|&(amp;)?)?", "je=[^\\/|\\?|&]*(\\/|&(amp;)?)?",
"dcr=[^\\/|\\?|&]*(\\/|&(amp;)?)?", "dcr=[^\\/|\\?|&]*(\\/|&(amp;)?)?",
"ie=[^\\/|\\?|&]*(\\/|&(amp;)?)?", "ie=[^\\/|\\?|&]*(\\/|&(amp;)?)?",
"sei=[^\\/|\\?|&]*(\\/|&(amp;)?)?" "sei=[^\\/|\\?|&]*(\\/|&(amp;)?)?",
"sa=[^\\/|\\?|&]*(\\/|&(amp;)?)?",
"dpr=[^\\/|\\?|&]*(\\/|&(amp;)?)?"
], ],
"exceptions": [ "exceptions": [
".*(mail\\.google\\.).*(\\/mail\\/u\\/0)\\/.*", ".*(mail\\.google\\.).*(\\/mail\\/u\\/0)\\/.*",

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "ClearURLs", "name": "ClearURLs",
"version": "1.2.2.19", "version": "1.2.2.20",
"author": "Kevin R.", "author": "Kevin R.",
"description": "Remove tracking elements form URLs.", "description": "Remove tracking elements form URLs.",
"homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls", "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",