mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
增加浏览器是否支持 flash 的判断,复制插件依赖 Flash
This commit is contained in:
parent
66b51ab741
commit
7ac93841d6
@ -6,9 +6,26 @@ require(["jquery", "codeMirror", "csrfToken", "bsAlert", "ZeroClipboard"],
|
||||
return;
|
||||
}
|
||||
|
||||
// 复制样例需要 Flash 的支持 检测浏览器是否安装了 Flash
|
||||
function detect_flash() {
|
||||
var ie_flash;
|
||||
try {
|
||||
ie_flash = (window.ActiveXObject && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) !== false)
|
||||
} catch (err) {
|
||||
ie_flash = false;
|
||||
}
|
||||
var _flash_installed = ((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") || ie_flash);
|
||||
return _flash_installed;
|
||||
}
|
||||
|
||||
if(detect_flash()) {
|
||||
// 提供点击复制到剪切板的功能
|
||||
ZeroClipboard.config({swfPath: "/static/img/ZeroClipboard.swf"});
|
||||
new ZeroClipboard($(".copy-sample"));
|
||||
}
|
||||
else{
|
||||
$(".copy-sample").hide();
|
||||
}
|
||||
|
||||
var codeEditor = codeMirror(codeEditorSelector, "text/x-csrc");
|
||||
var language = $("input[name='language'][checked]").val();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user