============================================================================================================================
Modification Name: BB Code: Card

Version: 1.0

Author: GuldantheWarlock

Description: This modification will add a BB code button for inserting custom card images.

Compatibility: XMB 1.9.5 SP1

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 v3. A copy is provided with this software package.

Please backup your files before installing this modification.
Neither XMBGarage nor the author can be held responsible if your board stops functioning properly due to you installing this modification

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 storeCaret(textEl) {

===============
Add Code Above:
===============

// BB Code: Card Mod Begin
function card() {
    if (helpmode) {
        alert(bbcode_help_card);
    }else if (advmode) {
        AddText('', '', "[card] [/card]", messageElement);
    }else {
        txt=prompt(bbcode_prompt_card,"card.jpg");
        if (txt!=null) {
            AddText('', '', "[card]"+txt+"[/card]", messageElement);
        }
    }
}
// BB Code: Card Mod End

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

function storeCaret(textEl) {

===============
Add Code Above:
===============

// BB Code: Card Mod Begin
function card() {
    if (helpmode) {
        alert(bbcode_help_card);
    }else if (advmode) {
        AddText('', '', "[card] [/card]", messageElement);
    }else {
        txt=prompt(bbcode_prompt_card,"card.jpg");
        if (txt!=null) {
            AddText('', '', "[card]"+txt+"[/card]", messageElement);
        }
    }
}
// BB Code: Card Mod End

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

function storeCaret() {

===============
Add Code Above:
===============

// BB Code: Card Mod Begin
function card() {
    if(helpmode) {
        alert(bbcode_help_card);

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

    } else {
        if(hasSelection(messageElement)) {
            text = prompt(bbcode_prompt_card, fetchSelection(messageElement));
            if(text == fetchSelection(messageElement)) {
                wrapText('[card]', '[/card]', messageElement);
            } else {
                AddText('[card]', '[/card]', text, messageElement);
            }
        } else {
            text = prompt(bbcode_prompt_card, 'card.jpg');
            AddText('[card]', '[/card]', text, messageElement);
        }
    }
}
// BB Code: Card Mod End

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

// BB Code: Card Mod Begin
$lang['bbcode_help_card'] = "Card Tag\\nShow a card image\\nUsage: [card]card.jpg[/card]";
$lang['bbcode_prompt_card'] = "Please enter the Card Name";
$lang['cb_insert_card'] = "Insert Card";
// BB Code: Card Mod End

============================================================================================================================
=======
Step 5:
=======
=======================
Edit File: functions.php
=======================
==========
Find Code:
==========

        $patterns[] = "#\[align=(left|center|right|justify)\](.+?)\[/align\]#Ssi";
        $replacements[] = '<div style="text-align: $1;">$2</div>';

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

        // BB Code: Card Mod Begin
        $patterns[] = "#\[card\](.+?)\[/card\]#Ssi";
        $replacements[] = '<img src="http://www.veracity.nu/images/decks/$1" alt="$1" />';
        // BB Code: Card Mod End

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

var messageElement;

===============
Add Code Above:
===============

var bbcode_help_card	= "$lang[bbcode_help_card]";
var bbcode_prompt_card = "$lang[bbcode_prompt_card]";

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

<a href="javascript:list()"><img src="$imgdir/bb_list.gif" border="0" width="23" height="22" alt="$lang[cb_insert_list]" /></a></td>

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

<a href="javascript:list()"><img src="$imgdir/bb_list.gif" border="0" width="23" height="22" alt="$lang[cb_insert_list]" /></a>
<a href="javascript:card()"><img src="$imgdir/bb_card.gif" border="0" width="23" height="22" alt="$lang[cb_insert_card]" /></a></td>

============================================================================================================================
=======
Step 8: 
=======

Upload the image 'bb_card.gif' to all of your theme folders.

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