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=nearby&clean_path=larnaca-cyprus%2F%CE%B4%CF%81%CE%B1%CF%83%CF%84%CE%B7%CF%81%CE%B9%CF%8C%CF%84%CE%B7%CF%84%CE%B5%CF%82%2Flarnaca-municipal-art-gallery&controller=topics&country_code=¤t_user_id=&filters%5BClass%5D%5B%5D=Hotel&id=3000000403777&klass_name=Attraction&list_type=hotels&nearby=true&order=asc&path=larnaca-cyprus%2F%CE%B4%CF%81%CE%B1%CF%83%CF%84%CE%B7%CF%81%CE%B9%CF%8C%CF%84%CE%B7%CF%84%CE%B5%CF%82%2Flarnaca-municipal-art-gallery%2F%CE%BA%CE%BF%CE%BD%CF%84%CE%B9%CE%BD%CF%8C-%CE%BE%CE%B5%CE%BD%CE%BF%CE%B4%CE%BF%CF%87%CE%B5%CE%AF%CE%B1&place=3000000403777&place_type=Attraction&place_type=attraction®ion=2000000014341&sort=best_value", function(status){
if (status === 200) {
HotelRates.ajax();
}
});
var HotelRates = {
hotels: "hotel_ids%5B%5D=5000001404597&hotel_ids%5B%5D=5000000118928&hotel_ids%5B%5D=5000000347940&hotel_ids%5B%5D=5000000362202&hotel_ids%5B%5D=5000001245059&hotel_ids%5B%5D=5000001257434&hotel_ids%5B%5D=5000000400907&hotel_ids%5B%5D=5000000053223&hotel_ids%5B%5D=5000000000934&hotel_ids%5B%5D=5000000409205&hotel_ids%5B%5D=5000000206168&hotel_ids%5B%5D=5000000915782&hotel_ids%5B%5D=5000000168666&hotel_ids%5B%5D=5000000376070&hotel_ids%5B%5D=5000004477174&hotel_ids%5B%5D=5000000048465&hotel_ids%5B%5D=5000000170122&hotel_ids%5B%5D=5000003812366&hotel_ids%5B%5D=5000004897853&hotel_ids%5B%5D=5000004855738&hotel_ids%5B%5D=5000000922090&hotel_ids%5B%5D=5000000389794&hotel_ids%5B%5D=5000000374267&hotel_ids%5B%5D=5000000139320&hotel_ids%5B%5D=5000000705636&hotel_ids%5B%5D=5000000024120&hotel_ids%5B%5D=5000000349970&hotel_ids%5B%5D=5000000209643&hotel_ids%5B%5D=5000000986266&hotel_ids%5B%5D=5000003661461",
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=2000000014341" + "&" + 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);
}
};