在ajax驱动的站点上选择并激活正确的控件。
// ==UserScript==// @name _Nike auto-buy(!!!) script// @include http://*/*// @require
http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js// @require https://gist.github.com/raw/2625891/waitForKeyElements.js// @grant
GM_addStyle// ==/UserScript==/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/var okayToClickAddtoCart = false;//-- Assumes that size is a standard <option> tag or similar...waitForKeyElements
(".selectBox-label[value='10']", selectShoeSize);function selectShoeSize (jNode) {
jNode.prop ('selected', true);
okayToClickAddtoCart = true;}waitForKeyElements (".add-to-cart.nike-button", clickAddToCart);function clickAddToCart (jNode) {
if ( ! okayToClickAddtoCart) {
return true; //-- Don't click yet.
}
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
jNode[0].dispatchEvent (clickEvent);}waitForKeyElements (".checkout-button", clickCheckoutButton);function clickCheckoutButton (jNode) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
jNode[0].dispatchEvent (clickEvent);}
偶然的你
随时随地看视频慕课网APP
相关分类