-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvip-pln-anti-afk.user.js
42 lines (36 loc) · 1.21 KB
/
vip-pln-anti-afk.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
// ==UserScript==
// @name Vendor Invoice Portal VIP PLN Anti AFK
// @namespace Violentmonkey Scripts
// @version 1.0
// @description Automatically clicks on a afk popup with a specific CSS class.
// @include https://vendorinvoice.pln.co.id/*
// @grant none
// @run-at document-start
// @require https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
// @version 1.0
// @author fenymufyd
// @copyright 2024, fenymufyd
// @license MIT
// ==/UserScript==
(function () {
"use strict";
// Define the query selector pattern based on the HTML line
function clickPopup() {
const popupz = document.querySelector("button#loginbtn");
if (popupz) {
popupz.click();
}
let dest = Array.from(
document.querySelectorAll("span.MuiButton-label")
).find((el) => el.textContent === "Lanjutkan");
if (dest) {
dest.click();
}
}
// Check for the popup every 5 minutes (300,000 milliseconds)
const intervalId = setInterval(clickPopup, 500);
// Stop checking when the popup is clicked or when you navigate away
window.addEventListener("beforeunload", () => {
clearInterval(intervalId);
});
})();