mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-15 21:55:36 +07:00
Version 1.9.0
- Added #284 - Added #56 - Fixed #241 - Possible fix & workaround for #203 - Fixed bug in "history tracking injection protection". This option was not disabled, when the global filter switch are on off - Added an option to im-/export the log (requires the `downloads` permission) - Added an option to im-/export the settings (requires the `downloads` permission) - Added information page for blocked sites, when they are called in the `main_frame` - Added "multiple times URL encodes" recognition - Refactoring - Changed background script loading sequence to prevent that required functions are not yet loaded.
This commit is contained in:
@@ -75,19 +75,13 @@ async function checkOSAndroid()
|
||||
});
|
||||
}
|
||||
|
||||
if(os == "android")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
return os === "android";
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the host without port from an url.
|
||||
* @param {String} url URL as String
|
||||
* @return {Array} host as string
|
||||
* @return {String} host as string
|
||||
*/
|
||||
function extractHost(url) {
|
||||
let parsed_url = new URL(url);
|
||||
@@ -126,8 +120,8 @@ function countFields(url)
|
||||
*/
|
||||
function existsFields(url)
|
||||
{
|
||||
var matches = (url.match(/\?.+/i) || []);
|
||||
var count = matches.length;
|
||||
let matches = (url.match(/\?.+/i) || []);
|
||||
let count = matches.length;
|
||||
|
||||
return (count > 0);
|
||||
}
|
||||
@@ -140,7 +134,7 @@ function existsFields(url)
|
||||
function extractFileds(url)
|
||||
{
|
||||
if(existsFields(url)) {
|
||||
var fields = url.replace(new RegExp(".*?\\?", "i"), "");
|
||||
let fields = url.replace(new RegExp(".*?\\?", "i"), "");
|
||||
if(existsFragments(url)) {
|
||||
fields = fields.replace(new RegExp("#.*", "i"), "");
|
||||
}
|
||||
@@ -169,7 +163,7 @@ function countFragments(url)
|
||||
function extractFragments(url)
|
||||
{
|
||||
if(existsFragments(url)) {
|
||||
var fragments = url.replace(new RegExp(".*?#", "i"), "");
|
||||
let fragments = url.replace(new RegExp(".*?#", "i"), "");
|
||||
return (fragments.match(/[^&]+=?[^&]*/gi) || []);
|
||||
}
|
||||
|
||||
@@ -183,8 +177,8 @@ function extractFragments(url)
|
||||
*/
|
||||
function existsFragments(url)
|
||||
{
|
||||
var matches = (url.match(/\#.+/i) || []);
|
||||
var count = matches.length;
|
||||
let matches = (url.match(/\#.+/i) || []);
|
||||
let count = matches.length;
|
||||
|
||||
return (count > 0);
|
||||
}
|
||||
@@ -298,3 +292,16 @@ function getBrowser() {
|
||||
return "Chrome";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes an URL, also one that is encoded multiple times.
|
||||
* @param url the url, that should be decoded
|
||||
*/
|
||||
function decodeURL(url) {
|
||||
const rtn = decodeURIComponent(url);
|
||||
if(rtn.indexOf("http://") === -1 && rtn.indexOf("https://") === -1) {
|
||||
return decodeURL(rtn);
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
Reference in New Issue
Block a user