Vediamo se riesco a farmi dare una mano aggiuntiva.
Per ritornare alla home va benissimo questo script
codice:
function returnHome() {
clickbuttons = document.evaluate("//a[contains(@class,'rtHome')]", document, null, 7, null);
clickbutton = clickbuttons.snapshotItem(0);
if (this.clickbutton != null) {
window.location = clickbutton;
}
}
Mentre per selezionare la categoria usavo una funzione semplicissima in jquery
codice:
var page1 = "APPLE"
function Category1() {
function gotoPAGE1() {
jQuery('span[class*=Title]')['each'](function (Value24) {
if (this['innerHTML'] == page1) {
window['location'] = this['parentNode']['href'];
};
});
};
var jQuery;
(function () {
var Value39 = document['getElementsByTagName']('head')[0] || document['documentElement'],
Value3a = document['createElement']('script');
Value3a['addEventListener']('load', function () {
jQuery = unsafeWindow['jQuery']['noConflict'](true);
letsJQuery();
}, false);
Value3a['src'] = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
Value3a['type'] = 'text/javascript';
Value3a['async'] = true;
Value39['insertBefore'](Value3a, Value39['firstChild']);
})();
function letsJQuery() {
jQuery(function () {
gotoPAGE1();
});
};
}
ovviamente la funzione in jquery ho provato a ripeterla con il nome della variabile diversa (var page2 = 'SONY'
E con quello postato in precedenza racchiuso in una funzione chiamata redirect
codice:
var theList = ['Product2','Product3'];
function redirect() {
var theProducts = document.getElementsByClassName('NameProduct');
var found = false;
for(i=0; i<theList.length; ++i) {
var j=0;
while(j<theProducts.length && !found) {
if(theProducts[j].innerHTML == theList[i] && theProducts[j].parentNode.parentNode.className!='SoldOut' && theProducts[j].parentNode.parentNode.tagName == 'A') {
location.href = theProducts[j].parentNode.parentNode.href;
found = true;
}
j++;
}
}
}
i body id delle pagine (che nel sample della Home ho dimenticato di aggiungere) sono:
Home = homeCategory
Categoria con i prodotti = products
Pagina successiva alla scelta dei prodotti = shippingDetail
Adesso avete tutto per aiutarmi, dovete solo renderlo un unico script, io ho provato ma non ci sono riuscito. Se perfavore potete aiutarmi ve ne sarei grato.