diff --git a/core_js/tools.js b/core_js/tools.js index 1e8f969..df5f384 100644 --- a/core_js/tools.js +++ b/core_js/tools.js @@ -288,7 +288,7 @@ function decodeURL(url) { } // 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 } diff --git a/external_js/ip-range-check.js b/external_js/ip-range-check.js index 8018826..67dcd69 100644 --- a/external_js/ip-range-check.js +++ b/external_js/ip-range-check.js @@ -484,10 +484,10 @@ function check_single_cidr(addr, cidr) { while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) { colonCount++; } - if (string.substr(0, 2) === '::') { + if (string.startsWith('::')) { colonCount--; } - if (string.substr(-2, 2) === '::') { + if (string.endsWith('::')) { colonCount--; } if (colonCount > parts) {