[pLog-svn] r4737 - plog/branches/lifetype-1.1.6/js/tinymce/plugins/insertvideo
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Feb 14 03:59:16 EST 2007
Author: oscar
Date: 2007-02-14 03:59:16 -0500 (Wed, 14 Feb 2007)
New Revision: 4737
Modified:
plog/branches/lifetype-1.1.6/js/tinymce/plugins/insertvideo/functions.js
Log:
Fix backported from LT 1.2.
Modified: plog/branches/lifetype-1.1.6/js/tinymce/plugins/insertvideo/functions.js
===================================================================
--- plog/branches/lifetype-1.1.6/js/tinymce/plugins/insertvideo/functions.js 2007-02-14 08:58:44 UTC (rev 4736)
+++ plog/branches/lifetype-1.1.6/js/tinymce/plugins/insertvideo/functions.js 2007-02-14 08:59:16 UTC (rev 4737)
@@ -8,11 +8,11 @@
return regexp.test(url);
}
-function getYouTubeLink( url )
-{
+function getYouTubeLink( url )
+{
// check if this is a URL pointing to a youtube link or to a youtube video
if( url.substring( 0, 31 ) == "http://www.youtube.com/watch?v=" ) {
- // and if it's a link to a normal youtube page, build the right link to the video player
+ // and if it's a link to a normal youtube page, build the right link to the video player
var regexp = /http:\/\/www.youtube.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
result = regexp.exec( url );
if( result ) {
@@ -22,12 +22,30 @@
// let's try to make a best guess...
videoId = url.substring( 31, url.length );
}
-
+
url = "http://www.youtube.com/v/" + videoId;
}
+
+ // Checks if the URL is missing WWW.
+ else if ( url.substring( 0, 27 ) == "http://youtube.com/watch?v=" ) {
+ // and if it's a link to a normal youtube page, build the right link to the video player
+ var regexp = /http:\/\/youtube.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
+ result = regexp.exec( url );
+ if( result ) {
+ videoId = result[1];
+ }
+ else {
+ // let's try to make a best guess...
+ videoId = url.substring( 27, url.length );
+ }
+
+ url = "http://www.youtube.com/v/" + videoId;
+ }
+
return( url );
}
+
function getGoogleVideoLink( url )
{
// check if it's a link to a video page or a link to the video player
More information about the pLog-svn
mailing list