[pLog-svn] r7098 - in plog/branches/lifetype-1.2/js/tinymce/plugins: . insertvideo insertvideo/css insertvideo/img insertvideo/langs

Jon Daley plogworld at jon.limedaley.com
Tue Dec 21 12:59:09 EST 2010


Hi Mark - nice to have you back.  :)

Did you see the items in mantis related to the insertvideo plugin?  A user 
posted ~150 video sites to include in this plugin, and it'd be nice to 
have those added if it isn't too much trouble.  People complain about not 
having every last video site in the world included in this plugin.

On Tue, 21 Dec 2010, mark at devel.lifetype.net wrote:

> Author: mark
> Date: 2010-12-21 12:37:19 -0500 (Tue, 21 Dec 2010)
> New Revision: 7098
>
> Added:
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/README.txt
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/content.css
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/flash.css
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin_src.js
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/functions.js
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/bolt.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/dailymotion.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/dalealplay.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/goear.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/grouper.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/gvideo.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/ifilm.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/metacafe.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/spacer.gif
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/vimeo.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/youtube.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/zippyvideos.png
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en.js
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en_dlg.js
>   plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/videoinput.html
> Log:
> InsertVideo works now, I just refactored the plugin (almost rewrite) based on the tecnique I used in InsertResource plugin. There is one todo item: functions.js must rewrite to its own namespace.
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/README.txt
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/README.txt	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/README.txt	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,18 @@
> +InsertVideo:
> +
> +Author: Oscar Renalias / LifeType (copied from the flash plugin)
> +
> +A plugin for tinymce that allows to insert videos from youtube and
> +google video without breaking the xhhtml compliancy. The code has been
> +shamelessly ripped from the tinymce 'flash' plugin but it works.
> +
> +
> +
> +History:
> +
> +10/2006: Created
> +
> +early 2007: various bug fixes/typos
> +
> +06/2007: DailyMotion support and Localized for other
> +         languages by Gabriel Rousseau
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/content.css
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/content.css	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/content.css	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,56 @@
> +.ltVideoYouTube {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/youtube.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +}
> +.ltVideoVimeo {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/vimeo.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +}
> +.ltVideoGoogleVideo {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/gvideo.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +}
> +.ltVideoMetacafe {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/metacafe.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +	}
> +.ltVideoIfilm {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/ifilm.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +	}
> +.ltVideoGoear {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/goear.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +	}
> +.ltVideoGrouper {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/grouper.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +	}
> +.ltVideoDailymot {
> +	border: 1px dotted #cc0000;
> +	background-image: url('../img/dailymotion.png');
> +	background-position: center;
> +	background-repeat: no-repeat;
> +	background-color: #ffffcc;
> +	}
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/flash.css
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/flash.css	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/css/flash.css	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,11 @@
> +.panel_wrapper div.current {
> +	height: 100px;
> +}
> +
> +#width, #height {
> +	width: 50px;
> +}
> +
> +#file {
> +	width: 250px;
> +}
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,8 @@
> +
> +(function(){tinymce.PluginManager.requireLangPack('insertvideo');tinymce.create('tinymce.plugins.InsertVideoPlugin',{init:function(ed,url){var t=this;t.ed=ed;t.url=url;ed.onBeforeSetContent.add(function(ed,o){o.content=t._insertToEditor(t,o.content);});ed.onPostProcess.add(function(ed,o){if(o.set){o.content=t._insertToEditor(t,o.content);}
> +if(o.get){o.content=t._getFromEditor(t,o.content);}});ed.addCommand('mceInsertVideo',function(){ed.windowManager.open({file:url+'/videoinput.html',width:500,height:300,inline:1},{plugin_url:url});});ed.addButton('insertvideo',{title:'insertvideo.desc',cmd:'mceInsertVideo',image:url+'/img/youtube.png'});ed.onInit.add(function(){if(ed.settings.content_css!==false)
> +ed.dom.loadCSS(url+"/css/content.css");});},getInfo:function(){return{longname:'Insert Video',author:'LifeType Team',authorurl:'http://www.lifetype.net',infourl:'http://www.lifetype.net',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_insertToEditor:function(t,content){cdom=t.ed.dom.create('div');t.ed.dom.setHTML(cdom,content);elems=t.ed.dom.select('object[data]',cdom);tinymce.each(elems,function(e){src=e.data;cls=t._getVideoType(src);if(src&&cls){height=e.height;width=e.width;imgHTML=t._getVideoImgHTML(src,height,width,cls);t.ed.dom.setOuterHTML(e,imgHTML);}});content=cdom.innerHTML;t.ed.dom.remove(cdom);return content;},_getFromEditor:function(t,content){cdom=t.ed.dom.create('div');t.ed.dom.setHTML(cdom,content);elems=t.ed.dom.select('img[class^=ltVideo]',cdom);tinymce.each(elems,function(e){cls=t._isValidVideoType(e.className);src=e.alt;if(src&&cls){height=e.height;width=e.width;embedHTML=t._getVideoFlashHTML(src,height,width,cls);t.ed.dom.setOuterHTML(e,embedHT
> ML);}});content=cdom.innerHTML;t.ed.dom.remove(cdom);return content;},_getVideoType:function(url)
> +{var sites={GoogleVideo:{regexp:/^http:\/\/video\.google\.com\//,cls:'ltVideoGoogleVideo'},YouTube:{regexp:/^http:\/\/.{2,3}\.youtube\.com\//,cls:'ltVideoYouTube'},Metacafe:{regexp:/^http:\/\/www\.metacafe\.com\//,cls:'ltVideoMetacafe'},Ifilm:{regexp:/^http:\/\/www\.ifilm\.com\//,cls:'ltVideoIfilm'},VideoGoear:{regexp:/^http:\/\/www\.goear.com\//,cls:'ltVideoGoear'},Grouper:{regexp:/^http:\/\/www\.grouper\.com\//,cls:'ltVideoGrouper'},DailyMotion:{regexp:/^http:\/\/www\.dailymotion\.com\//,cls:'ltVideoDailymot'},Vimeo:{regexp:/^http:\/\/vimeo\.com\//,cls:'ltVideoVimeo'}};var cls='';for(site in sites){if(url.match(sites[site].regexp)){cls=sites[site].cls;break;}}
> +return(cls);},_isValidVideoType:function(cls){result=cls.match(/^ltVideo(GoogleVideo|YouTube|Metacafe|Ifilm|Goear|Grouper|Dailymot|Vimeo)/);return(result?'ltVideo'+result[1]:false);},_getVideoImgHTML:function(src,height,width,cls){html='<img width="'+width+'" height="'+height+'"'+' src="'+this.url+'/img/spacer.gif'+'" title="'+src+'"'+' alt="'+src+'" class="'+cls+'" />';return html;},_getVideoFlashHTML:function(url,height,width,cls)
> +{html='<object type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" data="'+url+'" class="'+cls+'">'+'<param name="movie" value="'+url+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowScriptAccess" value="sameDomain" />'+'<param name="quality" value="best" />'+'<param name="bgcolor" value="#ffffff" />';if(cls=='ltVideoGoear'){html+='<param name="FlashVars" value="'+url.substring(43,url.length)+'" />';}else{html+='<param name="FlashVars" value="playerMode=embedded" />';}
> +html+='</object>';return html;}});tinymce.PluginManager.add('insertvideo',tinymce.plugins.InsertVideoPlugin);})();
> \ No newline at end of file
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin_src.js
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin_src.js	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin_src.js	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,170 @@
> +/**
> + * editor_plugin_src.js
> + *
> + * Copyright 2010, Lifetype Team, http://www.lifetype.net
> + * Released under GPLv2 License.
> + */
> +
> +(function() {
> +    tinymce.PluginManager.requireLangPack('insertvideo');
> +    tinymce.create('tinymce.plugins.InsertVideoPlugin', {
> +        init : function(ed, url) {
> +            var t = this;
> +                t.ed = ed;
> +                t.url = url;
> +
> +            ed.onBeforeSetContent.add(function(ed, o) {
> +                o.content = t._insertToEditor(t, o.content);
> +            });
> +
> +            ed.onPostProcess.add(function(ed, o) {
> +                if (o.set){
> +                    o.content = t._insertToEditor(t, o.content);
> +                }
> +                if (o.get){
> +                    o.content = t._getFromEditor(t, o.content);
> +                }
> +            });
> +
> +            ed.addCommand('mceInsertVideo', function() {
> +                ed.windowManager.open({
> +                    file : url + '/videoinput.html',
> +                    width : 500,
> +                    height : 300,
> +                    inline : 1
> +                }, {
> +                    plugin_url : url
> +                });
> +            });
> +
> +            // Register insertresource button
> +            ed.addButton('insertvideo', {
> +                title : 'insertvideo.desc',
> +                cmd : 'mceInsertVideo',
> +                image : url + '/img/youtube.png'
> +            });
> +
> +            ed.onInit.add(function() {
> +                if (ed.settings.content_css !== false)
> +                    ed.dom.loadCSS(url + "/css/content.css");
> +            });
> +        },
> +
> +        getInfo : function() {
> +            return {
> +                longname : 'Insert Video',
> +                author : 'LifeType Team',
> +                authorurl : 'http://www.lifetype.net',
> +                infourl : 'http://www.lifetype.net',
> +                version : tinymce.majorVersion + "." + tinymce.minorVersion
> +            };
> +        },
> +
> +        _insertToEditor : function(t, content) {
> +            // Parse all object tags and replace them with img
> +            cdom = t.ed.dom.create('div');
> +            t.ed.dom.setHTML(cdom, content);
> +            elems = t.ed.dom.select('object[data]', cdom);
> +
> +            tinymce.each(elems, function(e) {
> +                src = e.data;
> +                cls = t._getVideoType(src);
> +                if (src && cls) {
> +                    height = e.height;
> +                    width = e.width;
> +                    imgHTML = t._getVideoImgHTML(src, height, width, cls);
> +                    t.ed.dom.setOuterHTML(e, imgHTML);
> +                }
> +            });
> +
> +            content = cdom.innerHTML;
> +            t.ed.dom.remove(cdom);
> +
> +            return content;
> +        },
> +
> +        _getFromEditor : function(t, content) {
> +            // Parse all img[class=ltVideo*] tags and replace them with object+embed
> +            cdom = t.ed.dom.create('div');
> +            t.ed.dom.setHTML(cdom, content);
> +            elems = t.ed.dom.select('img[class^=ltVideo]', cdom);
> +
> +            tinymce.each(elems, function(e) {
> +                cls = t._isValidVideoType(e.className);
> +                src = e.alt;
> +                if (src && cls) {
> +                    height = e.height;
> +                    width = e.width;
> +                    embedHTML = t._getVideoFlashHTML(src, height, width, cls);
> +                    t.ed.dom.setOuterHTML(e, embedHTML);
> +                }
> +            });
> +
> +            content = cdom.innerHTML;
> +            t.ed.dom.remove(cdom);
> +
> +            return content;
> +        },
> +
> +        _getVideoType : function(url)
> +        {
> +          var sites = {
> +                GoogleVideo : {regexp : /^http:\/\/video\.google\.com\//, cls : 'ltVideoGoogleVideo'},
> +                YouTube     : {regexp : /^http:\/\/.{2,3}\.youtube\.com\//, cls : 'ltVideoYouTube'},
> +                Metacafe    : {regexp : /^http:\/\/www\.metacafe\.com\//, cls : 'ltVideoMetacafe'},
> +                Ifilm       : {regexp : /^http:\/\/www\.ifilm\.com\//, cls : 'ltVideoIfilm'},
> +                VideoGoear  : {regexp : /^http:\/\/www\.goear.com\//, cls : 'ltVideoGoear'},
> +                Grouper     : {regexp : /^http:\/\/www\.grouper\.com\//, cls : 'ltVideoGrouper'},
> +                DailyMotion : {regexp : /^http:\/\/www\.dailymotion\.com\//, cls : 'ltVideoDailymot'},
> +                Vimeo       : {regexp : /^http:\/\/vimeo\.com\//, cls : 'ltVideoVimeo'}
> +            };
> +
> +            var cls = '';
> +            for (site in sites) {
> +                if (url.match(sites[site].regexp)) {
> +                    cls = sites[site].cls;
> +                    break;
> +                }
> +            }
> +
> +            return( cls );
> +        },
> +
> +        _isValidVideoType: function(cls) {
> +            result = cls.match(/^ltVideo(GoogleVideo|YouTube|Metacafe|Ifilm|Goear|Grouper|Dailymot|Vimeo)/);
> +
> +            return (result ? 'ltVideo'+result[1] : false);
> +        },
> +
> +        _getVideoImgHTML : function(src, height, width, cls) {
> +            html = '<img width="' + width + '" height="' + height + '"' +
> +                   ' src="' + this.url + '/img/spacer.gif' + '" title="' + src + '"' +
> +                   ' alt="' + src + '" class="'+ cls +'" />';
> +
> +            return html;
> +        },
> +
> +        _getVideoFlashHTML : function(url, height, width, cls)
> +        {
> +            html = '<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" data="' + url + '" class="' + cls + '">' +
> +                   '<param name="movie" value="' + url + '" />' +
> +                   '<param name="wmode" value="transparent" />' +
> +                   '<param name="allowScriptAccess" value="sameDomain" />' +
> +                   '<param name="quality" value="best" />' +
> +                   '<param name="bgcolor" value="#ffffff" />';
> +            if (cls == 'ltVideoGoear') {
> +                html += '<param name="FlashVars" value="' + url.substring( 43, url.length ) + '" />';
> +            } else {
> +                html += '<param name="FlashVars" value="playerMode=embedded" />';
> +            }
> +
> +            html += '</object>';
> +
> +            return html;
> +        }
> +
> +    });
> +
> +    // Register plugin
> +    tinymce.PluginManager.add('insertvideo', tinymce.plugins.InsertVideoPlugin);
> +})();
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/functions.js
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/functions.js	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/functions.js	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,268 @@
> +function init() {
> +    tinyMCEPopup.requireLangPack();
> +    tinyMCEPopup.resizeToInnerSize();
> +}
> +
> +function isValidUrl( url )
> +{
> +    var regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
> +    return regexp.test(url);
> +}
> +
> +function getVimeoLink( url )
> +{
> +    var regexp = /http:\/\/(?:www\.)?vimeo.com\/([0-9]+)/i;
> +    result = regexp.exec( url );
> +    if(!result){
> +        return url;
> +    }
> +    videoId = result[1];
> +    url = "http://vimeo.com/moogaloop.swf?clip_id="+videoId+"&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=0a7ac2&amp;fullscreen=1";
> +    return url;
> +}
> +
> +function getYouTubeLink( url )
> +{
> +    var regexp;
> +    // 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=" ) {
> +    if( url.match( /http:\/\/.{2,3}\.youtube.com\/.*?v=/i )) {
> +        // and if it's a link to a normal youtube page, build the right link to the video player
> +        regexp = /http:\/\/.{2,3}\.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( 31, url.length );
> +        }
> +
> +        url = "http://www.youtube.com/v/" + videoId;
> +    }
> +    else if ( url.substring( 0, 27 ) == "http://youtube.com/watch?v=" ) {
> +        // Checks if the URL is missing WWW.
> +        // and if it's a link to a normal youtube page, build the right link to the video player
> +        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;
> +    }
> +    else {
> +        regexp = /.*?v=([\-0-9a-zA-z_]*).*/i;
> +        result = regexp.exec( url );
> +        if( result ) {
> +            videoId = result[1];
> +            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
> +    if( url.substring( 0, 40 ) == "http://video.google.com/videoplay?docid=" ) {
> +        // if it's a link to a video page, generate the right one
> +        var regexp = /http:\/\/video.google.com\/.*?docid=([\-0-9a-zA-z_]*).*/i;
> +        result = regexp.exec( url );
> +        if( result ) {
> +            videoId = result[1];
> +        }
> +        else {
> +            videoId = url.substring( 40, url.length );
> +        }
> +
> +        url = "http://video.google.com/googleplayer.swf?docId=" + videoId;
> +    }
> +
> +    return( url );
> +}
> +
> +function getMetacafeVideoLink( url )
> +{
> +    // check if it's a link to a video page or a link to the video player
> +    if( url.substring( 0, 30 ) == "http://www.metacafe.com/watch/" ) {
> +        // if it's a link to a video page, generate the right one
> +        var regexp = /http:\/\/www.metacafe.com\/watch\/.*?docid=([\-0-9a-zA-z_]*).*/i;
> +        result = regexp.exec( url );
> +        if( result ) {
> +            videoId = result[1];
> +        }
> +        else {
> +            videoId = url.substring( 30, url.length - 1 );
> +        }
> +
> +        url = "http://www.metacafe.com/fplayer/" + videoId + ".swf";
> +    }
> +
> +    return( url );
> +}
> +
> +function getiFilmVideoLink( url )
> +{
> +    // check if it's a link to a video page or a link to the video player
> +    if( url.substring( 0, 27 ) == "http://www.ifilm.com/video/" ) {
> +        // if it's a link to a video page, generate the right one
> +        var regexp = /http:\/\/www.ifilm.com\/video\/.*?docid=([\-0-9a-zA-z_]*).*/i;
> +        result = regexp.exec( url );
> +        if( result ) {
> +            videoId = result[1];
> +        }
> +        else {
> +            videoId = url.substring( 27, url.length );
> +        }
> +
> +        url = "http://www.ifilm.com/efp?flvbaseclip=" + videoId ;
> +    }
> +
> +    return( url );
> +}
> +
> +function getGoearVideoLink( url )
> +{
> +    // check if it's a link to a video page or a link to the video player
> +    if( url.substring( 0, 34 ) == "http://www.goear.com/listen.php?v=" ) {
> +        // if it's a link to a video page, generate the right one
> +        var regexp = /http:\/\/www.goear.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
> +        result = regexp.exec( url );
> +        if( result ) {
> +            videoId = result[1];
> +        }
> +        else {
> +            videoId = url.substring( 34, url.length );
> +        }
> +        url = "http://www.goear.com/files/external.swf?file=" + videoId ;
> +    }
> +
> +    return( url );
> +}
> +
> +function getGrouperVideoLink( url )
> +{
> +    // check if it's a link to a video page or a link to the video player
> +    if( url.substring( 0, 46 ) == "http://grouper.com/video/MediaDetails.aspx?id=" ) {
> +        // if it's a link to a video page, generate the right one
> +        var regexp = /http:\/\/www.grouper.com\/video\/MediaDetails.aspx.*?id=([\-0-9a-zA-z_]*).*/i;
> +        result = regexp.exec( url );
> +        if( result ) {
> +            videoId = result[1];
> +        }
> +        else {
> +            videoId = url.substring( 46, url.length );
> +        }
> +
> +        url = "http://grouper.com/mtg/mtgPlayer.swf?gvars=vurl~http%3a%2f%2fgrouper.com%2frss%2fflv.ashx%3fid%3d" + videoId + "_rf%7e-9_vfver~8_ap~1_extid~-1";
> +    }
> +
> +    return( url );
> +}
> +
> +function getDailymotionLink( url )
> +{
> +    // check if this is a URL pointing to a dailymotion embedded video link
> +    var regexp = /object\swidth="([0-9]+)"\sheight="([0-9]+)".+value="(http:\/\/www\.dailymotion\.com\/swf\/\w+).*"/;
> +    result = regexp.exec( url );
> +    return( result );
> +}
> +
> +function insertVideoCode()
> +{
> +    // get and check the URL
> +    urlField = document.forms[0].url;
> +    url = urlField.value;
> +    if( url === "" || !isValidUrl( url )) {
> +        window.alert( tinyMCEPopup.getLang('insertvideo_dlg.badurl', 0) );
> +        return( false );
> +    }
> +
> +    // check if a destination system was selected
> +    vimeo = document.getElementById("vimeo");
> +    youtube = document.getElementById("youtube");
> +    gvideo = document.getElementById("gvideo");
> +    metacafe = document.getElementById("metacafe");
> +    ifilm = document.getElementById("ifilm");
> +    goear = document.getElementById("goear");
> +    grouper = document.getElementById("grouper");
> +    dailymot = document.getElementById("dailymot");
> +
> +    if( vimeo.checked === false &&
> +        youtube.checked === false &&
> +        gvideo.checked === false &&
> +        metacafe.checked === false &&
> +        ifilm.checked === false &&
> +        goear.checked === false &&
> +        grouper.checked === false &&
> +        dailymot.checked === false ) {
> +        window.alert( tinyMCEPopup.getLang('insertvideo_dlg.selectiontype', 0) );
> +        return( false );
> +    }
> +
> +    if( vimeo.checked === true ) {
> +        link = getVimeoLink( url );
> +        css="ltVideoVimeo";
> +        width=425;
> +        height=355;
> +    }
> +    if( youtube.checked === true ) {
> +        link = getYouTubeLink( url );
> +        css="ltVideoYouTube";
> +        width=425;
> +        height=355;
> +    }
> +    if( gvideo.checked === true ) {
> +        link = getGoogleVideoLink( url );
> +        css="ltVideoGoogleVideo";
> +        width=425;
> +        height=355;
> +    }
> +    if( metacafe.checked === true ) {
> +        link = getMetacafeVideoLink( url );
> +        css="ltVideoMetacafe";
> +        width=400;
> +        height=345;
> +    }
> +    if( ifilm.checked === true ) {
> +        link = getiFilmVideoLink( url );
> +        css="ltVideoIfilm";
> +        width=448;
> +        height=365;
> +    }
> +    if( goear.checked === true ) {
> +        link = getGoearVideoLink( url );
> +        css="ltVideoGoear";
> +        width=366;
> +        height=75;
> +    }
> +    if( grouper.checked === true ) {
> +        link = getGrouperVideoLink( url );
> +        css="ltVideoGrouper";
> +        width=496;
> +        height=398;
> +    }
> +    if( dailymot.checked === true ) {
> +        result = getDailymotionLink( url );
> +        width = result[1];
> +        height = result[2];
> +        link = result[3];
> +        css="ltVideoDailymot";
> +    }
> +    insertFlash( link, css, width, height );
> +}
> +
> +function insertFlash( file, css, width, height ) {
> +    var html = '<img src="' + tinyMCEPopup.getWindowArg('plugin_url') + '/img/spacer.gif" mce_src="' + tinyMCEPopup.getWindowArg('plugin_url') + '/img/spacer.gif" ' +
> +               'width="' + width + '" height="' + height + '" ' +
> +               'border="0" alt="' + file + '" title="' + file + '" class="' + css + '" />';
> +
> +    tinyMCEPopup.execCommand("mceInsertContent", true, html);
> +    tinyMCEPopup.close();
> +}
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/bolt.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/bolt.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/dailymotion.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/dailymotion.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/dalealplay.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/dalealplay.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/goear.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/goear.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/grouper.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/grouper.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/gvideo.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/gvideo.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/ifilm.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/ifilm.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/metacafe.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/metacafe.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/spacer.gif
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/spacer.gif
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/vimeo.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/vimeo.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/youtube.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/youtube.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/zippyvideos.png
> ===================================================================
> (Binary files differ)
>
>
> Property changes on: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/img/zippyvideos.png
> ___________________________________________________________________
> Added: svn:mime-type
>   + application/octet-stream
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en.js
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en.js	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en.js	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,3 @@
> +tinyMCE.addI18n('en.insertvideo',{
> +	desc : 'Insert Video'
> +});
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en_dlg.js
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en_dlg.js	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/langs/en_dlg.js	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,10 @@
> +tinyMCE.addI18n('en.insertvideo_dlg',{
> +    desc : 'Insert Video',
> +    linklegend : 'Please provide a link to a video file.',
> +    link : 'Video URL:',
> +    selsource : 'Select Source:',
> +    dailymotembeddableplayer : 'Embeddable Player',
> +    badurl : 'Invalid URL',
> +    selectiontype : 'You must select the right video site.',
> +    inputurlstyle : 'style="width:350px;"'
> +});
>
> Added: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/videoinput.html
> ===================================================================
> --- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/videoinput.html	                        (rev 0)
> +++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/videoinput.html	2010-12-21 17:37:19 UTC (rev 7098)
> @@ -0,0 +1,52 @@
> +<html xmlns="http://www.w3.org/1999/xhtml">
> +<head>
> +    <title>{#insertvideo_dlg.desc}</title>
> +    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
> +    <script language="javascript" type="text/javascript" src="functions.js"></script>
> +    <script type="text/javascript">
> +        init();
> +    </script>
> +    <base target="_self" />
> +</head>
> +<body style="display: none">
> +    <form name="video" id="video" method="post" action="#">
> +        <div class="tabs">
> +            <ul>
> +                <li id="general_tab" class="current"><span>{#insertvideo_dlg.desc}</span></li>
> +            </ul>
> +        </div>
> +        <div class="panel_wrapper">
> +            <div id="general_panel" class="panel_current">
> +                <legend>{#insertvideo_dlg.linklegend}</legend>
> +                <table border="0" cellpadding="4" cellspacing="0">
> +                    <tr>
> +                        <td nowrap="nowrap">{#insertvideo_dlg.link}</td>
> +                        <td><input type="text" id="url" name="url" value="" {#insertvideo_dlg.inputurlstyle} /></td>
> +                    </tr>
> +                    <tr>
> +                        <td nowrap="nowrap">{#insertvideo_dlg.selsource}</td>
> +                        <td>
> +                            <input type="radio" id="youtube" style="border:0px" name="type" value="1"><img src="img/youtube.png" alt="YouTube" /> YouTube<br />
> +                            <input type="radio" id="gvideo" style="border:0px"name="type" value="2"><img src="img/gvideo.png" alt="Google Video" /> Google Video<br />
> +                            <input type="radio" id="metacafe" style="border:0px"name="type" value="3"><img src="img/metacafe.png" alt="Metacafe" /> Metacafe<br />
> +                            <input type="radio" id="ifilm" style="border:0px"name="type" value="4"><img src="img/ifilm.png" alt="iFilm" /> iFilm<br />
> +                            <input type="radio" id="goear" style="border:0px"name="type" value="5"><img src="img/goear.png" alt="Goear" /> Goear<br />
> +                            <input type="radio" id="grouper" style="border:0px"name="type" value="6"><img src="img/grouper.png" alt="Grouper" /> Grouper<br />
> +                            <input type="radio" id="dailymot" style="border:0px"name="type" value="7"><img src="img/dailymotion.png" alt="dailymotion" /> dailymotion <span style="color: grey; font-style: oblique;">({#insertvideo_dlg.dailymotembeddableplayer})</span><br />
> +                            <input type="radio" id="vimeo" style="border:0px" name="type" value="8"><img src="img/vimeo.png" alt="Vimeo" /> Vimeo<br />
> +                        </td>
> +                    </tr>
> +                </table>
> +            </div>
> +        </div>
> +        <div class="mceActionPanel">
> +            <div style="float:left">
> +                <input type="button" name="insert" value="{#insert}" onClick="insertVideoCode()" id="insert" />
> +            </div>
> +            <div style="float:right">
> +                <input type="button" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" id="cancel" />
> +            </div>
> +        </div>
> +    </form>
> +</body>
> +</html>
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com
~~
Corduroy pillows:  They're making headlines!


More information about the pLog-svn mailing list