- // ==UserScript==
- // @name HackForums.net - MultiQuote
- // @namespace spafic/multiquote
- // @description Enables users to quote multiple posts at once, then incert them with a single click into their forum reply.
- // @author Spafic
- // @copyright Spafic 2012 (http://userscripts.org/users/Spafic)
- // @licence GNU General Public License
- //
- // @match *://*.hackforums.net/showthread.php*
- // @version 3.1.0
- //
- // @icon http://cdn2.hackforums.net/uploads/ficons/hf-news.png
- // @icon64 http://cdn2.hackforums.net/uploads/ficons/hf-news.png
- // @history 1.0.0 - Script created
- // @history 1.1.0 - Fixed a few minor bugs
- // @history 2.0.0 - Recreated entire plugin to be compatible with other plugins
- // @history 3.0.0 - Recoded plugin from scratch as well as remove all reliance from the HackForums.net server.
- // @history 3.0.1 - Now cross-browser compatible
- // @history 3.0.2 - Compressed plugin
- // @history 3.0.3 - Fixed a small bug
- // @history 3.1.0 - Added support for classic view mode
- // ==/UserScript==
-
- (function(){var d,f,b,c,h,g,a,e,j,i;b=-1==document.body.innerHTML.indexOf(String.fromCharCode(60,33,45,45,32,101,110,100,58,32,112,111,115,116,98,105,116,95,99,108,97,115,115,105,99,32,45,45,62))?!1:!0;buttons=[];objshit={};e=d=a=0;if(!0==b){a=document.getElementById("posts");i=a.getElementsByClassName("bitButton");for(a=0;a<i.length;a++)"Report"==i[a].textContent&&(buttons[d]=i[a].parentNode,d++)}else f=document.getElementsByClassName("post_management_buttons float_right");if(!1==b)for(a=0;a<f.length;a++)d=document.getElementsByClassName("post_body")[a].getAttribute("id"),b=document.createElement("a"),b.setAttribute("mystuff",d),b.setAttribute("class","bitButton"),b.setAttribute("title","Add to quotes"),b.setAttribute("style","cursor:pointer;color: #efefef;background-color: #531F3E;border: 1px solid #370c23 !important;box-shadow: 0 1px 0 0 #b087ab inset !important;border-radius: 0px 6px 0px 6px !important;background-image: -ms-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: -moz-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: -o-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #825E7E), color-stop(1, #460D2C));background-image: -webkit-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: linear-gradient(top, #825E7E 0%, #460D2C 100%);padding: 3px 6px;text-shadow: 1px 1px 0px #000;text-decoration: none;font-family: arial;font-size: 14px;font-weight: bold;"),b.setAttribute("class","multiquote_button"),b.innerHTML="Q<span style='color:green'>+</span>",b.addEventListener("click",function(){-1==this.innerHTML.indexOf("-")?(this.innerHTML="Q<span style='color:red'>-</span>",this.title="Remove from quotes",c=this.getAttribute("mystuff"),var2_temp=document.createElement("div"),var2_temp.innerHTML=document.getElementById(c).innerHTML.toString().split(/<\/blockquote>/gim)[document.getElementById(c).innerHTML.split(/<\/blockquote>/gim).length-1],h=var2_temp.textContent.replace(/\t/gim,"").replace(/\n(.*?)\n/,"$1\n"),objshit[c]="[quote="+document.getElementById(c).parentNode.parentNode.parentNode.getElementsByClassName("post_author")[0].getElementsByTagName("a")[0].textContent+"]"+h+"[/quote]",h=c=""):(this.innerHTML="Q<span style='color:green'>+</span>",this.title="Add to quotes",c=this.getAttribute("mystuff"),delete objshit[c],c="")}),f[a].appendChild(b);else for(a=0;a<buttons.length;a++)d=buttons[a].getElementsByTagName("a")[0].getAttribute("href").split(/pid=/gim)[1],b=document.createElement("a"),b.setAttribute("mystuff",d),b.setAttribute("class","bitButton"),b.setAttribute("title","Add to quotes"),b.setAttribute("style","cursor:pointer;color: #efefef;background-color: #531F3E;border: 1px solid #370c23 !important;box-shadow: 0 1px 0 0 #b087ab inset !important;border-radius: 0px 6px 0px 6px !important;background-image: -ms-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: -moz-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: -o-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #825E7E), color-stop(1, #460D2C));background-image: -webkit-linear-gradient(top, #825E7E 0%, #460D2C 100%);background-image: linear-gradient(top, #825E7E 0%, #460D2C 100%);padding: 3px 6px;text-shadow: 1px 1px 0px #000;text-decoration: none;font-family: arial;font-size: 14px;font-weight: bold;"),b.setAttribute("class","multiquote_button"),b.innerHTML="Q<span style='color:green'>+</span>",b.addEventListener("click",function(){-1==this.innerHTML.indexOf("-")?(this.innerHTML="Q<span style='color:red'>-</span>",this.title="Remove from quotes",c="pid_"+this.getAttribute("mystuff"),var2_temp=document.createElement("div"),var2_temp.innerHTML=document.getElementById(c).innerHTML.toString().split(/<\/blockquote>/gim)[document.getElementById(c).innerHTML.split(/<\/blockquote>/gim).length-1],h=var2_temp.textContent.replace(/\t/gim,"").replace(/\n(.*?)\n/,"$1\n"),objshit[c]="[quote="+document.getElementById(c).parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("a")[1].textContent+"]"+h+"[/quote]",h=c=""):(this.innerHTML="Q<span style='color:green'>+</span>",this.title="Add to quotes",c=this.getAttribute("mystuff"),delete objshit[c],c="")}),buttons[a].appendChild(b);f=document.getElementById("quickreply_multiquote");f.setAttribute("style","display:block;width:100%;color:white;background-color:#333");f.innerHTML="";f.setAttribute("id","multiquotebar");a=document.createElement("a");a.innerHTML="Insert all quotes";a.setAttribute("class","bitButton");a.setAttribute("style","cursor:pointer");a.addEventListener("click",function(){for(j in objshit)document.getElementById("message").value=document.getElementById("message").value+"\n"+objshit[j]+"\n";objshit={};g=document.getElementsByClassName("multiquote_button");for(e=0;e<g.length;e++)g[e].innerHTML="Q<span style='color:green'>+</span>",g[e].title="Add to quotes";return!1});d=document.createElement("a");d.innerHTML="Clear all quotes";d.setAttribute("class","bitButton");d.setAttribute("style","cursor:pointer");d.addEventListener("click",function(){objshit={};g=document.getElementsByClassName("multiquote_button");for(e=0;e<g.length;e++)g[e].innerHTML="Q<span style='color:green'>+</span>",g[e].title="Add to quotes";return!1});f.appendChild(a);f.appendChild(d)})();