|
Post by Wormopolis on Dec 19, 2008 14:18:03 GMT -8
Browser Tested: IE and FF Placement: Global Footer for all boards, Board footer for single board. This code will auto-merge multiple posts from the same user into 1 post. It does not delete posts, nor affect post count. It uses your exisiting skin colors and username colors. Modify and Delete buttons only appear to those who would normally be able to access them. <script type="text/javascript"> <!-- // autoMerge multiple posts v 1.75 // by Wormopolis // Do Not Repost - Header must stay intact // put in board footer, or global footer for all boards.
var showAddedMessage=true; var addedMessage="$USER later added $WHEN"; //message to add: $USER will become username, $WHEN will become date var pushButtonsToRight=true;
if (!location.href.match(/userrecentposts/i) && !location.href.match(/ion=recent/)) { iCells=document.getElementsByTagName('td'); for ( i=iCells.length-1; i>0; i--) { if(iCells[i].className.match(/windowbg/) && iCells[i].width=='80%' && iCells[i].vAlign=='top') { var msgCell = iCells[i].firstChild.rows[1].cells[0]; var authCell = iCells[i].previousSibling; var postCell = authCell.parentNode; if (!authCell.getElementsByTagName('a')[2]) { var auth = authCell.innerHTML.split(/<\/a>/i)[2].split(/<br/i)[0]; } else { var auth = authCell.getElementsByTagName('a')[2].innerHTML; } var timeCell = msgCell.parentNode.previousSibling.getElementsByTagName('font')[1]; var msgTime = timeCell.innerHTML.replace(/Reply \#\d+/,''); keep = msgTime.substring(0,1); msgTime=msgTime.substring(1, msgTime.length); var addedMessage2=addedMessage.replace('$USER',auth).replace('$WHEN',msgTime); var disc = "<br/><br/>" + (showAddedMessage ? keep + " " + addedMessage2 : ''); var btns=msgCell.parentNode.previousSibling.getElementsByTagName('a'); for (m=0; m<btns.length; m++) { var tmp=document.createElement('div'); var cloneBtn=btns[m].cloneNode(true); tmp.appendChild(cloneBtn); if (pushButtonsToRight) tmp.innerHTML=tmp.innerHTML.replace(/<a/i, '<a style="float:right" '); disc+=tmp.innerHTML; } disc+="<br/>"; prev_auth=''; if (iCells[i].parentNode.previousSibling && iCells[i].parentNode.previousSibling.firstChild.nextSibling.className.match(/windowbg/) && iCells[i].parentNode.previousSibling.firstChild.nextSibling.width=='80%' && iCells[i].parentNode.previousSibling.firstChild.nextSibling.vAlign=='top') { var prev_msgCell = iCells[i].parentNode.previousSibling.firstChild.nextSibling.firstChild.rows[1].cells[0]; var prev_authCell = iCells[i].parentNode.previousSibling.firstChild; if (!prev_authCell.getElementsByTagName('a')[2]) { var prev_auth = prev_authCell.innerHTML.split(/<\/a>/i)[2].split(/<br/i)[0]; } else { var prev_auth = prev_authCell.getElementsByTagName('a')[2].innerHTML; } } if (prev_auth == auth) { vict=msgCell.firstChild; noob=document.createElement("br"); msgCell.replaceChild(noob,vict); prev_msgCell.innerHTML+=disc + msgCell.innerHTML; postCell.style.display='none'; } } } } // --> </script>
Preview:
|
|
|
Post by Wormopolis on Feb 24, 2009 16:49:41 GMT -8
new version 1.6. put quote button back next to each appended entry since top quote button didnt capture modified post.
|
|
hcfwesker
Not New Member
Posts: 37
hcfwesker said 0 great things
|
Post by hcfwesker on Jun 18, 2009 13:44:21 GMT -8
This is probably the GREATEST code anyone will put on their forum. And, it's not found on most other forum softwares; which gives PB forum's a little edge. It will cut down on multi posting; and has save us mods and staff alot of time and headache.
thanx for the code! Works Brilliantly!
|
|
|
Post by Wormopolis on Jun 19, 2009 1:46:06 GMT -8
You are welcome!
|
|
hcfwesker
Not New Member
Posts: 37
hcfwesker said 0 great things
|
Post by hcfwesker on Jul 14, 2009 15:26:10 GMT -8
Didn't even see the added "quote" button to the code. Very nice; and glad it uses different button images from each skin. Amazing.
|
|
dynastygal
Not New Member
[Sj1:0]
Posts: 23
dynastygal said 0 great things
|
Post by dynastygal on Feb 10, 2010 10:24:57 GMT -8
|
|
|
Post by Wormopolis on Feb 10, 2010 23:33:26 GMT -8
you have version 1.2, get version 1.6 from the first post of this thread.
|
|
dynastygal
Not New Member
[Sj1:0]
Posts: 23
dynastygal said 0 great things
|
Post by dynastygal on Feb 11, 2010 15:20:43 GMT -8
That fixed it, thanks.
|
|
|
Post by Wormopolis on Mar 6, 2010 1:44:07 GMT -8
v 1.7
changed how code looked for posts. was conflicting with footnotes code.
|
|
tutela
Not New Member
Posts: 17
tutela said 0 great things
|
Post by tutela on Mar 6, 2010 1:58:09 GMT -8
One question I have here as well. Since the forums allow a 60k character limit, if the character limit is bypassed through the use of automerge, does it start a new post automatically? I have a feeling that I may encounter this example through my post that I keep everyone updated on whenever I add new code or new features. Just an inquiry to avoid future issues.
|
|
|
Post by Wormopolis on Mar 6, 2010 2:02:30 GMT -8
nope. automerge doesnt affect the actual data of the post. it just merges what is displayed. so if you had 3 60K character posts in a row, you would end up with a single 180K character post (with the "later added" thing in between each one".
|
|
tutela
Not New Member
Posts: 17
tutela said 0 great things
|
Post by tutela on Mar 6, 2010 2:14:17 GMT -8
I am kind of confused, whenever I add new stuff to my post, using automerge, it subtracts from the total character limit. So, I'm not sure what you mean by it doesn't affect the actual data. The default character limit is 60k, unless there is a way to extend that. So, after automerging all my posts, it will eventually reach its limit of 60k in that post. My question is, will it allow me to continue posting using automerge in the same post even if it exceeds the character limit, or will it start a new post altogether, or will it not allow me to post anymore until someone else posts first?
EDIT: Also, if you get the time, do you think it would be possible to give specific members the option to override the auto merge feature so they are able to do multiple posts if they choose to do so? Maybe by putting their username or group (whichever is easier to do) in an exclusion list in the code?
|
|
|
Post by Wormopolis on Mar 6, 2010 12:39:24 GMT -8
if you add new stuff into a post, it will affect your characters remaining. the automerge code doesnt actually change what is inside a post. it just changes how something is displayed. it takes the contents of the 2nd post and moves it into the previous posts cell. then it hides the 2nd post.
adding stuff to your post regardless of automerge being there will deduct from the characters remaining.
so you want a variable that turns off automerge for certain members?
|
|
tutela
Not New Member
Posts: 17
tutela said 0 great things
|
Post by tutela on Mar 6, 2010 13:56:10 GMT -8
Yes, a variable that allows certain members to choose whether they want it on or off, like a button. But the button I want only available for certain members or usergroups etc.
|
|
|
Post by Wormopolis on Mar 6, 2010 19:45:54 GMT -8
ok before I add anything, lets be clear on the request.
you want users to be able to add something to their post that will keep it from being automerged (where it wont be merged for EVERYone)?
OR
you want a button somewhere on the screen that turns automerge off/on for an individual user? it will have to be stored in a cookie so normal cookie disclaimers apply.
|
|