View difference between Paste ID: 0kV5Hpny and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | // ==UserScript== |
2 | // @name clixsense auto-click script - v0.3.1 | |
3 | // @namespace http://userscripts.org/scripts/show/22272 | |
4 | // @include https://www.clixsense.com/browse.php | |
5 | // @Description This script browses through clixsense ads and automatically clicks them for you. It starts five minutes after you confirm execution. The script waits anywhere from 60 seconds to 5 minutes between clicks. This script is released under GPL License 3.0 or MIT License. | |
6 | // ==/UserScript== | |
7 | ||
8 | /* Settings */ | |
9 | minimum_wait = 60; // 30 seconds is the absolute minimum. I like a little buffer. | |
10 | maximum_wait = 5 * 60; // 5 minutes | |
11 | ||
12 | /* Declaration of global variables */ | |
13 | waiting_time = 0; | |
14 | clix_links = document.getElementsByTagName('a'); | |
15 | sponsor_links = new Array(); | |
16 | sponsor_target = new Array(); | |
17 | sponsor_link_number = new Array(); | |
18 | ||
19 | my_div = document.createElement('div'); | |
20 | my_div.innerHTML = '<div style="height: 60px; width: 150px; ' + | |
21 | 'background-color: #99FFCC; z-index: 100; position: fixed;' + | |
22 | 'padding: 5px; opacity: .4;' + | |
23 | 'right: 10px; bottom: 10px;" id="my_div">' + | |
24 | '' + | |
25 | '</div>'; | |
26 | ||
27 | document.body.insertBefore(my_div, document.body.firstChild); | |
28 | countdown_div = document.getElementById('my_div'); | |
29 | ||
30 | for (var i = 0; i < clix_links.length; i++) { | |
31 | if (clix_links[i].href.search(/browse.php\?launch/i) != -1) { | |
32 | sponsor_links.push(clix_links[i].href); | |
33 | sponsor_target.push(clix_links[i].target); | |
34 | sponsor_link_number.push(i); | |
35 | } | |
36 | } | |
37 | ||
38 | if (sponsor_links.length > 10) { | |
39 | if (confirm("There are more than 10 advertising links contained on this page.\r\nclixsense may be checking for a script. Do you want to continue?")) | |
40 | waiting_time = Math.floor(Math.random() * maximum_wait) + minimum_wait; | |
41 | } else if (sponsor_links.length > 0) { | |
42 | if (confirm("clixsense GreaseMonkey script found " + sponsor_links.length + " links. Click okay if you want to run this script.")) | |
43 | waiting_time = Math.floor(Math.random() * maximum_wait) + minimum_wait; | |
44 | } else { | |
45 | return false; | |
46 | } | |
47 | ||
48 | update_time(); | |
49 | ||
50 | ||
51 | /* FUNCTIONS */ | |
52 | ||
53 | function update_time() { | |
54 | waiting_time--; | |
55 | var min = Math.floor(waiting_time / 60); | |
56 | var seconds = waiting_time % 60; | |
57 | ||
58 | if (waiting_time == 0) { | |
59 | open_random_link(); | |
60 | } else { | |
61 | countdown_div.innerHTML = "Time remaining:: " + min + ":" + seconds; | |
62 | if (seconds < 10) | |
63 | countdown_div.innerHTML = "Time remaining:: " + min + ":0" + seconds; | |
64 | else | |
65 | countdown_div.innerHTML = "Time remaining:: " + min + ":" + seconds; | |
66 | ||
67 | window.setTimeout(update_time, 1000); | |
68 | } | |
69 | } | |
70 | ||
71 | function find_sponsor_table(url_target) { | |
72 | tables = document.getElementsByTagName('table'); | |
73 | for (var i = 0; i < tables.length; i++) { | |
74 | if (tables[i].innerHTML.search(/<table/i) == -1) { | |
75 | if (tables[i].innerHTML.search(url_target) != -1) { | |
76 | tables[i].style.display = 'none'; | |
77 | } | |
78 | } | |
79 | } | |
80 | } | |
81 | ||
82 | function open_random_link() { | |
83 | var link_href = ""; | |
84 | var link_target = ""; | |
85 | var blank_regexp = new RegExp(/^\s*$/); | |
86 | ||
87 | if (sponsor_links.length > 0) { | |
88 | do { | |
89 | var link_number = Math.floor(Math.random() * sponsor_links.length); | |
90 | link_href = sponsor_links.splice(link_number, 1); | |
91 | link_target = sponsor_target.splice(link_number, 1); | |
92 | } while ((blank_regexp.exec(link_href) != null) && (sponsor_links.length > 0)); | |
93 | ||
94 | if (blank_regexp.exec(link_href) != null) { | |
95 | alert("All links used up."); | |
96 | } else { | |
97 | window.open(link_href, link_target); | |
98 | find_sponsor_table(link_target); | |
99 | ||
100 | waiting_time = Math.floor(Math.random() * maximum_wait) + minimum_wait; | |
101 | update_time(); | |
102 | } | |
103 | } else { | |
104 | countdown_div.innerHTML = "All links visited. <a href='javascript:window.location.reload(true);'>Reload</a>"; | |
105 | } | |
106 | } |