您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name 党建学习平台伪播放4.0(alpha) // @namespace http://tampermonkey.net/ // @version 4.0.1 // @description try to take over the world! // @author Dabble // @match http://xjtudj.edu.cn/course_detail.html?navId=course_list* // @grant none // @run-at document-idle // ==/UserScript== (function() { 'use strict'; var btn=document.createElement("button"); btn.innerText = "开始刷课"; btn.onclick = (function() { var reg = /course_detail\.html\?navId=course_list\&courseId=([a-z0-9]{32})\&coursewareId=([a-z0-9]{32})$/; var msg = reg.exec(window.location.href); if(msg != null){ var courseId = msg[1]; var coursewareId = msg[2]; var videoElement = document.getElementsByTagName("video")[0]; if(!videoElement){ alert("无法找到播放器,请重试"); return false; } var DuringTime = document.getElementsByTagName("video")[0].duration; if(!DuringTime){ alert("无法获取视频时长,请重试"); return false; } videoElement.pause(); videoElement.removeAttribute('src'); // empty source videoElement.load(); if(DuringTime>0){ safePost($host + '/client/course/setFinished', { "courseId": courseId, "coursewareId": coursewareId, "progress": DuringTime }, function (res) { if (res.isSuccess) { if (coursewareId == res.data.coursewareId) { var progressHtml = ""; progressHtml = "<div class='progress-o'>本集学习进度<i>" + res.data.rateStr + '%' + "</i></div>" + "<div class='progress-t'>" + "<div class='progress-t-0' style='width: " + res.data.rateStr + "%;'></div></div>"; $("#progressBar").html(progressHtml); alert("已完成该课程"); } } }) } } }); document.getElementsByClassName("loc_font")[0].insertBefore(btn,null); })();