var ListPage = {
maxTries: 20,
interval: 0,
xhrRequests: [],
update: function(url, count, callback){
var fingerprint = "&t=" + (new Date().getTime());
var reqcount = "&req_count=" + count;
this.loader("on");
var self = this;
var req = new XMLHttpRequest();
req.open("GET", url + fingerprint + reqcount, true);
ListPage.xhrRequests.push(req);
req.onreadystatechange = function() {
if (req.readyState === 4 && (req.status === 200 || req.status === 202)) {
eval(req.responseText);
self.loader("off");
if (req.status === 200 || req.status !== 202 ) callback(req.status);
if (req.status === 202) {
if (count < self.maxTries) {
setTimeout(function(){ListPage.update(url, ++count, callback)}, self.interval);
self.interval += 100;
} else {
callback(req.status);
}
}
}
};
req.send(null);
},
loader: function(status) {
var spinnerD = document.querySelector('.spinnersD');
var spinnerM = document.querySelector('.spinnersM');
if (spinnerD && spinnerM) {
if (status === "on") {
spinnerD.className = "spinnersD shownow";
spinnerM.className = "spinnersM shownow";
} else {
// hide
spinnerD.className = "spinnersD";
spinnerM.className = "spinnersM";
}
}
},
ajax: function(url, callback) {
this.update(url, 1, callback);
}
};
ListPage.ajax("https://www.skyscanner.it/trip/hotels/hotel_list_page?action=nearby&clean_path=branson%2Fristoranti%2Foutback-steak-oyster-bar&controller=topics&country_code=¤t_user_id=&filters%5BClass%5D%5B%5D=Hotel&id=4000000289594&klass_name=Restaurant&list_type=hotels&nearby=true&order=asc&path=branson%2Fristoranti%2Foutback-steak-oyster-bar%2Fnei-dintorni-hotel&place=4000000289594&place_type=Restaurant&place_type=restaurant®ion=2000000000268&sort=best_value", function(status){
if (status === 200) {
HotelRates.ajax();
}
});
var HotelRates = {
hotels: "hotel_ids%5B%5D=5000000321029&hotel_ids%5B%5D=5000000140613&hotel_ids%5B%5D=5000000379698&hotel_ids%5B%5D=5000000283717&hotel_ids%5B%5D=5000000076530&hotel_ids%5B%5D=5000000070739&hotel_ids%5B%5D=5000000323859&hotel_ids%5B%5D=5000000985148&hotel_ids%5B%5D=5000000354524&hotel_ids%5B%5D=5000001007535&hotel_ids%5B%5D=5000000008285&hotel_ids%5B%5D=5000000344088&hotel_ids%5B%5D=5000000275204&hotel_ids%5B%5D=5000000148048&hotel_ids%5B%5D=5000000319265&hotel_ids%5B%5D=5000001636087&hotel_ids%5B%5D=5000000158187&hotel_ids%5B%5D=5000000279981&hotel_ids%5B%5D=5000000115022&hotel_ids%5B%5D=5000000295215&hotel_ids%5B%5D=5000000005453&hotel_ids%5B%5D=5000000407484&hotel_ids%5B%5D=5000000077140&hotel_ids%5B%5D=5000000306018&hotel_ids%5B%5D=5000000290822&hotel_ids%5B%5D=5000001636334&hotel_ids%5B%5D=5000000029325&hotel_ids%5B%5D=5000003939931&hotel_ids%5B%5D=5000000183072&hotel_ids%5B%5D=5000000044026",
ajaxCalls: function(tryIndex) {
if (this.hotels) {
ListPage.update("https://www.skyscanner.it/trip/hotels/hotel_rates_list?bookable_only=&country_code=¤t_user_id=&locale=it®ion=2000000000268" + "&" + this.hotels, tryIndex, function(){
var placeholder = document.querySelectorAll('.metasearch_featured .placeholder');
for (var i = 0; i < placeholder.length; i++) {
placeholder[i].style.display='none';
}
});
}
},
ajax: function() {
this.ajaxCalls(1);
},
singleAjax: function() {
this.ajaxCalls(ListPage.maxTries);
}
};