=======================================================================================================================================
Title: BB Code: Google Video

Mod Version: 1.0

Author: Thewarlock

Original Idea for Youtube: Tularis, John Briggs

Description: This modification will allow the use of inserting Google video within posts by means of BBCode.

Copyright:  2007-2008 XMBMods.com. All rights reserved.

Compatibility: XMB 1.9.8 SP3

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

=======================================================================================================================================
=======
Step 1:
=======

=======================
Edit File: lang/English.lang.php
=======================

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

?>

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

// BB Code: Google Video Mod Begin
$lang['bbcode_help_gvideo'] = "Google Video tag\\nAdds a Google Video movie.\\nUsage: [gvideo]your Google Video movie-id[/gvideo]";
$lang['bbcode_prompt_gvideo'] = "Please enter the Google Video movie-id of the movie you would like to link to.";
$lang['cb_insert_gvideo'] = "Insert Google Video Movie Id";
// BB Code: Google Video Mod End

=======================================================================================================================================
=======
Step 2:
=======

=========================
Edit File: include/functions.inc.php
=========================

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

    $patterns[] = "#\[email=([^\"'<>]*?){1}([^\"]*?)\](.*?)\[/email\]#Smi";
    $replacements[] = '<a href="mailto:\1\2">\3</a>';

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

    // BB Code: Google Video Mod Begin
    $patterns[] = "#\[gvideo]([a-zA-Z0-9_-]+)\[/gvideo\]#Smi";
    $replacements[] = '<object width="425" height="350"><param name="movie" value="http://video.google.com/googleplayer.swf?docId=\1"></param>
    <embed style="width:400px; height:326px;" id="VideoPlayback" align="middle" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=\1" allowScriptAccess="sameDomain" quality="best" bgcolor="#ffffff" scale="noScale" salign="TL"  FlashVars="playerMode=embedded"></embed></object>';
    // BB Code: Google Video Mod End

=======================================================================================================================================
=======
Step 3:
=======

===================================
Go To Administration Panel -> Templates -> css
===================================

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

.status_Member, .status_Banned {
    text-decoration: none;
    font-weight: normal;
    color: $tabletext;
    font-family: Verdana;
    font-size: 10px;
}

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

.gvideo {
    background-color: transparent;
    border: none;
}

=======================================================================================================================================
=======
Step 4:
=======

=============================================
Go To Administration Panel -> Templates -> functions_bbcode
=============================================

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

var bbcode_help_underline = "$lang[bbcode_help_underline]";
var bbcode_prompt_underline = "$lang[bbcode_prompt_underline]";

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

var bbcode_help_gvideo = "$lang[bbcode_help_gvideo]";
var bbcode_prompt_gvideo = "$lang[bbcode_prompt_gvideo]";

=======================================================================================================================================
=======
Step 5:
=======

================================================
Go To Administration Panel -> Templates -> 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:gvideo()"><img src="$THEME[imgdir]/bb_gvideo.gif" border="0" width="23" height="22" alt="$lang[cb_insert_gvideo]" /></a></td>

=======================================================================================================================================
=======
Step 6:
=======

=====================
Edit File: js/bbcodefns-ie.js
=====================

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

function storeCaret(textEl) {

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

// BB Code: Google Video Mod Begin
function gvideo() {
    if (helpmode) {
        alert(bbcode_help_gvideo);
    } else if (advmode) {
        AddText('', '', "[gvideo] [/gvideo]", messageElement);
    } else {
        var txt = prompt(bbcode_prompt_gvideo, "movie-id");
        if (txt != null) {
            AddText('', '', "[gvideo]"+txt+"[/gvideo]", messageElement);
        }
    }
}
// BB Code: Google Video Mod End

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

========================
Edit File: js/bbcodefns-mozilla.js
========================

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

function storeCaret() {

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

// BB Code: Google Video Mod Begin
function gvideo() {
    if (helpmode) {
        alert(bbcode_help_gvideo);
    } else if (advmode) {
        if (hasSelection(messageElement)) {
            wrapText('[gvideo]', '[/gvideo]', messageElement);
        } else {
            AddText('[gvideo]', '[/gvideo]', ' ', messageElement);
        }

    } else {
        if (hasSelection(messageElement)) {
            var text = prompt(bbcode_prompt_gvideo, fetchSelection(messageElement));
            if (text == fetchSelection(messageElement)) {
                wrapText('[gvideo]', '[/gvideo]', messageElement);
            } else {
                AddText('[gvideo]', '[/gvideo]', text, messageElement);
            }
        } else {
            var text = prompt(bbcode_prompt_gvideo, 'movie-id');
            AddText('[gvideo]', '[/gvideo]', text, messageElement);
        }
    }
}
// BB Code: Google Video Mod End

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

=======================
Edit File: js/bbcodefns-opera.js
=======================

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

function storeCaret(textEl) {

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

// BB Code: Google Video Mod Begin
function gvideo() {
    if (helpmode) {
        alert(bbcode_help_gvideo);
    } else if (advmode) {
        AddText('', '', "[gvideo] [/gvideo]", messageElement);
    } else {
        var txt = prompt(bbcode_prompt_gvideo, "movie-id");
        if (txt != null) {
            AddText('', '', "[gvideo]"+txt+"[/gvideo]", messageElement);
        }
    }
}
// BB Code: Google Video Mod End

=======================================================================================================================================
=======
Step 9:
=======

Upload provided generic image "bb_gvideo.gif" to all theme folders located in the "images" path.

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