Version 1.3.3.1
I've updated the ClearURLs core, so that ClearURLs only cleans the fields from urls. This means that ClearURLs can no longer examine all components of a URL and, if necessary, remove something, but only the so-called GET fields. This restricts not hardly, since everything that is not a GET field is a part of the url (the path) and should not actually be removed. However, because ClearURLs was able to remove these path elements, this problem came up again. Now ClearURLs can only remove GET fields and thus no longer destroy paths. I hope that there are fewer problems now. Another little side effect of the change, ClearURLs is now working more efficiently.
This commit is contained in:
parent
b2b1c935c5
commit
349b645d88
42
clearurls.js
42
clearurls.js
|
@ -336,6 +336,8 @@ function start(items)
|
|||
function removeFieldsFormURL(provider, request)
|
||||
{
|
||||
var url = request.url;
|
||||
var domain = url.replace(new RegExp("\\?.*", "i"), "");
|
||||
var fields = "";
|
||||
var rules = provider.getRules();
|
||||
var changes = false;
|
||||
var cancel = false;
|
||||
|
@ -357,15 +359,22 @@ function start(items)
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Only test for matches, if there are fields that can be cleaned.
|
||||
*/
|
||||
if(existsFields(url))
|
||||
{
|
||||
fields = url.replace(new RegExp(".*\\?", "i"), "");
|
||||
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
var beforReplace = url;
|
||||
var beforReplace = fields;
|
||||
|
||||
url = url.replace(new RegExp(rules[i], "i"), "");
|
||||
fields = fields.replace(new RegExp(rules[i], "i"), "");
|
||||
|
||||
if(beforReplace != url)
|
||||
if(beforReplace != fields)
|
||||
{
|
||||
//Log the action
|
||||
pushToLog(beforReplace, url, rules[i]);
|
||||
pushToLog(domain+"?"+beforReplace, domain+"?"+fields, rules[i]);
|
||||
|
||||
if(badges[tabid] == null)
|
||||
{
|
||||
|
@ -388,6 +397,15 @@ function start(items)
|
|||
changes = true;
|
||||
}
|
||||
}
|
||||
url = domain+"?"+fields;
|
||||
}
|
||||
else {
|
||||
if(domain != url)
|
||||
{
|
||||
url = domain;
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(provider.isCaneling()){
|
||||
pushToLog(request.url, request.url, translate('log_domain_blocked'));
|
||||
|
@ -417,8 +435,6 @@ function start(items)
|
|||
"url": url,
|
||||
"cancel": cancel
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -434,6 +450,19 @@ function start(items)
|
|||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if fields exists.
|
||||
* @param {String} url URL as String
|
||||
* @return {boolean}
|
||||
*/
|
||||
function existsFields(url)
|
||||
{
|
||||
var matches = (url.match(/\?.+/i) || []);
|
||||
var count = matches.length;
|
||||
|
||||
return (count > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function which called from the webRequest to
|
||||
* remove the tracking fields from the url.
|
||||
|
@ -492,6 +521,7 @@ function start(items)
|
|||
* a loop.
|
||||
*/
|
||||
if(result.changes){
|
||||
console.log(result.url);
|
||||
return {
|
||||
redirectUrl: result.url
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "ClearURLs",
|
||||
"version": "1.3.2.0",
|
||||
"version": "1.3.3.1",
|
||||
"author": "Kevin R.",
|
||||
"description": "Remove tracking elements form URLs.",
|
||||
"homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",
|
||||
|
|
Loading…
Reference in New Issue
Block a user