============================================================================================================================
Modification Title: BB Code: More Text Alignment Options v1.1

Author: Ahmad

Description: This modification will add more alignment options (Right , Left , Justify) to the text in posts in addition to the (Center) function.

Compatability: 1.9.5 SP1

Bonus: 2 example button icons for this feature.

Install Note: Before adding this modification to your forum, you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.
============================================================================================================================
=======
Step 1:
=======
========================
Edit File: include/bbcodefns-ie.js
========================
==========
Find Code:
==========

function center() {
    if (helpmode) {
        alert(bbcode_help_center);
    }else if (advmode) {
        AddText('', '', "[align=center] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_center,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=center]"+txt+"[/align]", messageElement);
        }
    }
}

===============
Add Code Below:
===============


// BB Code: More Text Alignment Options Mod Begin
function right() {
    if (helpmode) {
        alert(bbcode_help_right);
    }else if (advmode) {
        AddText('', '', "[align=right] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_right,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=right]"+txt+"[/align]", messageElement);
        }
    }
}

function left() {
    if (helpmode) {
        alert(bbcode_help_left);
    }else if (advmode) {
        AddText('', '', "[align=left] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_left,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=left]"+txt+"[/align]", messageElement);
        }
    }
}

function justify() {
    if (helpmode) {
        alert(bbcode_help_justify);
    }else if (advmode) {
        AddText('', '', "[align=justify] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_justify,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=justify]"+txt+"[/align]", messageElement);
        }
    }
}
// BB Code: More Text Alignment Options Mod End

=======================================================================================================================================
=======
Step 2:
=======
===========================
Edit File: include/bbcodefns-opera.js
===========================
==========
Find Code:
==========

function center() {
    if (helpmode) {
        alert(bbcode_help_center);
    }else if (advmode) {
        AddText('', '', "[align=center] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_center,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=center]"+txt+"[/align]", messageElement);
        }
    }
}

===============
Add Code Below:
===============

// BB Code: More Text Alignment Options Mod Begin
function right() {
    if (helpmode) {
        alert(bbcode_help_right);
    }else if (advmode) {
        AddText('', '', "[align=right] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_right,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=right]"+txt+"[/align]", messageElement);
        }
    }
}

function left() {
    if (helpmode) {
        alert(bbcode_help_left);
    }else if (advmode) {
        AddText('', '', "[align=left] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_left,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=left]"+txt+"[/align]", messageElement);
        }
    }
}

function justify() {
    if (helpmode) {
        alert(bbcode_help_justify);
    }else if (advmode) {
        AddText('', '', "[align=justify] [/align]", messageElement);

    }else {
        txt=prompt(bbcode_prompt_justify,"Text");
        if (txt!=null) {
            AddText('', '', "\r[align=justify]"+txt+"[/align]", messageElement);
        }
    }
}
// BB Code: More Text Alignment Options Mod End

=======================================================================================================================================
=======
Step 3:
=======
============================
Edit File: include/bbcodefns-mozilla.js
============================
==========
Find Code:
==========

function center() {
    if(helpmode) {
        alert(bbcode_help_center);

    } else if(advmode) {
        if(hasSelection(messageElement)) {
            wrapText('[align=center]', '[/align]', messageElement);
        } else {
            AddText('[align=center]', '[/align]', ' ', messageElement);
        }

    } else {
        if(hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_center, fetchSelection(messageElement));
            if(text == fetchSelection(messageElement)) {
                wrapText('[align=center]', '[/align]', messageElement);
            } else {
                AddText('[align=center]', '[/align]', text, messageElement);
            }
        } else {
            text = prompt(bbcode_prompt_center, 'Text');
            AddText('[align=center]', '[/align]', text, messageElement);
        }
    }
}

===============
Add Code Below:
===============


// BB Code: More Text Alignment Options Mod Begin
function right() {
    if (helpmode) {
        alert(bbcode_help_right);
    }else if(advmode) {
        if (hasSelection(messageElement)) {
            wrapText('[align=right]', '[/align]', messageElement);
        }else {
            AddText('[align=right]', '[/align]', ' ', messageElement);
        }
    }else {
        if (hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_right, fetchSelection(messageElement));
            if (text == fetchSelection(messageElement)) {
                wrapText('[align=right]', '[/align]', messageElement);
            }else {
                AddText('[align=right]', '[/align]', text, messageElement);
            }
        }else {
            text = prompt(bbcode_prompt_right, 'Text');
            AddText('[align=right]', '[/align]', text, messageElement);
        }
    }
}

