// ==UserScript== // @name 灯塔党建视频学习 // @namespace aaron.js.greasyfork.org // @version 0.1 // @description 多个视频,同时学习。 // @author Aaron // @match http://*.dtdjzx.gov.cn/resourcelist // @grant none // @downloadURL none // ==/UserScript== var user1=0; (function() { 'use strict'; // Your code here... $.postJSON("/bintang/getUserId", {}).then(e=>{ if(e){user1=e;} else{alert("请登录");} }) $($(".top.clearfix")[1]).append('

加速学习

'); $("#p_gobtn").click(e=>{ $(".item.list-item").each((i,n)=>{ if(n.outerHTML.indexOf("已读")<0){ var url=$(n).find("a")[0].getAttribute("href"); $(n).append('学习'); } }); }); window.gosss=function(url){ $.get(url).then((h,s,o)=>{ alert("学习开始,5分钟后刷新此页面"); var project2 = JSON.parse($(h).find("#script_course").html()); aaAddTimeCount(project2); $(h).find(".item.list-item a").each((i,n)=>{ $.get(n.href).then((h1,s1,o1)=>{ var project1 = JSON.parse($(h1).find("#script_course").html()); aaAddTimeCount(project2); }) }); }); } window.aaAddTimeCount=function(project1){ $.postJSON("/bintang/addTimeCount", project1).then(data=>{ if(data.code){ var ss=10; var t=1; while(ss<=project1.courseDuration*60){ setTimeout(()=>{ $.postJSON("/bintang/learntime", { timelength:project1.courseDuration, courseId:project1.courseId, userId:user1, studyTimes:ss}); },t*1000); ss+=30; t++; } }else{ console.log(project1.courseName+"观看失败"); } }) } })();