gistfile1.txt
· 2.3 KiB · Text
Brut
// ==UserScript==
// @name Auto Open Tab
// @namespace http://tampermonkey.net/
// @version 2026-04-08
// @description try to take over the world!
// @author You
// @match https://dyandraglobalstore-02.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=dyandraglobalstore-02.com
// @grant GM_openInTab
// ==/UserScript==
(function() {
'use strict';
const TARGET_HOUR = 15; // 5 PM
const TARGET_MINUTE = 0; // 00 minutes
const URL_PATTERN = /^https:\/\/widget\.loket\.com(\/.*)?$/;
const now = new Date();
const currentHour = now.getHours();
const currentMinute = now.getMinutes();
console.log('=== Auto Redirect Script ===');
console.log(Current time: ${currentHour}:${currentMinute.toString().padStart(2, '0')});
console.log(Target time: ${TARGET_HOUR}:${TARGET_MINUTE.toString().padStart(2, '0')});
// Check if current time is past the target time
if (currentHour > TARGET_HOUR ||
(currentHour === TARGET_HOUR && currentMinute >= TARGET_MINUTE)) {
console.log('✅ Time condition met! Scanning for links...');
// Get all links on the page
const allLinks = document.querySelectorAll('a[href]');
console.log(Total links found on page: ${allLinks.length});
// Filter and get unique matching URLs
const matchingUrls = new Set();
allLinks.forEach(link => {
const href = link.href;
if (URL_PATTERN.test(href)) {
matchingUrls.add(href);
}
});
console.log(Matching URLs found: ${matchingUrls.size});
if (matchingUrls.size > 0) {
console.log('📋 Matching URLs:');
let index = 1;
matchingUrls.forEach(url => {
console.log(` ${index++}. ${url}`);
});
// Open all matching URLs in new tabs
matchingUrls.forEach(url => {
console.log(🚀 Opening: ${url});
window.open(url, '_blank');
});
} else {
console.log('❌ No matching URLs found on this page.');
}
} else {
console.log('⏳ Time condition NOT met. No action taken.');
}
console.log('=== Script End ===');
})();
| 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 | })(); |