diff options
author | CommanderRoot <CommanderRoot@users.noreply.github.com> | 2022-05-03 15:52:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 15:52:45 +0300 |
commit | 56640ae815fbace78c62482711cb1733d26cee5e (patch) | |
tree | 18078e6b9ec3e8ffe7cc6ac28e4c8f0a309bce94 /plugins/CoreHome/angularjs | |
parent | 34ea7bbfcbc5a79a5c7b675b8cd2134cdda74cbe (diff) |
Replace deprecated String.prototype.substr() (#19111)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Diffstat (limited to 'plugins/CoreHome/angularjs')
5 files changed, 7 insertions, 7 deletions
diff --git a/plugins/CoreHome/angularjs/anchorLinkFix.js b/plugins/CoreHome/angularjs/anchorLinkFix.js index bdc55792a7..677eb31242 100644 --- a/plugins/CoreHome/angularjs/anchorLinkFix.js +++ b/plugins/CoreHome/angularjs/anchorLinkFix.js @@ -75,8 +75,8 @@ function handleScrollToAnchorIfPresentOnPageLoad() { - if (location.hash.substr(0, 2) == '#/') { - var hash = location.hash.substr(2); + if (location.hash.slice(0, 2) == '#/') { + var hash = location.hash.slice(2); scrollToAnchorIfPossible(hash, null); } } @@ -102,7 +102,7 @@ return; } - var hash = newUrl.substr(hashPos + 2); + var hash = newUrl.slice(hashPos + 2); scrollToAnchorIfPossible(hash, event); } diff --git a/plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js b/plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js index 5bf1a9a6bb..995950ef2d 100644 --- a/plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js +++ b/plugins/CoreHome/angularjs/common/directives/autocomplete-matched.js @@ -46,7 +46,7 @@ var startTerm = content.toLowerCase().indexOf(searchTerm.toLowerCase()); if (-1 !== startTerm) { - var word = content.substr(startTerm, searchTerm.length); + var word = content.slice(startTerm, startTerm + searchTerm.length); var escapedword = $sanitize(piwik.helper.htmlEntities(word)); content = content.replace(word, '<span class="autocompleteMatched">' + escapedword + '</span>'); element.html(content); diff --git a/plugins/CoreHome/angularjs/common/directives/field-condition.js b/plugins/CoreHome/angularjs/common/directives/field-condition.js index 3ff3116cf0..5c4c33ff8e 100644 --- a/plugins/CoreHome/angularjs/common/directives/field-condition.js +++ b/plugins/CoreHome/angularjs/common/directives/field-condition.js @@ -38,7 +38,7 @@ } else if (element.prop('tagName').toLowerCase() === 'select') { var name = element.val(); if (name.indexOf('string:') === 0) { - return name.substr('string:'.length); + return name.slice('string:'.length); } return name; diff --git a/plugins/CoreHome/angularjs/common/filters/ucfirst.js b/plugins/CoreHome/angularjs/common/filters/ucfirst.js index 3c9094f602..0af633e51e 100644 --- a/plugins/CoreHome/angularjs/common/filters/ucfirst.js +++ b/plugins/CoreHome/angularjs/common/filters/ucfirst.js @@ -15,7 +15,7 @@ } var firstLetter = (value + '').charAt(0).toUpperCase(); - return firstLetter + value.substr(1); + return firstLetter + value.slice(1); }; } })(); diff --git a/plugins/CoreHome/angularjs/http404check.js b/plugins/CoreHome/angularjs/http404check.js index b18b7be669..bba8ba6a65 100644 --- a/plugins/CoreHome/angularjs/http404check.js +++ b/plugins/CoreHome/angularjs/http404check.js @@ -42,7 +42,7 @@ -1 !== rejection.config.url.indexOf('plugins')) { var posEndUrl = rejection.config.url.indexOf('.html') + 5; - var url = rejection.config.url.substr(0, posEndUrl); + var url = rejection.config.url.slice(0, posEndUrl); var message = 'Please check your server configuration. You may want to whitelist "*.html" files from the "plugins" directory.'; message += ' The HTTP status code is ' + rejection.status + ' for URL "' + url + '"'; |