Compare e economize nos hotéis de Skopje
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.com.br/trip/hotels/hotel_list_page?action=index&clean_path=skopje-macedonia&controller=topics&country_code=¤t_user_id=&filters=&id=2000000017720&klass_name=Region&list_type=hotels&nearby=false&order=asc&path=skopje-macedonia%2Fhoteis&place=2000000017720&place_type=City&place_type=region®ion=2000000017720&sort=best_value", function(status){
if (status === 200) {
HotelRates.ajax();
}
});
var HotelRates = {
hotels: "hotel_ids%5B%5D=5000000113958&hotel_ids%5B%5D=5000000152423&hotel_ids%5B%5D=5000003989020&hotel_ids%5B%5D=5000001266030&hotel_ids%5B%5D=5000000127353&hotel_ids%5B%5D=5000000384302&hotel_ids%5B%5D=5000000305298&hotel_ids%5B%5D=5000000063239&hotel_ids%5B%5D=5000000351207&hotel_ids%5B%5D=5000000226298&hotel_ids%5B%5D=5000003852876&hotel_ids%5B%5D=5000001452954&hotel_ids%5B%5D=5000000091393&hotel_ids%5B%5D=5000000045677&hotel_ids%5B%5D=5000005911373&hotel_ids%5B%5D=5000003829412&hotel_ids%5B%5D=5000005378876&hotel_ids%5B%5D=5000004443621&hotel_ids%5B%5D=5000004451238&hotel_ids%5B%5D=5000003888063&hotel_ids%5B%5D=5000000013561&hotel_ids%5B%5D=5000000122595&hotel_ids%5B%5D=5000001240148&hotel_ids%5B%5D=5000000096862&hotel_ids%5B%5D=5000000077693&hotel_ids%5B%5D=5000000011865&hotel_ids%5B%5D=5000001242812&hotel_ids%5B%5D=5000000126749&hotel_ids%5B%5D=5000000110770&hotel_ids%5B%5D=5000000189864",
ajaxCalls: function(tryIndex) {
if (this.hotels) {
ListPage.update("https://www.skyscanner.com.br/trip/hotels/hotel_rates_list?bookable_only=&country_code=¤t_user_id=&locale=pt-BR®ion=2000000017720" + "&" + 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);
}
};