Skip to content

Instantly share code, notes, and snippets.

@einverne
Created May 23, 2014 14:46
Show Gist options
  • Save einverne/d6ab0b350d5e1edcef1b to your computer and use it in GitHub Desktop.
Save einverne/d6ab0b350d5e1edcef1b to your computer and use it in GitHub Desktop.
百度知道自动签到,虾米自动签到
// ==UserScript==
// @name Auto Check
// @namespace http://www.einverne.tk/
// @version 2014.05.23
// @description 百度知道自动签到,虾米自动签到
// @match http://zhidao.baidu.com/question/*
// @match http://*.xiami.com/*
// @copyright 2012+, einverne
// ==/UserScript==
(function(){
var signInTimer = setInterval ( function() {
var signInBtn = document.querySelector ("#signin-btn");
if (signInBtn) {
clearInterval (signInTimer);
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
signInBtn.dispatchEvent (clickEvent);
}
var xiamiCheckBtn = document.querySelector(".action");
if(xiamiCheckBtn) {
clearInterval(signInTimer);
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initEvent('click',true,true );
xiamiCheckBtn.dispatchEvent(clickEvent);
}
}
, 200
);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment