安全生产快速学习
当前为
// ==UserScript==
// @name aq100
// @namespace https://bjdc.100anquan.com/
// @version 0.2
// @description 安全生产快速学习
// @author Shining
// @match https://*.100anquan.com/*
// @match http://*.100anquan.com/*
// @grant unsafeWindow
// @grant GM_log
// @run-at document-end
// ==/使用网页自带的@require https://libs.baidu.com/jquery/1.8.3/jquery.min.js
// ==/不require引入jquery时
// ==/不引入jquery,$设置的是原网页的jquery,如果设置为document-start时:因为提前注入,无法使用原网页的jquery,会提示找不到$
// ==/unsafeWindow 沙盒模式
// ==/document-end 文件加载后运行插件
// ==/UserScript==
var tooberUrl = unsafeWindow.location.href;
var $ = unsafeWindow.$;
GM_log(tooberUrl);
window.onload = function(){
if(tooberUrl.indexOf("/course/courseEleView?") != -1){
//因为@run-at document-start,在此设置页面加载完才运行
GM_log("学习项");
$("#Menu").before('<input id="hackBtn" style="background-color:yellow;font-size:20px" type="button" style="height:60px" onclick="hackTime()" value="【破解!直接学习完毕】">');
unsafeWindow.hackTime = function(){
unsafeWindow.window.cc_js_Player.pause();
var time = Math.round(unsafeWindow.window.cc_js_Player.getDuration());
if(!isNaN(time)){
$("#stayInVideoTime").val(time);
unsafeWindow.ajaxSendData();
$("#hackBtn").val("已学完【"+time+"】秒");
$("#hackBtn").css({'background-color':'green','color':'white'});
$('#hackBtn').attr("disabled","disabled");
}else{
$("#hackBtn").val("破解失败【"+time+"】,请加载完视频再试");
$("#hackBtn").css({'background-color':'red','color':'white'});
}
}
}else if(tooberUrl.indexOf("/directExam/examIndexAutoV2") != -1){
//HTML directExam();
//https://bjdc.100anquan.com/directExam/freePracticeV2/2141/4456/stochastic
GM_log("考试");
//onclick
$("li").each(function(){
var attr = $(this).attr('onclick');
if (typeof attr !== typeof undefined && attr !== false) {
//chooseAnswer('4','205549','0','0'); //最后一位是'1'是正确的
if(endWidth(attr,"'1');")){
$(this).append(' <strong style="background-color:red;font-size:20px;color:white"> ✔ </strong>');
}
}
});
}else if(tooberUrl.indexOf("/directExam/examInfoTestv2") != -1){
//HTML directExam();
//https://bjdc.100anquan.com/directExam/freePracticeV2/2141/4456/stochastic
GM_log("强行考试");
//onclick
$(".tj_btn").before('<button style="background-color:yellow;font-size:20px" onclick="directExam();">强行考试</button>');
}else if(tooberUrl.indexOf("/loginV2/userLogin") != -1){
GM_log("跳过弱密码修改");
if($("html").html().indexOf("鉴于您的密码过于简单") != -1){
unsafeWindow.window.location.href = "https://bjdc.100anquan.com/index";
}
}
function endWidth(str, target){
var start = str.length-target.length;
var arr = str.substr(start,target.length);
if(arr == target){
return true;
}
return false;
}
}