mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 10:19:24 +02:00
Special Chars on Clean Title
This commit is contained in:
parent
68e26874c8
commit
db1d1ae24d
1 changed files with 9 additions and 1 deletions
|
@ -23,9 +23,17 @@ modal = modal || (function () {
|
|||
};
|
||||
})();
|
||||
|
||||
String.prototype.stripAccents = function() {
|
||||
var translate_re = /[àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ]/g;
|
||||
var translate = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY';
|
||||
return (this.replace(translate_re, function(match){
|
||||
return translate.substr(translate_re.source.indexOf(match)-1, 1); })
|
||||
);
|
||||
};
|
||||
|
||||
function clean_name(str) {
|
||||
|
||||
str = str.toLowerCase();
|
||||
str = str.stripAccents().toLowerCase();
|
||||
return str.replace(/\W+/g, "-");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue