jQuery(document).ready(function() { // On Clipboard copy /* jQuery("body").bind("copy", function(e) { console.log("Clipboard copy detected"); var c = e.originalEvent.clipboardData; if (c.types.length > 0) { var data = c.getData(c.types[0]); console.log(data); } else { navigator.clipboard.read().then(function(items) { for (let i = 0; i < items.length; i++) { for (let t = 0; t < items[i].types.length; t++) { if (items[i].types[t] == "text/html") { items[i].getType(items[i].types[t]).then(function(blob) { blob.text().then(function(html) { var modified = false; while (true) { var bgn_tag = '<'+'div class="secedit editbutton'; var end_tag = '<'+'/button'+'><'+'/div'+'><'+'/form'+'><'+'/div'+'>'; var bgn_pos = html.indexOf(bgn_tag); var end_pos = html.indexOf(end_tag); if (bgn_pos < 0 || end_pos < 0) break; modified = true; html = html.substring(0, bgn_pos) + html.substring(end_pos + end_tag.length); } if (modified) { const data = new Blob([html], {type: 'text/html'}) const item = new ClipboardItem({'text/html': data}); navigator.clipboard.write([item]); c.setData('text/html', html); console.log("Clipboard content cleaned!"); } }); }); } } } }); } }); */ });