PageSourceSearch

https://www.smmu.edu.cn/_js/_portletPlugs/jwplayer/jwplayerMedia.js

js smmu.edu.cn collected 2026-10-02 06:45:55 UTC 17,728 bytes, 400 lines download raw bytes

1/* 
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6//var browser = navigator.appName;
7//var isLessThanIE8 = false;
8//var b_version = navigator.appVersion;
9//var version = b_version.split(";");
10//var trim_Version = version[1].replace(/[ ]/g, "");
11//if (browser === "Microsoft Internet Explorer") {
12//    if (trim_Version === "MSIE6.0" || trim_Version === "MSIE7.0" || trim_Version === "MSIE8.0") {
13//        isLessThanIE8 = true;
14//    }
15//}
16var jwplayerIE8_playurl = "/_js/_portletPlugs/jwplayer/player.swf";
17var jwplayer_playurl = "/_js/_portletPlugs/jwplayer/jwplayer.flash.swf";
18var playImg = "/_images/mediaType/video.jpg";
19var playThumbnail = "/_js/_portletPlugs/jwplayer/img/images/preview.jpg";
20var context = "";
21var player;
22var fls = flashChecker();
23if (/Android|Windows Phone|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
24    fls.f = 0;
25//    localeChain = "en_US";
26}
27
28$().ready(function() {
29    $("script[sudy-wp-context]").each(function(i) {
30        context = $(this).attr("sudy-wp-context");
31        if (context) {
32            context = "/" + context;
33        }
34    });
35    changeVideoHtml();
36    $(".wp_audio_player,div[sudyplayer='wp_audio_player'],img[sudyplayer='wp_audio_player']").each(function(i) {
37        var id = $(this).attr("id");
38        var _src = $(this).attr("sudy-wp-player");
39        if (!_src) {
40            _src = $(this).attr("sudy-wp-src");
41        }
42        if (!_src) {
43            _src = $(this).attr("src");
44        }
45        if (!window.applicationCache && typeof(Worker) == "undefined") {
46            player = jwplayerIE8(id).setup({
47                flashplayer: context + jwplayerIE8_playurl,
48                file: _src,
49                width: 500,
50                height: 23,
51                autostart: $(this).attr("autostart"),
52                repeat: $(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat"),
53                controlbar: 'bottom'
54            });
55             player.onReady(function() {//准备就绪设置浮动方式
56                if (floatt)
57                    $("#" + id + "_wrapper").css("float", floatt);
58                if (margin){
59					$("#" + id + "_wrapper").css("margin", "0 auto");
60                    $("#" + id + "_wrapper").css("display", "block");
61                    $("#" + id).css("margin", "0 auto");
62                    $("#" + id).css("display", "block");
63				}
64            });
65        } else {
66        	var jwId = $(this).attr("id");
67            jwId = "id" + jwId;
68            jwId = jwId.replace(/\./gi, "0");
69            var autoplay = $(this).attr("autostart");
70            $(this).attr("id", jwId);
71            var con = '<audio controls="controls" ';
72			if ($(this).attr("repeat") === "true") {
73				con += ' loop="' + ($(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat"))+'" ';
74			}
75			con += ' src="'+_src+'" preload controls="controls" width="500" height="23" ><p>Your user agent does not support the HTML5 Video element.</p></audio>';
76			if (autoplay === "true") {
77            	con = '<audio controls="controls" autoplay muted ';
78				if ($(this).attr("repeat") === "true") {
79					con += ' loop="' + ($(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat")) + '" ';
80				}
81				con += ' src="'+_src+'" preload controls="controls" width="500" height="23" ><p>Your user agent does not support the HTML5 Video element.</p></audio>';
82        	}
83        	$(this).html(con);
84        }
85    });
86//     $("img[sudyplayer='wp_video_player']").each(function(i) {
87//        var id = $(this).attr("id");
88//        var _class = $(this).attr("class");
89//        var _style = $(this).attr("style");
90//        var sudy_wp_player = $(this).attr("sudy-wp-player");
91//        var sudy_wp_src = $(this).attr("sudy-wp-src");
92//        var _src = $(this).attr("src");
93//        var sudy_wp_thumb = $(this).attr("sudy-wp-thumb");
94//        var _autostart = $(this).attr("autostart");
95//        var _repeat = $(this).attr("repeat");
96//        $($(this).parent()).append("<div id=\""+id+"\" class=\""+_class+"\" style=\""+_style+"\" sudy-wp-player=\""+sudy_wp_player+"\" sudy-wp-src=\""+sudy_wp_src+"\" src=\""+_src+"\" sudy-wp-thumb=\""+sudy_wp_thumb+"\" autostart=\""+_autostart+"\" repeat=\""+_repeat+"\"></div>");
97//        $(this).remove();
98//    });
99    $(".wp_video_player,div[sudyplayer='wp_video_player'],img[sudyplayer='wp_video_player']").each(function(i) {
100        if (!$(this).attr("style")) {
101            $(this).css("width", "600px");
102            $(this).css("height", "400px");
103        }
104        try {
105            if (/Android|Windows Phone|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
106                var width1 = parseInt($(this).css("width"));
107                var height1 = parseInt($(this).css("height"));
108                if (width1 > document.body.clientWidth) {
109                    $(this).css("width", "100%");
110                    $(this).css("height", Math.floor(height1 * (document.body.clientWidth / width1)) + "px");
111                }
112            }
113        } catch (e) {
114        }
115        var id = $(this).attr("id");
116        var _src = $(this).attr("sudy-wp-player");
117        if (!_src) {
118            _src = $(this).attr("sudy-wp-src");
119        }
120        if (!_src) {
121            _src = $(this).attr("src");
122        }
123        if ((!window.applicationCache && typeof(Worker) == "undefined") || !isMp4(_src)) {
124            var floatt = $("#" + id).css("float");
125            //var margin = $("#"+id).css("margin");
126            var margin = document.getElementById(id).style.margin;
127            player = jwplayerIE8(id).setup({
128                flashplayer: context + jwplayerIE8_playurl,
129                file: _src,
130                image: $(this).attr("sudy-wp-thumb") ? $(this).attr("sudy-wp-thumb") : context + playThumbnail,
131                width: $(this).css("width").replace(/px/gi, ""),
132                height: $(this).css("height").replace(/px/gi, ""),
133                autostart: $(this).attr("autostart"),
134                repeat: $(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat"),
135                controlbar: 'bottom'
136            });
137            player.onReady(function() {//准备就绪设置浮动方式
138                if (floatt)
139                    $("#" + id + "_wrapper").css("float", floatt);
140                if (margin){
141					$("#" + id + "_wrapper").css("margin", "0 auto");
142                    $("#" + id + "_wrapper").css("display", "block");
143                    $("#" + id).css("margin", "0 auto");
144                    $("#" + id).css("display", "block");
145				}
146            });
147        } else {
148            var allowfullscreen = $(this).attr("allowfullscreen");
149            var jwId = $(this).attr("id");
150            jwId = "id" + jwId;
151            jwId = jwId.replace(/\./gi, "0");
152            var autoplay = $(this).attr("autostart"); 
153            $(this).attr("id", jwId);
154            var con = '<video  controls="controls" ';
155            if(allowfullscreen === 'false'){
156                con += '    controlsList="nofullscreen" ';
157            }
158			if ($(this).attr("repeat") === "true") {
159				con += ' loop="' + ($(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat")) + '" ';
160			}
161			con += ' src="'+_src+'" poster="'+($(this).attr("sudy-wp-thumb") ? $(this).attr("sudy-wp-thumb") : "")+'" preload="true" controls="controls" width="'+$(this).css("width").replace(/px/gi, "")+'" height="'+$(this).css("height").replace(/px/gi, "")+'" ><p>Your user agent does not support the HTML5 Video element.</p></video>';
162			if(autoplay === "true"){
163            	con = '<video  controls="controls" autoplay muted ';
164				if ($(this).attr("repeat") === "true") {
165					con += ' loop="' + ($(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat")) + '" ';
166				}
167				con += ' src="'+_src+'" poster="'+($(this).attr("sudy-wp-thumb") ? $(this).attr("sudy-wp-thumb") : "")+'" preload="true" controls="controls" width="'+$(this).css("width").replace(/px/gi, "")+'" height="'+$(this).css("height").replace(/px/gi, "")+'" ><p>Your user agent does not support the HTML5 Video element.</p></video>';
168        	}
169        	$(this).html(con);
170    //     	if(autoplay === "true"){
171				// setTimeout(function (){
172	 		// 		var _video = $("#"+jwId+'video');
173	 		// 		_video[0].muted = "false";
174				// 	_video[0].play();
175    //     		},3000);
176    //     	}
177        	
178            // player = jwplayer(jwId).setup({
179            //     flashplayer: context + jwplayer_playurl,
180            //     file: _src,
181            //     image: $(this).attr("sudy-wp-thumb") ? $(this).attr("sudy-wp-thumb") : context + playThumbnail,
182            //     width: $(this).css("width").replace(/px/gi, ""),
183            //     height: $(this).css("height").replace(/px/gi, ""),
184            //     autostart: $(this).attr("autostart"),
185            //     repeat: $(this).attr("repeat") === "true" ? "always" : $(this).attr("repeat"),
186            //     controlbar: 'bottom'
187            // });
188            // var floatt = $(this).css("float");
189            // var margin = $(this).css("margin");
190            // player.onReady(function() {//准备就绪设置浮动方式
191            //     if (floatt) {
192            //         $("#" + jwId).css("float", floatt);
193            //         $("#" + jwId + "_wrapper").css("float", floatt);
194            //     }
195            //     if (margin) {
196            //         $("#" + jwId).css("margin", margin);
197            //         $("#" + jwId + "_wrapper").css("margin", margin);
198            //     }
199            // });
200        }
201    });
202});
203function changeVideoHtml() {
204    var isIe = isIE();
205    $(".wp_video_player,div[sudyplayer='wp_video_player'],img[sudyplayer='wp_video_player']").each(function(i) {
206        var _src = $(this).attr("src");
207        var _sudyvideosrc = $(this).attr("sudyurl");
208        var _sudyvideoplayersrc = $(this).attr("targeturl");
209        if (!_sudyvideosrc) {
210            _sudyvideosrc = _src;
211        }
212        if (!_sudyvideosrc) {
213            _sudyvideosrc = $(this).attr("sudy-wp-src");
214        }
215        if (!_sudyvideosrc) {
216            _sudyvideosrc = $(this).attr("src");
217        }
218        if (_sudyvideosrc) {
219            var width = $(this).css("width");
220            var height = $(this).css("height");
221            var style = $(this).attr("style");
222            if(!isIe && !fls.f && !isMp4(_sudyvideosrc)){
223                var content = (style ? '<div style="' + style + '">' : '') + '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="' + width + '" height="' + height + '">' + (style ? '</div>' : '');
224                $($(this)).replaceWith(content);
225            }
226        }
227    });
228    $("embed").each(function(i) {
229        var content = "";
230        var sudyvideosrc = $(this).attr("sudy-wp-player");
231        if (!sudyvideosrc) {
232            sudyvideosrc = $(this).attr("src");
233        }
234        //排除模板上的flash
235        if (sudyvideosrc.indexOf("/_upload/tpl/") != -1) {
236            var width = $(this).attr("width");
237            var height = $(this).attr("height");
238            var play = $(this).attr("autostart");
239            var loop = $(this).attr("repeat");
240            var allowfullscreen = $(this).attr("allowfullscreen");
241            if (JWPlayer(sudyvideosrc)) {
242                content = convAnaly(isIe, sudyvideosrc, null, width, height, play, loop, allowfullscreen);
243                $($(this)).replaceWith(content);
244            } else if (!isIe) {
245                content = convAnaly(isIe, sudyvideosrc, null, width, height, play, loop, allowfullscreen);
246                $($(this)).replaceWith(content);
247            }
248        }
249    });
250    $(".wp_video_player,div[sudyplayer='wp_video_player'],img[sudyplayer='wp_video_player']").each(function(i) {
251        var sudyvideosrc = $(this).attr("sudy-wp-player");
252        if (!sudyvideosrc) {
253            sudyvideosrc = $(this).attr("sudy-wp-src");
254        }
255        if (!sudyvideosrc) {
256            sudyvideosrc = $(this).attr("src");
257        }
258        var content = "";
259        var width = $(this).css("width");
260        var height = $(this).css("height");
261        var sudyattr = $(this).attr("sudy-wp-thumb");
262        var play = $(this).attr("autostart");
263        var loop = $(this).attr("repeat");
264        var allowfullscreen = $(this).attr("allowfullscreen");
265        var style = $(this).attr("style");
266        if (sudyvideosrc && !JWPlayer(sudyvideosrc)) {
267            content = convAnaly(isIe, sudyvideosrc, sudyattr, width, height, play, loop, allowfullscreen, style);
268            $($(this)).replaceWith(content);
269        }
270    });
271}
272function convAnaly(isIe, sudyvideosrc, sudyattr, width, height, play, loop, allowfullscreen, style) {
273    var content = "";
274    if (JWPlayer(sudyvideosrc)) {
275        content = '<div style="width:' + width + 'px;height:' + height + 'px;' + '" id="' + Math.random() + '" class="wp_video_player" sudyplayer="wp_video_player" sudyvideo-src="' + sudyvideosrc + '" autostart="' + play + '" repeat="' + loop + '" allowfullscreen="' + allowfullscreen + '"></div>';
276    } else if (!isIe && (!FlashPlayer(sudyvideosrc) || (FlashPlayer(sudyvideosrc) && !fls.f))) {
277        content = (style ? '<div style="' + style + '">' : '') + '<a href="' + sudyvideosrc + '"><img class="sudy-image-140" src="' + (sudyattr ? sudyattr : playImg) + '" style="width:' + width + ';height: ' + height + '"></a>' + (style ? '</div>' : '');
278    } if (QuickTime(sudyvideosrc) !== null) {
279        content = '<video src="' + sudyvideosrc + '" width="' + width + '" height="' + height + '" autoplay="' + play + '" muted ';
280		if (loop === "true") {
281			content += ' loop="' + loop + '" ';
282		}
283		content += ' controls="controls"></video>';
284   } else {
285        var uploadSrcType = "";
286        if (WinPlayer(sudyvideosrc) !== null) {
287            uploadSrcType = 'application/x-mplayer2';
288        } else if (RealPlayer(sudyvideosrc) !== null) {
289            uploadSrcType = 'audio/x-pn-realaudio-plugin';
290//        } else if (QuickTime(sudyvideosrc) !== null) {
291//            uploadSrcType = 'video/quicktime';
292        } else if (FlashPlayer(sudyvideosrc) !== null) {
293            uploadSrcType = 'application/x-shockwave-flash';
294        } else if (AudioPlayer(sudyvideosrc) !== null) {
295            uploadSrcType = 'audio/mpeg';
296		}else{
297        	 return '<div style="' + style + '"><iframe style="border:0px;" src="' + sudyvideosrc + '" width="' + width + '" height="' + height + '"></iframe></div>';
298        }
299        content = (style ? '<div style="' + style + '">' : '') + '<embed type="' + uploadSrcType + '" class="edui-faked-video" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
300                ' src="' + sudyvideosrc + '" width="' + width + '" height="' + height + '"' +
301                ' wmode="opaque" play="' + play + '" ';
302		if (loop === "true") {
303			content += ' loop="' + loop + '" ';
304		}
305		content += ' menu="false" allownetworking="none" allowscriptaccess="never" allowfullscreen="' + allowfullscreen + '" >' + (style ? '</div>' : '');
306    }
307    return content;
308}
309function JWPlayer(url) {
310    var r, re;
311    re = /.(mp4|flv|f4v|3gp|mid|mpg|mp3|wav|ogg)$/i;
312    r = url.match(re);
313    return r;
314}
315function WinPlayer(url) {
316    var r, re;
317    re = /.(avi|wmv|asf|mid|mpg)$/i;
318    r = url.match(re);
319    return r;
320}
321function RealPlayer(url) {
322    var r, re;
323    re = /.(rm|ra|rmvb|ram)$/i;
324    r = url.match(re);
325    return r;
326}
327function QuickTime(url) {
328    var r, re;
329    re = /.(mov|qt|quicktime)$/i;
330    r = url.match(re);
331    return r;
332}
333function FlashPlayer(url) {
334    var r, re;
335    re = /.swf$/i;
336    r = url.match(re);
337    return r;
338}
339function AudioPlayer(url) {
340    var r, re;
341    re = /.(mp3|wav|ogg|mpg)$/i;
342    r = url.match(re);
343    return r;
344}
345function VideoPlayer(url) {
346    var r, re;
347    re = /.(mp4|flv|f4v)$/i;
348    r = url.match(re);
349    return r;
350}
351function FlvPlayer(url) {
352    var r, re;
353    re = /.(flv.x|flv|FLVPlayer_Progressive.swf)$/i;
354    r = url.match(re);
355    return r;
356}
357function isIE() { //ie?  
358    if (!!window.ActiveXObject || "ActiveXObject" in window)
359        return true;
360    else
361        return false;
362}
363function isMp4(url) {
364    var r, re;
365    re = /.(mp4)$/i;
366    r = url.match(re);
367    return r;
368}
369function flashChecker() {
370    var hasFlash = 0; //是否安装了flash 
371    var flashVersion = 0; //flash版本 
372    if (document.all) {
373        try {
374            var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
375            if (swf) {
376                hasFlash = 1;
377                VSwf = swf.GetVariable("$version");
378                flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
379            }
380        } catch (e) {
381        }
382    } else {
383        if (navigator.plugins && navigator.plugins.length > 0) {
384            var swf = navigator.plugins["Shockwave Flash"];
385            if (swf) {
386                hasFlash = 1;
387                var words = swf.description.split(" ");
388                for (var i = 0; i < words.length; ++i) {
389                    if (isNaN(parseInt(words[i])))
390                        continue;
391                    flashVersion = parseInt(words[i]);
392                }
393            }
394        }
395    }
396    return {
397        f: hasFlash,
398        v: flashVersion
399    };
400}

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.