// ==UserScript== // @name WLR for IE & Opera // @namespace http://forums.whirlpool.net.au // @version 0.1 // @description A port to IE & Opera of Meat Sack's WLR script // @include http://forums.whirlpool.net.au/* // @exclude http://forums.whirlpool.net.au/forum-replies.cfm?*p=-2* // ==/UserScript== /**important to do**/ //set up otions page to turn on/off features //put the smack-down on Bravo /**not important to do**/ //add wiki autolinks //contact is now online //common phrases //delicious tagger? /*function bugga(bugsName,bugsValue){ if($('#hideShow')[0] === undefined){ $('body').prepend(''); } var tempHoldDebug = $('#debugDiv').html(); $('#debugDiv').html(tempHoldDebug+"

----------------------------------

"+""+bugsName+":  "+bugsValue+"

"); $('#hideShow').unbind(); $('#hideShow').mouseup( function(){$('#debugDiv').toggle();}); }*/ /***Meat Sack's Smilies***/ var smlHappy = ''; var smlFrown = ''; var smlRazz = ''; var smlGrin =''; var smlNtl =''; var smlWink =''; var smlRoll =''; var smlShock =''; var smlEvil =''; var imgStar =''; var imgGUWPCT =''; smileys = { ">:\\)" : smlEvil, ":\\)" : smlHappy, ":-\\)" : smlHappy, ":\\(" : smlFrown, ":-\\(" : smlFrown, ":D" : smlGrin, ":-D" : smlGrin, ":\\|" : smlNtl, ":-\\|" : smlNtl, ":P" : smlRazz, ":-P" : smlRazz, ";\\)" : smlWink, ";-\\)" : smlWink, "rolls eyes": smlRoll, ":o" : smlShock, ":-o" : smlShock, "GUWPCT" : imgGUWPCT, "gold star" : imgStar }; regex = {}; for (key in smileys) { regex[key] = new RegExp(key, 'g'); } $('.bodytext').each(function(){ for (key in smileys) { var smilRep = $(this).html().replace(regex[key], smileys[key]); $(this).html(smilRep); } }); /*******whirlcode********/ var whirlCode = { wc_whirlBold : { encloseLeft : "[*", encloseRight : "*]"}, wc_whirlItalic : { encloseLeft : "[/", encloseRight : "/]"}, wc_whirlSingleQuote : { encloseLeft : "['", encloseRight : "']"}, wc_whirlDoubleQuote : { encloseLeft : "[\"", encloseRight : "\"]"}, wc_whirlQuote : { encloseLeft : "[+", encloseRight : "+]"}, wc_whirlSuperscript : { encloseLeft : "[^", encloseRight : "^]"}, wc_whirlSubscript : { encloseLeft : "[\\", encloseRight : "\\]"}, wc_whirlStrike : { encloseLeft : "[-", encloseRight : "-]"}, wc_whirlCourier : { encloseLeft : "[#", encloseRight : "#]"}, wc_whirlSmall : { encloseLeft : "[(", encloseRight : ")]"}, wc_whirlGrey : { encloseLeft : "[`", encloseRight : "`]"}, wc_whirlSerif : { encloseLeft : "[~", encloseRight : "~]"}, wc_whirlGoogle : { encloseLeft : "[?", encloseRight : "?]"}, wc_whirlEscape : { encloseLeft : "[.", encloseRight : ".]"}, wc_whirlWiki : { encloseLeft : "[[", encloseRight : "]]"} }; /********whirlcode buttons*********/ var wcButtons = '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
'; /*******whirlcode buttons event handler********/ function doStuffToTheText(theTextBox){ $('.wcodeButtons').mouseup(function(){ var buttonID = $(this).attr('id'); var currentValue = theTextBox.value; var theSelection = document.selection.createRange().text; theTextBox.focus(); if(theSelection === ""){ if(buttonID == "wc_whirlurl"){ document.selection.createRange().text = '&<#^&#'; $('body').prepend(''); $('body').prepend('
'+ '

Enter link title:

