⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 media.js

📁 这是一个开源的博客源码
💻 JS
字号:
tinyMCEPopup.requireLangPack();var oldWidth,oldHeight,ed,url;if(url=tinyMCEPopup.getParam("media_external_list_url")){document.write('<script language="javascript" type="text/javascript" src="'+tinyMCEPopup.editor.documentBaseURI.toAbsolute(url)+'"><\/script>')}function init(){var e="",g,h;var d="flash",a,c;ed=tinyMCEPopup.editor;tinyMCEPopup.resizeToInnerSize();g=document.forms[0];a=ed.selection.getNode();if(/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(a,"class"))){e=a.title;switch(ed.dom.getAttrib(a,"class")){case"mceItemFlash":d="flash";break;case"mceItemFlashVideo":d="flv";break;case"mceItemShockWave":d="shockwave";break;case"mceItemWindowsMedia":d="wmp";break;case"mceItemQuickTime":d="qt";break;case"mceItemRealMedia":d="rmp";break}document.forms[0].insert.value=ed.getLang("update","Insert",true)}document.getElementById("filebrowsercontainer").innerHTML=getBrowserHTML("filebrowser","src","media","media");document.getElementById("qtsrcfilebrowsercontainer").innerHTML=getBrowserHTML("qtsrcfilebrowser","qt_qtsrc","media","media");document.getElementById("bgcolor_pickcontainer").innerHTML=getColorPickerHTML("bgcolor_pick","bgcolor");var b=getMediaListHTML("medialist","src","media","media");if(b==""){document.getElementById("linklistrow").style.display="none"}else{document.getElementById("linklistcontainer").innerHTML=b}if(isVisible("filebrowser")){document.getElementById("src").style.width="230px"}if(e!=""){e=tinyMCEPopup.editor.plugins.media._parse(e);switch(d){case"flash":setBool(e,"flash","play");setBool(e,"flash","loop");setBool(e,"flash","menu");setBool(e,"flash","swliveconnect");setStr(e,"flash","quality");setStr(e,"flash","scale");setStr(e,"flash","salign");setStr(e,"flash","wmode");setStr(e,"flash","base");setStr(e,"flash","flashvars");break;case"qt":setBool(e,"qt","loop");setBool(e,"qt","autoplay");setBool(e,"qt","cache");setBool(e,"qt","controller");setBool(e,"qt","correction");setBool(e,"qt","enablejavascript");setBool(e,"qt","kioskmode");setBool(e,"qt","autohref");setBool(e,"qt","playeveryframe");setBool(e,"qt","tarsetcache");setStr(e,"qt","scale");setStr(e,"qt","starttime");setStr(e,"qt","endtime");setStr(e,"qt","tarset");setStr(e,"qt","qtsrcchokespeed");setStr(e,"qt","volume");setStr(e,"qt","qtsrc");break;case"shockwave":setBool(e,"shockwave","sound");setBool(e,"shockwave","progress");setBool(e,"shockwave","autostart");setBool(e,"shockwave","swliveconnect");setStr(e,"shockwave","swvolume");setStr(e,"shockwave","swstretchstyle");setStr(e,"shockwave","swstretchhalign");setStr(e,"shockwave","swstretchvalign");break;case"wmp":setBool(e,"wmp","autostart");setBool(e,"wmp","enabled");setBool(e,"wmp","enablecontextmenu");setBool(e,"wmp","fullscreen");setBool(e,"wmp","invokeurls");setBool(e,"wmp","mute");setBool(e,"wmp","stretchtofit");setBool(e,"wmp","windowlessvideo");setStr(e,"wmp","balance");setStr(e,"wmp","baseurl");setStr(e,"wmp","captioningid");setStr(e,"wmp","currentmarker");setStr(e,"wmp","currentposition");setStr(e,"wmp","defaultframe");setStr(e,"wmp","playcount");setStr(e,"wmp","rate");setStr(e,"wmp","uimode");setStr(e,"wmp","volume");break;case"rmp":setBool(e,"rmp","autostart");setBool(e,"rmp","loop");setBool(e,"rmp","autogotourl");setBool(e,"rmp","center");setBool(e,"rmp","imagestatus");setBool(e,"rmp","maintainaspect");setBool(e,"rmp","nojava");setBool(e,"rmp","prefetch");setBool(e,"rmp","shuffle");setStr(e,"rmp","console");setStr(e,"rmp","controls");setStr(e,"rmp","numloop");setStr(e,"rmp","scriptcallbacks");break}setStr(e,null,"src");setStr(e,null,"id");setStr(e,null,"name");setStr(e,null,"vspace");setStr(e,null,"hspace");setStr(e,null,"bgcolor");setStr(e,null,"align");setStr(e,null,"width");setStr(e,null,"height");if((h=ed.dom.getAttrib(a,"width"))!=""){e.width=g.width.value=h}if((h=ed.dom.getAttrib(a,"height"))!=""){e.height=g.height.value=h}oldWidth=e.width?parseInt(e.width):0;oldHeight=e.height?parseInt(e.height):0}else{oldWidth=oldHeight=0}selectByValue(g,"media_type",d);changedType(d);updateColor("bgcolor_pick","bgcolor");TinyMCE_EditableSelects.init();generatePreview()}function insertMedia(){var a,c=document.forms[0],b;tinyMCEPopup.restoreSelection();if(!AutoValidator.validate(c)){tinyMCEPopup.alert(ed.getLang("invalid_data"));return false}c.width.value=c.width.value==""?100:c.width.value;c.height.value=c.height.value==""?100:c.height.value;a=ed.selection.getNode();if(a!=null&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(a,"class"))){switch(c.media_type.options[c.media_type.selectedIndex].value){case"flash":a.className="mceItemFlash";break;case"flv":a.className="mceItemFlashVideo";break;case"shockwave":a.className="mceItemShockWave";break;case"qt":a.className="mceItemQuickTime";break;case"wmp":a.className="mceItemWindowsMedia";break;case"rmp":a.className="mceItemRealMedia";break}if(a.width!=c.width.value||a.height!=c.height.value){ed.execCommand("mceRepaint")}a.title=serializeParameters();a.width=c.width.value;a.height=c.height.value;a.style.width=c.width.value+(c.width.value.indexOf("%")==-1?"px":"");a.style.height=c.height.value+(c.height.value.indexOf("%")==-1?"px":"");a.align=c.align.options[c.align.selectedIndex].value}else{b='<img src="'+tinyMCEPopup.getWindowArg("plugin_url")+'/img/trans.gif"';switch(c.media_type.options[c.media_type.selectedIndex].value){case"flash":b+=' class="mceItemFlash"';break;case"flv":b+=' class="mceItemFlashVideo"';break;case"shockwave":b+=' class="mceItemShockWave"';break;case"qt":b+=' class="mceItemQuickTime"';break;case"wmp":b+=' class="mceItemWindowsMedia"';break;case"rmp":b+=' class="mceItemRealMedia"';break}b+=' title="'+serializeParameters()+'"';b+=' width="'+c.width.value+'"';b+=' height="'+c.height.value+'"';b+=' align="'+c.align.options[c.align.selectedIndex].value+'"';b+=" />";ed.execCommand("mceInsertContent",false,b)}tinyMCEPopup.close()}function updatePreview(){var b=document.forms[0],a;b.width.value=b.width.value||"320";b.height.value=b.height.value||"240";a=getType(b.src.value);selectByValue(b,"media_type",a);changedType(a);generatePreview()}function getMediaListHTML(){if(typeof(tinyMCEMediaList)!="undefined"&&tinyMCEMediaList.length>0){var b="";b+='<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">';b+='<option value="">---</option>';for(var a=0;a<tinyMCEMediaList.length;a++){b+='<option value="'+tinyMCEMediaList[a][1]+'">'+tinyMCEMediaList[a][0]+"</option>"}b+="</select>";return b}return""}function getType(b){var e,d,j,g,a,h=document.forms[0];e=ed.getParam("media_types","flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(";");if(b.match(/watch\?v=(.+)(.*)/)){h.width.value="425";h.height.value="350";h.src.value="http://www.youtube.com/v/"+b.match(/v=(.*)(.*)/)[0].split("=")[1];return"flash"}if(b.indexOf("http://video.google.com/videoplay?docid=")==0){h.width.value="425";h.height.value="326";h.src.value="http://video.google.com/googleplayer.swf?docId="+b.substring("http://video.google.com/videoplay?docid=".length)+"&hl=en";return"flash"}for(d=0;d<e.length;d++){j=e[d].split("=");g=j[1].split(",");for(a=0;a<g.length;a++){if(b.indexOf("."+g[a])!=-1){return j[0]}}}return null}function switchType(a){var b=getType(a),e=document,c=e.forms[0];if(!b){return}selectByValue(e.forms[0],"media_type",b);changedType(b);if(b=="qt"&&c.src.value.toLowerCase().indexOf("rtsp://")!=-1){alert(ed.getLang("media_qt_stream_warn"));if(c.qt_qtsrc.value==""){c.qt_qtsrc.value=c.src.value}}}function changedType(a){var b=document;b.getElementById("flash_options").style.display="none";b.getElementById("flv_options").style.display="none";b.getElementById("qt_options").style.display="none";b.getElementById("shockwave_options").style.display="none";b.getElementById("wmp_options").style.display="none";b.getElementById("rmp_options").style.display="none";if(a){b.getElementById(a+"_options").style.display="block"}}function serializeParameters(){var c=document,b=c.forms[0],a="";switch(b.media_type.options[b.media_type.selectedIndex].value){case"flash":a+=getBool("flash","play",true);a+=getBool("flash","loop",true);a+=getBool("flash","menu",true);a+=getBool("flash","swliveconnect",false);a+=getStr("flash","quality");a+=getStr("flash","scale");a+=getStr("flash","salign");a+=getStr("flash","wmode");a+=getStr("flash","base");a+=getStr("flash","flashvars");break;case"qt":a+=getBool("qt","loop",false);a+=getBool("qt","autoplay",true);a+=getBool("qt","cache",false);a+=getBool("qt","controller",true);a+=getBool("qt","correction",false,"none","full");a+=getBool("qt","enablejavascript",false);a+=getBool("qt","kioskmode",false);a+=getBool("qt","autohref",false);a+=getBool("qt","playeveryframe",false);a+=getBool("qt","targetcache",false);a+=getStr("qt","scale");a+=getStr("qt","starttime");a+=getStr("qt","endtime");a+=getStr("qt","target");a+=getStr("qt","qtsrcchokespeed");a+=getStr("qt","volume");a+=getStr("qt","qtsrc");break;case"shockwave":a+=getBool("shockwave","sound");a+=getBool("shockwave","progress");a+=getBool("shockwave","autostart");a+=getBool("shockwave","swliveconnect");a+=getStr("shockwave","swvolume");a+=getStr("shockwave","swstretchstyle");a+=getStr("shockwave","swstretchhalign");a+=getStr("shockwave","swstretchvalign");break;case"wmp":a+=getBool("wmp","autostart",true);a+=getBool("wmp","enabled",false);a+=getBool("wmp","enablecontextmenu",true);a+=getBool("wmp","fullscreen",false);a+=getBool("wmp","invokeurls",true);a+=getBool("wmp","mute",false);a+=getBool("wmp","stretchtofit",false);a+=getBool("wmp","windowlessvideo",false);a+=getStr("wmp","balance");a+=getStr("wmp","baseurl");a+=getStr("wmp","captioningid");a+=getStr("wmp","currentmarker");a+=getStr("wmp","currentposition");a+=getStr("wmp","defaultframe");a+=getStr("wmp","playcount");a+=getStr("wmp","rate");a+=getStr("wmp","uimode");a+=getStr("wmp","volume");break;case"rmp":a+=getBool("rmp","autostart",false);a+=getBool("rmp","loop",false);a+=getBool("rmp","autogotourl",true);a+=getBool("rmp","center",false);a+=getBool("rmp","imagestatus",true);a+=getBool("rmp","maintainaspect",false);a+=getBool("rmp","nojava",false);a+=getBool("rmp","prefetch",false);a+=getBool("rmp","shuffle",false);a+=getStr("rmp","console");a+=getStr("rmp","controls");a+=getStr("rmp","numloop");a+=getStr("rmp","scriptcallbacks");break}a+=getStr(null,"id");a+=getStr(null,"name");a+=getStr(null,"src");a+=getStr(null,"align");a+=getStr(null,"bgcolor");a+=getInt(null,"vspace");a+=getInt(null,"hspace");a+=getStr(null,"width");a+=getStr(null,"height");a=a.length>0?a.substring(0,a.length-1):a;return a}function setBool(a,b,c){if(typeof(a[c])=="undefined"){return}document.forms[0].elements[b+"_"+c].checked=a[c]!="false"}function setStr(a,d,g){var b=document.forms[0],c=b.elements[(d!=null?d+"_":"")+g];if(typeof(a[g])=="undefined"){return}if(c.type=="text"){c.value=a[g]}else{selectByValue(b,(d!=null?d+"_":"")+g,a[g])}}function getBool(e,g,f,b,c){var a=document.forms[0].elements[e+"_"+g].checked;b=typeof(b)=="undefined"?"true":"'"+jsEncode(b)+"'";c=typeof(c)=="undefined"?"false":"'"+jsEncode(c)+"'";return(a==f)?"":g+(a?":"+b+",":":'"+c+"',")}function getStr(c,g,f){var b=document.forms[0].elements[(c!=null?c+"_":"")+g];var a=b.type=="text"?b.value:b.options[b.selectedIndex].value;if(g=="src"){a=tinyMCEPopup.editor.convertURL(a,"src",null)}return((g==f||a=="")?"":g+":'"+jsEncode(a)+"',")}function getInt(c,g,f){var b=document.forms[0].elements[(c!=null?c+"_":"")+g];var a=b.type=="text"?b.value:b.options[b.selectedIndex].value;return((g==f||a=="")?"":g+":"+a.replace(/[^0-9]+/g,"")+",")}function jsEncode(a){a=a.replace(new RegExp("\\\\","g"),"\\\\");a=a.replace(new RegExp('"',"g"),'\\"');a=a.replace(new RegExp("'","g"),"\\'");return a}function generatePreview(l){var k=document.forms[0],a=document.getElementById("prev"),i="",r,e,d,m,g,o,q,j,b;a.innerHTML="<!-- x --->";j=parseInt(k.width.value);b=parseInt(k.height.value);if(k.width.value!=""&&k.height.value!=""){if(k.constrain.checked){if(l=="width"&&oldWidth!=0){o=j/oldWidth;b=Math.round(o*b);k.height.value=b}else{if(l=="height"&&oldHeight!=0){q=b/oldHeight;j=Math.round(q*j);k.width.value=j}}}}if(k.width.value!=""){oldWidth=j}if(k.height.value!=""){oldHeight=b}e=serializeParameters();switch(k.media_type.options[k.media_type.selectedIndex].value){case"flash":r="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";g="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";m="application/x-shockwave-flash";break;case"shockwave":r="clsid:166B1BCA-3F9C-11CF-8075-444553540000";g="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";m="application/x-director";break;case"qt":r="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";g="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";m="video/quicktime";break;case"wmp":r=ed.getParam("media_wmp6_compatible")?"clsid:05589FA1-C356-11CE-BF01-00AA0055595A":"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6";g="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";m="application/x-mplayer2";break;case"rmp":r="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA";g="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";m="audio/x-pn-realaudio-plugin";break}if(e==""){a.innerHTML="";return}e=tinyMCEPopup.editor.plugins.media._parse(e);if(!e.src){a.innerHTML="";return}e.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(e.src);e.width=!e.width?100:e.width;e.height=!e.height?100:e.height;e.id=!e.id?"obj":e.id;e.name=!e.name?"eobj":e.name;e.align=!e.align?"":e.align;if(!tinymce.isIE||document.location.protocol!="https:"){i+='<object classid="'+r+'" codebase="'+g+'" width="'+e.width+'" height="'+e.height+'" id="'+e.id+'" name="'+e.name+'" align="'+e.align+'">';for(d in e){i+='<param name="'+d+'" value="'+e[d]+'">';if(d=="src"&&e[d].indexOf("://")!=-1){i+='<param name="url" value="'+e[d]+'" />'}}}i+='<embed type="'+m+'" ';for(d in e){i+=d+'="'+e[d]+'" '}i+="></embed>";if(!tinymce.isIE||document.location.protocol!="https:"){i+="</object>"}a.innerHTML="<!-- x --->"+i}tinyMCEPopup.onInit.add(init);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -