diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 468bf64e9..b8d9da240 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1347,6 +1347,43 @@ function pop_up_box(value,tWidth,tTop,tLeft){ } } +//显示的时候根据当前网址是http 还是https 选择视频显示方式直接显示还是弹框 +function autoMedia(id){ + var rootPath = getRootPath(); + + function _mediaType(src) { + if (/\.(rm|rmvb)(\?|$)/i.test(src)) { + return 'audio/x-pn-realaudio-plugin'; + } + if (/\.(swf|flv)(\?|$)/i.test(src)) { + return 'application/x-shockwave-flash'; + } + return 'video/x-ms-asf-plugin'; + } + + if (rootPath.indexOf("https") < 0){ + $("#"+id+" img").each(function(){ + if ($(this).attr("class") == "mediaIco"){ + var href = $(this).parent().attr("href"); + //正则取地址 + if (href){ + var url = href.split("open('")[1].split("',")[0]; + if (url != ""){ + var type = _mediaType(url); + //1.video/x-ms-asf-plugin 类型的视频播放不了,2.audio/x-pn-realaudio-plugin没试过3.application/x-shockwave-flash可以播放 + if (type != "video/x-ms-asf-plugin"){ + var width = 550; + var height = 400; + var html = ''; + $(this).parent().replaceWith(html); + } + } + } + } + }); + } +} + //yk 自动识别URL 并加上链接 function autoUrl(id){ if ($("#"+id).children().length > 0 ){ @@ -1387,6 +1424,6 @@ function autoUrl(id){ }); $("#"+id).html(html); } + autoMedia(id); } -