Skip to content

Instantly share code, notes, and snippets.

@luhaoming
Last active June 14, 2022 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luhaoming/8cadb2665fc99ba611a18cdf34a0fe73 to your computer and use it in GitHub Desktop.
Save luhaoming/8cadb2665fc99ba611a18cdf34a0fe73 to your computer and use it in GitHub Desktop.
// ==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