mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Updates
This commit is contained in:
parent
ee76cffb9f
commit
c0550f17ee
1 changed files with 4 additions and 1 deletions
|
@ -70,10 +70,13 @@ if (urlParams.has('debug')) {
|
||||||
isDebuging = false;
|
isDebuging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeRegExp(string) {
|
||||||
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||||
|
}
|
||||||
if(typeof String.prototype.replaceAll === "undefined") {
|
if(typeof String.prototype.replaceAll === "undefined") {
|
||||||
console.log('replaceAll is undefined');
|
console.log('replaceAll is undefined');
|
||||||
String.prototype.replaceAll = function(match, _replace) {
|
String.prototype.replaceAll = function(match, _replace) {
|
||||||
return this.replace(new RegExp(match, 'g'), _replace);
|
return this.replace(new RegExp(escapeRegExp(match), 'g'), _replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue