// Quickreply
// Ermoeglicht das direkte Posten in Threads durch einen Klick auf Quick-Reply oder Alt+Q
// (c) 2010 by Dicope
// Mail: dicope [aht] plan-of-attack [puhnkt] net
// ==UserScript==
// @name          Quickreply
// @namespace     http://greasemonkey.ppopn.net
// @description   Ermoeglicht das direkte Posten in Threads durch einen Klick auf Quick-Reply oder Alt+Q
// Quickreply
// Ermoeglicht das direkte Posten in Threads durch einen Klick auf Quick-Reply oder Alt+Q
// (c) 2008 by Dicope
// Mail: dicope [aht] plan-of-attack [puhnkt] net
// ==UserScript==
// @name          Quickreply
// @namespace     http://greasemonkey.ppopn.net
// @description   Ermoeglicht das direkte Posten in Threads durch einen Klick auf Quick-Reply oder Alt+Q
// @include       http://82.149.226.131/bb/thread.php*
// @include       http://forum.counter-strike.de/bb/thread.php*
// @include       http://forum.cstrike.de/bb/thread.php*
// @include       http://forum.mods.de/bb/thread.php*
// ==/UserScript==
 
     var status = false; // true: QR direkt geoeffnet
 
     var links = document.getElementsByTagName('a');
     var i = links.length - 1;
     var tid = window.location.search.replace(/.*TID=([0-9]*).*/,'$1');
     while(i > 0) {
      if(links[i].href.indexOf('/quickmod.php?action=hidereply') > -1) {
        var ismod = true;
      }
      if(links[i].href.match(/(.*)newreply.php\?PID=(.*)/gi)) {
        var tr = document.createElement("tr");
        var td = document.createElement("td");
        td.style.padding = "5px";
        td.id = "gmquickreplytd1";
        td.style.backgroundColor = "#091827";
        td.style.verticalAlign = "top";
        var div = document.createElement("div");
        div.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        div.style.fontSize = "10px";
        div.style.width = "100%";
        div.style.textAlign = "center";
        div.style.fontWeight = "bold";
        var a = document.createElement("a");
        a.accessKey = "q";
        a.href = "javascript:if(document.getElementById(\"gmquickreply\").style.display == \"none\") { document.getElementById(\"gmquickreply\").style.display = \"inline\";document.getElementById(\"gmqrcopy\").style.display = \"block\";document.getElementById(\"gmquickreplyta\").focus();document.getElementById(\"gmquickreplytd1\").style.height = \"520px\"; document.getElementById(\"gmquickreplytd2\").style.height = \"420px\"; document.getElementById(\"gmquickreplytd1\").style.backgroundColor = \"#394E63\";document.getElementById(\"gmquickreplytd2\").style.backgroundColor = \"#394E63\"; } else { document.getElementById(\"gmquickreply\").style.display = \"none\";document.getElementById(\"gmqrcopy\").style.display = \"none\";document.getElementById(\"gmquickreplytd1\").style.height = \"0px\"; document.getElementById(\"gmquickreplytd2\").style.height = \"0px\"; document.getElementById(\"gmquickreplytd1\").style.backgroundColor = \"#091827\";document.getElementById(\"gmquickreplytd2\").style.backgroundColor = \"#091827\"; } void(0);";
        var text = document.createTextNode("Quick-Reply");
        tr.appendChild(td);
        td.appendChild(div);
        div.appendChild(a);
        a.appendChild(text);
        var div = document.createElement("div");
        div.id = "gmqrcopy";
        div.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        div.style.fontSize = "10px";
        div.style.paddingTop = "485px";
        div.style.fontWeight = "bold";
        div.style.display = "none";
        var a = document.createElement("a");
        a.href = "http://greasemonkey.ppopn.net/";
        a.appendChild(document.createTextNode("Quick-Reply"));
        div.appendChild(a);
        div.appendChild(document.createTextNode(" by "));
        var a = document.createElement("a");
        a.href = "http://" + window.location.host + "/bb/pm/?a=5&rcpt=1127894";
        a.appendChild(document.createTextNode("Dicope"));
        div.appendChild(a);
        td.appendChild(div);
        var td = document.createElement("td");
        td.id = "gmquickreplytd2";
        td.style.backgroundColor = "#091827";
        td.style.padding = "5px";
        var form = document.createElement("form");
        form.id = "gmquickreply";
        form.style.display = "none";
        form.name = "newreply";
        form.action = "newreply.php";
        form.method = "post";
        var input = document.createElement("input");
        input.type = "hidden";
        input.name = "TID";
        input.value = tid;
        form.appendChild(input);
        var input = document.createElement("input");
        input.type = "hidden";
        input.name = "token";
        input.value = unsafeWindow.newreply_token;
        form.appendChild(input);
        var label = document.createElement("label");
        label.htmlFor = "gmqrtitle";
        label.style.fontSize = "10px";
        label.style.marginLeft = "1px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.appendChild(document.createTextNode("Post-Titel"));
        form.appendChild(label);
        var input = document.createElement("input");
        input.type = "text";
        input.name = "post_title";
        input.id = "gmqrtitle";
        input.style.width = "250px";
        input.style.marginLeft = "10px";
        form.appendChild(input);
        form.appendChild(document.createElement("br"));
        form.appendChild(document.createElement("br"));
        var label = document.createElement("label");
        label.htmlFor = "gmquickreplyta";
        label.style.fontSize = "10px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.style.verticalAlign = "top";
        label.appendChild(document.createTextNode("Post-Icon"));
        form.appendChild(label);
        icons = new Array();
        icimg = new Array();
        icons[0] = 0;
        icimg[0] = "";
        icons[1] = 32;
        icimg[1] = "icon2.gif";
        icons[2] = 40;
        icimg[2] = "icon11.gif";
        icons[3] = 34;
        icimg[3] = "icon4.gif";
        icons[4] = 33;
        icimg[4] = "icon3.gif";
        icons[5] = 41;
        icimg[5] = "icon12.gif";
        icons[6] = 2;
        icimg[6] = "thumbsup.gif";
        icons[7] = 1;
        icimg[7] = "thumbsdown.gif";
        icons[8] = 54;
        icimg[8] = "pfeil.gif";
        icons[9] = 38;
        icimg[9] = "icon8.gif";
        icons[10] = 35;
        icimg[10] = "icon5.gif";
        icons[11] = 28;
        icimg[11] = "icon9.gif";
        icons[12] = 42;
        icimg[12] = "icon13.gif";
        icons[13] = 36;
        icimg[13] = "icon6.gif";
        icons[14] = 39;
        icimg[14] = "icon10.gif";
        icons[15] = 37;
        icimg[15] = "icon7.gif";
        var icocount = 0;
        var fieldset = document.createElement("fieldset");
        fieldset.style.display = "inline";
        fieldset.style.paddingLeft = "0px";
        fieldset.style.paddingTop = "0px";
        fieldset.style.borderStyle = "none";
        for(var value in icons) {
        icocount = icocount + 1;
        var input = document.createElement("input");
        input.type = "radio";
        input.name = "post_icon";
        input.id = "gmqr" + icons[value];
        input.value = icons[value];
        fieldset.appendChild(input);
        if(value == 0) {
        input.checked = "true";
        input.style.marginRight = "18px";
        } else {
        var label = document.createElement("label");
        var img = document.createElement("img");
        img.src = "./img/icons/" + icimg[value];
        label.appendChild(img);
        label.htmlFor = "gmqr" + icons[value];
        fieldset.appendChild(label);
        }
        if(icocount == 4) {
        fieldset.appendChild(document.createElement("br"));
        icocount = 0;
        }
        }
        form.appendChild(fieldset);
        form.appendChild(document.createElement("br"));
        form.appendChild(document.createElement("br"));
        var label = document.createElement("label");
        label.htmlFor = "gmquickreplyta";
        label.style.fontSize = "10px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.style.marginLeft = "31px";
        label.style.verticalAlign = "top";
        label.appendChild(document.createTextNode("Text"));
        form.appendChild(label);
        var textarea = document.createElement("textarea");
        textarea.name = "message";
        textarea.id = "gmquickreplyta";
        textarea.style.width = "500px";
        textarea.style.height = "250px";
        textarea.style.marginLeft = "10px";
        form.appendChild(textarea);
        form.appendChild(document.createElement("br"));
        var input = document.createElement("input");
        input.type = "checkbox";
        input.name = "post_converturls";
        input.checked = "true";
        input.style.marginLeft = "65px";
        input.style.marginTop = "10px";
        form.appendChild(input);
        var label = document.createElement("label");
        label.htmlFor = "post_converturls";
        label.style.fontSize = "10px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.appendChild(document.createTextNode("URLs automatisch erkennen"));
        form.appendChild(label);
        form.appendChild(document.createElement("br"));
        var input = document.createElement("input");
        input.type = "checkbox";
        input.name = "post_disablebbcode";
        input.style.marginLeft = "65px";
        input.defaultValue = "1";
        form.appendChild(input);
        var label = document.createElement("label");
        label.htmlFor = "post_disablebbcode";
        label.style.fontSize = "10px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.appendChild(document.createTextNode("BB-Code deaktivieren"));
        form.appendChild(label);
        form.appendChild(document.createElement("br"));
        var input = document.createElement("input");
        input.type = "checkbox";
        input.name = "post_disablesmilies";
        input.style.marginLeft = "65px";
        input.defaultValue = "1";
        form.appendChild(input);
        var label = document.createElement("label");
        label.htmlFor = "post_disablesmilies";
        label.style.fontSize = "10px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.appendChild(document.createTextNode("Smilies deaktivieren"));
        form.appendChild(label);
        form.appendChild(document.createElement("br"));
        if(ismod) {
        var input = document.createElement("input");
        input.type = "checkbox";
        input.name = "reply_close";
        input.style.marginLeft = "65px";
        input.defaultValue = "1";
        form.appendChild(input);
        var label = document.createElement("label");
        label.htmlFor = "reply_close";
        label.style.fontSize = "10px";
        label.style.fontWeight = "bold";
        label.style.fontFamily = "Verdana, Arial, Trebuchet MS, sans-serif";
        label.innerHTML = "Thread nach Posten schlie&szlig;en";
        form.appendChild(label);
        }
        var input = document.createElement("input");
        input.type = "submit";
        input.name = "submit";
        input.value = "Eintragen";
        input.style.marginLeft = "65px";
        input.accessKey = "s";
        input.style.width = "150px";
        input.style.display = "block";
        input.style.marginTop = "10px";
        form.appendChild(input);
        td.appendChild(form);
        tr.appendChild(td);
        var leiste = links[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
        leiste.parentNode.insertBefore(tr, leiste.nextSibling);
        break;
      }
      i = i - 1;
     }
     if(status == true) {
       document.getElementById("gmquickreply").style.display = "inline";document.getElementById("gmqrcopy").style.display = "block";document.getElementById("gmquickreplyta").focus();document.getElementById("gmquickreplytd1").style.height = "520px"; document.getElementById("gmquickreplytd2").style.height = "420px"; document.getElementById("gmquickreplytd1").style.backgroundColor = "#394E63";document.getElementById("gmquickreplytd2").style.backgroundColor = "#394E63";
     }