|
Post by Wormopolis on Jun 16, 2012 0:30:18 GMT -8
browsers tested: IE, FF, and Chrome placement: global footer
Creates a new reply button at the top of each post that will store who the author of the post is. when the reply is displayed, it will show at the top who the reply was to.
sorta along the lines of quoting a post without putting quoted content in your reply.
<script type="text/javascript"> <!-- // Special Reply Button (SRB) // v1.01 // by Wormopolis - www.wormocodes.com // request by natidefan // keep header intact - do not repost
var replyToButton="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/replyto.gif";
var showReplyingToByMessageArea=true; //puts who you are replying to under "Message:"
// ------------------------------
function getElements(src, type, attrs) { // Wormo tries a new way to hunt var ElResults=new Array(); //"insideText" is a new attribute that gets changed based on browser attrs='e[ec].' + attrs.replace(/insideText/g,(document.body.textContent ? 'textContent' : 'innerText')).replace(/\,/g,' && e[ec].');
for (e=src.getElementsByTagName(type), ec=0; ec<e.length; ec++) { attcheck=(eval(attrs)); if (attcheck) ElResults.push(e[ec]); } return (ElResults.length ? ElResults : null); }
if (pb_action.match(/display|search2|recent/)) { for ( test= getElements(document,'td','width=="40%",align=="right",innerHTML.match(/quote=/)'), tt=0; tt<test.length; tt++) { var autCell= test[tt].parentNode.parentNode.parentNode.parentNode.previousSibling; var aut= getElements(autCell, 'b', 'innerHTML.match(/user=/)') || 'Guest'; // var autDisp= (aut!='Guest' ? (aut[0].firstChild.firstChild.innerText || aut[0].firstChild.firstChild.textContent) : 'Guest'); var autDisp= (aut!='Guest' ? (aut[0].firstChild.innerHTML) : 'Guest'); var autLink= (aut!='Guest' ? aut[0].firstChild.href.split(/user=/)[1] : ''); for (links= getElements(test[tt], 'a','href.match(/quote=/)'), ll=0; ll<links.length; ll++) { var nwlnk=document.createElement('a'); nwlnk.href=links[ll].href.replace(/quote=(\d+)/,'post=$1&replink='+autLink+ '&repuser='+escape(autDisp)); var nwlnkimg=document.createElement('img'); nwlnkimg.border="0"; nwlnkimg.src=replyToButton; nwlnk.appendChild(nwlnkimg); links[ll].parentNode.insertBefore(nwlnk, links[ll]); } } for (changer= getElements(document, 'td', 'vAlign=="top",colSpan=="3",insideText.match(/\\[replyingto=/)'), cc=0; (changer!=null && cc<changer.length); cc++) { for (quotecheck= getElements(changer[cc], 'table', 'className=="quote",insideText.match(/\\[replyingto=/)'), qq=0; (quotecheck!=null && qq<quotecheck.length); qq++) { for (qtd=getElements(quotecheck[qq], 'td', 'insideText.match(/\\[replyingto=/)'), qt=0; (qt!=null && qt<qtd.length); qt++) { qtd[qt].innerHTML=qtd[qt].innerHTML.replace(/\[replyingto=(.*?)\](.*?)\[\/replyingto\]/g,''); } } var reppy=changer[cc].innerHTML.match(/\[replyingto=(.*?)\](.*?)\[\/replyingto\]/); if (reppy) { var repLink=reppy[1]; var repDisp=reppy[2]; var victimCell=changer[cc].parentNode.previousSibling.firstChild.nextSibling; victimCell.innerHTML=victimCell.innerHTML.replace('»', 'to ' + (repLink ? '<a href="\index.cgi?action=viewprofile&user='+repLink+'">' : '') + '<font size=2>' + unescape(repDisp.replace(/\s/g,'')) + '</font>' + (repLink ? '</a> »' : ' »')); changer[cc].innerHTML=changer[cc].innerHTML.replace(/\[replyingto=(.*?)\](.*?)\[\/replyingto\]/g,''); } } } if (document.postForm) { if (location.href.match(/quote=/)) { document.postForm.message.value= document.postForm.message.value.replace(/\[replyingto=(.*?)\](.*?)\[\/replyingto\]/g,''); } if (location.href.match(/repuser/) || (pb_action=='modifypost' && document.postForm.message.value.match(/\[replyingto/))) { if (pb_action=='modifypost') { var urlgrab=document.postForm.message.value.match(/\[replyingto=(.*?)\](.*?)\[\/replyingto\]/); document.postForm.message.value= document.postForm.message.value.replace(/\[replyingto=(.*?)\](.*?)\[\/replyingto\]/g,''); } else { var urlgrab=location.href.match(/replink=(.*?)&repuser=(.*?)(&|$)/); } var hider=document.createElement('input'); hider.id="replyto"; hider.type='hidden'; hider.value='[replyingto='+ urlgrab[1] +']'+ (urlgrab[2]) +'[/replyingto]'; document.postForm.message.parentNode.appendChild(hider); if (showReplyingToByMessageArea) { var vcell=document.postForm.message.parentNode.parentNode.previousSibling; var nwdiv=document.createElement('div'); nwdiv.innerHTML='<font size="1">(Replying to: ' + (urlgrab[1] ? '<a href="\index.cgi?action=viewprofile&user='+urlgrab[1]+'">' : '') + unescape(urlgrab[2].replace(/\s/g,'')) + (urlgrab[1] ? '</a>)</font>' : ')</font>'); vcell.appendChild(nwdiv); } } if (document.addEventListener) { document.postForm.addEventListener('submit',function() {if (document.getElementById('replyto')) document.postForm.message.value= document.getElementById('replyto').value+document.postForm.message.value;},true); } else { document.postForm.attachEvent('onsubmit',function() {if (document.getElementById('replyto')) document.postForm.message.value= document.getElementById('replyto').value+document.postForm.message.value;}); } }
// --> </script>
[norunubbc]
|
|
|
Post by Wormopolis on Jun 16, 2012 21:30:17 GMT -8
version update 1.01: made the experimental hunting function a little faster
|
|
jr
Not New Member
Posts: 10
jr said 0 great things
|
Post by jr on Mar 23, 2013 15:36:00 GMT -8
Thism is a cool code! Thanks!
|
|