[DEV] integrate youtube + googlevid in Advanced BBCode Box 5

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
User avatar
freddie
Registered User
Posts: 404
Joined: Sun Mar 31, 2002 1:40 pm
Location: Estes Park, USA
Contact:

[DEV] integrate youtube + googlevid in Advanced BBCode Box 5

Post by freddie »

Please check what you need:

1. I want to see some screenshots, or live action (scroll to point 1)

2. I have already installed advanced bbcode box mod 5.0.0 and i want to install the addon (scroll to point 2)

3. I haven't installed advanced advanced bbcode box mod but i want to (scroll to point 3)

*****************************************************************************

1. See the mod + addon in action

screenshots (screenshots are from my board (dutch) but install file and instructions for this mod are in english :wink: )

Image

Image

Image

Image

*****************************************************************************

2. Before installing the addon, you have to fix a java-script error in the advanced bbcode box mod 5.0.0 version. Folow steps below
  • note:

    :idea: there is a mistake in the original posting_body.tpl file from the advanced bbcode box-mod. this error will cause a javascript-error at the bottom of your screen when you use IE. :arrow: To solve this, folow steps below after installing advanced bbcode box mod


    open posting_body.tpl

    look for this part (think around line 154)

    Code: Select all

    <img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify') border-style: outset; border-width: 1" alt="justify">


    (its part of a longer line)
    and change it into

    Code: Select all

    <img border="0" src="mods/bbcode_box/images/justify.gif" class="postimage" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" style="border-style: outset; border-width: 1" alt="justify">
Ok, now that we have done that, it is time to install the google-video and youtube addon. Folow steps below

a) these are the image buttons (you need to put them in mods/bbcode_box/images/ )

Image and Image

b) ( The install file below is the result of al the comments on the first 6 pages of this topic, so you don't have to make any other adjustments and you don't have to pay attention to what is said on the first 6 pages here ;) )

Code: Select all

##############################################################
## MOD Title: Add youtube and google video to Advanced BBCode Box MOD
## MOD Author: Disturbed One < anthony@anthonycoy.com > (Anthony Coy) http://www.hvmdesign.com
## MOD Author: AL Tnen <al_tnen@hotmail.com> (N/A) http://www.tnen.zzn.com
## MOD Author: freddie <freddie@tactic.be> (Stefaan Van Damme) http://www.tactic.be
## MOD Description: This MOD adds lots of useful BBCode features and makes the bbcode buttons
##		    look just like Microsoft Office 2003. It also improves the functions of
##		    phpBB's BBCode function. It adds the bbcode exactly where the cursor is,
##		    inserts smilies where the cursor is, and adds more ways to customize posts.
##		    The MOD is very fast loading, and is a sleek addition to your phpBB bulletin board.
##
## MOD Version: 1.0.0c
##
## Installation Level:	Easy
## Installation Time:	10 Minutes
##
## Files To Edit: (5)
##	language/lang_english/lang_main.php
##	includes/bbcode.php
##	templates/subSilver/bbcode.tpl
##	templates/subSilver/posting_body.tpl
##	templates/subSilver/subsilver.css
##
## Included Files: (57)
##	bbcode_box/add_bbcode.js
##	bbcode_box/grad.htm
##	bbcode_box/images/*
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##	I (freddie) tried to contact the previous developpers of this mod, but they didn't replied.
##      I added the google video and youtube images, and stopped video from starting automatic
##
##	Please do not remove the copyright notice located on the box
##      without permission from me.
##
##	- Google video
##	- Youtube Video
##
##############################################################
## MOD History:
##
##  some minor changes 
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files ## Related To This MOD
############################################################## 
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['bbcode_f_help']

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['bbcode_help']['GVideo'] = 'GVideo: [GVideo]GVideo URL[/GVideo]';
$lang['GVideo_link'] = 'Link';

$lang['bbcode_help']['youtube'] = 'YouTube: [youtube]YouTube URL[/youtube]';
$lang['youtube_link'] = 'Link';

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<img border="0" src="mods/bbcode_box/images/code.gif" name="code" type="image" onClick="BBCcode()" onMouseOver="helpline('code')" class="postimage" alt="Code">
#
#-----[ IN-LINE FIND ]------------------------------------------
#
<img border="0" src="mods/bbcode_box/images/ram.gif" name="ram" type="image" onClick="BBCram()" onMouseOver="helpline('ram')" class="postimage" alt="Real Media">
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<img border="0" src="mods/bbcode_box/images/googlevid.gif" name="GVideo" type="image" onClick="BBCGVideo()" onMouseOver="helpline('googlevid')" class="postimage" alt="GoogleVid"><img border="0" src="mods/bbcode_box/images/youtube.gif" name="youtube" type="image" onClick="BBCyoutube()" onMouseOver="helpline('youtube')" class="postimage" alt="Youtube">
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
</EMBED></OBJECT><!-- END flash -->

