Last active
June 14, 2022 01:47
-
-
Save luhaoming/8cadb2665fc99ba611a18cdf34a0fe73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name yahoo coupon | |
// @namespace http://tampermonkey.net/ | |
// @version 0.4 | |
// @description 領取yahoo全站 | |
// @author Haoming | |
// @match https://tw.buy.yahoo.com/coupons/brand?bdid=* | |
// @match https://tw.buy.yahoo.com/coupons | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=yahoo.com | |
// @source | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
var items=Array.from(document.querySelectorAll("div")).filter(itm=>/全站/.test(itm.innerText)); | |
var itembtns=items.filter(itm=>/領取/.test(itm.innerText)) | |
if ( itembtns.length > 0){ | |
itembtns.pop().click() | |
} | |
var [nw,wk]=[new Date(),new Date()] | |
wk.setHours(nw.getHours()+1,0,0) | |
var timer=wk-nw | |
document.title=timer | |
setTimeout(()=>{location.reload()},timer) | |
setInterval(()=>{location.reload()},5*60*1000) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment