// ==UserScript== // @name Whirlpool Last Read // @namespace http://ideatriage.com // @description Adds last read feature to Whirpool forums // @include http://forums.whirlpool.net.au/* // @include http://bc.whirlpool.net.au/* // @exclude http://forums.whirlpool.net.au/whim-send* // @exclude http://forums.whirlpool.net.au/forum-replies.cfm?t=*&p=-2 // This is a user script for the Greasemonkey Firefox extension available at: //http://greasemonkey.mozdev.org/ //this script uses functions introduced in 0.3 and does not support earlier versions of greasemonkey nor does it support the nobbled GM 0.3.5 // Whirlpool Last Read 0.8436 /* 0.8436 Proposed Changes Identify other WLR users Add more smilies Option for both "Post Reply" and "View Preview" buttons. 0.8436 Changes - By Tromac (1/3/2008) Created and added 4 new smilies (angry, confused, ninja and glare) Added astrisk's to rolls eyes and gold star smilies 0.8435 Changes - By Tromac (12/2/2008) Added option to hide removed/deleted threads Added option for auto subscribe after post Fixed "Link" whirlcode buton - Maud'Dib 0.8434 Changes - By Tromac (11/2/2008) Can see if user notes are avaliable or not Fixed voteblock alignment bug with swirls - Big thanks to Yansky for the code 0.8433 Changes - By Tromac (11/2/2008) Added feature to enlarge Quick Quote text area. 0.8432 Changes - By Tromac (11/2/2008) Updated menu structure to match forums page 0.8431 Changes - By Tromac (11/2/2008) Excluded script from view full thread Added option for ignor user button 0.843 Changes - By Tromac (11/2/2008) Fixed recognition of threads without "?t=" tag Semi dynamic menu loads forum links depending on user access Added switch in settings page to select Q-Post 0.842 Changes - By Tromac (10/2/2008) Fixed smilies bug 0.841 Changes - By Tromac (9/2/2008) Updated avatar compatibility with Yansky's avatar system. Updated quick menu and links, including TPR link. Auto mark as read. 0.72 Changes Minor menu tweaks, added music lounge 0.7 Change List: GM 0.6+ Firefox 1.5 compatible Fixed settings Page bug. Fixed image resizing bug. Added multi quote boxes Separated Avatars from theme for more flexibility Themes, ranks, etc. options loaded via xml for instant updates Custom CSS option for quick fixes of appearance User Notes added Auto add show/hide users CSS to above mark all posts read button stop tracking thread button: */ (function() { var currentVersion = "0.71"; // JB functions GM_Storage={ unique:"wimage_", age:1000*60*60*24* 30, // 30 days enough?? setCookie:function(name, value, expires) { document.cookie= name + "=" + escape(value) + "; expires=" + expires.toGMTString(); }, getCookie:function(name) { var dc = ""+document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); }, cookie_setValue:function(name, value) { expires=new Date(); expires.setTime(expires.getTime() + this.age); this.setCookie(this.unique+name, value, expires); }, cookie_getValue:function(name, def) { var value=this.getCookie(this.unique+name); if(!value) value=def; //alert('JB GM name: ' +name +" value: " +value); return value; } }; if(typeof GM_setValue != "function") { GM_setValue=function(){ return GM_Storage.cookie_setValue(arguments[0], arguments[1]) }; GM_getValue=function(){ return GM_Storage.cookie_getValue(arguments[0], arguments[1]) }; } function editObject(tgt) { this.tgt=tgt; this.text=null; this.obj=null; if(window.getSelection || document.getSelection) { this.getSelectedText = this.getSelectedTextDOM; this.addReplaceSelectedText = this.addReplaceSelectedTextDOM; } else if(document.selection) { this.range=null; this.getSelectedText = this.getSelectedTextIE; this.addReplaceSelectedText = this.addReplaceSelectedTextIE; } } editObject.prototype.getSelectedTextDOM=function() { this.text=null; this.obj=null; if (window.getSelection) { this.text=(window.getSelection()).toString(); } else if (document.getSelection) { this.text=(document.getSelection()).toString(); } if(this.text.length==0) { var el = document.getElementById("qqText"); if(!el){ el=document.getElementById("body");} if(el){ if(0<(el.selectionEnd-el.selectionStart)) { this.obj=el; this.text=el.value.substring(el.selectionStart,el.selectionEnd); } } } return this.text; } editObject.prototype.addReplaceSelectedTextDOM=function(s) { var scrollTop=this.tgt.scrollTop; var scrollLeft=this.tgt.scrollLeft; var before; var after; var caretStart; var caretEnd; if(this.obj == this.tgt) { // src and destination element are the same - we replace caretStart=this.tgt.selectionStart; caretEnd=caretStart+s.length; } else { caretEnd=this.tgt.selectionEnd+s.length; caretStart=caretEnd; } before=(this.tgt.value).substring(0,this.tgt.selectionStart); after=(this.tgt.value).substring(this.tgt.selectionEnd); this.tgt.value=before+s+after; this.tgt.setSelectionRange(caretStart, caretEnd); this.tgt.focus(); this.tgt.scrollTop=scrollTop; this.tgt.scrollLeft=scrollLeft; } function writeConfig() { var config=""; for(o in buttons) { if(buttons[o].hidden) { config+=(config.length?":":"")+o; } } GM_setValue("hiddenButtons", config); } function addConfigCheckbox(where, id, label, state) { var newInput=document.createElement("INPUT"); newInput.id=id; newInput.type="checkbox"; newInput.checked=state; var newLabel=document.createElement("LABEL"); newLabel.setAttribute("for",id); newLabel.appendChild(document.createTextNode(label)); where.appendChild(newInput); where.appendChild(newLabel); where.appendChild(document.createElement("BR")); return newInput; } function clickConfig(event) { if(event) { event.stopPropagation(); event.preventDefault(); } var newDiv=document.getElementById("wc_config"); if(newDiv) return; newDiv=document.createElement("DIV"); newDiv.style.position="fixed"; newDiv.style.left="10px"; newDiv.style.top="10px"; newDiv.id="wc_config"; newDiv=document.body.appendChild(newDiv); newDiv=newDiv.appendChild(document.createElement("DIV")); newDiv.style.backgroundColor="#ddddff"; newDiv.style.border="ridge 3px"; newDiv.style.color="#000000"; for(o in buttons) addConfigCheckbox(newDiv, "wc_config_"+o, buttons[o].value.replace(/\-/g,""), buttons[o].hidden?false:true); newDiv.appendChild(document.createElement("BR")); var inClose=newDiv.appendChild(document.createElement("INPUT")); inClose.type="button"; inClose.value="CANCEL"; inClose.addEventListener('click', function() { var div=document.getElementById("wc_config"); document.body.removeChild(div); }, false); var inSubmit=newDiv.appendChild(document.createElement("INPUT")); inSubmit.type="button"; inSubmit.value="ACCEPT"; inSubmit.addEventListener('click',function() { var div=document.getElementById("wc_config"); var btns=div.getElementsByTagName("INPUT"); for(var i=0; i < btns.length; i++) { var btn=btns[i]; if(btn.type=="checkbox") { buttons[btn.id.substr(10)].hidden=btn.checked?false:true; } } writeConfig(); document.body.removeChild(div); }, false); } function clickWhirl(event) { var bId; if(event) { event.stopPropagation(); event.preventDefault(); bId=event.currentTarget.id.substr(3); if(event.which==3) return(clickConfig(event)); } else { event=window.event; bId=event.srcElement.id.substr(3); } var bObj=buttons[bId]; var text=edit.getSelectedText(); var pre="["+bObj.whirl.substr(0,1); var post=bObj.whirl.substr(-1)+"]"; if(text.length) { if(bObj.re && bObj.replace) { var tt=text.split("|"); tt[0]=tt[0].replace(bObj.re, bObj.replace); text=tt.join("|"); } edit.addReplaceSelectedText(pre+text+post); } else { edit.addReplaceSelectedText(bObj.opened?post:pre); bObj.opened=!bObj.opened; } } function clickUrl(event) { var bId; if(event) { event.stopPropagation(); event.preventDefault(); bId=event.currentTarget.id.substr(3); if(event.which==3) return(clickConfig(event)); } else { event=window.event; bId=event.srcElement.id.substr(3); } var bObj=buttons[bId]; var promptText=bId.substr(7); var url=edit.getSelectedText(); var pre=''; var post=""; var cutPos=-1; if(!url) { var textArea=document.getElementById("body"); if(!textArea)textArea=document.getElementById("f_body"); if(!textArea)textArea=document.getElementById("qqText"); if(textArea && textArea.setSelectionRange) { textArea.focus(); var caret=textArea.selectionStart; var txt=textArea.value; var c=txt.substr(caret, 1); if(c>" ") { var start=caret; var end=caret; while(start>-1 && txt.substr(--start,1)>" "); start++; while(end" "); url=txt.substring(start,end); textArea.setSelectionRange(start, end+1); } } } if(!url) { var clean=txtDest.value.replace(/\n/gm," "); var sp=clean.split(" "); if(sp.length) { var indx=sp.length-1; var check=sp[indx].toLowerCase(); if(!check.length) check=sp[--indx].toLowerCase(); if(check.indexOf("http://") == 0 || check.indexOf("https://") == 0 || check.indexOf("ftp://") == 0) { url=sp[indx]; cutPos=txtDest.value.lastIndexOf(url); } } } if(url.length) { var text; var DefaultUrlPrompt='Click here ...'; if(promptText=="Text") text=window.prompt("Enter desription for this link", DefaultUrlPrompt); else if(promptText=="Href") { text=url; url=""; url=window.prompt("Enter url", "http://"); } if(text.length && url.length) { if(cutPos >= 0) txtDest.value=txtDest.value.substr(0, cutPos); edit.addReplaceSelectedText(pre+url+mid+text+post); } } } function readConfig() { var config=GM_getValue("hiddenButtons", ""); if(config.length) { var configArray=config.split(":"); for(var i=0; i < configArray.length; i++) { if(buttons[configArray[i]]) buttons[configArray[i]].hidden=true; } } } function addButtons(el, txtDest) { readConfig(); var btnEl=document.createElement("button"); btnEl.style.fontSize="1em"; btnEl.style.color="#001188"; btnEl.style.margin="0"; btnEl.style.padding="0"; btnEl.id="wc_config_button"; btnEl.appendChild(document.createTextNode("\u00a9")); btnEl=el.appendChild(btnEl); btnEl.addEventListener('click', clickConfig, false); for(var o in buttons) { var bn=buttons[o]; bn.opened=false; // flag for when no text selected btnEl=document.createElement("button"); btnEl.style.margin="0"; btnEl.style.padding="0"; btnEl.id="wc_"+o; btnEl.accessKey=bn.key; if(bn.hidden) { btnEl.style.width="0"; btnEl.style.height="0"; btnEl.style.borderStyle="none"; } else { var splits=bn.value.split("-"); var access=document.createElement("SPAN"); access.style.color="#aa3333"; access.appendChild(document.createTextNode(splits[1])); btnEl.appendChild(document.createTextNode(splits[0])); btnEl.appendChild(access); btnEl.appendChild(document.createTextNode(splits[2])); btnEl.style.fontSize="1em"; btnEl.style.color="#001188"; } btnEl=el.appendChild(btnEl); if(o.substr(0,5) == "whirl") { btnEl.title=o.substr(5)+" WhirlCode"; btnEl.addEventListener('click', clickWhirl, false); } if(o.substr(0,7) == "makeUrl") { btnEl.title="Add url "+o.substr(7); btnEl.addEventListener('click', clickUrl, false); } } } // end JB functions function is_all_ws( nod ){ return !(/[^\t\n\r ]/.test(nod.data)); } function loadWLRvalues(){ //load values from threadRead into associative array and return it. var test = GM_getValue('threadRead'); var basicArray = test.split(RegExp(" *, *", "gi")); var assArray = new Array(); //alert('values stored: ' +basicArray.length); for (var i = 0; i < basicArray.length; i++){ tempArray = basicArray[i].split(RegExp(" *: *", "gi")); assArray[eval('\"' +tempArray[0] +'\"')] = tempArray[1]; } return assArray; } function WLR_getValue(key, wlrArray, defaultValue){ for ( var j in wlrArray){ if ( j == key){ return wlrArray[j] } } return defaultValue; } function WLR_setValue(event, WLRkey, WLRvalue){ WLRarray = loadWLRvalues(); //else check array length < max value var arL=0; var match =0; for ( var j in WLRarray){ arL++; //check if already in array if(j==WLRkey){ //if yes mark value for deletion WLRarray[WLRkey]='delete'; match=1; } } WLRmaxValue = GM_getValue('WLRmaxValue'); if( (arL+1 - match ) >= WLRmaxValue){ //greater than or equal to max value, even counting match deletion.. var count =0; for (var i in WLRarray){ if (count < (arL-match-WLRmaxValue)){ WLRarray[i]= 'delete'; count++; } } } var arrayString = ""; for (var k in WLRarray){ if(WLRarray[k]!= 'delete'){ //add to array arrayString += k +":" +WLRarray[k] +", "; }else{ //alert('deleting: '+k +" : " +WLRarray[k]); } } //add final new value arrayString += WLRkey +":" +WLRvalue +", "; GM_setValue('threadRead', arrayString); event.preventDefault(); } function WLR_settings(e){ GM_setValue(e.target.name.substr(2), e.target.value); //e.preventDefault(); } function WLR_lastPostLink (threadStyle, WLRValues){ var xpth1 ="//tr/td[@class = '"+threadStyle +"2'][1]"; var numReply = document.evaluate( xpth1, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var xpth2 ="//tr/td[@class = '"+threadStyle +"4'][last()]"; // get last post link -note turn into function someday allThread = document.evaluate( xpth2, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < allThread.snapshotLength; i++) { var thisThread = allThread.snapshotItem(i).firstChild.href; startPos =thisThread.indexOf('=') + 1; var endPos = thisThread.indexOf('&'); linkTopic = thisThread.substring(startPos, endPos); linkReply = WLR_getValue(linkTopic, WLRValues, 0)*1; if (linkReply>0){ totalPosts =numReply.snapshotItem(i).innerHTML*1 +1; var newPosts = totalPosts - linkReply; //modify last post link allThread.snapshotItem(i).firstChild.href = 'http://forums.whirlpool.net.au/forum-replies.cfm?t=' +linkTopic +'&p=' +Math.ceil(linkReply/pperpage) +'#r' +linkReply; allThread.snapshotItem(i).className = threadStyle+'6'; allThread.snapshotItem(i).firstChild.title = newPosts; if(newPosts>0){ //new posts since last read //allThread.snapshotItem(i).style.backgroundColor = 'orange'; allThread.snapshotItem(i).parentNode.className = 'wlr_new'; allThread.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.innerHTML +=" (" +newPosts +")"; mrk = document.createElement("a"); xTxt = document.createTextNode(" #"); mrk.appendChild(xTxt); mrk.id = linkTopic+"_"+totalPosts; mrk.title = 'mark all replies as read'; mrk.addEventListener('click',function(evt){tmpAr = evt.target.id.split('_'); WLR_setValue(evt,tmpAr[0],tmpAr[1]); evt.target.parentNode.parentNode.className ='wlr_no_new';evt.target.style.display ="none";},false); allThread.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.appendChild(mrk); }else{ //no new posts since last read //allThread.snapshotItem(i).style.backgroundColor = 'yellow'; allThread.snapshotItem(i).parentNode.className = 'wlr_no_new'; } stpTrk = document.createElement("a"); xTxt = document.createTextNode(" x"); stpTrk.appendChild(xTxt); stpTrk.id = linkTopic+"_"+totalPosts; stpTrk.title = 'Stop tracking this thread'; stpTrk.addEventListener('click',function(evt){tmpAr = evt.target.id.split('_'); WLR_setValue(evt,tmpAr[0],'delete'); evt.target.parentNode.parentNode.className ='';evt.target.style.display ="none"; evt.target.previousSibling.style.display ="none"},false); allThread.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.appendChild(stpTrk); } } } function WLR_lastPostLinkUser (threadStyle, WLRValues){ var xpth1 ="//tr/td[@class = '"+threadStyle +"2'][2]"; var numReply = document.evaluate( xpth1, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var xpth2 ="//tr/td[@class = 'threadUP4a']|//tr/td[@class = 'threadUP4b']|//tr/td[@class = 'threadUP4c']"; // get last post link -note turn into function someday allThread = document.evaluate( xpth2, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < allThread.snapshotLength; i++) { if(allThread.snapshotItem(i).firstChild.nextSibling){ var thisThread = allThread.snapshotItem(i).firstChild.nextSibling.href; }else{ var thisThread = allThread.snapshotItem(i).firstChild.href; } startPos =thisThread.indexOf('=') + 1; var endPos = thisThread.indexOf('&'); linkTopic = thisThread.substring(startPos, endPos); linkReply = WLR_getValue(linkTopic, WLRValues, 0)*1; if (linkReply>0){ //modify last post link if(allThread.snapshotItem(i).firstChild.nextSibling){ allThread.snapshotItem(i).firstChild.nextSibling.href = 'http://forums.whirlpool.net.au/forum-replies.cfm?t=' +linkTopic +'&p=' +Math.ceil(linkReply/pperpage) +'#r' +linkReply; }else{ allThread.snapshotItem(i).firstChild.href = 'http://forums.whirlpool.net.au/forum-replies.cfm?t=' +linkTopic +'&p=' +Math.ceil(linkReply/pperpage) +'#r' +linkReply; } allThread.snapshotItem(i).className = "threadN6"; allThread.snapshotItem(i).style.backgroundImage=""; totalPosts =numReply.snapshotItem(i).innerHTML*1 +1; var newPosts = totalPosts - linkReply; if(newPosts>0){ //new posts since last read allThread.snapshotItem(i).parentNode.className = 'wlr_new'; allThread.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.innerHTML +=" (" +newPosts +")"; mrk = document.createElement("a"); xTxt = document.createTextNode(" #"); mrk.appendChild(xTxt); mrk.id = linkTopic+"_"+totalPosts; mrk.title = 'mark all replies as read'; mrk.addEventListener('click',function(evt){tmpAr = evt.target.id.split('_'); WLR_setValue(evt,tmpAr[0],tmpAr[1]); evt.target.parentNode.parentNode.className ='wlr_no_new';evt.target.style.display ="none";},false); allThread.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.appendChild(mrk); }else{ //no new posts since last read allThread.snapshotItem(i).parentNode.className = 'wlr_no_new'; } stpTrk = document.createElement("a"); xTxt = document.createTextNode(" x"); stpTrk.appendChild(xTxt); stpTrk.id = linkTopic+"_"+totalPosts; stpTrk.title = 'Stop tracking this thread'; stpTrk.addEventListener('click',function(evt){tmpAr = evt.target.id.split('_'); WLR_setValue(evt,tmpAr[0],'delete'); evt.target.parentNode.parentNode.className ='';evt.target.style.display ="none"; evt.target.previousSibling.style.display ="none"},false); allThread.snapshotItem(i).previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.appendChild(stpTrk); } } } function makeMenu(menArray, addition){ var newDiv = document.createElement("div"); var tempList=""; for (i=1; i<(menArray.length-1); i++){ var tLink =menArray[i].split(RegExp(" *\\^ *","gi")); tempList +='
  • ' +tLink[0] +'
  • '; } newDiv.innerHTML += ''; newDiv.className ="mainMenu"; newDiv.id = menArray[0]; //newDiv.id +="wlrMenu_"+menArray[0]; return(newDiv); } function makeMenuHTML(menArray){ var newDiv = document.createElement("div"); var tempList=""; for (var i=1; i<(menArray.length); i++){ tempList +='
  • ' +menArray[i] +'
  • '; } newDiv.innerHTML += ''; newDiv.className="mainMenu"; newDiv.id ="searchMenu"; //newDiv.id +="wlrMenu_"+menArray[0]; return(newDiv); } function addGlobalStyle(css) { var head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = css; head.appendChild(style); } function addRadioSetting(setting, title, explanation){ var WLRset = document.createElement("div"); WLRset.className="setExp"; WLRset.id = 'id_'+setting; var settingValue = eval(setting); sp = document.createElement("span"); sp.className ="setting"; lab1 = document.createElement("label"); lab2 = document.createElement("label"); lab1.innerHTML = 'on'; lab2.innerHTML = 'off'; in1 = document.createElement("input"); in1.name = 'r_'+setting; in1.type = 'radio'; in1.value = '1'; in2 = document.createElement("input"); in2.name = 'r_'+setting; in2.type = 'radio'; in2.value = '0'; if (settingValue == 1){ in1.checked = true; }else{ in2.checked=true; } in1.addEventListener("click",function(event){ WLR_settings(event);},false); in2.addEventListener("click",function(event){ WLR_settings(event);},false); lab1.appendChild(in1); lab2.appendChild(in2); sp.appendChild(lab1); sp.appendChild(lab2); spEx = document.createElement("span"); spEx.className = "setHead"; spEx.innerHTML = title; brk = document.createElement("br"); expTxt = document.createElement("span"); expTxt.innerHTML = explanation; WLRset.appendChild(sp); WLRset.appendChild(spEx); WLRset.appendChild(brk); WLRset.appendChild(expTxt); var wikiN = document.getElementById('replies'); wikiN.parentNode.insertBefore(WLRset, wikiN); } function addListSetting(settingAr, labelAr, setting, title, explanation){ var WLRset = document.createElement("div"); WLRset.className="setExp"; WLRset.id = 'id_'+setting; sp = document.createElement("span"); sp.className ="setting"; sel = document.createElement("select"); sel.name = 's_'+setting; deflt = GM_getValue(setting); for (i=0; i0 ||hrefLower.indexOf(".gif") >0 || hrefLower.indexOf("png") >0) && hrefLower.indexOf(".php")<1 && hrefLower.indexOf(".asp")<1){ //image detected. var imL = document.createElement("img"); imL.src = imageNode.href; imL.setAttribute("id", "picZ" +i); imL.style.maxWidth = window.zImgWidth + "px"; if((imL.naturalWidth < 2000) && (imL.naturalHeight < 2000)){ imL.addEventListener('load', function(event){if(this.width>maxW){this.width =maxW};},false); imL.addEventListener('click', function(event){if(this.width==maxW){this.width =this.naturalWidth}else if(this.width>maxW){this.width =maxW};}, false); imageNode.parentNode.insertBefore(imL, imageNode); imgBrk = document.createElement("br"); imageNode.parentNode.insertBefore(imgBrk, imageNode); } } } } function showNote(evt){ txtBlock = evt.target.parentNode.firstChild.nextSibling; if(txtBlock.style.display =="none"){ txtBlock.style.display ="block"; txtBlock.value = GM_getValue('u'+txtBlock.id,''); txtBlock.addEventListener('change', function(evt){GM_setValue('u'+evt.target.id, evt.target.value);},false); }else{ txtBlock.style.display ="none"; txtBlock.removeEventListener('change',function(evt){},false); } } function hideUser(evt){ var customCSS = GM_getValue('customCSS'); customCSS += ".wlr_"+evt.target.id +" {display:none;}" GM_setValue('customCSS', customCSS); } function shortcutKeys(evt, repUrl){ // saves textarea for quickquote if(!evt){ alert('huh?'); }else if (evt.ctrlKey==1 && evt.keyCode==13 ){ postReply(evt, repUrl); }else if (evt.ctrlKey==1 && evt.keyCode==32){ clearQuote(evt); } //evt.preventDefault(); } //Smilies - define swaps much further down below //The angry, confused, ninja and glaring smilies were created and are copyrighted by Tromac (1/3/2008) //confused var smlConfused = ""; //ninja var smlNinja = ""; //glare var smlGlare = ""; //angry var smlAngry = ""; //smiling var smlHappy = "\":)\""; // frowning var smlFrown = "\":(\""; // sticking tongue out var smlRazz = "\":P\""; // big grin var smlGrin =""; // neutral, straight mouth var smlNtl =""; // wink var smlWink =""; var smlRoll =""; var smlShock =""; var smlEvil =""; var imgStar =""; //JB buttons // buttons to add // var buttons={ whirlBold :{ value:"-b-old", whirl:"*", key:"b" }, whirlItalic :{ value:"-i-talic", whirl:"/", key:"i" }, whirlSingleQuote :{ value:"'quo-t-e'", whirl:"'", key:"t" }, whirlDoubleQuote :{ value:'"-q-uote"', whirl:'"', key:'q' }, whirlQuote :{ value:"w-h-o", whirl:"+", key:"h" }, // looks like rubbish whirlSuperscript :{ value:"su-p-er", whirl:"^", key:"p" }, whirlSubscript :{ value:"sub-\\-", whirl:"\\", key:"\\" }, whirlStrike :{ value:"stri-k-e", whirl:"-", key:"k" }, whirlCourier :{ value:"-c-ourier", whirl:"#", key:"c" }, whirlSmall :{ value:"s-m-all", whirl:"()", key:"m" }, whirlGrey :{ value:"g-r-ey", whirl:"`", key:"r" }, whirlSerif :{ value:"-s-erif", whirl:"~", key:"s" }, whirlGoogle :{ value:"-g-oogle", whirl:"?", key:"g" }, whirlEscape :{ value:"-e-sc", whirl:".", key:"e" }, whirlWiki :{ value:"-w-iki", whirl:"[]", key:"w", re:/_/g, replace:" " }, makeUrlText :{ value:"-l-ink", key:"l" }, makeUrlHref :{ value:"-u-rl", key:"u" }, }; // // add buttons to el, they will add whirlcode to element txtDest //end JB buttons //load settings//////////////////////////// var wlrVers = GM_getValue('version',0)*1; //alert('wlrVers: ' +wlrVers); if(wlrVers < currentVersion){ //first run (0.5 is the first version to track these things, make a nested if statement for new versions so they don't override settings already set by user) alert('This version of Whirlpool Last Read is being run for the first time, new settings will use default values'); if(wlrVers < 0.501){ GM_setValue('lRead', 1); GM_setValue('styleFlip', 0); GM_setValue('smilies', 1); GM_setValue('preName', ""); GM_setValue('postName', " writes..."); GM_setValue('prevDone',0); GM_setValue('threadRead',""); GM_setValue('qPost', 0); GM_setValue('ignoreSwitch', 0); GM_setValue('qqRows', 10); GM_setValue('hideDRThreads', 0); GM_setValue('autoSubscribe', 0); } if(wlrVers < 0.502){ GM_setValue('imgL', 0); } if(wlrVers < 0.503){ GM_setValue('autoClear', 1); } if(wlrVers < 0.61){ GM_setValue('smallMon', 0); GM_setValue('avatar', 0); } if(wlrVers < 0.67){ GM_setValue('navMenu',1); GM_setValue('theme_enabled', 0); } GM_setValue('floatQuote', 0); GM_setValue('qqNum', 3); GM_setValue('currentQq',1); GM_setValue('customCSS','a{}'); GM_setValue('WLRmaxValue', 400); GM_setValue('imgWidth', 300); GM_setValue('version', currentVersion); } //these are not editable, the numbers are just defaults that will be used if values in about:config get damaged. var WLRmaxValue =GM_getValue('WLRmaxValue',300); var zImgWidth =GM_getValue('imgWidth', 300); var lRead = GM_getValue('lRead'); var smallMon = GM_getValue('smallMon'); var styleFlip = GM_getValue('styleFlip'); var avatar = GM_getValue('avatar'); var theme_enabled = GM_getValue('theme_enabled', 0); var smilies =GM_getValue('smilies'); var autoClear = GM_getValue('autoClear',0); var qPost = GM_getValue('qPost'); var ignoreSwitch = GM_getValue('ignoreSwitch'); var qqRows = GM_getValue('qqRows'); var hideDRThreads = GM_getValue('hideDRThreads'); var autoSubscribe = GM_getValue('autoSubscribe'); var navMenu = GM_getValue('navMenu'); var prevDone = GM_getValue('prevDone')*1; var imgL = GM_getValue('imgL',0); var floatQuote = GM_getValue('floatQuote', 0); var rank = GM_getValue('rank', 0); var qqNum = GM_getValue('qqNum', 3); var currentQq = GM_getValue('currentQq', 1); var customCSS = GM_getValue('customCSS','a{}'); //end user modifiable settings, Only change things below this line if you know what you're doing. var threadDisplay = "&n=" +GM_getValue('threadDisplay',30); // Number of posts per page, DONT CHANGE THIS YET OR YOU"LL BREAK STUFF var pperpage = 20; // Number of alternate images for current theme. var theme_alt =2; //misc. variables, var allThread, thisThread, topic, position, startPos, userNum; //url of current page urlcheck = window.location.href; window.picArray = new Array(); //nav bar //css //addGlobalStyle('div.menuHD:hover{background-color: #9999FF;}'); addGlobalStyle(customCSS); if (navMenu>0){ addGlobalStyle('.mainMenu ul { list-style-type: none; z-index: 50 !important;} .mainMenu ul ul li {background: #616CA3; padding: 5px;} .mainMenu ul ul li:hover{ background-color:#FF9933;} .mainMenu { width: auto; font-family: Arial, sans-serif;} .mainMenu > ul > li { background: #3A437B; left: -38px; font: 1.2em arial, sans-serif;} .mainMenu ul li:hover{background:#FF9933;} .mainMenu li.more:after{ content: url(../images/arrow.gif);} .mainMenu > ul { margin: 0; font: 0.9em Arial, sans-serif; border-left:10px black solid; width: 92%;} .mainMenu a {text-decoration: none; color: white;} .mainMenu > ul li { list-style-type: none; border:black solid 1px; border-left: 3px; position: relative; margin: 0;} .mainMenu > ul ul {display: none;} .mainMenu > ul li:hover > ul {display: block; position: absolute; top: -1px; left: 70%; z-index: 3; width: 10em; font: 0.8em Arial, sans-serif;} .mainMenu > li a { display: block; text-decoration: none;} #searchMenu ul li:hover > ul {display: block; width: 300px !important;} '); //"Your Links" on navbar //addGlobalStyle('#nav_info div.nav_item {display: none}'); //var yourLinksBar = document.getElementById('nav_info'); //if (yourLinksBar) { // yourLinksBar.parentNode.removeChild(yourLinksBar); //} //Check which lounges are avaliable to load into menu - Tromac if((document.location.host.indexOf("whirlpool") >= 0) && (document.location.pathname=="/" || document.location.pathname=="/forum.cfm")&&document.location.host.indexOf("forums.") !== -1) { var sections={}; var things = document.evaluate('//TD[@class="indexL2"]/DIV/A/B', document.body, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); var currSect=null; GM_setValue('tprLounge', 'false'); GM_setValue('partLounge', 'false'); GM_setValue('itnLounge', 'false'); for(var i=0; i' +'' +'' +'' +'
    ' +'' +'Google' +'
    ' +'' +'' +'
    ' +'' +'' +'' +'' +'' +'
    ' +'' +'Web' +'' +'' +'forums.whirlpool.net.au' +'
    ' +'' +'' +'' +'' +'' +'' +'' +'' +'
    ' +''; var SearchArray = new Array(); SearchArray = SearchMenu.split(RegExp(" *, *", "gi")); //main catergories = new Array(); //top of sidebar allDivs = document.evaluate( //directly below logo "//td[@class='pagenav']/div[2]", //middle of sidebar // "//div[@class='un_welc1']", //just before 'Your Links section // "//div[@class='un_stuff'][last()]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); welcomeDiv = allDivs.snapshotItem(0); menuDiv = makeMenu(SettingArray,""); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(WhirlArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(MobileArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(CompaniesArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(TechArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(CompArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(LoungeArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenu(ConnectionsArray,threadDisplay); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); menuDiv = makeMenuHTML(SearchArray); welcomeDiv.parentNode.insertBefore(menuDiv, welcomeDiv); } //Operations for main forum pages if(urlcheck.indexOf('user.cfm') != -1){ //load last read on user page if(lRead>0){ addGlobalStyle('@import "http://ideatriage.com/files/wlrtheme/rank/small/themex2.css";' +'td.threadN6 { border-bottom: 1px solid #BBB; background: #DDD url(/img/forum/grad-grey.gif); }'); lastReadArray = loadWLRvalues(); WLR_lastPostLinkUser ('threadUP', lastReadArray); } } if(urlcheck.indexOf('?f') != -1){ if(lRead>0){ addGlobalStyle('@import "http://ideatriage.com/files/wlrtheme/rank/small/themex2.css";' +'td.threadN6 { border-bottom: 1px solid #BBB; background: #DDD url(/img/forum/grad-grey.gif); }'); lastReadArray = loadWLRvalues(); WLR_lastPostLink ('threadN', lastReadArray); WLR_lastPostLink ('threadS', lastReadArray); WLR_lastPostLink ('threadO', lastReadArray); //Hide removed/deleted threads if (hideDRThreads == 1) { addGlobalStyle('.threadP0, .threadP1, .threadP2, .threadP3, .threadP4{display:none;}'); } } } //Operations for thread pages) else if(urlcheck.indexOf('?t=') != -1 || urlcheck.indexOf('forum-replies.cfm?r=') != -1) { if(smallMon>0){ addGlobalStyle('#replies td.bodyuserRead{vertical-align: top !important;}'); } //css for thread pages if(avatar>0){addGlobalStyle('@import "http://ideatriage.com/wlr/avatar/avatar.css"; ');} if(avatar>0){addGlobalStyle('@import "http://goodbyepolar.com/wpavatars/avatar.css"; ');} if(rank!=0){addGlobalStyle('@import "' +rank +'";')}; if(theme_enabled!=0){addGlobalStyle('@import "'+theme_enabled +'";' )}; addGlobalStyle('#replies td.bodyuserRead{ background: url("data:image/gif,GIF89a%08%00d%00%B3%00%00%F3%E8%DC%F4%EA%DF%F5%EC%E2%F3%E9%DD%F8%F2%EB%F5%ED%E3%F4%EB%E0%F6%EF%E6%F7%F0%E8%F7%F1%E9%F6%EE%E5%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%00%00%00%00%00%2C%00%00%00%00%08%00d%00%00%04W%90%C8I%AB%BD4%E9%CD%7BB%60(%8E%C8a%9Ehz(l%CB%16p%2C%CFt%2C%DCx%AE%EF%7C%EF%E3%86%A0pH%2C%0A%03%C8%A4r%C9l%3A%9F%D0%C0%60J%ADZ%AF%D8l%15%C0%EDz%BF%E0%B0xL.%9B%CF%E8%B4z%CDn%BB%DF%F0%B8%7CN%AF%DB%EF%F8%BC%3C%02%00%3B") #F3E8DC repeat-x top; vertical-align: bottom; border-bottom: 1px solid #bbb; font: 10px "Lucida Grande",Verdana,Arial,Helvetica,sans-serif; } ' +'.clearCSS {border:0px solid gray; color:black; background:#DAF2B3; width:150px; font:16px Arial;} .textCSS {width: 80%; border:0px solid gray; color:black; background:#e5e5e5;}' +'img {border:none;}' +'.greylink{background:none; border:none; padding:0px; margin:0px; font: 1em arial, sans-serif; color:grey; cursor: pointer;}' +'a.greylink:hover{color:grey}' +'div.userNote {position: absolute !important; float:left; clear:both; z-index: 5 !important;}' +'.noteTxt{position:absolute !important; z-index: 20 !important; right:-200px; top:-5px;-moz-border-radius:8px; border: solid black 1px; padding:px;}' +'.noteAvail button{border: solid 2px #000080 !important}' +'.infoBut{height:20px; width:20px; border: solid 2px #CCCCCC !important;}'); //Change colour of Q-Post button depending on setting if (qPost == 1) { addGlobalStyle('.previewCSS {border:0px solid gray; color:black; background:#bfcefe; width:150px; font:16px Arial;} '); } else { addGlobalStyle('.previewCSS {border:0px solid gray; color:black; background:#ffdcbf; width:150px; font:16px Arial;} '); } if(floatQuote>0){ addGlobalStyle('#quickQuote{position: fixed; top:3px; left:460px; background: white; -moz-border-radius:18px; border: solid black 3px;}' +'.op25{-moz-opacity: 0.25;}' +'.op95{-moz-opacity: 0.95;}'); } //find user #'s userNum = document.evaluate( "//td[@class = 'bodyuser']/div[1]|//td[@class = 'bodyuser_r']/div[1]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); //find user rank var userRank = document.evaluate( "//td[@class = 'bodyuser']/div[3] | //td[@class = 'bodyuser_r']/div[3]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0; iSection Mod'){ rankT = 'Section_Mod'; } //rankT = rankT.replace(/Section Mod<\/a>/g,"Section_Mod"); rankT = rankT.replace(/<\/a>/g, ""); rankT = rankT.replace(/\s/g, "_"); rankT = rankT.replace(/'/g, "_"); rankT = rankT.replace(/,/g, "_"); userRank.snapshotItem(i).parentNode.parentNode.className = rankT; } if (imgL ==1){ showImages(zImgWidth); } lastReadArray = loadWLRvalues(); //thread page, get topic #//////////////// startPos =urlcheck.indexOf('=') + 1; endPos = urlcheck.indexOf('&'); GM_setValue('prevDone',0); var endPos2 = urlcheck.indexOf('#'); if (endPos<0 && endPos2<0){ //no extra arguments in url check topic = urlcheck.substring(startPos ); }else{ if(endPos<0){ //no '&' so use index of # as endpoint endPos = endPos2; } topic = urlcheck.substring(startPos, endPos); } if(lRead>0){ var lastRead = WLR_getValue(topic, lastReadArray, 0); lastRead *=1; } //get current page # in breadcrumb menu var cPage = document.evaluate( "//td[@class = 'm2a']//span |//td[@class = 'm2']//span", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); if(cPage.snapshotItem(0)){ cPage = cPage.snapshotItem(0); // next page access key if(cPage.nextSibling.nextSibling){ cPage.nextSibling.nextSibling.accessKey ="."; } //previous page access key if(cPage.previousSibling.previousSibling){ cPage.previousSibling.previousSibling.accessKey =","; } } //reply link var repURL = document.evaluate( "//a[@class = 'breply']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(i=0; i0){ replyURL = repURL.snapshotItem(i).href; break; } } //draw quick quote textarea var qq = document.evaluate( "/html/body/div/div[3]/div/div[6]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); var qQuote = document.createElement("textarea"); qQuote.name ='qqText'; qQuote.id = 'qqText'; qQuote.className='textCSS'; //Change following value to change size of quick quote text area. Note: size is in characters, not pixels. qQuote.cols = '100'; if(floatQuote>0){ qQuote.rows = '1'; }else{ qQuote.rows = qqRows; } if(autoClear ==1){ if(urlcheck.indexOf('#bottom')>= 0){ if(currentQq>=qqNum){ GM_setValue('currentQq',1); }else{ currentQq++; GM_setValue('currentQq',currentQq); } currentQq = GM_getValue('currentQq'); GM_setValue('qQuoter'+currentQq,''); } } if(floatQuote>0){ qQuote.addEventListener('focus', function(event){hideQuote(event);},false); qQuote.blur(); } // qQuote.addEventListener('focus', function(event){alert('focus');event.target.rows=10;event.preventDefault(); },false); qQuote.value = unescape(GM_getValue('qQuoter'+currentQq,'')); qQuote.addEventListener('keydown', function(event){shortcutKeys(event, replyURL);},false); qqDiv = document.createElement("div"); qqDiv.align = 'center'; qqDiv.appendChild(qQuote); qqDiv.id = 'quickQuote'; if (floatQuote>0){ qqDiv.className ='op25'; } var brk = document.createElement("br"); qqDiv.appendChild(brk); //preview button prevBtn =document.createElement("input"); prevBtn.type = 'submit'; prevBtn.className= 'previewCSS'; //Q-Post button if (qPost == 1) { prevBtn.value="Post Reply" ; } else { prevBtn.value="View Preview" ; } prevBtn.accessKey ="1"; prevBtn.addEventListener('click', function(event){postReply(event, replyURL)}, false); qqDiv.appendChild(prevBtn); //spacer spacer = document.createElement("text"); spacer.innerHTML = "     "; qqDiv.appendChild(spacer); //clear button clearBtn =document.createElement("input"); clearBtn.type = 'reset'; clearBtn.className= 'clearCSS'; clearBtn.value="Clear" ; clearBtn.accessKey ="2"; clearBtn.addEventListener('click', function(event){clearQuote(event); },false); qqDiv.appendChild(clearBtn); sel = document.createElement("select"); sel.name = 'quoteCopy'; deflt = GM_getValue('currentQq',1); for (i=1; i<=qqNum; i++){ opt = document.createElement('option'); opt.value = i; if(opt.value == deflt){ opt.selected = true; } optTxt = document.createTextNode(i); opt.appendChild(optTxt); sel.appendChild(opt); } sel.addEventListener("change",function(evt){Savetxt(evt); GM_setValue('currentQq', evt.target.value); document.getElementById('qqText').value = unescape(GM_getValue('qQuoter'+evt.target.value,'')); },false); qqDiv.appendChild(sel); var qText = qq.snapshotItem(0).parentNode.insertBefore(qqDiv,qq.snapshotItem(0)); window.addEventListener('unload', function(event){Savetxt(event)}, false); //Check if subscribed to thread - Tromac var chkSubscribed = document.evaluate( "//div[@id='subscription_bar']/a" , document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue.textContent.match('Unsubscribe'); if(chkSubscribed){ GM_setValue('subscribed', 'true'); } else { GM_setValue('subscribed', 'false'); } // JB code var textArea=document.getElementById("body"); var buttonLocation; if(textArea) { var url=document.location.href; if(url.indexOf("forum-reply.cfm?r")>-1){ var p2i=document.evaluate("//input[@name='post2']", document,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null); p2i=p2i.singleNodeValue; if(p2i) { window.post2input=p2i; p2i.id="post2"; } } if(url.indexOf("whim-send.cfm")<0){ var targetTr=textArea.parentNode.parentNode.previousSibling; while(targetTr && targetTr.nodeName!="TR") targetTr=targetTr.previousSibling; if(!targetTr) return;//don't have a previous row ... maybe we could add one ... not in this version var tds=targetTr.getElementsByTagName("TD"); if(tds.length < 2) return;// buttonLocation=tds[1]; buttonLocation.style.fontSize="80%"; buttonLocation.style.textAlign="center"; } else { var tNode=document.getElementsByTagName("BLOCKQUOTE")[0]; if(tNode) { var newDiv=document.createElement("DIV"); buttonLocation=tNode.parentNode.insertBefore(newDiv, tNode); buttonLocation.style.fontSize="80%"; newDiv.style.textAlign="center"; } } } if(!textArea) { textArea=document.getElementById("f_body"); if(textArea) { var tNode=document.getElementById("f_form"); if(!tNode) return; tNode=tNode.parentNode; if(!tNode) return; var newDiv=document.createElement("DIV"); buttonLocation=tNode.appendChild(newDiv); buttonLocation.style.fontSize="120%"; } } if(!textArea) { textArea=document.getElementById("qqText"); if(textArea) { var tNode=textArea.parentNode; if(!tNode) return; var newDiv=document.createElement("DIV"); buttonLocation=tNode.insertBefore(newDiv,textArea); buttonLocation.style.fontSize="80%"; } } var edit; if(textArea && buttonLocation) { edit=new editObject(textArea); addButtons(buttonLocation, textArea); } else { window._whirlCode = function() { var textArea=document.getElementById("qqText"); var buttonLocation; if(textArea) { var tNode=textArea.parentNode; if(!tNode) return; var newDiv=document.createElement("DIV"); buttonLocation=tNode.insertBefore(newDiv,textArea); } if(textArea && buttonLocation) { edit=new editObject(textArea); addButtons(buttonLocation, textArea); } }; } // end JB code //userName var userName = document.evaluate( "//span[@class = 'bu_name']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); userNameAr = new Array(); for( var lp=0; lp0){ urltopic = urlcheck.substring(0, urlcheck.indexOf("&")); }else{ urltopic = urlcheck; } var n = document.createElement("button"); var nt = document.createTextNode("q-quote"); n.className = 'greylink'; n.id =cPost2+'_'+userNameAr[loop]; n.addEventListener("click", function(event){quotePost(event, urltopic)}, false); n.appendChild(nt); nodeTemp.parentNode.insertBefore(n, nodeTemp); var bar = document.createElement("span"); bar.className = 'bar'; bar.innerHTML = ' | '; nodeTemp.parentNode.insertBefore(bar,nodeTemp); if(lRead>0){ //add bookmark button var n2 = document.createElement("a"); var nt2 = document.createTextNode("mark"); n2.className = 'greylink'; n2.href ='#'; n2.id = cPost; n2.addEventListener("click", function(event){WLR_setValue(event, topic , this.id)},false); n2.appendChild(nt2); nodeTemp.parentNode.insertBefore(n2, nodeTemp); var bar2 = document.createElement("span"); bar2.className = 'bar'; bar2.innerHTML = ' | '; nodeTemp.parentNode.insertBefore(bar2,nodeTemp); if (lastRead >= cPost){ //is read, apply css style if(styleFlip==0){ var cssTemp = nodeTemp.parentNode.parentNode; cssTemp.className +=' bodyuserRead'; }else{ } }else{ //stuff to do to unread posts if(styleFlip!=0){ var cssTemp = nodeTemp.parentNode.parentNode; cssTemp.className +=' bodyuserRead'; }else{ } } } } for(i=0; i0 && (urlcheck.indexOf('ux') == -1)){ var lastAnchor = anchorAr[anchorAr.length-1]; if(lastRead < lastAnchor){ //update last read # if(lastAnchor > 20000){ alert('Whirlpool Last Read Error: \n reply value too high. Please copy these values and contact Meat Sack \n Topic:'+topic +'\n lastAnchor:' +lastAnchor ); }else{ //WLR_setValue(topic, lastAnchor); window.addEventListener('load', function(event){WLR_setValue(event, topic, lastAnchor);}, false); } } } //ignore user button display. not in use yet addGlobalStyle('.voteblock {margin:0 !important;width:100px !important;}' +'.voteblock>span{float:left !important;margin:4px 2px;}' +'.voteblock>span *{float:left !important;margin:0 !important;}'); if (ignoreSwitch == 1) { addGlobalStyle('.voteblock {margin:0 !important;width:120px !important;}'); ignoreUser = document.evaluate( "//span[@class = 'voteitem'][1]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < ignoreUser.snapshotLength; i++) { userTemp = ignoreUser.snapshotItem(i); var vbAlign = document.createElement("span"); var ignoreCtr = document.createElement("span"); var ignoreBtn = document.createElement("span"); ignoreBtn.className ="voteitem"; ignoreBtn.title ="ignore user"; ignoreBtn.id = userNumber[i]; ignoreBtn.addEventListener('click',function(evt){hideUser(evt)},false); smlTxt = document.createTextNode(":X"); ignoreBtn.appendChild(smlTxt); ignoreCtr.appendChild(ignoreBtn); spc = document.createTextNode(" "); ignoreCtr.appendChild(spc); userTemp.parentNode.insertBefore(ignoreCtr, userTemp); } } //smiley code if(smilies ==1){ smileys = { "\\*ninja\\*" : smlNinja, ":-S" : smlConfused, ":S" : smlConfused, "\\*confused\\*": smlConfused, "\\*glare\\*": smlGlare, "¬_¬" : smlGlare, ">:\\)" : smlEvil, ">:-\\)" : smlEvil, "\\*angry\\*": smlAngry, ">:\\(" : smlAngry, ":-@" : smlAngry, ":@" : smlAngry, ">:-\\(" : smlAngry, ":\\)" : smlHappy, ":-\\)" : smlHappy, ":\\(" : smlFrown, ":-\\(" : smlFrown, ":D" : smlGrin, ":-D" : smlGrin, ":\\|" : smlNtl, ":-\\|" : smlNtl, ":P" : smlRazz, ":-P" : smlRazz, ";\\)" : smlWink, ";-\\)" : smlWink, "\\*rolls eyes\\*": smlRoll, "rolls eyes": smlRoll, ":o" : smlShock, ":-o" : smlShock, "\\*gold star\\*" :imgStar, "gold star" : imgStar }; regex = {}; for (key in smileys) { regex[key] = new RegExp(key, 'g'); //alert('regex: ' +regex[key]); } textnodes = document.evaluate( "//td[@class = 'bodytext']//text()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); k=0; for (var i = 0; i < textnodes.snapshotLength; i++) { node = textnodes.snapshotItem(i); if(!is_all_ws(node)){ //GM_log(node.data); var s = document.createElement("span"); node.data = node.data.replace(//g,">"); s.innerHTML = node.data.replace(/\s+$/g, ' '); for (key in smileys) { s.innerHTML = s.innerHTML.replace(regex[key], smileys[key]); } node.parentNode.replaceChild(s, node); } } } }else if(urlcheck.indexOf('reply.cfm') != -1){ //code to copy quick quote text area to the reply box, & keep it there even after preview. if(urlcheck.indexOf('e=') == -1){ if (prevDone == 0 && document.getElementsByTagName('textarea')[1].value ==''){ document.getElementsByTagName('textarea')[1].value = unescape(GM_getValue('qQuoter'+currentQq,'')); if(document.getElementsByTagName('textarea')[1].value != ''){ GM_setValue('prevDone',1); //If subscribed, mark post as read if ((GM_getValue('subscribed') == 'true')||(autoSubscribe == 1)) { markReadBox = document.getElementById("modesu"); markReadBox.click(); GM_setValue('subscribed', 'false'); } //Check for Q-Post if (qPost == 1) { prevbutton = document.getElementById("post"); prevbutton.click(); } else { prevbutton = document.getElementById("prev"); prevbutton.click(); } } } // JB code } var textArea=document.getElementById("body"); var buttonLocation; if(textArea) { var url=document.location.href; var p2i=document.evaluate("//input[@name='post2']", document,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null); p2i=p2i.singleNodeValue; if(p2i) { window.post2input=p2i; p2i.id="post2"; } var targetTr=textArea.parentNode.parentNode.previousSibling; while(targetTr && targetTr.nodeName!="TR") {targetTr=targetTr.previousSibling; } if(!targetTr){ alert('1');return;}//don't have a previous row ... maybe we could add one ... not in this version var tds=targetTr.getElementsByTagName("TD"); //if(tds.length < 2) {alert('2'); return;}// buttonLocation=tds[1]; buttonLocation.style.fontSize="80%"; buttonLocation.style.textAlign="center"; } var edit; if(textArea && buttonLocation) { edit=new editObject(textArea); addButtons(buttonLocation, textArea); } else { window._whirlCode = function() { var textArea=document.getElementById("qqText"); var buttonLocation; if(textArea) { var tNode=textArea.parentNode; if(!tNode) return; var newDiv=document.createElement("DIV"); buttonLocation=tNode.insertBefore(newDiv,textArea); } if(textArea && buttonLocation) { edit=new editObject(textArea); addButtons(buttonLocation, textArea); } }; } // end jb code }else if(urlcheck.indexOf('tag=wlr') != -1){ //settings page //settings page styles addGlobalStyle('.setHead { font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #333366; font-style: normal; font-weight: bolder;}' +'.setExp { font-family: Arial, Helvetica, sans-serif; background-color: #CCCCCC; padding: 3px; width: 609px; margin-left: 20px; border-top: solid 1px;} ' +'.setting { background-color: #666666; float: right; clear:both; padding: 3px; color: #FFFFFF; font-weight: bold; }' +'.settingLink { font: 0.6em Arial; color: #FFFFFF; font-weight: bold; text-decoration: none;}' +'#id_customCSS {height: 300px;}' +'#id_customCSS textarea{width:400px; height: 280px;}'); //theme XML load //alert (typeof GM_xmlhttpRequest); if(typeof GM_xmlhttpRequest != "undefined") { GM_xmlhttpRequest({ method:"GET", url:"http://ideatriage.com/wlr/theme.xml", headers:{ "User-Agent":"monkeyagent", "Accept":"text/monkey,text/xml", }, onload:function(doc) { doc = doc.responseText.replace(/<\?xml.*\?>/,''); doc = new XML(doc); nameAr = new Array(); j =0; for each( i in doc..name){ nameAr[j] =i; j++ } valueAr = new Array(); k = 0; for each (l in doc..url){ valueAr[k] = l; k++ } addListSetting(valueAr , nameAr, 'theme_enabled', 'Theme', 'How avatars and/or rankings are laid out'); }, onerror:function(details){ alert('error'); } }); //rank XML load GM_xmlhttpRequest({ method:"GET", url:"http://ideatriage.com/wlr/rank.xml", headers:{ "User-Agent":"monkeyagent", "Accept":"text/monkey,text/xml", }, onload:function(doc) { doc = doc.responseText.replace(/<\?xml.*\?>/,''); doc = new XML(doc); nameAr = new Array(); j =0; for each( i in doc..name){ nameAr[j] =i; j++ } valueAr = new Array(); k = 0; for each (l in doc..url){ valueAr[k] = l; k++ } addListSetting(valueAr , nameAr,'rank', 'Rank Graphics', 'What set of rank icons to use'); }, onerror:function(details){ alert('error'); } }); } var WLRset = document.createElement("div"); WLRset.className="setExp"; WLRset.innerHTML ='Whirlpool Last Read Settings:
    For more information see wiki entry below.'; var wikiN = document.getElementById('replies'); wikiN.parentNode.insertBefore(WLRset, wikiN); addRadioSetting('lRead', "Last Read Tracker", "Turns Last Read Tracker on or off"); addListSetting(['100','300', '500', '1000', '2000', '5000'] , ['100','300', '500', '1000', '2000', '5000'],'WLRmaxValue', 'Threads to Track', 'Number of threads for the last read tracker'); addRadioSetting('styleFlip', "Style Flip", "Change what gets shaded when tracker is on.
    On = unread posts shaded,
    Off = read posts shaded"); addRadioSetting('smilies', "Smilies", "With smilies on, script will change:
    :)
    into:
    "+smlHappy); addRadioSetting('imgL', "Links to Images", "turns links to images, into images, won't work unless link is direct to image"); addRadioSetting('autoClear', "Clear Quote after post", "will clear quick qote after a post (and any time #bottom appears in the url, so watch out)"); addRadioSetting('smallMon', "Small Monitor", "If you use the 'small monitor' setting in the official whirlpool settings, turn this on as well"); addRadioSetting('avatar', "Avatars", "Display avatars in posts?"); addRadioSetting('hideDRThreads', "Hide Deleted/Removed Threads in forum view", "Self explanatory. Forum view becomes much less cluttered."); addRadioSetting('navMenu', "Navigation Menu", "Functional, but not customizable yet."); addRadioSetting('qPost', "Quick Post", "When turned on, a \"Post Reply\" button replaces the \"View Preview\" button."); addRadioSetting('autoSubscribe', "Auto-Subscribe", "Automatically subscrie to a thread when you make a post."); addListSetting(['10','15', '20', '25', '30', '35'] , ['10','15', '20', '25', '30', '35'],'qqRows', 'Quick Quote Text Area', 'Increase the number of rows of the Quick Quote text area.'); addRadioSetting('ignoreSwitch', "IgnoreUser Button", "Adds a button next to each user's aura vote smilies, which when activated will prevent you from seeing that user. "); addRadioSetting('floatQuote',"BETA: Endless Pages", "Compatability mode for JB's endless forum pages script, Does NOT work yet."); addTextSetting('customCSS','Custom CSS' , 'Adds any CSS entered in text field'); } })();