showtimu

var showTimu = [];
function pushTimu(second,map){
	showTimu = [];
	$.each(map,function(i,ele){
		var index=parseInt(i);
		if(0<second-index&&second-index<=3){
			$.each(map,function(index,ele){
				if(second>index){
					showTimu.push(ele);
				}
			});
		return;
		}
	});
}
function getTimu(index){
	//i为倒数多少题
	var timu = showTimu[showTimu.length-1-index];
	return timu;
}
var interval;

function invoke(second){
	pushTimu(second,map);
	//获得最后一条题目
	var timu  = getTimu(0);
	if(timu){
		showLastTimu(timu,1);
	}
}

var map;

function getMap(){
	com.insigma.ajax({
	    url:"/zxpx/auc/play/ejectqueList",
	    dataType:'json',
	    data:{_method:'GET','coursewareid':'CS2019030000007402CW2019030000020425'},
	    type:'post',
	    success: function(data) {
   			if(data.success){
   				var result=data.resData.ejectqueList;
   				if(result !=null && typeof(result) !='undefined' && result.length>0){
   					map=$.parseJSON(result);
   				}
   			}
	    }
	});
}

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();
    }
}

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();
	
	/* 为弹出题目赋值 */
	getMap();
	$('.course-panel #contentList').css('max-height',window.screen.height-380);

	$('#hightable').css('min-height',window.screen.height-535);
	$('#pdfFrame').height(window.screen.height-412);

	$('#course_introduce').click(function(){
		$('#diss').show();
		$('#menu').hide();
		$('#course_contents').removeClass('course-panel-footer-active');
		$('#course_contents').addClass('course-panel-footer-btn');

		$(this).removeClass('course-panel-footer-btn');
		$(this).addClass('course-panel-footer-active');
	});
	
	$('#course_contents').click(function(){
		$('#diss').hide();
		$('#menu').show();
		$('#course_introduce').removeClass('course-panel-footer-active');
		$('#course_introduce').addClass('course-panel-footer-btn');

		$(this).removeClass('course-panel-footer-btn');
		$(this).addClass('course-panel-footer-active');
	});
});

	function toggleWin() {
		$('#disWin').toggle(200);
		if($('.toggleWin').hasClass('out')){
			$('.toggleWin').html('<i class="fa fa-chevron-left"></i>');
			$('.toggleWin').removeClass('out');
			$('.toggleWin').addClass('in');
		}else{
			$('.toggleWin').html('<i class="fa fa-chevron-right"></i>');
			$('.toggleWin').removeClass('in');
			$('.toggleWin').addClass('out');
		}
		
	//	$('#disWin').animate({
	//		'toggle'
	//	});
	}

	function formatTime(seconds) {
		var min = Math.floor(seconds / 60), second = seconds % 60, hour, newMin, time;
		if (min > 60) {
			hour = Math.floor(min / 60);
			newMin = min % 60;
		}
		if (second < 10) {
			second = '0' + second;
		}
		if (min < 10) {
			min = '0' + min;
		}
		return time = hour ? (hour + ':' + newMin + ':' + second)
				: (min + ':' + second);
	}

  

原文地址:https://www.cnblogs.com/nextseven/p/10834760.html