Post by Wormopolis on Jul 7, 2010 23:40:45 GMT -8
Browser Tested: IE and FF
placement: (code part) Main footer, (placement part) anywhere above code.
This code will move the last post data and/or topics/posts from the last cell of each board row into one location. this could be a table at the top or a side table, as long as the destination appears ABOVE the code in the main footer. if you have some sort of main page remodel, this code will need to go above it (this code does not affect other codes).
if using the standard default setup, you will need an element (td, div, span) with id=lastpostspot somewhere for the contents to end up. if you use a global table, and you want the destination to be hidden when not on the main page, you can give THAT element the id=lp_table and set it to be hidden by default, and the code will unhide it when on main page. example:
<table id="lp_table" style="display:none"><tr><td id="lastpostspot"></td></tr></table>
no.. you cant have main page data be visible on ALL pages. you cant fetch data from the server like that.
There are different modes to this code so pay attention:
lp_relocate=true; //turn on code to relocate last posts
this turns on/off the code's relocate for last posts, in case you just want to do topics/posts relocation
lp_mode=1;
// lp_modes:
// 1: move all discovered last posts into destination
// 2: move only ones that have specific divs setup
// 3: both
This sets the relocation mode. you can have all last posts relocated, JUST the ones you want to special places, or both...
// modes 1 and 3 require an element with id="lastpostspot"
// if using lp_mode 2 (or 3), specific divs must have id="lpreloc_"+boardid
// example board id general would look for div id="lpreloc_general"
that is important if you are running mode 2 or 3. if those locations arent found, then the code wont put anything anywhere.
lp_newmode=true;
// lp_newmode:
// true: seperate out the last posts that register as "new" when in lp_mode 1 or 3. specific divs in 3 stay normal
// false: group all together in order they are found
if you are relocating all last posts (or in mode 3) then you can have all the "new" posts grouped with each other and "old" posts grouped with each other. new/old is decided by the on/off icon to the left of the board name.
lp_newmode_order=1;
// order:
// 1 = new posts first
// 2 = old posts first
if using the newmode, you can choose to have new posts listed first or old posts.
nwpstsDivide='<hr width="75%">NEW POSTS<hr width="75%">'; //HTML for divider, can be image if desired
oldpstsDivide='<hr width="75%">OLD POSTS<hr width="75%">'; //HTML for divider, can be image if desired
these variables are the "headers" above each group if using newmode. you need to escape single quotes if you use them. HTML is valid.
tp_relocate=true; // turn on code to relocate topics/posts numbers
this variable turns on/off the topics/posts relocate if you just want to use the last post relocation part of the code. there is not a section for relocating ALL topics/posts data into one place like there was for last posts however
// requires elements with id="tpreloc_"+boardid
// example board id general would look for div id="tpreloc_general"
this is just like the last post mode 2 section. if you dont have these, then the data wont be relocated.
tp_seperator="/";
this is what will show up between the topics data and the posts data. can be anything you want.
tp_mode=2;
// tp_modes:
// 1: move just numbers seperated by whatever is in seperator variable ... 4 / 12 (example)
// 2: move numbers with labels seperated by whatever is in seperator variable ... 4 threads / 12 posts
this variable will put labels next to each number explaining what it is if you dont already have something you want there.
hopefully that all made sense. let me know if you have questions.
Preview: running it on main page of www.wormocodes.com
placement: (code part) Main footer, (placement part) anywhere above code.
This code will move the last post data and/or topics/posts from the last cell of each board row into one location. this could be a table at the top or a side table, as long as the destination appears ABOVE the code in the main footer. if you have some sort of main page remodel, this code will need to go above it (this code does not affect other codes).
if using the standard default setup, you will need an element (td, div, span) with id=lastpostspot somewhere for the contents to end up. if you use a global table, and you want the destination to be hidden when not on the main page, you can give THAT element the id=lp_table and set it to be hidden by default, and the code will unhide it when on main page. example:
<table id="lp_table" style="display:none"><tr><td id="lastpostspot"></td></tr></table>
no.. you cant have main page data be visible on ALL pages. you cant fetch data from the server like that.
There are different modes to this code so pay attention:
lp_relocate=true; //turn on code to relocate last posts
this turns on/off the code's relocate for last posts, in case you just want to do topics/posts relocation
lp_mode=1;
// lp_modes:
// 1: move all discovered last posts into destination
// 2: move only ones that have specific divs setup
// 3: both
This sets the relocation mode. you can have all last posts relocated, JUST the ones you want to special places, or both...
// modes 1 and 3 require an element with id="lastpostspot"
// if using lp_mode 2 (or 3), specific divs must have id="lpreloc_"+boardid
// example board id general would look for div id="lpreloc_general"
that is important if you are running mode 2 or 3. if those locations arent found, then the code wont put anything anywhere.
lp_newmode=true;
// lp_newmode:
// true: seperate out the last posts that register as "new" when in lp_mode 1 or 3. specific divs in 3 stay normal
// false: group all together in order they are found
if you are relocating all last posts (or in mode 3) then you can have all the "new" posts grouped with each other and "old" posts grouped with each other. new/old is decided by the on/off icon to the left of the board name.
lp_newmode_order=1;
// order:
// 1 = new posts first
// 2 = old posts first
if using the newmode, you can choose to have new posts listed first or old posts.
nwpstsDivide='<hr width="75%">NEW POSTS<hr width="75%">'; //HTML for divider, can be image if desired
oldpstsDivide='<hr width="75%">OLD POSTS<hr width="75%">'; //HTML for divider, can be image if desired
these variables are the "headers" above each group if using newmode. you need to escape single quotes if you use them. HTML is valid.
tp_relocate=true; // turn on code to relocate topics/posts numbers
this variable turns on/off the topics/posts relocate if you just want to use the last post relocation part of the code. there is not a section for relocating ALL topics/posts data into one place like there was for last posts however
// requires elements with id="tpreloc_"+boardid
// example board id general would look for div id="tpreloc_general"
this is just like the last post mode 2 section. if you dont have these, then the data wont be relocated.
tp_seperator="/";
this is what will show up between the topics data and the posts data. can be anything you want.
tp_mode=2;
// tp_modes:
// 1: move just numbers seperated by whatever is in seperator variable ... 4 / 12 (example)
// 2: move numbers with labels seperated by whatever is in seperator variable ... 4 threads / 12 posts
this variable will put labels next to each number explaining what it is if you dont already have something you want there.
hopefully that all made sense. let me know if you have questions.
<script type="text/javascript">
<!--
// Last Post/Topics/Posts Relocate v1.2
// By Wormopolis - www.wormocodes.com
// do not repost - keep header intact
// request by cainey-face
lp_relocate=true; //turn on code to relocate last posts
lp_mode=1;
// lp_modes:
// 1: move all discovered last posts into destination
// 2: move only ones that have specific divs setup
// 3: both
// modes 1 and 3 require an element with id="lastpostspot"
// if using lp_mode 2 (or 3), specific divs must have id="lpreloc_"+boardid
// example board id general would look for div id="lpreloc_general"
lp_newmode=true;
// lp_newmode:
// true: seperate out the last posts that register as "new" when in lp_mode 1 or 3. specific divs in 3 stay normal
// false: group all together in order they are found
lp_newmode_order=1;
// order:
// 1 = new posts first
// 2 = old posts first
nwpstsDivide='<hr width="75%">NEW POSTS<hr width="75%">'; //HTML for divider, can be image if desired
oldpstsDivide='<hr width="75%">OLD POSTS<hr width="75%">'; //HTML for divider, can be image if desired
tp_relocate=true; // turn on code to relocate topics/posts numbers
// requires elements with id="tpreloc_"+boardid
// example board id general would look for div id="tpreloc_general"
tp_seperator="/";
tp_mode=2;
// tp_modes:
// 1: move just numbers seperated by whatever is in seperator variable ... 4 / 12 (example)
// 2: move numbers with labels seperated by whatever is in seperator variable ... 4 threads / 12 posts
// NO NEED TO EDIT BELOW - unless you know what you are doing
if (pb_action=='home') {
lstpstCont='<br>';
nwlstpstCont='<br>';
for (tds=document.getElementsByTagName('td'), s=0; s<tds.length; s++) {
if (tds[s].width=='66%' && tds[s].vAlign=='top' && tds[s].className.match(/windowbg/)) {
brdlnk=tds[s].getElementsByTagName('a')[0];
brdid=brdlnk.href.split('board=')[1];
lstpstcl=tds[s].nextSibling.nextSibling.nextSibling;
tpcscl=tds[s].nextSibling;
pstscl=tds[s].nextSibling.nextSibling;
nwpstcl=tds[s].previousSibling;
nwpstchk=(nwpstcl.firstChild.alt && nwpstcl.firstChild.alt=='[/li][li]');
lstpstStuff=lstpstcl.firstChild.innerHTML.split(/<br>/i);
tpcsStuff=tpcscl.firstChild.innerHTML;
pstsStuff=pstscl.firstChild.innerHTML;
lstpstEntry=(lstpstStuff[2] ? lstpstStuff[2].replace(/in /,'')+' '+lstpstStuff[1]+' '+lstpstStuff[0] : '');
if ((lp_mode==2 || lp_mode==3) && document.getElementById('lpreloc_'+brdid) && lp_relocate) {
document.getElementById('lpreloc_'+brdid).innerHTML=lstpstEntry;
} else {
if (lp_mode!=2) {
if (lp_newmode && nwpstchk && pb_username!='Guest') nwlstpstCont+=lstpstEntry+'<br>';
else lstpstCont+=lstpstEntry+'<br>';
}
}
if (document.getElementById('tpreloc_'+brdid) && tp_relocate) {
tpStuff=tpcsStuff + (tp_mode==2 ? ' Topic'+(tpcsStuff!='1'?'s ':' ') : ' ') + tp_seperator + ' ' + pstsStuff + (tp_mode==2 ? ' Post'+(pstsStuff!='1'?'s ':' ') : ' ');
document.getElementById('tpreloc_'+brdid).innerHTML=tpStuff;
}
}
}
if (lp_mode != 2 && document.getElementById('lastpostspot') && lp_relocate) {
lstpstCont+='<br>';
nwlstpstCont+='<br>';
if (lp_newmode && pb_username!='Guest' ) {
lstpstfinal=( lp_newmode_order==1 ? (lstpstCont!='<br><br>' && nwlstpstCont!='<br><br>' ? nwpstsDivide : '') + nwlstpstCont + (lstpstCont!='<br><br>' ? oldpstsDivide : '') + lstpstCont : (lstpstCont!='<br><br>' && nwlstpstCont!='<br><br>' ? oldpstsDivide : '') + lstpstCont + (nwlstpstCont!='<br><br>' ? nwpstsDivide : '') + nwlstpstCont);
document.getElementById('lastpostspot').innerHTML=lstpstfinal;
} else {
document.getElementById('lastpostspot').innerHTML=lstpstCont;
}
}
if (document.getElementById('lp_table')) document.getElementById('lp_table').style.display="";
}
// -->
</script>
Preview: running it on main page of www.wormocodes.com