|
Post by Wormopolis on Jul 7, 2010 23:39:47 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 poststhis 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. ico_relocate=true; // turn on code to relocate on/off icon
this variable turns on the ability to move the on/off icon to the left of the boards. just like tpreloc, you need a destination named like id="icoreloc_general" hopefully that all made sense. let me know if you have questions. <script type="text/javascript"> <!-- // Last Post/Topics/Posts Relocate v1.51 // 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_hideboard=false; // Set true if you want to hide the regular boards
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=2; // 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
var includeBoards=true; //show boards along with last posts
// NEW TO 1.51 var excludeTheseBoards="boardid1|boardid2|boardid3"; //exclude these boards from showing up in new posts list
/*--------------------------------------------------------------------*/
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
/*--------------------------------------------------------------------*/
ico_relocate=true; // turn on code to relocate on/off icon
// requires elements with id="icoreloc_"+boardid // example board id general would look for div id="icoreloc_general"
/*--------------------------------------------------------------------*/
// 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]; var findbtable=tds[s].parentNode; while (!findbtable.className || findbtable.className!='bordercolor') findbtable=findbtable.parentNode; if (lp_hideboard) findbtable.style.display="none"; tmpdiv=document.createElement('div'); tmpdiv.appendChild(brdlnk.cloneNode(true)); 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; icoStuff=nwpstcl.innerHTML; 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=''; var lp_nolist=new RegExp("^("+excludeTheseBoards+")$",''); if (!brdid.match(lp_nolist)) lstpstEntry=(lstpstStuff[2] ? lstpstStuff[2].replace(/in /,'')+' '+(includeBoards ? 'in '+tmpdiv.innerHTML + ' ': '')+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 && lstpstEntry!='') { 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 (document.getElementById('icoreloc_'+brdid) && ico_relocate) { document.getElementById('icoreloc_'+brdid).innerHTML=icoStuff; } } } 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>' && nwlstpstCont!='<br><br>' ? oldpstsDivide : '') + lstpstCont : (lstpstCont!='<br><br>' && nwlstpstCont!='<br><br>' ? oldpstsDivide : '') + lstpstCont + (nwlstpstCont!='<br><br>' && lstpstCont!='<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
|
|
|
Post by Wormopolis on Jul 8, 2010 0:47:35 GMT -8
I know someone is going to ask if they can be sorted by date.. and frankly, that will suck to write since its all converted to text in the cell and would have to be converted back to a date.
I might get around to it eventually, but it wont be anytime soon.
|
|
victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jul 15, 2010 8:12:39 GMT -8
This is great. I was able to figure out how to use it on my Sony Forum. I have it all together since it was putting today's post from some boards as Old Posts instead of New Posts. It definitely has some sorting issues.
|
|
|
Post by Wormopolis on Jul 16, 2010 22:25:55 GMT -8
It uses the on/off icon that would normally be in the first cell of each board row. if that icon is off, then the last post gets listed as old. if you view a board and reset that icon, then there is NO way to tell if anymore posts in a board are new. at least not yet.
I had an idea... but I dont know if I will ever get time to test it.
|
|
sophie
Not New Member
Posts: 8
sophie said 0 great things
|
Post by sophie on Jul 30, 2010 13:44:22 GMT -8
Ah, thanks. Works great. Just wondering: is there a way to hide the original boards? I noticed in one thread it was something like...The code would only show what was inside of it, not anything else? I tried hiding the boards but that didn't work.
|
|
|
Post by Wormopolis on Jul 31, 2010 1:31:17 GMT -8
hiding the boards using the board modify will cause the code to not function since IT wont be able to see the boards anymore either. typically, when people use this code and want their boards to all be hidden so they can make their own main page remodel, they put at the very bottom of main header:
<div style="display:none">
and at the top of main footer:
</div>
but keep in mind this will hide EVERYTHING on the main page below the welcome table. including the login box and the info center. so you would need something to bring those outside the div to keep them visible.
I will see if I can write up something that will hide boards but leave newsfader/infocenter/loginbox that you might be able to put in if you dont want to go the route of hiding everything.
if you are looking to just hide certain boards, check in my database for the hide-a-board script.
|
|
sophie
Not New Member
Posts: 8
sophie said 0 great things
|
Post by sophie on Aug 2, 2010 5:44:02 GMT -8
It also seems to hide the admin center. It would be great if you could write up a script that wouldn't get rid of that stuff =)
|
|
|
Post by Wormopolis on Aug 2, 2010 18:36:43 GMT -8
yeah the admin center would be below the main header as well.
as I said.. those other forums were completely remaking their main page. they might not even have HAD an infocenter.
try this:
<script type="text/javascript"> <!-- // Hide boards, leave IC and Login
if (pb_action=='home') { for (lnks=document.getElementsByTagName('a'), li=0; li<lnks.length; li++) { if (lnks[li].className=='nav') { tbl=lnks[li].nextSibling; while (!tbl.nodeName.match(/table/i)) tbl=tbl.nextSibling; tbl.style.display="none"; break; } } }
// --> </script>
TOP of main footer
|
|
sophie
Not New Member
Posts: 8
sophie said 0 great things
|
Post by sophie on Aug 10, 2010 8:05:27 GMT -8
Hmm, I hate to complain but I have a couple of issues. 1. Can the navtree be removed from the main page only?
2. The code still lets the boards show up when you're viewing a member profile, any way to fix that? It also shows up when I look at the admin center but that's less of an issue. (Was looking at the wrong code, sorry)
|
|
|
Post by Wormopolis on Aug 10, 2010 19:38:55 GMT -8
|
|
game
Junior Member
Code Digger
Posts: 59
game said 0 great things
|
Post by game on Aug 12, 2010 18:22:56 GMT -8
Now that Proboards has made the 'New Topic' option, can you do the same for it? Instead of New Post, New Topics??? This is what I was asking about a month back, but you said it was against TOS Rules. Well now that Proboards have gave us the 'New Topic' option, we should be good...right?
|
|
|
Post by Wormopolis on Aug 12, 2010 20:23:09 GMT -8
still cant get the information unless on the page that it sends it to already. notice the URL when that button is clicked.
|
|
sophie
Not New Member
Posts: 8
sophie said 0 great things
|
Post by sophie on Aug 14, 2010 12:39:14 GMT -8
Is it possible to get the on/off icons into the coding? Some of the members like to have on/off so they know if there's new posts at a glance, so I thought it would be worth asking.
|
|
|
Post by Wormopolis on Aug 14, 2010 16:00:07 GMT -8
not beyond reason. where did you have in mind they would end up?
|
|
pasc
Not New Member
Posts: 10
pasc said 0 great things
|
Post by pasc on Oct 6, 2010 16:13:00 GMT -8
Hello! Thank you for making this code! I do have a question though:
when posts are deleted, it seems to create gaps. Is there anyway to make that not happen?
|
|