json - Need a few extra lines of code in a Chrome Extension? -
i saw question come once before on site (https://stackoverflow.com/questions/18006943/nike-updated-website-and-my-script-isnt-working), closed cause guy wasn't asking specific questions; let me break down y'all.
so there's been chrome extension that's been floating around automatically added specified sizes , quantities of whatever nike shoe link opened cart visited site. coding follows:
var size_i_want = "9.5"; var how_many = 1; function addtocart() { var sizeslist=document.getelementsbyname("skuandsize")[0]; function setquantity() { document.getelementsbyname("qty")[0].selectedindex = how_many-1; } function setsizevalue() { (var i=0; i<sizeslist.length; i++){ if(sizeslist.options[i].text == size_i_want) { document.getelementsbyname("skuandsize")[0].selectedindex = i; setquantity(); } } } if(sizeslist != undefined) { setsizevalue(); document.getelementsbyclassname("button-container add-to-cart")[0].click(); } else { settimeout("addtocart()", 250); } } settimeout("addtocart()", 250);
while i'm not code guy, can assume looking @ code skuandsize size , variable control size_i_want, etc, same goes quantity how_many, blah blah.
now nike updated website, changing layout , cart system, changing way size , quantity selection works. code inept. is, no longer anything, can't identify added site cause code become more useless chicken million dollars. few members on forum frequent (who decided they'd rather trivial helpful), mentioned took couple code lines fix code, , old code might not need editing.
so took @ site code, particularly size , quantity selection portion:
i'm pretty sure culprit skuid, hey. i'm not particularly bright. i'm totally devoid of coding knowledge. if it's not trouble, shed light, or @ least give me not-so-cryptic point in correct direction?
Comments
Post a Comment