// ==UserScript== // @name My School // @namespace http://svtcc.cliv2.dongst.cn // @version 0.3 // @description try to take over the world! // @author Zhu Rong // @match 第二课堂网站/* // @connect * // ==/UserScript== var time = 1000; var loginlocation="第二课堂网址/#/"; var account="账号"; var password="密码"; var state="已完结"; var order ="1"; var type="思想政治与道德素养"; (function() {//入口 'use strict'; var a1 = setTimeout(landing, 1000); })(); function landing() {//登陆界面和跳转到活动页面的操作 if (window.location.href == loginlocation) { var event = new Event('compositionstart'); var uii = document.querySelectorAll('.uni-input-input'); uii[0].dispatchEvent(event); uii[1].dispatchEvent(event); uii[0].value = account; uii[1].value = password; event = new Event('compositionend'); uii[0].dispatchEvent(event); uii[1].dispatchEvent(event); document.querySelector('#slideVerify').__vue__.$emit('success'); setTimeout(landing, 1500); return; } if (window.location.href == "http://svtcc.cliv2.dongst.cn/#/pages/home/index") { var imgevent = document.getElementsByClassName("img"); imgevent[1].click(); setTimeout(second, 2000); return; } setTimeout(second, 2000); } function second() {//获取所有满足条件的对象并存入数组中,并调用下一个函数 if (window.location.href != "http://svtcc.cliv2.dongst.cn/#/pages/acti/index?otokey=0") { return; } revise(); var v2 = document.getElementsByClassName("text-green"); var v3 = document.getElementsByClassName("cu-tag bg-blue light sm"); var v4 = new Array(); for (var i = 0; i < v2.length; i++) { if (v2[i].innerText == state && v3[i].innerText == type) { v4.push(v3[i]); } } v4.forEach( function(value,index,array){ //value.click(); time+=1000; console.log(time); setTimeout(third(value), time); } ) } function revise() {//修改活动界面的类型,为secend函数服务 document.querySelector('uni-view').__vue__.$parent.actiStatusStr = state; document.querySelector('uni-view').__vue__.$parent.actiStatusId = order; document.getElementsByClassName('cu-btn bg-blue margin-sm lg')[0].click(); } function third(value) {//满足条件自动报名,如果执行完毕就15秒后再次执行second函数 value.click(); var v4 = document.getElementsByClassName("bg-red submit er"); if (v4[0] != null && v4[0].innerText == "报名") { v4[0].click(); window.history.go(-1); } window.history.go(-1); if (window.location.href =="http://svtcc.cliv2.dongst.cn/#/pages/acti/index?otokey=0") { setTimeout(second,1000*15); } }