[pLog-svn] r7261 - plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Tue Oct 31 22:41:04 EDT 2023


Author: jondaley
Date: 2023-10-31 22:41:03 -0400 (Tue, 31 Oct 2023)
New Revision: 7261

Modified:
   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
Log:
fixed vimeo videos

Modified: plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js	2023-11-01 02:15:15 UTC (rev 7260)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin.js	2023-11-01 02:41:03 UTC (rev 7261)
@@ -4,5 +4,8 @@
 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=tinymce.DOM.create('div');tinymce.DOM.setHTML(cdom,content);elems=tinymce.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);tinymce.DOM.setOuterHTML(e,imgHTML);}});content=cdom.innerHTML;tinymce.DOM.remove(cdom);return content;},_getFromEditor:function(t,content){cdom=tinymce.DOM.create('div');tinymce.DOM.setHTML(cdom,content);elems=tinymce.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);tinymce.DOM.set
 OuterHTML(e,embedHTML);}});content=cdom.innerHTML;tinymce.DOM.remove(cdom);return content;},_getVideoType:function(url)
 {var sites={GoogleVideo:{regexp:/^http:\/\/video\.google\.com\//,cls:'ltVideoGoogleVideo'},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|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
+{switch(cls){case"ltVideoVimeo":if(!url.match("/player.vimeo.com/"))
+playerUrl=url.replace("vimeo.com","player.vimeo.com");else
+playerUrl=url;html='<iframe class="'+cls+'" src="'+playerUrl+'" width="'+width+'" height="'+height+'" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>';break;default: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>';break;}
+return html;}});tinymce.PluginManager.add('insertvideo',tinymce.plugins.InsertVideoPlugin);})();
\ No newline at end of file

Modified: 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	2023-11-01 02:15:15 UTC (rev 7260)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertvideo/editor_plugin_src.js	2023-11-01 02:41:03 UTC (rev 7261)
@@ -145,20 +145,33 @@
 
         _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" />';
+            switch(cls){
+            case "ltVideoVimeo":
+                if(!url.match("/player.vimeo.com/"))
+                    playerUrl = url.replace("vimeo.com", "player.vimeo.com");
+                else
+                    playerUrl = url;
+                
+                html = '<iframe class="'+cls+'" src="'+playerUrl+'" width="'+width+'" height="'+height+'" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>';
+                break;
+                
+            default:
+                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>';
+                break;
             }
 
-            html += '</object>';
-
             return html;
         }
 



More information about the pLog-svn mailing list