-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht.js
53 lines (37 loc) · 1.4 KB
/
t.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
//How much loop Time needed
var loopTimes=500;
//Sleep between each loop
var sleepMicroSecond=500;
var x = document.getElementsByClassName("goog-button-base-content");
var element=x[(x.length-1)];
var dispatchMouseEvent = function(target, var_args) {
var e = document.createEvent("MouseEvents");
// If you need clientX, clientY, etc., you can call
// initMouseEvent instead of initEvent
e.initEvent.apply(e, Array.prototype.slice.call(arguments, 1));
target.dispatchEvent(e);
};
/**
main function
**/
function c(){
if('Continue »'==element.innerHTML){
// Do something after the sleep!
dispatchMouseEvent(element, 'mouseover', true, true);
dispatchMouseEvent(element, 'mousedown', true, true);
dispatchMouseEvent(element, 'click', true, true);
dispatchMouseEvent(element, 'mouseup', true, true);
}
}
var i = 1; // set your counter to 1
function myLoop () { // create a loop function
setTimeout(function () { // call a 3s setTimeout when the loop is called
// your code here
i++; // increment the counter
if (i < loopTimes) { // if the counter < 10, call the loop function
myLoop(); // .. again which will trigger another
c(); // Main function
} // .. setTimeout()
}, sleepMicroSecond)
}
myLoop();