var ctx = '/zxpx';
function IEVersion() {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isOpera = userAgent.indexOf("Opera") > -1;
var isIE = userAgent.indexOf('compatible') > -1
&& userAgent.indexOf('MSIE') > -1 && !isOpera; //判断是否IE浏览器
if (isIE) {
var reIE = new RegExp('MSIE (\\d+\\.\\d+);');
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp['$1']);
if(fIEVersion && !isNaN(fIEVersion) &&fIEVersion<=9){
alert('本系统不支持您当前使用的浏览器版本,建议使用IE11、Chrome等主流浏览器以及其他主流浏览器的极速模式!');
closeLab();
}
}
}
function IsPC() {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
var flag = false;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > -1) {
flag = true;
break;
}
}
if(flag){
alert('本系统不支持手机端浏览器!');
window.opener=null;
window.open('about:blank','_self','').close();
//window.location.href="http://ggfw.gdhrss.gov.cn:8080/zjjyweb/user/index.do";
}
}
function closeLab(){
var userAgent = navigator.userAgent;
if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Presto") != -1) {
window.location.replace("about:blank");
} else {
window.opener = null;
window.open("", "_self");
window.close();
}
}
$(document).ready(function(){
IEVersion();
IsPC();
$('#input-sch').keydown(function(event){
if (event.keyCode==13) //按Enter键的键值为13
$('#btn-sch').click(); //调用搜索按钮的点击事件
});
$('img').error(function(){
if($(this).data('errortime')!=1){
$(this).attr('src','/zxpx/assets/image/photo/coursecover.png?f='+parseInt(Math.random()*99999999999999999+1));
$(this).data('errortime',1);
}
});
$('img').each(function (i,el){
if($(el).attr('src')==''){
if($(el).data('errortime')!=1){
$(el).attr('src','/zxpx/assets/image/photo/coursecover.png?f='+parseInt(Math.random()*99999999999999999+1));
$(el).data('errortime',1);
}
}
});
$('#btn-logout').click(function(){
top.location.href="/zxpx/dologout?ret_url=http://ggfw.gdhrss.gov.cn:80/zxpx";
});
$('#btn-sch').on('click',courseSearch);
});
function courseSearch(){
var url = '/zxpx/hyper/search/courselist';
var searchstr = $('#input-sch').val();
if(searchstr){
url+=('?cstr='+searchstr);
}
$(location).prop('href',url);
}