'+ '  
'); $('.cancel').mouseup(function(){ $('#modal,#modal2').remove(); $('#body')[0].value = $('#body')[0].value.replace("&<#^&#",""); theTextBox.focus(); }); setTimeout("$('#urlAddress').focus();", 5); var urlAdd; $('#ok')[0].onmouseup = firstOK; $('#urlAddress')[0].onkeyup = function (evt) { if (!evt) { evt = window.event; } if(evt.keyCode == 13){ firstOK(); } }; function firstOK(){ if ($('#urlAddress')[0].value !== ""){ urlAdd = $('#urlAddress')[0].value; $('#modal').remove(); setTimeout("$('#urlName').focus();", 5); } } $('#ok2')[0].onmouseup = secondOk; $('#urlName')[0].onkeyup = function (evt) { if (!evt) { evt = window.event; } if(evt.keyCode == 13){ secondOk(); } }; function secondOk(){ if ($('#urlName')[0].value !== ""){ var urlN = $('#urlName')[0].value; $('#modal2').remove(); if(urlAdd.indexOf('http') < 0){ $('#body')[0].value = $('#body')[0].value.replace('&<#^&#',''+urlN+''); } else{ $('#body')[0].value = $('#body')[0].value.replace('&<#^&#',''+urlN+''); } } } } else if(((currentValue.split(whirlCode[buttonID].encloseLeft).length+currentValue.split(whirlCode[buttonID].encloseRight).length) % 2) === 0){ document.selection.createRange().text = whirlCode[buttonID].encloseLeft; } else{ document.selection.createRange().text = whirlCode[buttonID].encloseRight; } } else if((theSelection !== "") && (buttonID != 'wc_whirlurl')){ document.selection.createRange().text = whirlCode[buttonID].encloseLeft + theSelection + whirlCode[buttonID].encloseRight; } theTextBox.focus(); theSelection = ''; }); } var lrl; if(document.cookie.indexOf('wlrcookie') > -1){ var docCookArray = document.cookie.split('; '); var wlrCookArray = []; for(ca=0;ca -1){ var cookieSplit = docCookArray[ca].split('wlrcookie=')[1]; wlrCookArray.unshift(cookieSplit); //so oldest cookie is at end } } var wlrCookArrayString = wlrCookArray.toString().replace(/,/,""); var arr; var regexCheat = wlrCookArrayString+"t%3D"; } /*******run on forum-threads.cfm page********/ /****Cookies & Last Read Function on forum-threads.cfm page*****/ if((document.URL.indexOf('threads') > -1) || (document.URL.indexOf('user') > -1)){ $('td[@width=23] a').each(function(){ var bottomLinkParent = $(this).parent(); var cutHref = this.href.slice(this.href.indexOf('t=')+2,this.href.indexOf('&p=-1#bottom')); if(wlrCookArrayString.indexOf(cutHref) > -1){ bottomLinkParent.clone().css({opacity: "0.4"}).insertAfter(bottomLinkParent); var getLastRead = regexCheat.slice(regexCheat.indexOf(cutHref), regexCheat.indexOf('t%3D', regexCheat.indexOf(cutHref))); this.href = this.href.replace("&p=-1#bottom","").replace(""+cutHref+"", ""+decodeURIComponent(getLastRead)+""); //bugga('this.href.replace("&p=-1#bottom","").replace(""+cutHref+"", ""+decodeURIComponent(getLastRead)+""); ',this.href.replace("&p=-1#bottom","").replace(""+cutHref+"", ""+decodeURIComponent(getLastRead)+"")); bottomLinkParent.css({background:"#DDDDDD url(http://img.photobucket.com/albums/v215/thegooddale/red-ltgrey.gif) repeat scroll 0%"}); $(this).children('img').attr('alt','Jump to last read post in thread'); } }); } ///end Cookies & Last Read Function on forum-threads.cfm page /*******run on forum-replies page********/ if (document.URL.indexOf('replies') > -1) { var threadNoCheck = $('a').contains('First post')[0].href.replace("&p=-1",""); var threadNumberWc; if (threadNoCheck.indexOf('#') > -1){ threadNumberWc = threadNoCheck.slice(threadNoCheck.indexOf('t=')+2, threadNoCheck.indexOf('#')); } else{ threadNumberWc = threadNoCheck.split('t=')[1]; } var replyLink = $('.breadtask a:first')[0].href; /****Avatars*****/ var lnk = document.createElement('LINK'); lnk.rel = 'stylesheet'; lnk.type = 'text/css'; lnk.href = 'http://ideatriage.com/wlr/avatar/avatar.css'; document.getElementsByTagName( 'HEAD' )[0].appendChild( lnk ); $("td[@class^=bodyuser]").each(function(){ $(this).children('a:first').wrap('
'); //temp fix so the div:first-child in the WLR CSS works var tempLinkuserId = $(this).children('div:eq(2)').children('a:first')[0].href; var prunedId = tempLinkuserId.slice(tempLinkuserId.indexOf('id=')+3); $(this).parent().addClass('wlr_'+prunedId); }); if (replyLink.indexOf("print") === -1){ //check if thread is closed $('.greylink:even').after(' | q-quote'); /*******insert the quick quote text box********/ $('#replies').after('
' + '
' + wcButtons+ '' + '' + '' + '' + '' + '' + '' + '
' + ' ' + '' + '
' + '
'); /***event handlers for Preview & Clear Buttons***/ var getOnce = $('#body'); var theTextBox = getOnce[0]; $('#prev').mouseup(function(){ this.value = 'Please wait...'; return true; }); $('#clearText').mouseup(function(){ theTextBox.value = ""; theTextBox.focus(); return false; }); /***quick quote function***/ $('.qquoteie').click(function(){ var theClick = $(this); var txt = document.selection.createRange().text; var getLink = theClick.prev().prev().attr("href"); var getPostId = getLink.slice(getLink.indexOf("r=")+2, getLink.indexOf("&tp")); var getUserName = theClick.parent().parent().prev().prev().find('.bu_name').text(); var writesID = "[+"+getPostId+" "+getUserName+" writes... +]\n"; var writesText = '["'+txt+'"]\n\n'; var anyTextInBox = theTextBox.value; if (anyTextInBox !== ""){ theTextBox.value = anyTextInBox+"\n"+writesID+writesText; } else{ theTextBox.value = writesID+writesText; } window.scrollBy(0, 999999999); theTextBox.focus(); return false; }); getOnce.css("width","70%"); doStuffToTheText(theTextBox); } /****Cookies & Last Read Function on forum-replies page*****/ var anchorAray = []; var hrefArray = []; function getY( element, linkHref ){ var iReturnValue = 0; iReturnValue += element.offsetTop; element = element.offsetParent; iReturnValue += element.offsetTop; anchorAray.push(iReturnValue); hrefArray.push(linkHref); } $('a[@title$=specific post]').each(function(){ getY(this, this.href); }); var largestScrollY = 1; window.onscroll = function() { if (document.documentElement.scrollTop > largestScrollY){ //change to window.pageYOffset if need to get it to work in FF largestScrollY = document.documentElement.scrollTop; } }; function writeToCookie(lrl){ function putStringArrayBackToCookie(lrl ,arr) { var w = 0; var wlrCookArrayFinal = []; for(i=0;i= 4000) && ( document.cookie.split('; ').length < 19)){ //if current cookie's length is greater than or equal to 4000 (about 4K in size) & there are less than 19 cookies, create a new cookie var x = document.cookie.charAt(document.cookie.lastIndexOf('wlrcookie')-1); //the last index of wlrcookie should be the most recent cookie var xIncrement = x++; document.cookie = xIncrement+'wlrcookie='+lrl+';expires=Fri, 17 Dec 2009 10:00:00 GMT'; } else if(wlrCookArrayString.indexOf(threadNumberWc) < 0){ //if the thread number is not in any cookie, if( document.cookie.split('; ').length < 18){ var arrSplit = wlrCookArrayString.split( "t%3D" ); arrSplit.shift(); arr = arrSplit.reverse(); //split it then reverse it so when allocate back to cookies, the first item(which will be the oldest anchor) will be allocated to the oldest cookie first - which will then be at the end of the cookie's value putStringArrayBackToCookie(lrl, arr); } else{ var arrSplit = wlrCookArrayString.split( "t%3D" ); arrSplit.shift(); arr = arrSplit.reverse(); //split it then reverse it so when allocate back to cookies, the first item(which will be the oldest anchor) will be allocated to the oldest cookie first - which will then be at the end of the cookie's value arr.pop(); putStringArrayBackToCookie(lrl, arr); } } else if((wlrCookArrayString.indexOf(threadNumberWc) > -1) && (Number(regexCheat.slice(regexCheat.indexOf('%23r', regexCheat.indexOf(threadNumberWc))+4, regexCheat.indexOf('t%3D', regexCheat.indexOf(threadNumberWc)))) < Number(lrl.split('%23r')[1]))){ //if they move down an already tracked page - should save new anchor (if it's higher) and delete old one - var toSearchFor = regexCheat.slice(regexCheat.indexOf(threadNumberWc)-4, regexCheat.indexOf('t%3D', regexCheat.indexOf(threadNumberWc))); //search & remove if( document.cookie.split('; ').length < 18){ var repTosear = wlrCookArrayString.replace(""+toSearchFor+"", ""); if(repTosear.length === 0){ document.cookie = '0wlrcookie='+lrl+';expires=Fri, 17 Dec 2009 10:00:00 GMT'; } else{ var arrSplit = repTosear.split( "t%3D" ); arrSplit.shift(); //remove first empty split on left arr = arrSplit.reverse(); //split it then reverse it so when allocate back to cookies, the first item(which will be the oldest anchor) will be allocated to the oldest cookie first - which will then be at the end of the cookie's value putStringArrayBackToCookie(lrl, arr); } } else{ if(wlrCookArray[wlrCookArray.length-1].slice(wlrCookArray[wlrCookArray.length-1].lastIndexOf("t%3D")).indexOf(threadNumberWc) > -1){ var arrSplit = wlrCookArrayString.split("t%3D"); arrSplit.shift(); //remove first empty split on left arr.pop(); //remove anchor from the end beacuse it contains the anchor we want to replace anyway arr.pop(); //remove anchor from the end so enough room to put another one in cookie arr = arrSplit.reverse(); //split it then reverse it so when allocate back to cookies, the first item(which will be the oldest anchor) will be allocated to the oldest cookie first - which will then be at the end of the cookie's value putStringArrayBackToCookie(lrl, arr); } else{ wlrCookArrayString = wlrCookArrayString.replace(""+toSearchFor+"", ""); var arrSplit = wlrCookArrayString.split( "t%3D" ); arrSplit.shift(); //remove first empty split on left arr.pop(); //remove anchor from the end so enough room to put another one in cookie arr = arrSplit.reverse(); //split it then reverse it so when allocate back to cookies, the first item(which will be the oldest anchor) will be allocated to the oldest cookie first - which will then be at the end of the cookie's value putStringArrayBackToCookie(lrl, arr); } } } } function readFromCookieOnThread(){ if(document.cookie.indexOf('wlrcookie') > -1){ if(wlrCookArrayString.indexOf(threadNumberWc) > -1) { var anchorfromCookie = regexCheat.slice(regexCheat.indexOf('%23r', regexCheat.indexOf(threadNumberWc))+4, regexCheat.indexOf('t%3D', regexCheat.indexOf(threadNumberWc))); var getAnchorNumber; for(h=0;h -1)){ alert("(document.URL.indexOf('#') < 0) && (anchorString.indexOf(anchorInPage) > -1)"+(document.URL.indexOf('#') < 0) && (anchorString.indexOf(anchorInPage) > -1)); window.location = anchorInPage; } */ } } } function findMin(numArrayLength, tempAnchorAray){ var tempHoldMeh; for(j=0;j 0) && ((tempAnchorAray[j] < tempHoldMeh) || (tempHoldMeh === undefined))){ tempHoldMeh = tempAnchorAray[j]; lrl = encodeURIComponent(hrefArray[j].substr(hrefArray[j].indexOf('?')+1)); } } writeToCookie(lrl); } function saveTheCookieSaveTheWorld(){ if(document.URL.indexOf('bottom') > -1){ lrl = encodeURIComponent(hrefArray[hrefArray.length-1].substr(hrefArray[hrefArray.length-1].indexOf('?')+1)); writeToCookie(lrl); } else{ var numArrayLength = anchorAray.length; var tempAnchorAray = []; for(i=0;i -1){ $(this).children('img:last').after('
'); } else if(this.href.toLowerCase().lastIndexOf('.jpeg') > -1){ $(this).children('img:last').after('
'); } else if(this.href.toLowerCase().lastIndexOf('.bmp') > -1){ $(this).children('img:last').after('
'); } else if(this.href.toLowerCase().lastIndexOf('.png') > -1){ $(this).children('img:last').after('
'); } else if(this.href.toLowerCase().lastIndexOf('.gif') > -1){ $(this).children('img:last').after('
'); } }); }//end of run on forum-replies page /***run on wiki pages****/ else if(document.URL.indexOf('wiki') > -1){ var theTextBox = $('#f_body')[0]; $('#f_body').after(wcButtons); doStuffToTheText(theTextBox); } /***run on whim read****/ else if(document.URL.indexOf("whim-read")>-1){ for (key in smileys) { var smilRep = $('#replies').html().replace(regex[key], smileys[key]); $('#replies').html(smilRep); } } /***run on whim send****/ else if(document.URL.indexOf("whim-send")>-1){ var theTextBox = $('#body')[0]; $('#body').css({width:'600px'}).before(wcButtons); $('#buttonsDiv').css({fontSize: '80%', textAlign: 'center', marginTop: '5px', marginBottom: '5px', width:'600px'}); doStuffToTheText(theTextBox); for (key in smileys) { var smilRep = $('td[@bgcolor="#c3c9de"]').html().replace(regex[key], smileys[key]); $('td[@bgcolor="#c3c9de"]').html(smilRep); } } /***run on preview page****/ else if(document.URL.indexOf("reply")>-1){ var theTextBox = $('#body')[0]; $('#body').css({width:'600px',marginTop: '10px'}).before(wcButtons).parent().css('width','600px'); doStuffToTheText(theTextBox); for (key in smileys) { var smilRep = $('.bodytext:last').html().replace(regex[key], smileys[key]); $('.bodytext:last').html(smilRep); } } /***run on user page****/ else if(document.URL.indexOf("forum-user.cfm")>-1){ var theTextBox = $('#body')[0]; $('#body').before(wcButtons); $('#buttonsDiv').css({fontSize: '80%', textAlign: 'center', marginTop: '5px', marginBottom: '5px'}).parent().css("width","410px").parent().parent().css("width","410px"); doStuffToTheText(theTextBox); document.forms[ 1 ].elements.namedItem( 'body' ).style.width = "400px"; document.forms[ 1 ].elements.namedItem( 'body' ).setAttribute( "rows", "10"); document.forms[ 1 ].elements.namedItem( 'subject' ).style.width = "400px"; document.forms[ 1 ].elements.namedItem( 'subject' ).style.marginBottom = "20px"; if(document.URL.indexOf($(".nav_item_name > a > span").text().split('user ')[1]) > -1){ var aboutTr = $('tr[@valign=bottom]:first'); aboutTr.css({cursor:'pointer'}).children('td').css("opacity","0.5").end().next().attr('id','hider'); aboutTr.hover(function(){ $(this).children('td').css("opacity","1"); },function(){ if(trHide.css('display') == 'none'){ $(this).children('td').css("opacity","0.5"); } else{ $(this).children('td').css("opacity","0.9"); } }); var trHide = $('#hider'); trHide.hide(); aboutTr.toggle(function(){ trHide.css('display','block'); $(this).children('td').css('opacity','0.9'); },function(){ trHide.css('display','none'); $(this).children('td').css('opacity','0.5'); }); } } /***run on thread search page***/ else if((document.URL.indexOf("search")>-1) && (document.URL.indexOf("head") < 0)){ function mywrite(s) { $("form[@action*=forum-search]").next().after('
'+s+'
'); } var mysheet=document.styleSheets[1]; document.write = mywrite; //the Bravo magic mysheet.addRule("#swickiForm ", "padding:0;margin:0;"); mysheet.addRule("#swickiSearch ", "background-color:#EEEEEE;font-family:Arial;font-size:10px;height:auto;padding:5px;"); mysheet.addRule("#w ", "width:100%;"); mysheet.addRule(".communitypowered ", "width:66%;color:#F05C25;font-size:9px;line-height:10px;padding:2px;"); mysheet.addRule("#headertitle ", "float:left;font-size:13px;font-family:Arial;color:#666666;white-space:nowrap;text-transform:uppercase;"); mysheet.addRule("#cloudheader ", "-moz-box-sizing: border-box;padding:5px 10px 2px 10px;text-align:left;height:22px;overflow:hidden;background:#EEEEEE;"); mysheet.addRule(".hotcloud ", "padding:10px;background:#EEEEEE;font-family:Georgia;line-height:1.1;overflow:hidden;border-top:1px solid #FFFFFF;"); mysheet.addRule(".clouditem a ", "text-decoration:none;color:#F26721;"); mysheet.addRule(".clouditem a:hover ", "text-decoration:none;background:#f6f6f6; color:#F26721;"); mysheet.addRule(".dellink ", "visibility:hidden;position:relative;top:-12px;left:-8px;background:#EEEEEE;font-size:10px;font-weight:bold;color:#F05C25;"); mysheet.addRule(".link ", "font-size:11px;color:#F26721;text-decoration:none;"); mysheet.addRule(".link:hover ", "text-decoration:underline;background:#f6f6f6;"); mysheet.addRule(".clouditem a.recent_search ", "color: red;"); mysheet.addRule("#cloudfooter ", "margin-top:5px;padding:5px;height:10px;"); mysheet.addRule("#cloudmore ", "color:#F26721;float:right;"); mysheet.addRule("#cloudquestionl ", "float:left;"); mysheet.addRule("#cloudquestionr ", "float:right;"); mysheet.addRule("#cloudanswer ", "display:none;padding:5px;font-family:Arial;font-size:11px;color:#000;text-align:left;"); mysheet.addRule("#cloudanswer a ", "text-decoration:underline;"); script = document.createElement('script'); script.charset="UTF-8"; script.type = 'text/javascript'; script.src = "http://swicki.eurekster.com/sidebar?groupkey=4c78bb27-79f3-4878-a1bb-93e62086793a&target=_self&numresults=20&format=js"; $("head").append(script); } var mysheet=document.styleSheets[1]; /***Style Buttons****/ mysheet.addRule("#prev", "border:0px solid gray; color:black; background:#FFDCBF; width:150px; font:16px Arial;margin:2px 10px 0 0;"); mysheet.addRule("#clearText", "border:0px solid gray; color:black; background:#DAF2B3; width:150px; font:16px Arial;margin:2px 0 0 10px;"); mysheet.addRule(".wcodeButtons", "color:black;font:11px Tahoma"); /***JB's Nav (the quarter)***/ mysheet.addRule("#nav-container","position: fixed;left:132px;top: 24px;font-size:11px;font-family:Arial,sans-serif;z-index:1000;margin:25px 0 50px 15px;height:16px;overflow:hidden;"); mysheet.addRule("#nav-container:hover","height:235px;overflow: visible;cursor:pointer;"); mysheet.addRule("#nav-container img","border:none;margin-bottom:-3px;background-color: transparent;width: 16px;height: 16px;padding-right:20px;padding-bottom:2px;"); mysheet.addRule("#nav-container ul","padding:0;margin:0;list-style-type:none;width:130px;border-bottom: 1px solid #444;"); mysheet.addRule("#nav-container li","position:relative;background: rgb(58, 67, 123);height:23px;"); mysheet.addRule("#nav-container table","position:absolute; border-collapse:collapse; top:0; left:0; z-index:100; font-size:1em;"); mysheet.addRule("#nav-container a","display:block;text-decoration:none;height:22px;line-height:22px;width:129px;color:#FFF;text-indent:10px;border: 1px solid #444; border-width:1px 1px 0;"); mysheet.addRule("#nav-container a:hover","color:#fff; background: orange;"); mysheet.addRule("#nav-container :hover > a","color:#fff;background: orange;"); mysheet.addRule("#nav-container ul ul","visibility:hidden;position:absolute;top:0;left:130px;border-bottom: 1px solid #444;"); mysheet.addRule("#nav-container ul li:hover ul","visibility:visible;"); mysheet.addRule("#nav-container ul a:hover ul","visibility:visible;"); mysheet.addRule("#nav-container li","float:left;"); mysheet.addRule("#nav-container .righty li","background: rgb(97, 108, 163);"); var userNumber = $(".nav_item_name > a > span").text(); var removeText = new Array(); removeText = userNumber.split(' '); $("body").prepend('');