User:Daedryon/monaco.js

ajaxPages = new Array("Special:RecentChanges");

function setCookie(c_name,value,expiredays) { var exdate=new Date exdate.setDate(exdate.getDate+expiredays) document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString) }

function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=") if (c_start!=-1) { c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return "" }

function getXmlHttpRequestObject { if (window.XMLHttpRequest) { return new XMLHttpRequest; //Not Internet Explorer } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); //Internet Explorer } else { //fail silently } } getRCDataRO = getXmlHttpRequestObject; var cr = new RegExp("\r", "gm"); var lf = new RegExp("\n", "gm"); var endText = new RegExp(' [\t\s]*?[\t\s]*? ', "mi"); var rcTimer; var rcRefresh = 60000; function preloadAJAXRC { if (skin == "monaco") { s = 1; } else { s = 0; } ajaxRCCookie = (getCookie("ajaxload-"+wgPageName)=="on") ? true:false; document.getElementsByTagName("h1")[0].innerHTML += ' Enable Recent Changes Auto-Refresher '; document.getElementById("ajaxRCtoggle").checked = ajaxRCCookie; if (getCookie("ajaxload-"+wgPageName)=="on") loadRCData; }

function toggleRC { if (document.getElementById("ajaxRCtoggle").checked == true) { setCookie("ajaxload-"+wgPageName, "on", 30); loadRCData; } else { setCookie("ajaxload-"+wgPageName, "off", 30); clearTimeout(rcTimer); } }

function loadRCData { if (getRCDataRO.readyState == 4 || getRCDataRO.readyState == 0) { if (location.href.indexOf("/wiki/")) { rcURL = "http://" + location.hostname + "/wiki/" + wgPageName + location.search; } else { rcURL = "http://" + location.hostname + "/" + wgPageName + location.search; } getRCDataRO.open("GET", rcURL, true); getRCDataRO.onreadystatechange = parseRCdata; getRCDataRO.send(null); } }

function parseRCdata { if (getRCDataRO.readyState == 4) { textFilter = new RegExp(' .*? [\t\s]*?[\t\s]*? ', "i"); rawRCdata = getRCDataRO.responseText.replace(cr, "").replace(lf, ""); filteredRCdata = textFilter.exec(rawRCdata); updatedText = filteredRCdata[0].replace(' ', "").replace(endText, ""); document.getElementById("bodyContent").innerHTML = updatedText; rcTimer = setTimeout("loadRCData;", rcRefresh); } }

for (x in ajaxPages) { if (wgPageName == ajaxPages[x]) addOnloadHook(preloadAJAXRC); }

if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/c/c9/Button_strike.png?1", "speedTip": "Strikeout", "tagOpen": " ", "tagClose": " ", "sampleText": "Strikeout"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/3/3a/Button_headline3.png?1", "speedTip": "Level 3 headline", "tagOpen": "===", "tagClose": "===", "sampleText": "Headline text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/central/images/0/08/Button_headline4.png?1", "speedTip": "Level 4 headline", "tagOpen": "====", "tagClose": "====", "sampleText": "Headline text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/0/0b/Button_headline5.png?1", "speedTip": "Level 5 headline", "tagOpen": "=====", "tagClose": "=====", "sampleText": "Headline text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/2/28/Button_wikilink.png?1", "speedTip": "Link", "tagOpen": "",    "tagClose": "", "sampleText": "Link"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/3/3b/Button_template_alt.png?1", "speedTip": "Template", "tagOpen": "", "sampleText": "Template"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/b/b4/Button_category03.png?1", "speedTip": "Category", "tagOpen": "[[Category:",    "tagClose": "]]", "sampleText": "Category"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/4/47/Button_redir.png?1", "speedTip": "Redirect", "tagOpen": "#REDIRECT ",    "tagClose": "", "sampleText": "Redirect"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/central/images/2/29/Button_user.png?1", "speedTip": "Userpage", "tagOpen": "User:",    "tagClose": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/central/images/b/bc/Usertalk.png?1", "speedTip": "Usertalk", "tagOpen": "User_talk:",    "tagClose": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/1/1f/ButtonCastleCrashers.png?1", "speedTip": "Castle Crashers", "tagOpen": "Castle_Crashers_Wiki:",    "tagClose": "", "sampleText": "Insert Link"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/f/f6/Button_html_comment.png?1", "speedTip": "HTML comment", "tagOpen": "", "sampleText": "HTML"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/2/23/Button_code.png?1", "speedTip": "Code", "tagOpen": " ", "sampleText": "Code"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/7/73/Button_code_nowiki.png?1", "speedTip": "Code + NoWiki", "tagOpen": " ", "sampleText": "NoWiki"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/central/images/d/d5/Button_noinclude.png?1", "speedTip": "NoInclude", "tagOpen": " ", "tagClose": " ", "sampleText": "NoInclude"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/5/5f/Button_center.png?1", "speedTip": "Text Centering", "tagOpen": " ", "tagClose": " ", "sampleText": "Text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/central/images/a/a7/ButtonYouTube.png?1", "speedTip": "YouTube", "tagOpen": " ", "tagClose": " ", "sampleText": "YT Video Code"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images3.wikia.nocookie.net/central/images/8/8c/Button_RedX.png?1", "speedTip": "Mark for Deletion", "tagOpen": "", "sampleText": "Reason"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/central/images/3/3b/Button_stubsvg.png?1", "speedTip": "Mark as Stub", "tagOpen": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images4.wikia.nocookie.net/central/images/8/88/Btn_toolbar_enum.png?1", "speedTip": "Numbered List", "tagOpen": "#", "tagClose": "Insert Text", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/4/4e/Button_Bullets.png?1", "speedTip": "Dash List", "tagOpen": "*", "tagClose": "Insert Text", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/7/70/Button_lower_letter.png?1", "speedTip": "SubScript", "tagOpen": " ", "tagClose": " ", "sampleText": "Text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/8/80/Button_upper_letter.png?1", "speedTip": "SuperScript", "tagOpen": " ", "tagClose": " ", "sampleText": "Text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/1/1b/Button_miss_signature.png?1", "speedTip": "Unsigned", "tagOpen": "", "sampleText": "Username/IP"};

}