Advertisement
Guest User

Untitled

a guest
Jul 10th, 2016
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var frozenIceWrapper=function(){this.run=function(){this.supports_html5_storage()?(console.log("Logger gestartet"),this.insertButtons(),this.bindToChat()):alert("Der Browser unterschtützt diese Technologie nicht!")},this.supports_html5_storage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}},this.bindToChat=function(){var e=this.saveToLog;$(".messagelist").bind("DOMNodeInserted",function(t){var n=t.target,o=(n.getElementsByClassName("messagerow"),n.getElementsByClassName("messagetext")),a=null,l="";for(node in o)"ms__"!=node.substring(0,4)&&isNaN(node.substring(0,1))||(console.log(node+": "+o[node].innerHTML),null==a?a=o[node].innerHTML:l+=o[node].innerHTML+" ");if(console.log("(:) "+a+"  "+l),null!=a){var r=new Date;console.log("("+r.getHours()+":"+r.getMinutes()+") "+a+"  "+l),e("("+r.getHours()+":"+r.getMinutes()+") "+a+"  "+l)}})},this.saveToLog=function(e){var t=localStorage.getItem("chatLogFrozen");null==t&&(t=""),t+="\n"+e,localStorage.setItem("chatLogFrozen",t)},this.clearLog=function(){confirm("Wollen sie den ChatLog löschen?")&&localStorage.removeItem("chatLogFrozen")},this.download=function(e,t){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),n.setAttribute("download",e),n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)},this.downloadLog=function(){var e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(localStorage.getItem("chatLogFrozen"))),e.setAttribute("download","Log.txt"),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)},this.insertButtons=function(){var e=document.getElementsByClassName("dynmap-link leaflet-control"),t=e[0],n=document.createElement("a"),o=document.createElement("a");n.title="Download Chat Log",n.innerHTML="Download",o.title="Delete Chat Log",o.innerHTML="Delete",t.appendChild(n),t.appendChild(o),n.addEventListener("click",this.downloadLog),o.addEventListener("click",this.clearLog)}},chatLog=new frozenIceWrapper;chatLog.run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement