mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 10:49:36 +02:00
add nl2br JS function
This commit is contained in:
parent
e4d489b9b9
commit
ab203eabb8
1 changed files with 8 additions and 0 deletions
|
@ -373,3 +373,11 @@ function copyToClipboard(text) {
|
||||||
$('#elementToCopy').select();
|
$('#elementToCopy').select();
|
||||||
document.execCommand('copy');
|
document.execCommand('copy');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nl2br (str, is_xhtml) {
|
||||||
|
if (typeof str === 'undefined' || str === null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
|
||||||
|
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue