PageSourceSearch

https://tour.firenze.it/static/single_city/js/sc.js

js tour.firenze.it collected 2026-09-30 11:18:43 UTC 8,712 bytes, 277 lines download raw bytes

1function sc_setCookie(name, value, days) {
2  var expires = "";
3  if (days) {
4    var date = new Date();
5    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
6    expires = "; expires=" + date.toUTCString();
7  }
8  document.cookie = name + "=" + (value || "") + expires + "; path=/";
9}
10function sc_getCookie(name) {
11  var nameEQ = name + "=";
12  var ca = document.cookie.split(';');
13  for (var i = 0; i < ca.length; i++) {
14    var c = ca[i];
15    while (c.charAt(0) == ' ') c = c.substring(1, c.length);
16    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
17  }
18  return null;
19}
20
21function sc_eraseCookie(name) {
22  document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
23}
24
25function sc_assign_exp(exp_name, analytics_dimension) {
26  var cookie_name = "exp_dimension_" + exp_name;
27  var value = sc_getCookie(cookie_name);
28  if (value == null) {
29    // Genereates a number between 0 to 1;
30    var random_number = Math.random();
31    if (random_number < 0.5) {
32      value = "0";
33    }
34    else {
35      value = "1";
36    }
37    sc_setCookie(cookie_name, value, 7);
38  }
39  window.ga('set', 'dimension' + analytics_dimension, exp_name + value);
40  return value;
41}
42
43
44function sc_get_exp(exp_name) {
45  var value = sc_getCookie("exp_dimension_" + exp_name);
46  return value;
47}
48
49function get_extendend_gyg_url(tour_url) {
50
51}
52
53function getCETorCESTDate() {
54  var localDate = new Date();
55  var utcOffset = localDate.getTimezoneOffset();
56  var cetOffset = utcOffset + 60;
57  var cestOffset = utcOffset + 120;
58  var cetOffsetInMilliseconds = cetOffset * 60 * 1000;
59  var cestOffsetInMilliseconds = cestOffset * 60 * 1000;
60
61  var cestDateStart = new Date();
62  var cestDateFinish = new Date();
63  var localDateTime = localDate.getTime();
64  var cestDateStartTime;
65  var cestDateFinishTime;
66  var result;
67
68  cestDateStart.setTime(Date.parse('29 March ' + localDate.getFullYear() + ' 02:00:00 GMT+0100'));
69  cestDateFinish.setTime(Date.parse('25 October ' + localDate.getFullYear() + ' 03:00:00 GMT+0200'));
70
71  cestDateStartTime = cestDateStart.getTime();
72  cestDateFinishTime = cestDateFinish.getTime();
73
74  if (localDateTime >= cestDateStartTime && localDateTime <= cestDateFinishTime) {
75    result = new Date(localDateTime + cestOffsetInMilliseconds);
76  } else {
77    result = new Date(localDateTime + cetOffsetInMilliseconds);
78  }
79
80  return result;
81}
82
83function zf_uuidv4() {
84  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
85    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
86    return v.toString(16);
87  });
88}
89
90function sc_generate_key(data_map) {
91  data_map = {};
92  //  var datetime = getCETorCESTDate();
93  var localDate = new Date();
94  var cest_datetime = new Date(localDate.getTime() + (120 * 1000 * 60)); // 120 (GMT + 2)
95  var orig_datetime = new Date(localDate.getTime() - (localDate.getTimezoneOffset() * 1000 * 60));
96  data_map['language'] = window.ga.getAll()[0].get('language');
97
98  data_map['orig_date_time'] = orig_datetime.toISOString().slice(0, -1);
99  data_map['cest_date_time'] = cest_datetime.toISOString();
100  data_map['dh'] = location.hostname;
101  data_map['acode'] = window.ga.getAll()[0].get('trackingId');
102  data_map['client_id'] = window.ga.getAll()[0].get('clientId');
103  data_map['user_agent'] = navigator.userAgent;
104  data_map['uip'] = window.zf_rip;
105  data_map['ul'] = (navigator.language || navigator.userLanguage).toLowerCase();
106  data_map['cd1'] = window.ga.getAll()[0].get('clientId');
107
108  const queryString = window.location.search;
109  const urlParams = new URLSearchParams(queryString);
110  var source = urlParams.get('utm_source')
111  if (source) {
112    data_map['ds'] = source;
113  }
114  //  http://www.landingpageURL.com?utm_source=bing&utm_medium=cpc&utm_campaign=Sales&utm_content=Clearance&utm_term=Shoes
115
116  source = urlParams.get('utm_medium');
117  if (source) {
118    data_map['cm'] = source;
119  }
120
121  source = urlParams.get('utm_campaign');
122  if (source) {
123    data_map['cn'] = source;
124  }
125
126  source = urlParams.get('utm_content');
127  if (source) {
128    data_map['cc'] = source;
129  }
130
131  source = urlParams.get('utm_term');
132  if (source) {
133    data_map['ck'] = source;
134  }
135  source = urlParams.get('gclid');
136  if (source) {
137    data_map['gclid'] = source;
138  }
139
140
141  var data_map_all = [data_map];
142  if (window.ga.getAll()[1] != undefined) {
143    var target = {};
144    var returnedTarget = Object.assign(target, data_map);
145    returnedTarget['acode'] = window.ga.getAll()[1].get('trackingId');
146    returnedTarget['client_id'] = window.ga.getAll()[1].get('clientId');
147    returnedTarget['cd1'] = window.ga.getAll()[1].get('clientId');
148    data_map_all.push(returnedTarget);
149  }
150  // console.log(data_map_all);
151  var json_data = JSON.stringify(data_map_all);
152  var final_value = btoa(json_data);
153  final_value = window.encodeURIComponent(final_value);
154  return final_value;
155
156  //     dataMap.addAll(extraData);
157  // //    partnerVisitorId = partnerVisitorId.replaceAll("&", "");
158  //     List<int> stringBytes = utf8.encode(jsonEncode(dataMap));
159  //     // List<int> gzipBytes = new GZipEncoder().encode(stringBytes);
160  //     //print(gzipBytes.length);
161  //     String compressedString = base64.encode(stringBytes);
162  //     //print(compressedString);
163  //     compressedString = Uri.encodeComponent(compressedString);
164  //     //print(compressedString);
165  //     var uid = (Uuid().v4().toString());
166  //     var trackingUrl = "https://kvstore.zonzofox.com/SET/$uid/$compressedString";
167  //     var dio = Dio();
168  //     final performanceInterceptor = DioFirebasePerformanceInterceptor();
169  //     dio.interceptors.add(performanceInterceptor);
170  //     /* Make request and in case of errors stay silent */
171  //     dio.get(trackingUrl).catchError((_) {
172  //       this._sentryService.captureMessage('HTTP error in KVSTORE');
173  //     });
174  //     return uid;
175}
176
177function sc_tr_gyg_click(event, tour_id, tour_url) {
178  event.preventDefault();
179  //var encoded_key = sc_generate_key();
180  // var uuid = zf_uuidv4();
181  // var new_url = tour_url + `__partner_visitor_id=${uuid}`;
182  //console.log(uuid);
183  // $.get("/set_kvstore", { "k": uuid, "v": encoded_key });
184  window.zf_ga('send', 'event', 'GYG', 'GYG-clicked', 'GYG-clicked-' + tour_id);
185  // // GA4
186  // window.gtag("event", "GYG_CLICK", {
187  // tour_id: tour_id,
188  // });
189  ;
190  // window.setTimeout(function () {
191  //   window.open(new_url, "_self");
192  // }, 100);
193  window.setTimeout(function () {
194    window.open(tour_url, "_self");
195  }, 100);
196
197}
198
199
200function sc_tr_booking_click(event, hotel_link, banner_location) {
201  event.preventDefault();
202  //var encoded_key = sc_generate_key();
203  // var uuid = zf_uuidv4();
204  // var new_url = tour_url + `__partner_visitor_id=${uuid}`;
205  //console.log(uuid);
206  // $.get("/set_kvstore", { "k": uuid, "v": encoded_key });
207  window.zf_ga('send', 'event', 'Booking', 'Booking-clicked', 'Booking-clicked-' + banner_location);
208  // // GA4
209  // window.gtag("event", "GYG_CLICK", {
210  // tour_id: tour_id,
211  // });
212  ;
213  // window.setTimeout(function () {
214  //   window.open(new_url, "_self");
215  // }, 100);
216  window.setTimeout(function () {
217    window.open(hotel_link, "_self");
218  }, 50);
219
220}
221function sc_tr_holafly_click(event, banner_location) {
222  event.preventDefault();
223  //var encoded_key = sc_generate_key();
224  // var uuid = zf_uuidv4();
225  // var new_url = tour_url + `__partner_visitor_id=${uuid}`;
226  //console.log(uuid);
227  // $.get("/set_kvstore", { "k": uuid, "v": encoded_key });
228  window.zf_ga('send', 'event', 'Esim', 'Esim-Holafly', 'Esim-Holafly-clicked-' + banner_location);
229  // // GA4
230  // window.gtag("event", "GYG_CLICK", {
231  // tour_id: tour_id,
232  // });
233  ;
234  // window.setTimeout(function () {
235  //   window.open(new_url, "_self");
236  // }, 100);
237  window.setTimeout(function () {
238
239    window.open("https://holafly.sjv.io/mOGDjy", "_self");
240  }, 50);
241
242}
243
244function zf_track_install(event, platform, city_slug, url) {
245  event.preventDefault();
246  window.zf_ga('send', 'event', 'App', 'App_' + city_slug, 'App_' + city_slug + '_' + platform);
247  window.setTimeout(function () {
248
249    window.open(url, "_self");
250  }, 50);
251
252
253}
254
255
256
257function sc_enable_gd_optimize() {
258  console.log("ENABLE OPTIMIZE");
259  var exp_case = sc_assign_exp("geoplace_details", 2);
260}
261
262function sc_last_js_optimize() {
263  if (window.sc_analytics_loaded != 1) {
264    setTimeout(sc_last_js_optimize, 60);
265    return;
266  }
267  var current_value = sc_get_exp("geoplace_details");
268  console.log("E1: " + current_value);
269  $(document).ready(function () {
270    if (current_value == "1") {
271      $("#single_tour_feat").remove();
272      $("#geoplace_details_container").removeClass("margin_60");
273      $("#geoplace_details_container").addClass("margin_30");
274    }
275  });
276}
277

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.