|
Post by Wormopolis on Oct 23, 2011 15:41:13 GMT -8
browsers tested: IE, FF and Chrome placement: global footer
when clicking exalt or smite, the normal action is to take you to the person's profile and leave you there. this code will put up a message (editable) and ask if you want to go back to where you just were.
<script type="text/javascript"> <!-- // boomerang karma action // v1.1 // by Wormopolis - www.wormocodes.com // do not repost - keep header intact
var exaltMessage="$USER appreciates the love you have given them. Go back to where you were?"; var smiteMessage="$USER is a bit more sad for your actions. Go back to where you were?";
if (pb_action.match(/(display|viewprofile|search2)/)) { for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='20%' && td[tt].className.match(/windowbg/) && td[tt].vAlign=='top' && td[tt].getElementsByTagName('b')[0] && td[tt].getElementsByTagName('b')[0].innerHTML.match(/action=viewprofile/)) { var dispName= (td[tt].getElementsByTagName('b')[0].firstChild.innerText ? td[tt].getElementsByTagName('b')[0].firstChild.innerText : td[tt].getElementsByTagName('b')[0].firstChild.textContent); var boomerangStuff=''; var postCellStuff=td[tt].nextSibling; if (pb_action!='viewprofile') { for (lnk=postCellStuff.getElementsByTagName('a'), ll=0; ll<lnk.length; ll++) { if (lnk[ll].innerHTML.match(/link to post/i) && lnk[ll].href.match(/action=gotopost&(.*)$/)) { boomerangStuff=RegExp.$1; break; } } for (lnk2=td[tt].getElementsByTagName('a'), ll=0; ll<lnk2.length; ll++) { if (lnk2[ll].href.match(/action=karma/)) { lnk2[ll].href += '&' + escape(dispName) + '&' + boomerangStuff; if (lnk2[ll].addEventListener) { lnk2[ll].addEventListener('click',function() {saveBoomerang(this.href);},true); } else { lnk2[ll].onclick=function() {saveBoomerang(this.href);}; } } } } } } if (document.cookie.match(/boomerang=(.*)(;|$)/)) { var recoveredStuff=RegExp.$1.split('&'); var dt=new Date(); dt.setFullYear(dt.getFullYear()-5); document.cookie='boomerang=gone; expires='+dt; var karmatype=recoveredStuff.shift(); var recDispName=unescape(recoveredStuff.shift()); recoveredStuff=recoveredStuff.join('&'); var putMessage=(karmatype=='1' ? exaltMessage : smiteMessage); putMessage=putMessage.replace('$USER',recDispName); if(confirm(putMessage)) location.href='/index.cgi?action=gotopost&'+recoveredStuff; } }
function saveBoomerang(addedStuff) { var dt=new Date(); dt.setMinutes(dt.getMinutes()+5); document.cookie='boomerang='+addedStuff.split('type=')[1]+';'; }
// --> </script>
|
|
|
Post by Streamstrider on Oct 24, 2011 19:23:21 GMT -8
I can try this on Reality Shift to see how it goes.
EDIT: Tested it for me, and it seems to work. Gonna PM everyone and ask them to try it out, just to see if the browsers act differently.
|
|
|
Post by Streamstrider on Oct 28, 2011 15:56:07 GMT -8
So far, members have found it working on Mozilla Firefox, Internet Explorer, and Google Chrome. No info on other browsers at the moment. However, it might be worth mentioning that it only works when a person is redirected from a thread, and not a PM or other such location.
|
|
|
Post by Wormopolis on Oct 28, 2011 17:48:59 GMT -8
yeah that was sorta on purpose. PMs dont really have something embedded in them that I can go back to. and profile views.. well you were already there to begin with.
|
|
|
Post by Streamstrider on Oct 28, 2011 17:52:39 GMT -8
Exactly. I had tons of people just exalt from the profile or from the PM, and I was like *facepalm*.
|
|
|
Post by Wormopolis on Oct 28, 2011 18:33:04 GMT -8
I MIGHT be able to use the location for PMs, but I have to sit down and see if it would work.
Profile views dont have a boomerang, but I might be able to make them pop up the message still
|
|
|
Post by Streamstrider on Oct 28, 2011 20:27:21 GMT -8
I don't think it'd be necessary. I know I wouldn't want it, except MAYBE the OPTION of having it for PMs. Otherwise, having the pop-up appear just every time you exalt someone from the profile page is probably just going to get bothersome. xD
|
|