中山会计网上继续教育平台刷课zswlxy

中山会计继教刷课

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name 中山会计网上继续教育平台刷课zswlxy
// @namespace Violentmonkey Scripts
// @match https://www.zswlxy.com.cn/*
// @description 中山会计继教刷课
// @version  1.00
// @author  Cosil
// @grant GM_setValue
// @grant GM_getValue
// @icon https://www.zswlxy.com.cn/kjwx/webassets/css/images/zxlogin.png
// ==/UserScript==
$(function() {

	if (location.pathname.search('toStudy') > -1) { //toStudy页面
		var ccg = GM_getValue("ccg")
		playerKZ.popUp = function() {}; //使题目弹窗方法失效
		player.on('ended', function() { //重写onEnded
			console.log('结束播放');
			$(".global_top_label_other:contains(学习课程)").click() //退回toCourse界面
		});
		setTimeout(function() {
			//todo:errorCode
			player.play(); //开始播放
			player.mute(); //静音
			var interval = setInterval(function() {
				if (player.getDuration() > 0) {
					var startPoint = parseInt(player.getDuration() * ccg);
					if (startPoint > 30) {
						startPoint -= 30;
					} //预留30s,防止时长不足
					player.seek(startPoint * ccg - 20); //根据比例seek
					clearInterval(interval);
				}
			}, 500);
		}, 1000); //延时1秒进行,确保加载防止error
	}

	if (location.pathname.search('toCourse') > -1) { //toCourse页面
		var lessons = $("tr:contains(继续学习)");
		if (lessons.length < 1) {
			lessons = $("tr:contains(开始学习)")
		}
		var next = $(lessons[0]).find("a");
		if (next == null) {
			alert("本课程学习完毕,请进行考试!");
			return;
		}
		GM_setValue("ccg", $(lessons[0]).find("span")[0].innerHTML / $(lessons[0]).find("span")[1].innerHTML); //已学时长比例
		next.click();
	}

	//todo:已购买的年度科目跳转
	/*function getUrlParam(name) {//获得url参数
	    var param = location.href.match("(?<=" + name + "=).*?(?=&|$)")[0];
	    return param == null ? null : param
	}*/
})