|
Post by Wormopolis on May 20, 2012 19:29:06 GMT -8
Browsers tested: FF, Chrome, IE Placement: global footer
This will give a new option when creating a post to have it transformed on display into a regular table with the thread title as a header row and no author on the left. replies will be disabled, and only those with power to modify/delete can change the table. this will also hide the post in recent/search.
CSS provided for styling
If you want additional posts to be merged into one table, you must tablefy all of the posts in reverse order. This means you tablefy the first post LAST
<style type="text/css"> .tablefyTable {background-color:#000000;} .tablefyTitle {background-color:#222222;} .tablefyTitle font {font-weight: bold; font-size: 18px;} .tablefyContent {background-color:#111111} </style>
<script type="text/javascript"> <!-- // Tablefy a post // v1.41 // by Wormopolis - www.wormocodes.com // do not repost - keep header intact
var removeHRline=true;
var TF_allowedUsersRule=true; //set true if you only want certain users to create tablefied posts var TF_allowedUsers='admin|user2|user3'; //seperate by |
if ((document.postForm && document.postForm.lock && !location.href.match(/thread=/)) || (location.href.match(/modifypost/) && !document.postForm.message.value.match(/\[norunubbc\]/))) { //handle a modify without lock option if (!document.postForm.lock && document.postForm.message.value.match(/\[tablefied\]/ig)) { var inphold=document.createElement('span'); inphold.style.display='none'; inphold.innerHTML='<input name="tablefyhold" type="hidden" value="tablefied">'; document.postForm.subject.parentNode.appendChild(inphold); document.postForm.message.value=document.postForm.message.value.replace(/\[tablefied\]/ig,''); } else { if (document.postForm.lock) { var lockspot=document.postForm.lock.parentNode.parentNode; var tablefyspot=lockspot.cloneNode(true); tablefyspot.firstChild.firstChild.innerHTML='Tablefy this post:'; tablefyspot.firstChild.nextSibling.innerHTML='<input type="checkbox" name="tablefy"> To transform this post into a table announcment'; if (TF_allowedUsersRule && !pb_username.match(new RegExp('^('+TF_allowedUsers+')$',''))) tablefyspot.style.display='none'; lockspot.parentNode.insertBefore(tablefyspot, lockspot.nextSibling); if (document.postForm.message.value.match(/\[tablefied\]/)) { document.postForm.message.value=document.postForm.message.value.replace(/\[tablefied\]/ig,''); document.postForm.tablefy.checked=true; } } } if (document.postForm.addEventListener) { document.postForm.addEventListener('submit', function() {document.postForm.message.value = document.postForm.message.value.replace(/\[tablefied\]/ig,''); if ((document.postForm.tablefy && document.postForm.tablefy.checked) || (document.postForm.tablefyhold && document.postForm.tablefyhold.value=='tablefied')) {document.postForm.message.value += '[tablefied]'; if (document.postForm.lock) document.postForm.lock.checked='true';}}, true); } else { document.postForm.attachEvent('onsubmit', function() {if ((document.postForm.tablefy && document.postForm.tablefy.checked) || (document.postForm.tablefyhold && document.postForm.tablefyhold.value=='tablefied')) {document.postForm.message.value += '[tablefied]'; if (document.postForm.lock) document.postForm.lock.checked='true';}}); } } if (pb_action.match(/display|recent|search2/)) { for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='20%' && td[tt].className=='catbg' && td[tt].innerHTML.match(/lock(ed)?\.(gif|png)/)) { var firstPostRow=td[tt].parentNode.nextSibling.nodeName.match(/tr/i) ? td[tt].parentNode.nextSibling : td[tt].parentNode.nextSibling.nextSibling; if (firstPostRow.innerHTML.match(/\[tablefied\]/ig) && !firstPostRow.innerHTML.match(/\[norunubbc\]/)) { if (pb_action.match(/recent|search2/)) { var rectable= td[tt].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; rectable.style.display='none'; } else { for (prows=td[tt].parentNode.parentNode.parentNode.rows, pp=0; pp<prows.length; pp++) { prows[pp].style.display='none'; } firstPostRow.firstChild.nextSibling.className+=' tablefyTable'; firstPostRow.firstChild.nextSibling.bgColor=''; firstPostRow.firstChild.style.display='none'; var postTable=firstPostRow.firstChild.nextSibling.firstChild; postTable.rows[0].cells[0].style.display='none'; postTable.rows[0].cells[1].width='100%'; postTable.rows[0].cells[1].className+=' tablefyTitle'; postTable.rows[1].cells[0].className+=' tablefyContent'; postTable.rows[0].cells[1].align='center'; postTable.rows[0].cells[1].lastChild.style.display='none'; if (removeHRline) postTable.rows[1].cells[0].getElementsByTagName('hr')[0].style.display='none'; for (lnks=postTable.rows[0].cells[2].getElementsByTagName('a'), ll=0; ll<lnks.length; ll++) { if (lnks[ll].href.match(/action=post/)) lnks[ll].style.display='none'; } if (postTable.rows[0].cells[2].getElementsByTagName('a').length==0) postTable.rows[0].cells[2].style.display ='none'; postTable.rows[2].style.display='none'; firstPostRow.firstChild.style.display='none'; var finalTablefiedCell=postTable.rows[1].cells[0]; postTable.rows[1].cells[0].innerHTML = postTable.rows[1].cells[0].innerHTML.replace(/\[tablefied\]/ig,'') firstPostRow.style.display=''; for (td2=document.getElementsByTagName('td'), tt2=td2.length-1; tt2>0; tt2--) { if (td2[tt2].className=='titlebg' && td2[tt2].innerHTML.match(/Quick Reply/)) { var qrtable= td2[tt2].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; qrtable.style.display='none'; break; } } var checkNextRow=firstPostRow.nextSibling; while (checkNextRow && checkNextRow.innerHTML.match(/\[tablefied\]/)) { postTable=checkNextRow.firstChild.nextSibling.firstChild; for (lnks=postTable.rows[0].cells[2].getElementsByTagName('a'), ll=0; ll<lnks.length; ll++) { if (lnks[ll].href.match(/action=post/)) lnks[ll].style.display='none'; } finalTablefiedCell.innerHTML+='<br>'+postTable.rows[0].cells[2].innerHTML; postTable.rows[1].cells[0].getElementsByTagName('hr')[0].style.display='none'; finalTablefiedCell.innerHTML+='<br>'+postTable.rows[1].cells[0].innerHTML.replace(/\[tablefied\]/ig,''); checkNextRow=checkNextRow.nextSibling; } break; } } } } } // --> </script>
[norunubbc]
|
|
|
Post by Wormopolis on May 21, 2012 22:17:53 GMT -8
version update 1.2: added in switch for removing HR line at the top, also got it working in IE
|
|
|
Post by Wormopolis on May 22, 2012 20:23:56 GMT -8
version update 1.21: code ran on itself removing a crucial part. also added in a new class for the overall table.
|
|
|
Post by Wormopolis on May 26, 2012 19:58:27 GMT -8
version update 1.23: added in variables for member inclusion
|
|
|
Post by Wormopolis on May 27, 2012 21:14:49 GMT -8
version update 1.3: added in some stuff for modifying a tablefied post without stripping the tag
|
|
|
Post by Wormopolis on Jun 6, 2012 17:44:14 GMT -8
version update 1.4: added in ability to merge additional posts of that thread into the table.
|
|
|
Post by Wormopolis on Jun 7, 2012 23:52:17 GMT -8
version update 1.41: IE bug fix
|
|