NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name stljs
// @namespace http://tampermonkey.net/
// @version 2025-08-05
// @description try to take over the world!
// @author ens
// @match https://gdipx.yanxiu.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=yanxiu.com
// @license MIT
// @grant unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
(function() {
'use strict';
setTimeout(function() {
if (unsafeWindow.youh) {
console.log('卧槽,已经有这个变量了!');
}
var you = {
sq: function(str) {
return document.querySelector(str);
},
sqa: function(str) {
return document.querySelectorAll(str);
},
getv: function(name, def) {
return GM_getValue(name, def);
},
setv: function(name, val) {
GM_setValue(name, val);
},
findAndDo: function(keys, func) {
//用于对某元素组各个元素运行相应函数func(i),其返回值代表是否继续遍历到完。
let elems = document.querySelectorAll(keys);
for (let i = 0; i < elems.length; i++) {
if (!func(i, elems[i], elems)) {
console.error(elems[i]);
return;
}
}
func(-1, null, elems);
},
log: null,
currentTime: 0,
newTime: 0,
pauseTime: 0,
interval: null
};
if (window.location.href.indexOf('train2') > -1) {
you.setv('playing', 'no');
console.log('课程开始了,请准备好医疗箱、炸药包');
}
you.log = function(str) {
console.log(str);
you.setv('message', str);
};
you.interval = setInterval(function() {
if (document.querySelector('.vcp-timelabel')) {
//视频播放页
you.newTime = document.querySelector('.vcp-timelabel').innerText;
if (document.querySelector('.ended-mask').style.display != 'none') {
//视频结束画面
you.log('哥哥,你竟然看完了一个视频!这下不得不奖励你了:');
you.findAndDo('.res-item', function(i, q, qs) {
if (i == -1) {
you.log('啊...我好想学习,我似乎又开始了学习!');
qs[0].click();
} else if (q.className.indexOf('active') > -1) {
if (qs.length - 1 == i) {
//最后一个视频了
you.log('全看完了,拜拜');
you.setv('playing', 'end');
window.opener = null;
window.open('', '_self');
window.close();
return false;
} else {
you.log('再看一个!(根本不想)');
qs[i + 1].querySelector('.res-name').click();
return false;
}
} else {
return true;
}
});
return;
}
if (document.querySelector('.action-timer').innerText.indexOf('已完成') > -1) {
//最后一个视频了
you.log('全看完了,拜拜');
you.setv('playing', 'end');
window.opener = null;
window.open('', '_self');
window.close();
}
if (you.newTime == you.currentTime) {
//停止了
you.pauseTime++;
if (document.querySelector('.scoring-wrapper').style.display != 'none') {
you.log('给你四星半好评,boom!');
let moveEvent = new MouseEvent('mousemove', {
'view': unsafeWindow,
'bubbles': true, // 事件是否会在它冒泡到 DOM 树上的时候触发父级元素的事件处理器
'cancelable': true, // 是否可以用 preventDefault() 取消默认动作
'clientX': 100, // 鼠标指针的 X 坐标
'clientY': 200 // 鼠标指针的 Y 坐标
});
document.querySelectorAll('.rate-item')[9].dispatchEvent(moveEvent);
document.querySelectorAll('.rate-item')[9].click();
document.querySelectorAll('.ivu-btn.ivu-btn-primary')[1].click();
return;
}
if (document.querySelector('.alarmClock-wrapper').style.display != 'none') {
you.log('有个点我继续计时,艹,点他!');
document.querySelector('.alarmClock-wrapper').click();
return;
}
if (document.querySelector('.action-timer').innerText.indexOf('已完成') > -1) {
//最后一个视频了
you.log('全看完了,拜拜');
you.setv('playing', 'end');
window.opener = null;
window.open('', '_self');
window.close();
}
if (you.pauseTime > 3) {
you.log('不知道发生了什么反正停止了,不要停!快,自己动!');
document.querySelector('.vcp-playtoggle').click();
}
} else {
you.pauseTime = 0;
}
you.currentTime = you.newTime;
} else if (window.location.href.indexOf('train2') > -1) {
//课程列表页
if (you.getv('playing', 'no') == 'no') {
console.log('new play');
you.findAndDo('.course-item', function(i, q, qs) {
if (i == -1) {
//遍历完毕,竟然全看完了
console.log('你竟然看完了一车视频?');
if (document.querySelector('.number').className ==
'is-active number') {
console.log('不好意思,还有一车');
document.querySelectorAll('.number')[1].click();
}
return false;
} else if (q.innerText.indexOf('已观看 100%') > -1) {
return true;
} else {
//找到没看过的了
you.setv('playing', i + '');
q.click();
return false;
}
});
} else if (you.getv('playing', 'no') == 'end') {
you.setv('playing', 'no');
location.reload();
} else {
console.log('playing ' + you.getv('playing', 'no') + ' message: ' + you.getv(
'message',
'没事发生!'));
if (you.getv('message', '没事发生!') != '没事发生!') {
you.setv('message', '没事发生!');
}
}
} else {
return;
}
}, 3000);
unsafeWindow.youh = you;
}, 3000);
})();