Загрузка данных


javascript:(()=>{const IND='\u00A0'.repeat(6),EMPTY=false;const ae=document.activeElement;const t=(ae&&(ae.tagName==='TEXTAREA'||ae.isContentEditable))?ae:document.querySelector('textarea,[contenteditable="true"]');if(!t){alert('Поле не найдено. Кликните в поле ответа и нажмите закладку снова.');return;}const b=document.createElement('div');b.style.cssText='position:fixed;top:10vh;left:15vw;right:15vw;bottom:10vh;z-index:999999;background:white;border:2px solid black;padding:12px;display:flex;flex-direction:column;gap:8px;box-shadow:0 0 30px rgba(0,0,0,.4)';b.innerHTML='<b>Вставьте текст (Ctrl+V) и нажмите «Перенести в форму»</b><textarea style="flex:1;font:14px sans-serif"></textarea><div><button data-a="ok">Перенести в форму</button> <button data-a="no">Отмена</button></div>';document.body.appendChild(b);const ta=b.querySelector('textarea');ta.focus();b.addEventListener('click',e=>{const a=e.target.dataset.a;if(!a)return;if(a==='ok'){const p=ta.value.replace(/\r\n?/g,'\n').split('\n').map(l=>l.replace(/^[\s\u00A0.°·•\u2022\u25E6]+/,'').trimEnd()).filter(l=>l);if(t.tagName==='TEXTAREA'){const s=p.map(x=>IND+x).join(EMPTY?'\n\n':'\n');Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,'value').set.call(t,s);t.dispatchEvent(new Event('input',{bubbles:true}));t.dispatchEvent(new Event('change',{bubbles:true}));}else{const esc=s=>s.replace(/&/g,'&amp;').replace(/</g,'&lt;');t.focus();document.execCommand('selectAll');document.execCommand('insertHTML',false,p.map(x=>'<p>'+IND+esc(x)+'</p>').join(EMPTY?'<p><br></p>':''));}}b.remove();});})();