Dolayısıyla, herhangi bir nike.com spor ayakkabı sayfasını (HTML bağlantısı olmadan) her ziyaret ettiğimde, onu otomatik olarak ayakkabı bedenimden seçmeye çalışıyorum. sepete ve beni kontrol ediyor.AJAX tarafından yönetilen bir sitede doğru denetimlerin seçilmesi ve etkinleştirilmesi
Şu anda bu komut dosyasını (aşağıda) kullanmaya çalışıyorum, ancak spor ayakkabı sayfasına her gittiğimde, istediğim ayakkabı boyutunu tam olarak eklemiyor, ancak doğrudan sepette hiçbir şey olmadan ödeme yapmaya gidiyor.
Kodu, gerçek sayfa HTML'siyle eşleştirmem gerektiğini söylüyorum, ancak bunu nasıl yapacağımı bilmiyorum. Lütfen yardım et.
// ==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);
}
Link to the "target page"
Snapshot of the target HTML sadece sorudan senaryoyu değiştirmek daha ziyade
'.selectBox etiketli [değeri = '10' ] 'jQuery seçicidir. Görünüşe göre, gerçek sayfanın HTML'siyle eşleşmiyor. Sonra http için bu dosyayı ('Targetpage.htm') yüklemek, sayfasına gidin senaryoyu devre dışı bırak "Targetpage.htm" olarak Firefox (** Ctrl ** + ** S **), sayfayı kaydedin: // pastebin.com/ ve sorgunuzdan pastebin'e bağlantı verin. Daha sonra jQuery seçicinizi/ayarlarınızı ayarlamanıza yardımcı olabiliriz. İşte –
İşte targetpage, http://pastebin.com/6M7cMw40 – Nite
olan test sayfası (targetpage) http://store.nike.com/us/en_us/?l=shop,pdp,ctr-inline/cid olduğu -1/pid-656545/pgid-656543 – Nite