#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN GVideo -->
<object width="425" height="350">
        <param name="movie" value="http://video.google.com/googleplayer.swf?docId={GVIDEOID}"></param>
<embed style="width:400px; height:326px;" id="VideoPlayback"
        align="middle" type="application/x-shockwave-flash"
        src="http://video.google.com/googleplayer.swf?docId={GVIDEOID}"
        allowScriptAccess="sameDomain" quality="best" bgcolor="#ffffff"
        scale="noScale" salign="TL"  FlashVars="playerMode=embedded">
</embed>
</object><br />
<a href="http://video.google.com/googleplayer.swf?docId={GVIDEOID}" target="_blank">{GVIDEOLINK}</a><br />
<!-- END GVideo -->

<!-- BEGIN youtube -->
<object width="425" height="350">
   <param name="movie" value="http://www.youtube.com/v/{YOUTUBEID}"></param>
   <embed src="http://www.youtube.com/v/{YOUTUBEID}" type="application/x-shockwave-flash" width="425" height="350"></embed>
</object><br />
<a href="http://youtube.com/watch?v={YOUTUBEID}" target="_blank">{YOUTUBELINK}</a><br />
<!-- END youtube -->

#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------
#
$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);

#
#-----[ AFTER, ADD ]------------------------------------------
#
$bbcode_tpl['GVideo'] = str_replace('{GVIDEOID}', '\\1', $bbcode_tpl['GVideo']);
$bbcode_tpl['GVideo'] = str_replace('{GVIDEOLINK}', $lang['GVideo_link'], $bbcode_tpl['GVideo']);

$bbcode_tpl['youtube'] = str_replace('{YOUTUBEID}', '\\1', $bbcode_tpl['youtube']);
$bbcode_tpl['youtube'] = str_replace('{YOUTUBELINK}', $lang['youtube_link'], $bbcode_tpl['youtube']);

