-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathonethingcloud.user.js
79 lines (64 loc) · 2.12 KB
/
onethingcloud.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ==UserScript==
// @name OneThingCloud
// @version 2020.07.11
// @author ytzong
// @description OneThingCloud
// @include http*://*onethingpcs.com/*
// @copyright 2020+
// @run-at document-end
// @grant GM_addStyle
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js
// ==/UserScript==
function getRandomInt(n) {
return Math.floor(Math.random() * n);
}
function startMain() {
console.log('start ' + new Date().toTimeString())
try {
/*
let n = jQuery('.task-list .btn-download').length
jQuery('.task-list .btn-download').eq(getRandomInt(n)).click()
jQuery('.task-list .btn-download').eq(getRandomInt(n)).click()
jQuery('.task-list .btn-download').eq(getRandomInt(n)).click()
//jQuery('.task-list .btn-download').click()
*/
jQuery('.task-list .btn-download').eq(-5).click()
jQuery('.task-list .btn-download').eq(1).click()
jQuery('.task-list .btn-download').eq(0).click()
}
catch (e) {
}
}
function reload() {
if (new Date().getMinutes() % 2 == 0 && new Date().getSeconds() == 0) {
console.log('refresh ' + new Date().toTimeString())
window.location.reload(true)
}
}
function stop() {
if (new Date().getMinutes() % 2 == 0 && new Date().getSeconds() == 5) {
console.log('stop ' + new Date().toTimeString())
try {
//jQuery('.task-list .btn-pause').click()
jQuery('.task-item').each(function () {
let speed = jQuery(this).find('.download span').text()
if (!speed.includes('MB')) {
jQuery(this).find('.btn-pause').click()
}
})
}
catch (e) {
}
}
}
function start() {
if (new Date().getMinutes() % 2 == 0 && new Date().getSeconds() == 20) {
startMain()
}
if (new Date().getMinutes() % 2 == 0 && new Date().getSeconds() == 30) {
startMain()
}
}
window.setInterval(reload, 1000)
window.setInterval(stop, 1000)
window.setInterval(start, 1000)