Last active 1 week ago

dakusuno revised this gist 1 week ago. Go to revision

1 file changed, 10 deletions

gistfile1.txt

@@ -22,19 +22,14 @@
22 22 const currentHour = now.getHours();
23 23 const currentMinute = now.getMinutes();
24 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 25
29 26 // Check if current time is past the target time
30 27 if (currentHour > TARGET_HOUR ||
31 28 (currentHour === TARGET_HOUR && currentMinute >= TARGET_MINUTE)) {
32 29
33 - console.log('✅ Time condition met! Scanning for links...');
34 30
35 31 // Get all links on the page
36 32 const allLinks = document.querySelectorAll('a[href]');
37 - console.log(Total links found on page: ${allLinks.length});
38 33
39 34 // Filter and get unique matching URLs
40 35 const matchingUrls = new Set();
@@ -46,10 +41,8 @@
46 41 }
47 42 });
48 43
49 - console.log(Matching URLs found: ${matchingUrls.size});
50 44
51 45 if (matchingUrls.size > 0) {
52 - console.log('📋 Matching URLs:');
53 46 let index = 1;
54 47 matchingUrls.forEach(url => {
55 48 console.log(` ${index++}. ${url}`);
@@ -61,12 +54,9 @@
61 54 window.open(url, '_blank');
62 55 });
63 56 } else {
64 - console.log('❌ No matching URLs found on this page.');
65 57 }
66 58
67 59 } else {
68 - console.log('⏳ Time condition NOT met. No action taken.');
69 60 }
70 61
71 - console.log('=== Script End ===');
72 62 })();

dakusuno revised this gist 1 week ago. Go to revision

1 file changed, 72 insertions

gistfile1.txt(file created)

@@ -0,0 +1,72 @@
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 + })();
Newer Older