function left() {
    if (helpmode) {
        alert(bbcode_help_left);
    }else if(advmode) {
        if (hasSelection(messageElement)) {
            wrapText('[align=left]', '[/align]', messageElement);
        }else {
            AddText('[align=left]', '[/align]', ' ', messageElement);
        }
    }else {
        if (hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_left, fetchSelection(messageElement));
            if (text == fetchSelection(messageElement)) {
                wrapText('[align=left]', '[/align]', messageElement);
            }else {
                AddText('[align=left]', '[/align]', text, messageElement);
            }
        }else {
            text = prompt(bbcode_prompt_left, 'Text');
            AddText('[align=left]', '[/align]', text, messageElement);
        }
    }
}

function justify() {
    if (helpmode) {
        alert(bbcode_help_justify);
    }else if(advmode) {
        if (hasSelection(messageElement)) {
            wrapText('[align=justify]', '[/align]', messageElement);
        }else {
            AddText('[align=justify]', '[/align]', ' ', messageElement);
        }
    }else {
        if (hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_justify, fetchSelection(messageElement));
            if (text == fetchSelection(messageElement)) {
                wrapText('[align=justify]', '[/align]', messageElement);
            }else {
                AddText('[align=justify]', '[/align]', text, messageElement);
            }
        }else {
            text = prompt(bbcode_prompt_justify, 'Text');
            AddText('[align=justify]', '[/align]', text, messageElement);
        }
    }
}
// BB Code: More Text Alignment Options Mod End

============================================================================================================================
=======
Step 4:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above  ?>
============================

// BB Code: More Text Alignment Options Mod Begin
$lang['bbcode_help_right'] = "Right tag\\nRight the enclosed text.\\nUsage: [align=right]This text is set to right[/align]";
$lang['bbcode_prompt_right'] = "Please enter the text that should be set to right";
$lang['cb_insert_right'] = "Insert text with right aligning";
$lang['bbcode_help_left'] = "Left tag\\nLeft the enclosed text.\\nUsage: [align=left]This text is set to left[/align]";
$lang['bbcode_prompt_left'] = "Please enter the text that should be set to left";
$lang['cb_insert_left'] = "Insert text with left aligning";
$lang['bbcode_help_justify'] = "Justify tag\\nJustify the enclosed text.\\nUsage: [align=justify]This text is justified[/align]";
$lang['bbcode_prompt_justify'] = "Please enter the text that should be Justified";
$lang['cb_insert_justify'] = "Insert text that should be justified";
// BB Code: More Text Alignment Options Mod End

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
=========================
Edit Template: functions_bbcode
=========================

==========
Find Code:
==========

var bbcode_help_center = "$lang[bbcode_help_center]";
var bbcode_prompt_center = "$lang[bbcode_prompt_center]";

================
Replace Code With:
================

var bbcode_help_right   = "$lang[bbcode_help_left]";
var bbcode_prompt_right = "$lang[bbcode_prompt_left]";

var bbcode_help_center = "$lang[bbcode_help_center]";
var bbcode_prompt_center = "$lang[bbcode_prompt_center]";

var bbcode_help_left    = "$lang[bbcode_help_right]";
var bbcode_prompt_left  = "$lang[bbcode_prompt_right]";

var bbcode_help_justify = "$lang[bbcode_help_justify]";
var bbcode_prompt_justify   = "$lang[bbcode_prompt_justify]";


============================================================================================================================
=======
Step 6:
=======
===============================
Go To Administration Panel --> Templates
===============================
============================
Edit Template: functions_bbcodeinsert
============================
==========
Find Code:
==========

<a href="javascript:center()"><img src="$imgdir/bb_center.gif" border="0" width="23" height="22" alt="$lang[cb_insert_centered]" /></a>

===============
Replace with :
===============

<a href="javascript:left()"><img src="$imgdir/bb_left.gif" border="0" width="23" height="22" alt="$lang[cb_insert_left]" /></a>
<a href="javascript:center()"><img src="$imgdir/bb_center.gif" border="0" width="23" height="22" alt="$lang[cb_insert_centered]" /></a>
<a href="javascript:right()"><img src="$imgdir/bb_right.gif" border="0" width="23" height="22" alt="$lang[cb_insert_right]" /></a>
<a href="javascript:justify()"><img src="$imgdir/bb_justify.gif" border="0" width="23" height="22" alt="$lang[cb_insert_justify]" /></a>


============================================================================================================================
=======
Step 7:
=======

Upload the "bb_left.gif , bb_right.gif , bb_justify.gif" located in the Contents folder to your theme directory.

=======================================================================================================================================
Enjoy!