mirror of
https://github.com/ClearURLs/Addon.git
synced 2024-08-17 23:50:36 +03:00
Replace deprecated String.prototype.substr()
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with startsWith() or endsWith() Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
parent
42268bf215
commit
93434d3bce
@ -288,7 +288,7 @@ function decodeURL(url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Required (e.g., to fix https://github.com/ClearURLs/Addon/issues/71)
|
// Required (e.g., to fix https://github.com/ClearURLs/Addon/issues/71)
|
||||||
if(rtn.substr(0, 4) !== 'http') {
|
if(!rtn.startsWith('http')) {
|
||||||
rtn = 'http://'+rtn
|
rtn = 'http://'+rtn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,10 +484,10 @@ function check_single_cidr(addr, cidr) {
|
|||||||
while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) {
|
while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) {
|
||||||
colonCount++;
|
colonCount++;
|
||||||
}
|
}
|
||||||
if (string.substr(0, 2) === '::') {
|
if (string.startsWith('::')) {
|
||||||
colonCount--;
|
colonCount--;
|
||||||
}
|
}
|
||||||
if (string.substr(-2, 2) === '::') {
|
if (string.endsWith('::')) {
|
||||||
colonCount--;
|
colonCount--;
|
||||||
}
|
}
|
||||||
if (colonCount > parts) {
|
if (colonCount > parts) {
|
||||||
|
Loading…
Reference in New Issue
Block a user