-
-
如何绕过这个“在线学习防挂机”限制???
-
发表于:
2013-2-19 16:50
16622
-
一个在线学习网站,如果15分钟没有任何操作,就会自动退出。
从网站上看到这段“防挂机”代码如下,请教如何绕过这个限制!
JS代码
var PageTimeCounter = 0; //初始化页面挂机时间倒计时
var ShutdownCounter = 0; //初始化提示窗口关闭倒计时
var PageTime = 900; //定义页面弹出关闭信息时间,单位秒
var ShutdownTime = 300; //定义关闭信息持续时间,单位秒
var MsgStatus = "hide"; //初始化弹出消息显示状态
var ShowPop; //显示弹出消息
var HidePop; //隐藏弹出消息
function ready() {
var PopMessage = document.getElementById("PopMessage");
$(document).mousemove(function () { ChangeToMaskLess(); if (MsgStatus == "hide") { PageTimeCounter = 0; ShutdownCounter = 0; }; });
document.getElementById('PopMessage').style.height = '0px';
setInterval('ChangeToMask()', 5000);
setInterval('CheckPageTime();', 1000);
}
function ChangeToMask() {//启用遮罩层,To-Hack-iframe
var MaskDivZindex = document.getElementById("MaskDiv");
MaskDivZindex.style.zIndex = "0";
}
function ChangeToMaskLess() {//禁用遮罩层,To-Control-iframe
var MaskDivZindex = document.getElementById("MaskDiv");
MaskDivZindex.style.zIndex = -100;
}
function CheckPageTime() {
if (PageTimeCounter < PageTime)
PageTimeCounter++;
else
PageTimeCounter = PageTime;
$('#show').text(PageTime - PageTimeCounter); //页面挂机时间倒计时
$('#ShowShutdownCounter').text(ShutdownTime - ShutdownCounter); //关闭当前浏览器窗口倒计时,以秒显示
$('#PageTime').text((PageTime / 60).toFixed(0)); //页面挂机时间设定值,以分钟显示
if (PageTimeCounter >= PageTime) {
Show_Notice();
}
}
function ShutdownPage() {
ShutdownCounter++;
if (ShutdownCounter >= ShutdownTime) {
Exit();
}
}
function Exit() {//强制关闭当前浏览器窗口
window.opener = null; window.open("", '_self', ""); window.close();
}
function Show_Notice() {
var PopMessage = document.getElementById("PopMessage");
var popH = parseInt(PopMessage.style.height); //将对象的高度转化为数字
PopMessage.style.display = "block";
ShowPop = setInterval("changeH('up')", 20);
ShutdownPage();
}
function Close_Notice() {
PageTimeCounter = 0;
ShutdownCounter = 0;
var PopMessage = document.getElementById("PopMessage");
var popH = parseInt(PopMessage.style.height); //将对象的高度转化为数字
PopMessage.style.display = "block";
HidePop = setInterval("changeH('down')", 20);
}
function changeH(str) {//显示和隐藏退出提示框
var PopMessage = document.getElementById("PopMessage");
var popH = parseInt(PopMessage.style.height);
if (str == "up") {
if (popH <= 100) {
PopMessage.style.height = (popH + 4).toString() + "px";
}
else {
clearInterval(ShowPop);
MsgStatus = "show";
}
}
if (str == "down") {
if (popH >= 4) {
PopMessage.style.height = (popH - 4).toString() + "px";
}
else {
clearInterval(HidePop);
PopMessage.style.display = "none";
MsgStatus = "hide";
}
}
}
$(document).ready(ready); //启动主程序
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!