Última atividade 1 week ago

Revisão 995301d008ed970640fd7a9cd04f1f2f0869661e

gistfile1.txt Bruto
1// ==UserScript==
2// @name Auto Open Tab
3// @namespace http://tampermonkey.net/
4// @version 2026-04-08
5// @description try to take over the world!
6// @author You
7// @match https://dyandraglobalstore-02.com/*
8// @icon https://www.google.com/s2/favicons?sz=64&domain=dyandraglobalstore-02.com
9// @grant GM_openInTab
10// ==/UserScript==
11
12
13(function() {
14 'use strict';
15
16 const TARGET_HOUR = 15; // 5 PM
17 const TARGET_MINUTE = 0; // 00 minutes
18
19 const URL_PATTERN = /^https:\/\/widget\.loket\.com(\/.*)?$/;
20
21 const now = new Date();
22 const currentHour = now.getHours();
23 const currentMinute = now.getMinutes();
24
25 console.log('=== Auto Redirect Script ===');
26 console.log(Current time: ${currentHour}:${currentMinute.toString().padStart(2, '0')});
27 console.log(Target time: ${TARGET_HOUR}:${TARGET_MINUTE.toString().padStart(2, '0')});
28
29 // Check if current time is past the target time
30 if (currentHour > TARGET_HOUR ||
31 (currentHour === TARGET_HOUR && currentMinute >= TARGET_MINUTE)) {
32
33 console.log('✅ Time condition met! Scanning for links...');
34
35 // Get all links on the page
36 const allLinks = document.querySelectorAll('a[href]');
37 console.log(Total links found on page: ${allLinks.length});
38
39 // Filter and get unique matching URLs
40 const matchingUrls = new Set();
41
42 allLinks.forEach(link => {
43 const href = link.href;
44 if (URL_PATTERN.test(href)) {
45 matchingUrls.add(href);
46 }
47 });
48
49 console.log(Matching URLs found: ${matchingUrls.size});
50
51 if (matchingUrls.size > 0) {
52 console.log('📋 Matching URLs:');
53 let index = 1;
54 matchingUrls.forEach(url => {
55 console.log(` ${index++}. ${url}`);
56 });
57
58 // Open all matching URLs in new tabs
59 matchingUrls.forEach(url => {
60 console.log(🚀 Opening: ${url});
61 window.open(url, '_blank');
62 });
63 } else {
64 console.log('❌ No matching URLs found on this page.');
65 }
66
67 } else {
68 console.log('⏳ Time condition NOT met. No action taken.');
69 }
70
71 console.log('=== Script End ===');
72})();