#
#-----[ FIND ]------------------------------------------
#
// [email]user@domain.tld[/email] code..
$patterns[] = "#\[email\]([a-z0-9&\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
$replacements[] = $bbcode_tpl['email'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
// [GVideo]GVideo URL[/GVideo] code..
$patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
$replacements[] = $bbcode_tpl['GVideo'];
         
 // [youtube]YouTube URL[/youtube] code..
$patterns[] = "#\[youtube\]http://(?:www\.)?youtube.com/watch\?v=([0-9A-Za-z-_]{11})[^[]*\[/youtube\]#is";
$replacements[] = $bbcode_tpl['youtube'];

#
#-----[ OPEN ]------------------------------------------
#
mods/bbcode_box/bbcode_box.js
#
#-----[ FIND ]------------------------------------------
#
symbol_help = "Insert Symbol Into Post";
#
#-----[ AFTER, ADD ]------------------------------------------
#
youtube_help = "Post a youtube-movie";
googlevid_help = "Post a google video";
#
#-----[ FIND ]------------------------------------------
#
var symbol = 0;

#
#-----[ AFTER, ADD ]------------------------------------------
#
var youtube = 0;
var GVideo = 0;

#
#-----[ FIND ]------------------------------------------
#
function helpline(help) {

#
#-----[ BEFORE, ADD ]------------------------------------------
#
function BBCGVideo() {
   var FoundErrors = '';
   var enterURL   = prompt("Give the URL of the page containing the movie", "http://");
   if (!enterURL)    {
      FoundErrors += "Didnt gave an URL";
   }
   if (FoundErrors)  {
      alert("Error:"+FoundErrors);
      return;
   }
   var ToAdd = "[GVideo]"+enterURL+"[/GVideo]";
   PostWrite(ToAdd);
}

function BBCyoutube() {
   var FoundErrors = '';
   var enterURL   = prompt("Give the URL of the page containing the movie", "http://");
   if (!enterURL)    {
      FoundErrors += "Didnt gave an URL";
   }
   if (FoundErrors)  {
      alert("Error:"+FoundErrors);
      return;
   }
   var ToAdd = "[youtube]"+enterURL+"[/youtube]";
   PostWrite(ToAdd);
}

#
#-----[ OPEN ]------------------------------------------
#
mods/bbcode_box/add_bbcode.js
#
#-----[ FIND ]------------------------------------------
#
symbol_help = "Insert Symbol Into Post";
#
#-----[ AFTER, ADD ]------------------------------------------
#
youtube_help = "Post a youtube-movie";
googlevid_help = "Post a google video";
#
#-----[ FIND ]------------------------------------------
#
var symbol = 0;

#
#-----[ AFTER, ADD ]------------------------------------------
#
var youtube = 0;
var GVideo = 0;
#
#-----[ FIND ]------------------------------------------
#
function helpline(help) {

#
#-----[ BEFORE, ADD ]------------------------------------------
#
function BBCGVideo() {
   var FoundErrors = '';
   var enterURL   = prompt("Give the URL of the page containing the movie", "http://");
   if (!enterURL)    {
      FoundErrors += "Didnt gave an URL";
   }
   if (FoundErrors)  {
      alert("Error:"+FoundErrors);
      return;
   }
   var ToAdd = "[GVideo]"+enterURL+"[/GVideo]";
   PostWrite(ToAdd);
}

function BBCyoutube() {
   var FoundErrors = '';
   var enterURL   = prompt("Give the URL of the page containing the movie", "http://");
   if (!enterURL)    {
      FoundErrors += "Didnt gave an URL";
   }
   if (FoundErrors)  {
      alert("Error:"+FoundErrors);
      return;
   }
   var ToAdd = "[youtube]"+enterURL+"[/youtube]";
   PostWrite(ToAdd);
}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
thx to HoundoftheB for helping me making the addon easymod compatible

*****************************************************************************

3. If you want to use the advanced bbcode box mod for the first time, you can download the new version 5.1.0c. In this version, the javascript error is fixed AND the youtube and googlevideo buttons are included !

read this topic about advanced bbcode box mod here


Please help eachother when you find errors cause im not good in solving them :D
Last edited by freddie on Sun Jun 17, 2007 9:49 pm, edited 27 times in total.

KasLimon
Registered User
Posts: 26
Joined: Tue Oct 10, 2006 9:32 pm

Post by KasLimon »

It works fine!

The problem is with the foreign google videos, with youtube it's perfect.

You can see it here: Image

If you try to make it compatible with video.google.es, .com.au, .ca, .de, .fr, .it, .nl, .pl and .co.uk it would be better. If you need help, just say me the problem and I'll try to help you ;)

User avatar
freddie
Registered User
Posts: 404
Joined: Sun Mar 31, 2002 1:40 pm
Location: Estes Park, USA
Contact:

Post by freddie »

change this

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
+ line below
into this

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
$patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
in bbcode.php

and let me know the result plz
Last edited by freddie on Tue Nov 07, 2006 9:27 am, edited 1 time in total.

User avatar
Elias
Registered User
Posts: 4725
Joined: Sat Feb 25, 2006 4:31 pm
Location: In the Water!
Name: Elias

Post by Elias »

Very nice MOD. I love it and will be using it.
Thanks for this.
"Mystery creates wonder, and wonder is the basis of man's desire to understand." - Neil Armstrong
|Installing Extensions|Writing Extensions|Extension Validation Policy|

KasLimon
Registered User
Posts: 26
Joined: Tue Oct 10, 2006 9:32 pm

Post by KasLimon »

The result was fine! you can see the result here.

Also, you can add one feature to each video (the helpline). You can try to do this in bbcode_box.js and add_bbcode.js:

Find (full line ends with ; ):

Code: Select all

flash_help
After, Add

Code: Select all

GVideo_help="Enter Google Video: [GVideo]Video URL[/GVideo]";
youtube_help="Enter Youtube video: [youtube]Video URL[/youtube]";
In my forum don't works the GVideo helpline (my little add) but youtube helpline works :?... I don't know why...

And just a little error in your modifications:
Find
function BBCGVideo() {
var FoundErrors = '';
var enterURL = prompt("Give the URL of the page containing the movie", "http://");
if (!enterURL) {
FoundErrors += " Error: Didnt gave an URL";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[GVideo]"+enterURL+"[/GVideo]";
PostWrite(ToAdd);
}

function BBCyoutube() {
var FoundErrors = '';
var enterURL = prompt("Give the URL of the page containing the movie", "http://");
if (!enterURL) {
FoundErrors += " Error: Didnt gave an URL";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[youtube]"+enterURL+"[/youtube]";
PostWrite(ToAdd);
}

Replace with:
function BBCGVideo() {
var FoundErrors = '';
var enterURL = prompt("Give the URL of the page containing the movie", "http://");
if (!enterURL) {
FoundErrors += " Didn't gave an URL";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[GVideo]"+enterURL+"[/GVideo]";
PostWrite(ToAdd);
}

function BBCyoutube() {
var FoundErrors = '';
var enterURL = prompt("Give the URL of the page containing the movie", "http://");
if (!enterURL) {
FoundErrors += " Didn't gave an URL";
}
if (FoundErrors) {
alert("Error:"+FoundErrors);
return;
}
var ToAdd = "[youtube]"+enterURL+"[/youtube]";
PostWrite(ToAdd);
}

When you don't write an URL it shows "Error: Error: Didnt..." and now it must show "Error: Didn't..."

Ok, I'm trying to find the error of my add but I don't find it ;)

Congratulations! It alll work fine!

Peter77sx
Registered User
Posts: 3259
Joined: Wed Nov 09, 2005 2:51 pm

Post by Peter77sx »

Hmm. I must be using an older version of the advanced bbcode mod but is working fine. thank you for this. :)



KasLimon, thanks for the fix... I also noticed that.

KasLimon
Registered User
Posts: 26
Joined: Tue Oct 10, 2006 9:32 pm

Post by KasLimon »

Sorry I'm lost. Did I make/repare/send (I don't know what verb put in here, sorry ;) ) any fix?

I'm sorry about mystupid question but I thought that this mod was in developement... Or... are you talking about the advanced bbcode box mod?

User avatar
freddie
Registered User
Posts: 404
Joined: Sun Mar 31, 2002 1:40 pm
Location: Estes Park, USA
Contact:

Post by freddie »

i think 'fix' = 'help with the mod' ;)

KasLimon
Registered User
Posts: 26
Joined: Tue Oct 10, 2006 9:32 pm

Post by KasLimon »

Ok, thanks freddie.

Then, have you tested than I said in my other message?

User avatar
freddie
Registered User
Posts: 404
Joined: Sun Mar 31, 2002 1:40 pm
Location: Estes Park, USA
Contact:

Post by freddie »

about being compatible with google.de, .es .au ? i use it and it works

i still need to put that helpline in my first post, but ll do it soon

KasLimon
Registered User
Posts: 26
Joined: Tue Oct 10, 2006 9:32 pm

Post by KasLimon »

Yes, with foreign google sites it do it :roll:

But I cannot see the google's helpline, just the youtube's... Yours work?

User avatar
freddie
Registered User
Posts: 404
Joined: Sun Mar 31, 2002 1:40 pm
Location: Estes Park, USA
Contact:

Post by freddie »

mine works yes,

but i think i forgot something in my first post :oops:

For helpline

Both for /mods/bbcode_box/add_bbcode.js and /mods/bbcode_box/bbcode_box.js


Find:

Code: Select all

ram_help="Insert Real Media file: [ram]File URL[/ram]";
After Add:

Code: Select all

googlevid_help="Insert Google Video URL: [GVideo]GVideo URL[/GVideo]";
youtube_help="Insert Youtube URL: [youtube]Youtube URL[/youtube][/ram]";

dnbspace
Registered User
Posts: 127
Joined: Thu Oct 19, 2006 11:21 am
Location: Milton Keynes

Post by dnbspace »

freddie wrote: change this

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
$patterns[] = "#\[GVideo\]http://video.google.com/videoplay\?docid=([0-9A-Za-z-_]*)[^[]
into this

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
$patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
in bbcode.php

and let me know the result plz


this doesnt work for me.

When i do this and try to add the google video to a thread I get this

Parse error: parse error, unexpected '[' in /home/content/H/a/t/Hattersley/html/includes/bbcode.php on line 259

Can you please have a look at my code

Code: Select all

\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";*\[/GVideo\]#is"; 
$replacements[] = $bbcode_tpl['GVideo']; 

KasLimon
Registered User
Posts: 26
Joined: Tue Oct 10, 2006 9:32 pm

Post by KasLimon »

Hi, when freddie sais this:
freddie wrote: change this

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
$patterns[] = "#\[GVideo\]http://video.google.com/videoplay\?docid=([0-9A-Za-z-_]*)[^[]
into this

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
$patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
in bbcode.php

and let me know the result plz

You must search the full line (that ends with ;) and replace it all into this:

Code: Select all

// [GVideo]GVideo URL[/GVideo] code.. 
$patterns[] = "#\[GVideo\]http://video.google.[A-Za-z0-9.]{2,5}/videoplay\?docid=([0-9A-Za-z-_]*)[^[]*\[/GVideo\]#is";
Try this and tell us ;)

dnbspace
Registered User
Posts: 127
Joined: Thu Oct 19, 2006 11:21 am
Location: Milton Keynes

Post by dnbspace »

you guys are excellent, where can I donate? :lol:

Post Reply

Return to “[2.0.x] MODs in Development”