zoukankan      html  css  js  c++  java
  • 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);
    	}
    

      

  • 相关阅读:
    [译]在Python中如何使用额enumerate 和 zip 来迭代两个列表和它们的index?
    [译]如何去除Git的unstaged的文件提示“old mode 100755 new mode 100644”?
    [译]在SQL查询中如何映射(替换)查询的结果?
    [总结]《敏捷软件开发: 原则、模式与实践》一次编程实践
    [书摘]《敏捷软件开发: 原则、模式与实践》第一部分:敏捷开发
    [译]Python
    [问题解决]Python locale error: unsupported locale setting
    [持续补充]开发过程中常见bug查找思路
    [译]如何比较同一分支上的不同commit的代码区别?
    [整理]如何切换到远程分支
  • 原文地址:https://www.cnblogs.com/nextseven/p/10834760.html
Copyright © 2011-2022 走看看