My School
// ==UserScript==
// @name My School
// @namespace http://svtcc.cliv2.dongst.cn
// @version 0.3
// @description try to take over the world!
// @author Zhu Rong
// @match http://svtcc.cliv2.dongst.cn/*
// @connect *
// ==/UserScript==
var odd=false;
var account = "";
var password = "";
var state = "报名中";
var order = "1";
var type = "思想政治与道德素养";
var logined=false;
var repeat6 = true;
(function() { //入口
'use strict';
setTimeout(logging,1500);
})();
function logging() { //登陆界面和跳转到活动页面的操作
if (window.location.href == "http://svtcc.cliv2.dongst.cn/#/") {
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');
console.log(1);
logined=false;
setTimeout(logging,1500);
}else if (window.location.href == "http://svtcc.cliv2.dongst.cn/#/pages/home/index") {
var imgevent = document.getElementsByClassName("img");
imgevent[1].click();
setTimeout(logging,1500);
}else{
if(logined == false){
logined=true;
setTimeout(revise,1500);
}
}
}
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();
if(!odd){
let div=document.createElement("div");
div.innerHTML='<span id="span-1">span1</span><span class="sp">span class</span>';
/* <div id="two" style="position:absolute; top:10px; left:10px; z-index:1000; width: 300px;height: 300px;background-color: aqua;">
</div> */
div.style='position:absolute; top:10px; left:10px; z-index:1000; width: 300px;height: 300px;background-color: aqua;';
document.body.append(div);
}
setTimeout(second,1000);
console.log("未进入");
}
function second() {//获取所有满足条件的对象并存入数组中,并调用下一个函数
var v2 = document.getElementsByClassName("text-green");
var v3 = document.getElementsByClassName("cu-tag bg-blue light sm");
var v4 = [];
const output = (i,obj) => new Promise((resolve) => {
setTimeout(() => {
third(obj);
resolve();
}, 2200 * i);
});
for (var i = 0; i < v2.length; i++) {
/*if (v2[i].innerText == state && v3[i].innerText == type) {
v4.push(output(i,v3[i]));
}*/
if (v2[i].innerText == state) {
v4.push(output(i,v3[i]));
}
}
console.log("进入");
Promise.all(v4).then(() => {
setTimeout(() => {
if (window.location.href !="http://svtcc.cliv2.dongst.cn/#/pages/acti/index?otokey=0") {
window.location.href="http://svtcc.cliv2.dongst.cn/#/pages/acti/index?otokey=0";
}
repeat();
}, 3000);
});
}
function third(value) {//满足条件自动报名,如果执行完毕就15秒后再次执行second函数
value.click();
setTimeout(() => {
var v4 = document.getElementsByClassName("bg-red submit er");
var v5=document.getElementsByClassName("bg-red submit");
if (v4[0] != null || v5[0] !=null) {
if (v4[0] != null && v4[0].innerText == "我要报名") {
v4[0].click();
}
if(v5[0].textContent == "我要报名"){
v5[0].click();
}
console.log("报名成功");
if(document.getElementsByClassName("cu-btn bg-orange margin-left")!=null){
document.getElementsByClassName("cu-btn bg-orange margin-left")[0].click();
}
}
}, 600);
setTimeout(() => {
window.history.go(-1);
}, 1200);
}
function repeat(){
if(repeat6);
setTimeout(second,10*60*1000);
}