0 Utenti e 1 Visitatore stanno visualizzando questo topic.
// ==UserScript==// @name safe_copy// @namespace Violentmonkey Scripts// @match *://*/*// @grant none// ==/UserScript==var ndiv,nd_1A,nd_2A;function cretEl(){ var nd = document.createElement('div') nd.id = 'my_mew_Div' nd.setAttribute('style','display:none; position:fixed; top:10px; left:10px; min-width: 20vw; \ min-height:10vh; background:grey; border-radius: 8px; border: 3px solid black; \ box-shadow: 10px 10px 8px gray; z-index: 99999; \ font-size:16px;') var nd_1 = document.createElement('textarea') nd_1.id = 'my_mew_sp_1' nd_1.setAttribute('cols','60') nd_1.setAttribute('style','display:block; position:relative; margin:5px 5px 0px 5px; padding:3px; \ width: calc(100% -10px); height:90%; resize: both; background: black !important; \ color:green; \ font-size:1.2rem !important;') var nd_2 = document.createElement('button') nd_2.id = 'my_mew_sp_2' nd_2.setAttribute('style','display:block; position:relative; margin:5px auto 5px; padding:3px; \ width: 50%; height:5%; text-align: center; background: #414141; color: magenta; \ border: 5px outset black; \ font-size:1.35rem;') nd_2.innerHTML='X close X'; var O_O = document.createElement('style') O_O.innerHTML='#my_mew_sp_2:active{border:inset !important; color: black !important;}' document.body.append(nd) nd.append(nd_1) nd.append(nd_2) nd.append(O_O) ndiv = document.getElementById('my_mew_Div'); nd_1A = document.getElementById('my_mew_sp_1') nd_2A = document.getElementById('my_mew_sp_2') }function selFunc() { O_X = document.getElementById('my_mew_Div'); if(!O_X){ cretEl(); } const selection = document.getSelection(); ndiv.style.display='block'; nd_1A.value = selection; nd_2A.addEventListener('click',function(){ this.parentNode.style.display = 'none'; },{once:true},false);}var source = document.querySelector('body');source.addEventListener('copy', selFunc)