-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontent.js
69 lines (59 loc) · 1.58 KB
/
content.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
// Old Code
// let likeit = () => {
// var likeBtn = document.querySelector('[aria-label="Like"]'); likeBtn.click()
// }
// let nopeit = () => {
// var dislikeBtn = document.querySelector('[aria-label="Nope"]'); dislikeBtn.click()
// }
let arr = document.getElementsByTagName('button');
let likeit = () => {
var likeBtn = arr[arr.length-3];
likeBtn.click()
}
let nopeit = () => {
var dislikeBtn = arr[arr.length-5];
dislikeBtn.click();
}
var auto;
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
if (request.message == "like") {
function startLike() {
console.log("started liking");
auto = setInterval(likeit, 100);
}
startLike();
}
if (request.message == "nope") {
function startDisLike() {
console.log("started disliking");
auto = setInterval(nopeit, 100);
}
startDisLike();
}
// if (request.message == "loaded") {
// function extloaded() {
// console.log("TA Extension Loaded");
// }
// extloaded();
// }
// if (request.message === "nope") {
// function startNope() {
// console.log("started nope")
// setInterval(nopeit(), 1000)
// function nopeit() {
// var nopeBtn = document.querySelector('[aria-label="Nope"]'); nopeBtn.click()
// }
// }
// startNope();
// }
if (request.message == "pause") {
function pause() {
clearInterval(auto);
// clearInterval(nopeit);
console.log("Automation Stopped");
}
pause();
}
}
);