verbose/js/main.js
2023-11-20 12:42:57 +01:00

26 satır
913 B
JavaScript

/*function copytext(elid) {
window.getSelection().selectAllChildren(document.getElementById(elid));
document.execCommand('copy');
}*/
function copytext(index) {
navigator.clipboard.writeText(document.getElementById('post_'+index).value);
var notif=document.getElementById('notif');
notif.textContent='Post '+(index+1)+' text was successfully copied into your clipboard :-)';
notif.style.display='block';
}
function repments(match,p1,p2) {
return p1+p2;
}
function replinks(match,p1) {
return p1+'UUUUUUUUUUUUUUUUUUUUUUU';
}
function mastlength(cont) {
const mentre=/(^|\W)(@[a-zA-Z0-9_]+)@(([a-z0-9]([a-z0-9-]+[a-z0-9])?){1,63}\.)+([a-z0-9]([a-z0-9-]+[a-z0-9])?){1,63}\b/g;
const linkre=new RegExp(`(^|\\W)https?://(([a-z0-9]([a-z0-9-]+[a-z0-9])?){1,63}\\.)+(${tlds.join('|')})(/\\S*[\\w/=_\-])?`,'g');
cont=cont.replace(mentre,repments);
cont=cont.replace(linkre,replinks);
return cont.length;
}