PageSourceSearch

http://www.ntanime.com/system/resource/js/news/mp4video.js

js ntanime.com collected 2026-10-06 13:17:52 UTC 6,971 bytes, 180 lines download raw bytes

1//正文中输出mp4播放代码 
2//浏览器支持flash时,使用flowplayer播放器,否则支持html5时使用html5的video标签播放
3function showVsbVideo(vurl,vheight,vwidth,align,style,vautoplay,mid)
4{
5	if(vurl=="")
6	{
7	    return;   
8	}
9	var outputHTML="";
10    if (hasPlayHtml5Vedio())
11    {
12        outputHTML = outPutHTML5Video(vurl, vheight, vwidth, vautoplay, align, style, mid);
13    } else {
14        outputHTML = outPutFlashVideo(vurl, vheight, vwidth, vautoplay, align, style, mid);
15    }
16	document.write(outputHTML);      
17}
18
19function hasPlayHtml5Vedio()
20{
21	var a=document.createElement("video"),	c=!!a.canPlayType;
22	if(c)
23	{
24		c=new Boolean(c),
25		c.ogg=a.canPlayType('video/ogg; codecs="theora"');
26		var d='video/mp4; codecs="avc1.42E01E';
27		c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')
28	}
29	return c;			
30}
31function outPutFlashVideo(videoUrl,wHeight,wWidth,bautoPlay,align,style,mid)
32{
33		if(!mid||mid=="")
34		{
35		    mid="id=_vsb_player";
36		}
37        var flashUrl = "";
38		var hasLoadPlayer = false;
39		try{
40		    //判断是否引用了flowplayer 的相关JS   内容组件是不引用的
41            var tmpplayer = flowplayer;
42            hasLoadPlayer = true;
43        }catch (e){
44        }
45
46		if(hasLoadPlayer){
47            var realmid = mid.replace("id=","").replace(/\\/g,"").replace(/"/g,"");
48            var realwidth = wWidth.replace("width=","").replace(/\\/g,"").replace(/"/g,"");
49            var realheight = wHeight.replace("height=","").replace(/\\/g,"").replace(/"/g,"");
50            flashUrl = '<a href="'+videoUrl+'" style="display:block;width:'+realwidth+'px;height:'+realheight+'px;" '+mid+'></a><script>flowplayer(\"'+realmid+'\", \"/system/resource/swf/flowplayer.commercial.swf\", {clip:{autoPlay:"+bautoPlay+",autoBuffering:true}});</script>';
51        }else{
52            flashUrl='<object '+mid+' align="'+align+'" style="'+style+'" type="application/x-shockwave-flash" data="/system/resource/swf/flowplayer.commercial.swf"  '+wWidth+'  '+wHeight+'>';
53            var configstr='&quot;playlist&quot;:[{&quot;url&quot;:&quot;'+videoUrl+'&quot;,&quot;scaling&quot;:&quot;fit&quot;,&quot;autoPlay&quot;:'+bautoPlay+',&quot;autoBuffering&quot;:&quot;false&quot;}]';
54            flashUrl=flashUrl+'<param name="flashvars" value="config={'+configstr+'}">';
55            flashUrl=flashUrl+'<param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="sameDomain"><param name="quality" value="high"><param name="cachebusting" value="false"><param name="bgcolor" value="#000000"><param name="src" value="/system/resource/swf/flowplayer.commercial.swf">';
56            flashUrl=flashUrl+'</object>';
57        }
58		return flashUrl;
59}
60
61function outPutHTML5Video(videoUrl,wHeight,wWidth,bautoPlay,align,style,mid)
62{
63		if(!mid||mid=="")
64		{
65		    mid="id=_vsb_player";
66		}
67		var res='<video controlsList="nodownload" controls '+mid+' style="background-color:#474747;'+style+'" align="'+align+'" '+wWidth+'  '+wHeight;
68		if(bautoPlay && bautoPlay=="true")
69		{
70		    res+=' autoplay="autoplay" ';
71		}
72		res +='><source src="'+videoUrl+'" type="video/mp4" /></video> ';
73		return  res;
74}	
75
76function outVideoForMobile(vurl,vheight,vwidth,vautoplay)
77{
78        //手机显示时,视频宽度为设备宽度
79        if(hasPlayHtml5Vedio())
80        {
81		    var res='<video controls="controls" controlsList="nodownload" width="'+document.body.clientWidth+'"';
82    		if(vautoplay&&vautoplay=="true")
83    		{
84    		    res+=' autoplay="autoplay" ';
85    		}
86    		res +='><source src="'+vurl+'" type="video/mp4" /></video> ';
87		
88    		document.write(res);    
89		}    
90		else
91		    alert("不支持");        
92}
93//文章内容组件其实是不需要的  因为newscontent.js里面已经包含了这个方法,加到这里只要是为了简介组件使用
94//正文中输出mp3播放代码
95function showVsbAudio(aurl,vheight,vwidth,align,styles,vautoplay)
96{
97    if(aurl=="")
98    {
99        return;
100    }
101    var playersrc = "/system/resource/images/ueditor/musicFlash/player_mp3_maxi.swf";
102    var flashvars = "mp3="+aurl+"&showstop=1&showvolume=1&bgcolor1=eeeeee&bgcolor2=a0a0a0";
103    var autoplayStr = "";
104    if(vautoplay=="true")
105    {
106        autoplayStr = "autoplay = 'true'";
107        flashvars +="&autoplay=1";
108    }
109    var outputHTML="";
110    outputHTML +='<audio src="'+aurl+'" width="'+vwidth+'" height="'+vheight+'"  '+autoplayStr+' align="'+align+'" style="'+styles+'"  controls="controls" loop="true"><embed align="'+align+'" style="'+styles+'" width="'+vwidth+'" height="'+vheight+'" src="'+playersrc+'" flashvars="'+flashvars+'" /></audio>';
111    document.write(outputHTML);
112}
113
114
115/**
116 * 正文中显示PDF
117 * @param path
118 * @param width
119 * @param heigth
120 * @param imagenum
121 * @param style
122 * @param imagedata
123 */
124function showVsbpdfIframe(path,width,heigth,imagenum,style,imagedata){
125    if(path=="")
126    {
127        return;
128    }
129    var outputHTML="";
130
131    //判断浏览器版本
132    if(isSupportPddfjs()){
133        //pdfjs
134        outputHTML = "<iframe src=\"/system/resource/pdfjs/viewer.html?file="+encodeURIComponent(path)+"\" width=\""+width+"\" height=\""+heigth+"\" style='"+style+"'></iframe>";
135    }else{
136        //图片
137        if(imagedata && imagedata.length >0){
138            var imageStr = "";
139            imageStr = "<div style='"+style+";overflow-y: auto;overflow-x:hidden;text-indent: 0;width: "+(width.indexOf("%") != -1?width:width+"px")+";height: "+(heigth.indexOf("%") != -1?heigth:heigth+"px")+"; '>";
140            for(var i=0;i<imagedata.length ;i++){
141                var tmpimgpath = imagedata[i];
142                imageStr += "<img src='"+tmpimgpath+"' width='100%' class='img_vsb_content'>";
143                imageStr += "<div style=\"height:32px;line-height:32px;font-size:14px; width:100%;background-color:#3D3D3D;text-align:center;color:#ececec;\">第 "+(i+1)+" 页</div>";
144            }
145            imageStr += "</div>";
146            outputHTML = imageStr;
147        }else{
148            outputHTML = "<iframe src=\""+path+"\" width=\""+width+"\" height=\""+heigth+"\" style='"+style+"'></iframe>";
149        }
150    }
151    document.write(outputHTML);
152}
153
154/**
155 * 判断浏览器是否支持pdf.jsz`
156 * @returns {boolean}
157 */
158function isSupportPddfjs(){
159    var agent = navigator.userAgent.toLowerCase();
160    var isIe = /(msie\s|trident.*rv:)([\w.]+)/.test(agent);
161    if(isIe){
162        return false;
163    }
164
165    var safari;
166    if(/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(agent) && !/chrome/i.test(agent)){
167        safari = + (RegExp['\x241'] || RegExp['\x242']);
168    }
169
170    if(safari && safari < 11){
171        return false;
172    }
173
174    var mobile = agent.match(/applewebkit.*mobile.*/);
175    if(mobile){
176        return false;
177    }
178
179    return true;
180}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.