User:Theemperor/monobook.js

//<!-- var smileyBox;

function showSmileyBar { vis = (smileyBox.style.display == "block"); if (!vis) {   var toolbar = document.getElementById('toolbar'); toolbar.appendChild(smileyBox); smileyBox.style.display = "block"; } else { smileyBox.style.display = "none"; } }

function smileys { /* if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageId" : "smileyButton", "imageFile": "http://rationalwiki.com/wiki/images/9/9e/Button_goat.png", "speedTip": "Smileys", "tagOpen": "", "tagClose": "", "sampleText": ""} }*/

var toolbar = document.getElementById('toolbar'); if (!toolbar) { return false; }

var textbox = document.getElementById('wpTextbox1'); if (!textbox) { return false; }

// Don't generate buttons for browsers which don't fully // support it. if (!(document.selection && document.selection.createRange)   && textbox.selectionStart === null) { return false; } /* var smileyButton = document.getElementById("smileyButton"); smileyButton.onclick = function { showSmileyBar; return false; };*/

var image = document.createElement("img"); image.width = 23; image.height = 22; image.className = "mw-toolbar-editbutton"; image.id = "smileyButton"; image.src = "http://rationalwiki.com/wiki/images/9/9e/Button_goat.png"; image.border = 0; image.alt = "Smileys"; image.title = "Smileys"; image.style.cursor = "pointer"; image.onclick = function { showSmileyBar; return false; };

toolbar.appendChild(image); smileyBox = document.createElement("div"); smileyBox.id = "smileyBox"; smileyBox.style.position = "static"; /* smileyBox.style.width = "200px"; smileyBox.style.height = "200px";*/ smileyBox.style.backgroundColor = "CornflowerBlue"; /*populate smiley box using RationalWiki:Smileys*/ var req = false; if (window.XMLHttpRequest) { req = new XMLHttpRequest; } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req) { req.open("GET", "http://rationalwiki.com/wiki/index.php?title=RationalWiki:Smileys", true); //req.overrideMimeType("text/xml"); req.onreadystatechange = function {     if (req.readyState==4 && req.status == 200) { var xmlhack = document.createElement("div"); xmlhack.innerHTML = req.responseText; var divs = xmlhack.getElementsByTagName("div"); //var divs = req.responseXML.documentElement.getElementsByTagName("div"); var bci; var i;       for (i=0; i0) {         addSmiley(smileyBox,imgs.item(0)); }     }    }    req.send(null); }

smileyBox.style.display = "none"; return true; }

function addSmiley(parent, item) { item.onclick = function { insertTags( + item.alt + ,,); return false; }; item.style.margin="4px"; item.style.cursor = "pointer"; item.title = item.alt; parent.appendChild(item); }

hookEvent("load", smileys); //-->