Post by Todge on Oct 6, 2008 9:49:52 GMT -8
This will add another button to your posting page between the and the buttons. Clicking it will enter the tags to your post.
Any text between them will be justified to the width of the post box.
Put it in your Global Footer..
You need to edit this line at the top with the URL of your chosen button image..
I have already made one which you are welcome to use, but please host it yourself as I can't guarantee that I will keep it in the same location..
Any text between them will be justified to the width of the post box.
Put it in your Global Footer..
<script type="text/javascript">
<!--
// Justify text in posts..
var jButton = 'URL OF IMAGE';
// Add button to posting page..
if(document.postForm)
{
var buttons = document.images;
for(b = 0; b < buttons.length; b++)
{
if(buttons[b].alt.match(/Align Right/))
{
buttons = buttons[b + 1].parentNode;
break;
}}
var justifyButton = document.createElement('A');
justifyButton.setAttribute('href', 'javascript:add("[justify]","[/justify]")');
justifyButton.innerHTML = '<img src="' + jButton + '" border="0" alt="Justify">';
buttons.parentNode.insertBefore(justifyButton, buttons);
}
// Find and justify board descriptions
if(/^(home|boardindex)$/.test(pb_action)&& !/=newestthreads$/i.test(location.href))
{
var n=document.getElementsByTagName("td"),a,x=-1;
while(n[++x]){ a=n[x].innerHTML;
if(n[x].width=="66%"&&n[x].onclick&&a.indexOf("[justify]")!=-1){
n[x].innerHTML=a.replace(/\[justify\]/ig, '<div align="justify">').replace(/\[\/justify\]/ig, '</div>');
}}}
// Find and justify text in posts...
if(pb_action.match(/(display|post|preview|search2)/))
{
var posts = document.getElementsByTagName('font');
for(p = 0; p < posts.length; p++)
{
if((posts[p].innerHTML.match(/google_ad_section_start/) && posts[p].innerHTML.match(/\[justify\]/i)) || (posts[p].size == 1 && posts[p].innerHTML.match(/\[justify\]/i) && !posts[p].innerHTML.match(/(<textare|script:add)/i)))
{
var fonts = posts[p].getElementsByTagName('font');
var codes = new Array();
for(f = 0; f < fonts.length; f++)
{
if(fonts[f].className == 'code')
{
codes[f] = fonts[f].innerHTML;
fonts[f].innerHTML = f;
}}
posts[p].innerHTML = posts[p].innerHTML.replace(/\[justify\]/ig, '<div align="justify">');
posts[p].innerHTML = posts[p].innerHTML.replace(/\[\/justify\]/ig, '</div>');
for(f = 0; f < fonts.length; f++)
{
if(fonts[f].className == 'code')
{
fonts[f].innerHTML = codes[fonts[f].innerHTML];
}}}}}
// -->
</script>
You need to edit this line at the top with the URL of your chosen button image..
var jButton = 'URL OF IMAGE';
I have already made one which you are welcome to use, but please host it yourself as I can't guarantee that I will keep it in the same location..
Updated to take 'code' tags into consideration.
Make sure this code is ABOVE any code you have that modifies the code tags.
Make sure this code is ABOVE any code you have that modifies the code tags.
Updated to include board description.
Thanks Subdevo.
Thanks Subdevo.