TheBarmaley
Platinum Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Цитата: Кнопка сохранения текста поста в файл. Код:javascript: for(var i=0,a=document.querySelectorAll(".post");i<a.length;i++){a[i].parentNode.firstChild.innerHTML=" <button id='"+i+"' class='lt'>▼</button> | "+a[i].parentNode.firstChild.innerHTML};document.addEventListener("mouseup",function(b){b=b.target;if("lt"==b.className){lt(b.id)}});function lt(a){var c=document.createElement("a");h=new Blob([document.location.href.split("#")[0]+"#"+a+"\n\n"+document.querySelectorAll(".post")[a].textContent],{type:"octet/stream"});c.setAttribute("href",window.URL.createObjectURL(h));c.setAttribute("download",new Date().toTimeString().substr(0,8)+".txt");c.click();c.remove()}; |
|