Post by Cam! on Nov 20, 2010 18:25:02 GMT
Title: Code Tag Modification.
Creator: Alex.
Copyright Info: Open Source.
Placement: Global Footers, or a select board footer.
Code:
Creator: Alex.
Copyright Info: Open Source.
Placement: Global Footers, or a select board footer.
Code:
<script type="text/javascript">
<!--
// code tag modification
/*Code Tag Modification - By Alex - Open Source*/
var Code_Tag_Modification={
Location_Check: function(){
if(window.location.href.match(/action=(display|(user)?recent|calendarview|pmview)/) || window.location.href.match(/index.cgi$/) && (document.postForm||document.title.match(/\s-\sSearch/))){
this.Execute_Loop();
}
},
Execute_Loop: function(){
var Table=document.getElementsByTagName('table');
var i=Table.length-1;
do{
if(Table.item(i).cellPadding=="2" && Table.item(i).cellSpacing=="0" && Table.item(i).className=="code" && Table.item(i).width=="100%"){
Table.item(i).parentNode.parentNode.parentNode.parentNode.style.backgroundColor = 'transparent';
Table.item(i).cellPadding='1';
var Font=Table.item(i).rows[0].cells[0].firstChild;
var Br=Font.getElementsByTagName('br');
var Lines='1\n';
for(var a=0;a<Br.length;a++){
Lines+=(a+2)+'\n';
}
Font.innerHTML='<table width="100%" align="center" cellspacing="0" cellpadding="4"><tr><td align="right" class="windowbg" width="5%" rowspan="2" valign="top"><textarea rows="'+(Br.length+3)+'" cols="5" style="font-size: 10px; text-align: right;" disabled="true">'+Lines+'</textarea></td><td align="left" class="windowbg" width="95%"><textarea rows="'+(Br.length+3)+'" style="font-size: 10px; width: 100%;" wrap="off" onfocus="this.select()">'+Font.innerHTML.replace(/<br\s?\/?>/ig, '\n').replace(new RegExp('&a'+'mp;nb'+'sp;', 'g'), ' ')+'</textarea></td></tr><tr><td class="windowbg" width="100%"><div style="float: left;"><textarea style="display: none;">'+Font.innerHTML.replace(/<br\s?\/?>/ig, '\n').replace(new RegExp('&a'+'mp;nb'+'sp;', 'g'), ' ')+'</textarea><input type="submit" value="Undo All" onclick="this.parentNode.parentNode.parentNode.previousSibling.cells[1].firstChild.value = this.previousSibling.value"/></div><div style="float: right;"><font size="1">Total Characters: <span></span></font></div></td></tr></table>';
Font.getElementsByTagName('span').item(0).innerHTML = Font.getElementsByTagName('textarea').item(1).value.length;
}
i--;
}
while(i>4);
}
};
Code_Tag_Modification.Location_Check();
//-->
</script>