main.js 913 B

1234567891011121314151617181920212223242526
  1. /*function copytext(elid) {
  2. window.getSelection().selectAllChildren(document.getElementById(elid));
  3. document.execCommand('copy');
  4. }*/
  5. function copytext(index) {
  6. navigator.clipboard.writeText(document.getElementById('post_'+index).value);
  7. var notif=document.getElementById('notif');
  8. notif.textContent='Post '+(index+1)+' text was successfully copied into your clipboard :-)';
  9. notif.style.display='block';
  10. }
  11. function repments(match,p1,p2) {
  12. return p1+p2;
  13. }
  14. function replinks(match,p1) {
  15. return p1+'UUUUUUUUUUUUUUUUUUUUUUU';
  16. }
  17. function mastlength(cont) {
  18. 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;
  19. const linkre=new RegExp(`(^|\\W)https?://(([a-z0-9]([a-z0-9-]+[a-z0-9])?){1,63}\\.)+(${tlds.join('|')})(/\\S*[\\w/=_\-])?`,'g');
  20. cont=cont.replace(mentre,repments);
  21. cont=cont.replace(linkre,replinks);
  22. return cont.length;
  23. }