Συγκρίνετε και εξοικονομήστε σε Σίδνεϊ ξενοδοχεία
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://gr.skyscanner.com/trip/hotels/hotel_list_page?action=index&clean_path=%CF%83%CE%AF%CE%B4%CE%BD%CE%B5%CF%8A&controller=topics&country_code=¤t_user_id=&filters=&id=2000000000171&klass_name=Region&list_type=hotels&nearby=false&order=asc&path=%CF%83%CE%AF%CE%B4%CE%BD%CE%B5%CF%8A%2F%CE%BE%CE%B5%CE%BD%CE%BF%CE%B4%CE%BF%CF%87%CE%B5%CE%AF%CE%B1&place=2000000000171&place_type=City&place_type=region®ion=2000000000171&sort=best_value", function(status){
if (status === 200) {
HotelRates.ajax();
}
});
var HotelRates = {
hotels: "hotel_ids%5B%5D=5000000177243&hotel_ids%5B%5D=5000000698651&hotel_ids%5B%5D=5000000000094&hotel_ids%5B%5D=5000000095154&hotel_ids%5B%5D=5000000177454&hotel_ids%5B%5D=5000000177493&hotel_ids%5B%5D=5000000000409&hotel_ids%5B%5D=5000000105137&hotel_ids%5B%5D=5000000380988&hotel_ids%5B%5D=5000000001102&hotel_ids%5B%5D=5000000177470&hotel_ids%5B%5D=5000000346655&hotel_ids%5B%5D=5000000250276&hotel_ids%5B%5D=5000001025694&hotel_ids%5B%5D=5000000249997&hotel_ids%5B%5D=5000000095562&hotel_ids%5B%5D=5000000186225&hotel_ids%5B%5D=5000000250196&hotel_ids%5B%5D=5000000346429&hotel_ids%5B%5D=5000000698358&hotel_ids%5B%5D=5000000375454&hotel_ids%5B%5D=5000000705777&hotel_ids%5B%5D=5000000069344&hotel_ids%5B%5D=5000000250060&hotel_ids%5B%5D=5000000704897&hotel_ids%5B%5D=5000001018826&hotel_ids%5B%5D=5000000177393&hotel_ids%5B%5D=5000000380852&hotel_ids%5B%5D=5000000149516&hotel_ids%5B%5D=5000000062383",
ajaxCalls: function(tryIndex) {
if (this.hotels) {
ListPage.update("https://gr.skyscanner.com/trip/hotels/hotel_rates_list?bookable_only=&country_code=¤t_user_id=&locale=el®ion=2000000000171" + "&" + 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);
}
};