|
Post by Wormopolis on Jun 23, 2012 17:18:33 GMT -8
Browsers tested: IE, FF, and Chrome placement: Global footer
after code is installed, everytime someone makes a modification to a post it will keep the count number in memory and insert it back into the post. when the post is displayed, it shows down by the last edit message.
<script type="text/javascript"> <!-- // show number of times modified in post // v1.1 // by Wormopolis - www.wormocodes.com // do not repost - keep header intact
var currentModCount=0;
function updateModificationCount() { document.postForm.message.value+='[mod='+(currentModCount+1)+']'; } function displayModificationCount(post) { var postTable=post.firstChild; var editRow=postTable.rows[2]; var lastEditSpot=editRow.getElementsByTagName('i')[0]; var postContent=postTable.rows[1].cells[0]; var modCount=postContent.innerHTML.match(/\[mod=(\d+?)\]/); postContent.innerHTML=postContent.innerHTML.replace(/\[mod=(\d+?)\]/,''); var inserted=document.createTextNode('Modified '+modCount[1]+' time'+(modCount[1]!=1?'s - ':' - ')); lastEditSpot.parentNode.insertBefore(inserted,lastEditSpot); }
if (pb_action=='modifypost') { if (document.postForm && document.postForm.message.value.match(/\[mod=(\d+?)\]/)) { currentModCount=parseInt(RegExp.$1); } document.postForm.message.value=document.postForm.message.value.replace(/\[mod=(\d+?)\]/,''); if (document.postForm.addEventListener) { document.postForm.addEventListener('submit',updateModificationCount,true); } else { document.postForm.attachEvent('onsubmit',updateModificationCount); } } if (pb_action=='post' && location.href.match(/quote=/)) { if (document.postForm.message.value.match(/\[mod=(\d+?)\]/)) { document.postForm.message.value=document.postForm.message.value.replace(/\[mod=(\d+?)\]/g,''); } } if (pb_action.match(/display|recent|search/)) { for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='80%' && td[tt].vAlign=='top' && td[tt].className.match(/windowbg/) && td[tt].innerHTML.match(/\[mod=(\d+?)\]/)) displayModificationCount(td[tt]); } }
//--> </script>
|
|