mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-18 23:25:36 +07:00
Counter fix
This commit is contained in:
29
clearurls.js
29
clearurls.js
@@ -204,13 +204,21 @@ function removeFieldsFormURL(provider, request)
|
|||||||
badges[tabid] = 0;
|
badges[tabid] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid});
|
|
||||||
browser.storage.local.set({"globalCounter": ++globalCounter});
|
browser.storage.local.set({"globalCounter": ++globalCounter});
|
||||||
|
browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid});
|
||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(provider.isCaneling()){
|
if(provider.isCaneling()){
|
||||||
|
if(badges[tabid] == null)
|
||||||
|
{
|
||||||
|
badges[tabid] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.storage.local.set({"globalCounter": ++globalCounter});
|
||||||
|
browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid});
|
||||||
|
|
||||||
cancel = true;
|
cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,6 +230,19 @@ function removeFieldsFormURL(provider, request)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of parameters query strings.
|
||||||
|
* @param {String} url URL as String
|
||||||
|
* @return {int} Number of Parameters
|
||||||
|
*/
|
||||||
|
function countFields(url)
|
||||||
|
{
|
||||||
|
var matches = url.match(/[a-z\d]+=[a-z\d]+/gi);
|
||||||
|
var count = matches? matches.length : 0;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function which called from the webRequest to
|
* Function which called from the webRequest to
|
||||||
* remove the tracking fields from the url.
|
* remove the tracking fields from the url.
|
||||||
@@ -231,7 +252,11 @@ function removeFieldsFormURL(provider, request)
|
|||||||
*/
|
*/
|
||||||
function clearUrl(request)
|
function clearUrl(request)
|
||||||
{
|
{
|
||||||
browser.storage.local.set({"globalURLCounter": ++globalURLCounter});
|
var URLbeforeReplaceCount = countFields(request.url);
|
||||||
|
//Add Fields form Request to global url counter
|
||||||
|
globalURLCounter += URLbeforeReplaceCount;
|
||||||
|
browser.storage.local.set({"globalURLCounter": globalURLCounter});
|
||||||
|
|
||||||
browser.storage.local.get('globalStatus', clear);
|
browser.storage.local.get('globalStatus', clear);
|
||||||
|
|
||||||
function clear(data){
|
function clear(data){
|
||||||
|
|||||||
Reference in New Issue
Block a user