PageSourceSearch

https://radionerazzurra.it/src/js/app/init.js

js radionerazzurra.it collected 2026-09-30 11:07:46 UTC 41,397 bytes, 931 lines download raw bytes

1var _views = new Array();
2var _floatingMenu = null;
3
4_app['language'] = "it";
5
6var _init = {
7
8	_data: null,
9	_contest: null,
10	_firebase: null,
11	_isCarPlay: false,
12
13	/*Init App Main Method*/
14	app: function () {
15
16		console.log("[PERFORMANCE] P1: " + performance.now());
17		var _this = this;
18
19		//Load external library
20		_this.library();
21
22		//Check status online/offline
23		_this.offline();
24
25		//Init ImgCache
26		_this.cache();
27
28		//Check tecnology
29		_this.technology();
30
31		//Check language
32		_this.language();
33
34		//Init API library
35		_this.api();
36
37		//Device Id
38		_this.deviceId();
39
40		/*
41		// if aggregator app
42		viewLabel = "radios";
43		_views[viewLabel] = new FM_View();
44		_views[viewLabel].create(viewLabel, viewLabel);
45		_views[viewLabel].headerCreate(_system.label(viewLabel));
46		_views[viewLabel].loadModelsArticle(["list-radio"]);
47		*/
48
49		viewLabel = "downloads";
50		_views[viewLabel] = new FM_View();
51		_views[viewLabel].create(viewLabel, viewLabel);
52		_views[viewLabel].headerCreate(_system.label(viewLabel));
53		_views[viewLabel].loadModelsArticle(['list-downloads', 'list-downloads-offline']);
54
55		viewLabel = "home";
56		_views[viewLabel] = new FM_View();
57		_views[viewLabel].create(viewLabel, viewLabel);
58		_views[viewLabel].headerCreate(_system.label(viewLabel));
59		_views[viewLabel].loadModelsArticle(["list-lists", "card-with-play-embedded", "list-episodes", "list-episodes-browser", "list-episodes-video", "list-episodes-video-browser", "list-standard", "list-standard-no-date", "list-standard-no-date-external-link", "list-standard-card", "card-standard", "list-standard-no-lazy", "list-standard-external-link", "list-standard-card-external-link", "list-standard-no-lazy-external-link", "card-standard-external-link", "card-with-play", "card-with-play-episode", "card-search", "card-search-image", "promobox", "promobox-external-link", "list-streamings", "card-with-play-streaming", "home-header-streamings", "home-header-programs", "home-header-embedded", "card-with-play-embedded-custom", "card-radio", "card-interactivity"]);
60		_views[viewLabel].addSection("home-speaker"); //Subsection: 1
61		_views[viewLabel].addSection("home-article"); //Subsection: 2
62		_views[viewLabel].addSection("home-page"); //Subsection: 3
63		_views[viewLabel].addSection("home-page-article"); //Subsection: 4
64		_views[viewLabel].addSection("home-program"); //Subsection: 6
65		_views[viewLabel].addSection("home-episode"); //Subsection: 7
66		_views[viewLabel].addSection("home-streaming"); //Subsection: 7
67		if (!_system.isBrowser()) _views[viewLabel].addSection("offline"); //Subsection: 8
68
69		_views[viewLabel].headerbar.addButton("button-home-socials", "", "link", "_home.socials.show()", "right", null, 0);
70
71		_views[viewLabel].headerbar.addButton("button-home-user", "", "account_circle", "_system.goToPage('account')", "left");
72		// _views[viewLabel].headerbar.addButton("button-home-search", "", "search", "_system.goToPage('search')", "right", null, 0);
73		_views[viewLabel].headerbar.addButton("button-home-program-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 5, 'list-filter');
74		_views[viewLabel].headerbar.addButton("button-home-episode-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 6, 'list-filter');
75
76		if (_config.app._mode == "group") {
77			_views[viewLabel].headerbar.addButton("button-home-filterRadios", "", "menu", "_filterRadios.show()", "right", null, 0);
78			_views[viewLabel].headerbar.addButton("button-home-filterRadios-img-container", "", "<img class='radio-selected'>", "_filterRadios.show()", "right", null, 0, 'with-img');
79
80			_views[viewLabel].headerbar.addButton("button-home-speaker-share", "", "share", "_system.share()", "right", null, 1);
81			_views[viewLabel].headerbar.addButton("button-home-article-share", "", "share", "_system.share()", "right", null, 2);
82			_views[viewLabel].headerbar.addButton("button-home-page-share", "", "share", "_system.share()", "right", null, 3);
83			_views[viewLabel].headerbar.addButton("button-home-page-articles-share", "", "share", "_system.share()", "right", null, 4);
84			_views[viewLabel].headerbar.addButton("button-home-program-share", "", "share", "_system.share()", "right", null, 5);
85			_views[viewLabel].headerbar.addButton("button-home-episode-share", "", "share", "_system.share()", "right", null, 6);
86			_views[viewLabel].headerbar.addButton("button-home-streaming-share", "", "share", "_system.share()", "right", null, 7);
87
88		}
89		// viewLabel = "search";
90		// _views[viewLabel] = new FM_View();
91		// _views[viewLabel].create(viewLabel, viewLabel);
92		// _views[viewLabel].headerCreate(_system.label(viewLabel));
93		// _views[viewLabel].loadModelsArticle(["card-search", "card-search-image"]);
94
95		viewLabel = "articles";
96		_views[viewLabel] = new FM_View();
97		_views[viewLabel].create(viewLabel, viewLabel);
98		_views[viewLabel].headerCreate(_system.label(viewLabel));
99		_views[viewLabel].loadModelsArticle(["list-standard"]);
100		_views[viewLabel].addSection("articles-detail"); //Subsection: 1
101		_views[viewLabel].headerbar.addButton("button-articles-share", "", "share", "_system.share()", "right", null, 1);
102
103		viewLabel = "programs";
104		_views[viewLabel] = new FM_View();
105		_views[viewLabel].create(viewLabel, viewLabel);
106		_views[viewLabel].headerCreate(_system.label(viewLabel));
107		_views[viewLabel].loadModelsArticle(["list-programs", "list-episodes", "list-episodes-browser", "list-episodes-video", "list-episodes-video-browser", "card-standard", "list-embedded"]);
108		_views[viewLabel].addSection("programs-detail"); //Subsection: 1
109		_views[viewLabel].addSection("programs-episode"); //Subsection: 2
110		_views[viewLabel].headerbar.addButton("button-programs-detail-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 1);
111		_views[viewLabel].headerbar.addButton("button-programs-user", "", "account_circle", "_system.goToPage('account')", "left");
112		_views[viewLabel].headerbar.addButton("button-programs-episode-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 2);
113
114		if (_config.app._mode == "group") {
115			_views[viewLabel].headerbar.addButton("button-programs-episode-share", "", "share", "_system.share()", "right", null, 2);
116			_views[viewLabel].headerbar.addButton("button-programs-share", "", "share", "_system.share()", "right", null, 1);
117
118			_views[viewLabel].headerbar.addButton("button-programs-filterRadios", "", "menu", "_filterRadios.show()", "right", null, 0);
119			_views[viewLabel].headerbar.addButton("button-programs-filterRadios-img-container", "", "<img class='radio-selected'>", "_filterRadios.show()", "right", null, 0, 'with-img');
120		}
121
122		viewLabel = "schedule";
123		_views[viewLabel] = new FM_View();
124		_views[viewLabel].create(viewLabel, viewLabel);
125		_views[viewLabel].headerCreate(_system.label(viewLabel));
126		_views[viewLabel].loadModelsArticle(["list-schedule", "list-episodes", "list-episodes-browser", "list-episodes-video", "list-episodes-video-browser", "card-standard", "list-embedded"]);
127		_views[viewLabel].addSection("schedule-detail"); //Subsection: 1
128		_views[viewLabel].addSection("schedule-episode"); //Subsection: 2
129		_views[viewLabel].headerbar.addButton("button-schedule-detail-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 1);
130		_views[viewLabel].headerbar.addButton("button-schedule-user", "", "account_circle", "_system.goToPage('account')", "left");
131		_views[viewLabel].headerbar.addButton("button-schedule-episode-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 2);
132		if (_config.app._mode == "group") {
133			_views[viewLabel].headerbar.addButton("button-schedule-episode-share", "", "share", "_system.share()", "right", null, 2);
134			_views[viewLabel].headerbar.addButton("button-schedule-share", "", "share", "_system.share()", "right", null, 1);
135
136			_views[viewLabel].headerbar.addButton("button-schedule-filterRadios", "", "menu", "_filterRadios.show()", "right", null, 0);
137			_views[viewLabel].headerbar.addButton("button-schedule-filterRadios-img-container", "", "<img class='radio-selected'>", "_filterRadios.show()", "right", null, 0, 'with-img');
138		}
139		/*
140		viewLabel = "podcasts";
141		_views[viewLabel] = new FM_View();
142		_views[viewLabel].create(viewLabel, viewLabel);
143		_views[viewLabel].headerCreate(_system.label(viewLabel));
144		_views[viewLabel].loadModelsArticle(["list-with-play"]);
145
146		viewLabel = "playlists";
147		_views[viewLabel] = new FM_View();
148		_views[viewLabel].create(viewLabel, viewLabel);
149		_views[viewLabel].headerCreate(_system.label(viewLabel));
150		_views[viewLabel].loadModelsArticle(["list-with-play"]);
151		*/
152
153		viewLabel = "section";
154		_views[viewLabel] = new FM_View();
155		_views[viewLabel].create(viewLabel, viewLabel);
156		_views[viewLabel].headerCreate(_system.label(viewLabel));
157		_views[viewLabel].loadModelsArticle([]);
158		_views[viewLabel].headerbar.addButton("button-section-user", "", "account_circle", "_system.goToPage('account')", "left");
159
160		viewLabel = "page404";
161		_views[viewLabel] = new FM_View();
162		_views[viewLabel].create(viewLabel, viewLabel);
163
164		viewLabel = "chats";
165		_views[viewLabel] = new FM_View();
166		_views[viewLabel].create(viewLabel, viewLabel);
167		_views[viewLabel].headerCreate(_system.label(viewLabel));
168		_views[viewLabel].loadModelsArticle(["chats-topic", "chats-message", "chats-survey-no-image", "chats-survey", "chats-topic-no-image", "chats-reply", "chats-message-audio", "chats-message-img"]);
169		_views[viewLabel].addSection("chats-detail"); //Subsection: 1
170		_views[viewLabel].headerbar.addButton("button-chat-user", "", "account_circle", "_system.goToPage('account')", "left");
171
172		viewLabel = "profile";
173		_views[viewLabel] = new FM_View();
174		_views[viewLabel].create(viewLabel, viewLabel);
175		_views[viewLabel].headerCreate(_system.label(viewLabel));
176		_views[viewLabel].loadModelsArticle(['list-downloads', 'list-downloads-offline', 'list-items-playlist', 'list-items-playlist-browser', 'list-items-playlist-video', "list-playlists"]);
177		_views[viewLabel].addSection("profile-registration"); //Subsection: 1
178		_views[viewLabel].headerbar.setTitle(_system.label('profile-registration'), 1);
179		_views[viewLabel].addSection("profile-complete"); //Subsection: 2
180		_views[viewLabel].headerbar.setTitle(_system.label('profile-complete'), 2);
181		_views[viewLabel].addSection("profile-detail"); //Subsection: 3
182		_views[viewLabel].headerbar.setTitle(_system.label('profile-detail'), 3);
183		_views[viewLabel].addSection("profile-edit"); //Subsection: 4
184		_views[viewLabel].headerbar.setTitle(_system.label('profile-edit'), 4);
185		_views[viewLabel].addSection("profile-userplaylists"); //Subsection: 5
186		_views[viewLabel].headerbar.setTitle(_system.label('profile-userplaylists'), 5);
187		_views[viewLabel].headerbar.addButton("profile-userplaylists-add", "", "add", "_navigator.profile.userPlaylistAdd()", "right", null, 5);
188		_views[viewLabel].addSection("profile-userplaylists-create"); //Subsection: 6
189		_views[viewLabel].headerbar.setTitle(_system.label('profile-userplaylists-create'), 6);
190		_views[viewLabel].addSection("profile-userplaylists-detail"); //Subsection: 7
191		_views[viewLabel].headerbar.setTitle(_system.label('profile-userplaylists-detail'), 7);
192		_views[viewLabel].addSection("profile-recover-password"); //Subsection: 8
193		_views[viewLabel].headerbar.setTitle(_system.label('recover-password'), 8);
194		_views[viewLabel].addSection("profile-downloads"); //Subsection: 8
195		_views[viewLabel].headerbar.setTitle(_system.label('profile-downloads'), 8);
196
197		_views[viewLabel].headerbar.addButton("button-login-back", "", "arrow_back", "_system.back(1)", "left", null, 0);
198		// _views[viewLabel].headerbar.addButton("button-profile-back", "", "arrow_back", "_system.back(1)", "left", null, 3);
199
200
201		viewLabel = "contest";
202		_views[viewLabel] = new FM_View();
203		_views[viewLabel].create(viewLabel, viewLabel);
204		_views[viewLabel].headerCreate(_system.label(viewLabel));
205		_views[viewLabel].loadModelsArticle([]);
206		_views[viewLabel].addSection("contest-blocked"); //Subsection: 1
207
208
209		viewLabel = "speakers";
210		_views[viewLabel] = new FM_View();
211		_views[viewLabel].create(viewLabel, viewLabel);
212		_views[viewLabel].headerCreate(_system.label(viewLabel));
213		_views[viewLabel].loadModelsArticle(["list-standard", "list-episodes", "list-speaker-programs", "list-episodes", "list-speakers", "list-programs", "list-embedded", "list-speaker-embedded", "list-episodes", "list-episodes-browser", "list-episodes-video", "list-episodes-video-browser"]);
214		_views[viewLabel].addSection("speakers-detail"); //Subsection: 1
215		_views[viewLabel].addSection("speakers-program"); //Subsection: 2
216		_views[viewLabel].addSection("speakers-episode"); //Subsection: 3
217
218		_views[viewLabel].headerbar.addButton("button-speakers-program-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 2);
219		_views[viewLabel].headerbar.addButton("button-speakers-episode-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 3);
220		_views[viewLabel].headerbar.addButton("button-speakers-user", "", "account_circle", "_system.goToPage('account')", "left");
221		if (_config.app._mode == "group") {
222			_views[viewLabel].headerbar.addButton("button-speakers-share", "", "share", "_system.share()", "right", null, 1);
223			_views[viewLabel].headerbar.addButton("button-speakers-program-share", "", "share", "_system.share()", "right", null, 2);
224			_views[viewLabel].headerbar.addButton("button-speakers-episode-share", "", "share", "_system.share()", "right", null, 3);
225
226			_views[viewLabel].headerbar.addButton("button-speakers-filterRadios", "", "menu", "_filterRadios.show()", "right", null, 0);
227			_views[viewLabel].headerbar.addButton("button-speakers-filterRadios-img-container", "", "<img class='radio-selected'>", "_filterRadios.show()", "right", null, 0, 'with-img');
228		}
229
230		viewLabel = "streamings";
231		_views[viewLabel] = new FM_View();
232		_views[viewLabel].create(viewLabel, viewLabel);
233		_views[viewLabel].headerCreate(_system.label(viewLabel));
234		_views[viewLabel].loadModelsArticle(["list-streamings"]);
235		_views[viewLabel].addSection("streamings-detail"); //Subsection: 1
236		_views[viewLabel].headerbar.addButton("button-streamings-user", "", "account_circle", "_system.goToPage('account')", "left");
237		// _views[viewLabel].headerbar.addButton("button-programs-episode-share", "", "share", "_system.share()", "right", null, 2);
238		// _views[viewLabel].headerbar.addButton("button-programs-episode-filter", "", "calendar_month", "_programs.items.showFilter()", "right", null, 2);
239		if (_config.app._mode == "group") {
240			_views[viewLabel].headerbar.addButton("button-streamings-share", "", "share", "_system.share()", "right", null, 1);
241
242			_views[viewLabel].headerbar.addButton("button-streamings-filterRadios", "", "menu", "_filterRadios.show()", "right", null, 0);
243			_views[viewLabel].headerbar.addButton("button-streamings-filterRadios-img-container", "", "<img class='radio-selected'>", "_filterRadios.show()", "right", null, 0, 'with-img');
244		}
245
246		viewLabel = "pages";
247		_views[viewLabel] = new FM_View();
248		_views[viewLabel].create(viewLabel, viewLabel);
249		_views[viewLabel].headerCreate(_system.label(viewLabel));
250		_views[viewLabel].loadModelsArticle(["list-programs", "list-episodes", "list-episodes-browser", "list-episodes-video", "list-episodes-video-browser", "list-standard", "list-standard-card", "list-standard-no-date", "list-standard-no-date-external-link", "list-standard-external-link", "list-standard-card-external-link", "list-streamings"]);
251		_views[viewLabel].addSection("pages-detail"); //Subsection: 1
252		_views[viewLabel].addSection("pages-article"); //Subsection: 2
253
254		_views[viewLabel].headerbar.addButton("button-pages-user", "", "account_circle", "_system.goToPage('account')", "left");
255
256		if (_config.app._mode == "group") {
257			_views[viewLabel].headerbar.addButton("button-pages-detail-share", "", "share", "_system.share()", "right", null, 1);
258			_views[viewLabel].headerbar.addButton("button-pages-article-share", "", "share", "_system.share()", "right", null, 2);
259
260			_views[viewLabel].headerbar.addButton("button-pages-filterRadios", "", "menu", "_filterRadios.show()", "right", null, 0);
261			_views[viewLabel].headerbar.addButton("button-pages-filterRadios-img-container", "", "<img class='radio-selected'>", "_filterRadios.show()", "right", null, 0, 'with-img');
262		}
263		/*
264		viewLabel = "songs";
265		_views[viewLabel] = new FM_View();
266		_views[viewLabel].create(viewLabel, viewLabel);
267		_views[viewLabel].headerCreate(_system.label(viewLabel));
268		*/
269
270		//Init Floating Menu object
271		_floatingmenu = new FM_FloatingMenu();
272
273		//Render elements post view-render
274		_this.elements();
275
276		//Check Events post view-render
277		_this.events();
278
279		//Init push notifications
280		_this.push();
281
282		$('footer').show();
283
284		navigator.splashscreen.hide();
285
286		if (_config.app.radio.id === null) {
287			//Radio choise if not specified into config
288			// _navigator.radios.main();
289		} else {
290			//Init settings specific radio
291			console.log("[PERFORMANCE] P before settings: " + performance.now());
292			_this.settings().then(function () {
293				console.log("[PERFORMANCE] P after settings: " + performance.now());
294				// _this.adswizz();
295
296				// setTimeout(function () {
297				// 	NavigationBar.backgroundColorByHexString(_config.app.primaryColor);
298				// }, 2000);
299
300				_cookies.getAll();
301
302				/*Init player App*/
303				_this.player();
304
305				//Init User status
306				if (_app.isOffline) {
307					setTimeout(function () {
308						_system.goToPage("account/downloads");
309					}, 200);
310					return
311				}
312
313				// navigator.splashscreen.hide();
314
315				//Init Toolbar
316				_this.toolbar();
317
318				//Init contest area
319				_this.contest();
320
321				_this.modules();
322
323				console.log("[PERFORMANCE] P before login: " + performance.now());
324
325				_profile.login.refresh(true).then(function () {
326
327					console.log("[PERFORMANCE] P after login: " + performance.now());
328
329					_onetrust.init();
330
331					//Resume downloads
332					_this.downloads();
333
334					_this.header();
335
336					//Check Main View (logged/not logged)
337					setTimeout(function () {
338						_profile.log("welcome", "connected");
339
340						ImgCache.init(function () {
341							console.log('[IMGCACHE] init: success!');
342							_navigator.routing();
343							console.log("[PERFORMANCE] 11: " + performance.now());
344							// _this.main();
345						}, function () {
346							console.log('[IMGCACHE] init: error!');
347							_navigator.routing();
348							// _this.main();
349						});
350
351						//Check specific elements for PWA or Website
352						_init.standalone();
353
354						_init.permissions()
355
356					}, 50);
357
358					// _localnotification.init();
359
360				});
361
362			});
363		}
364	},
365
366	library: function () {
367
368		// if (_system.isBrowserOrApp() == "browser") {
369		// 	! function(t, n) {
370		// 		t[n] = t[n] || {
371		// 			nlsQ: function(e, o, c, r, s, i) {
372		// 				return s = t.document, r = s.createElement("script"), r.async = 1, r.src =
373		// 					("http:" === t.location.protocol ? "http:" : "https:") + "//cdn-gl.imrworldwide.com/conf/" +
374		// 					e + ".js#name=" + o + "&ns=" + n, i = s.getElementsByTagName("script")[0],
375		// 					i.parentNode.insertBefore(r, i), t[n][o] = t[n][o] || {
376		// 						g: c || {},
377		// 						ggPM: function(e, c, r, s, i) {
378		// 							(t[n][o].q = t[n][o].q || []).push([e, c, r, s, i])
379		// 						}
380		// 					}, t[n][o]}}}
381		// 	(window, "NOLBUNDLE");
382
383		// 	  // SDK Initialization
384		// 	window.nSdkInstance = NOLBUNDLE.nlsQ("PE86A473B-960D-4357-88FA-4FA9CF0B270F", "nlsnInstance", {
385		// 		// nol_sdkDebug: "debug"
386		// 	});
387		// }
388
389		//Google Preload ADV
390		//$.getScript("https://imasdk.googleapis.com/js/sdkloader/ima3.js");
391
392		//ShareThis
393		// if (_system.isBrowserOrApp() == "browser") {
394		// 	if (window.location.hostname == "www.Radio Company.ilsole24ore.com") {
395		// 		$.getScript("https://platform-api.sharethis.com/js/sharethis.js#property=64a45ef69c5ef40019022709&product=inline-share-buttons");
396		// 	} else if (window.location.hostname.indexOf("preprod") >= 0) {
397		// 		$.getScript("https://platform-api.sharethis.com/js/sharethis.js#property=64a45eeb9c5ef40019022708&product=inline-share-buttons");				
398		// 	} else {
399		// 		$.getScript("https://platform-api.sharethis.com/js/sharethis.js#property=64141a02886bea00193ba605&product=inline-share-buttons");
400		// 	} 
401		// }	
402
403		//Nielsen
404		// if (_system.isBrowserOrApp() == "app") {
405		// 	if(_system.isAndroid()){
406		// 		window.Nielsen.initialize({
407		// 			appid: "P70F388D4-8F73-4AC3-82DB-4D320B3218B1",
408		// 			appname: "Radio Company",
409		// 			appversion: "6.2.2",
410		// 			sfcode: "it",
411		// 		});
412		// 		window.Nielsen.loadMetadata({
413		// 			type: "static",
414		// 			section: "home_Radio Company_Android",
415		// 			assetid: "Home"
416		// 		});
417		// 	} else if (_system.isOS()) {
418		// 		window.Nielsen.initialize({
419		// 			appid: "P1E41D41D-4262-4FA5-B74E-524192CEC51E",
420		// 			appname: "Radio Company",
421		// 			appversion: "2.2.0",
422		// 			sfcode: "it",
423		// 		});
424		// 		window.Nielsen.loadMetadata({
425		// 			type: "static",
426		// 			section: "home_Radio Company_iOS",
427		// 			assetid: "Home"
428		// 		});
429		// 	}
430		// }
431	},
432
433	offline: function () {
434		if (_system.isBrowserOrApp() == "app") {
435			if (navigator.connection !== undefined && (navigator.connection.type == "none" || navigator.connection.type == "unknown")) {
436				_app.isOffline = true;
437				$('body').addClass('offline');
438				$('body').addClass('offline-header');
439			} else {
440				_app.isOffline = false;
441				$('body').removeClass('offline');
442				$('body').removeClass('offline-header');
443			}
444		}
445	},
446
447	technology: function () {
448		if (window.cordova !== undefined) {
449			$('body').addClass("tech-" + _system.isBrowserOrApp());
450		}
451	},
452
453	/*Init device ID*/
454	deviceId: function () {
455		if (window.cordova !== undefined && window.device !== undefined && device.uuid !== undefined) {
456			deviceUid = device.uuid;
457			localStorage.setItem("__serviceDeviceId", deviceUid);
458		} else {
459			if (localStorage.getItem("__serviceDeviceId") === null || localStorage.getItem("__serviceDeviceId") == "null") {
460				deviceUid = "browser-" + (new Date().getTime()) + parseInt(Math.random() * 10000 + 10000);
461				localStorage.setItem("__serviceDeviceId", deviceUid);
462			}
463		}
464	},
465
466	/*Init API module*/
467	api: function () {
468		//Firebase connection
469		if (this._firebase === null) {
470			this._firebase = firebase.initializeApp(_config.api[_config.app.connection]);
471			firebase.auth().tenantId = 'gruppo-sphera-0rqst';
472
473			// analyitics for web to sphera group
474			// Your web app's Firebase configuration
475			// For Firebase JS SDK v7.20.0 and later, measurementId is optional
476			if (_system.isBrowser()) {
477				const firebaseConfig = {
478 					apiKey: "AIzaSyD6_-HsJJB4yKosW-zQvMCnVgv97Ge94fg",
479  					authDomain: "radio4dot0---nerazzurra.firebaseapp.com",
480  					projectId: "radio4dot0---nerazzurra",
481  					storageBucket: "radio4dot0---nerazzurra.firebasestorage.app",
482  					messagingSenderId: "710785529811",
483  					appId: "1:710785529811:web:d3f57f6dd984eec3d8a126",
484  					measurementId: "G-YJNBQ0Q46N"
485				};
486
487				// // Initialize Firebase
488				const app = firebase.initializeApp(firebaseConfig, "radio4dot0---nerazzurra");
489				const analytics = firebase.analytics(app);
490			}
491		}
492	},
493
494	/*Init Player App*/
495	player: function () {
496		if (window.cordova === undefined) {
497			console.log("[PLAYER] window cordova undefined");
498		} else {
499			if (_system.isAndroid() && _system.isBrowserOrApp() == "app") {
500				_player = _playerAndroid;
501				console.log("[PLAYER] is android");
502			} else if (_system.isOS() && _system.isBrowserOrApp() == "app") {
503				_player = _playerIOS;
504				console.log("[PLAYER] is anything else");
505			}
506		}
507
508		if(_init._isCarPlay) {
509			_init._data['is_player_autoplay'] = false;
510		}
511
512		_home.live._autoplay = false;
513		_player._deferred = false;
514		_player._tagtoggle = "live";
515		_player._smallPause = false;
516
517		// if (_app.isOffline || (_init._data.is_dvr_audio !== undefined ? !_init._data.is_dvr_audio : false)) {
518		$('.return-start').hide();
519		$('.return-live').hide();
520		// }
521
522		_player.init();
523	},
524
525	/*Init Main View*/
526	main: function () {
527		if (_app.isOffline) {
528			_navigator.profile.downloads();
529		} else {
530			_navigator.home.main();
531		}
532	},
533
534	/*Init Language*/
535	language: function () {
536		// if (!_check.isNull(localStorage.getItem('__app_language_default'))) {
537		// 	// _app.language = localStorage.getItem('__app_language_default');
538		// 	_app.language = "it";
539		// } else {
540		// 	if (navigator.language.indexOf("it") >= 0) {
541		// 		_app.language = "it";
542		// 	} else {
543		// 		// _app.language = "en";
544		// 	}
545		// 	localStorage.setItem('__app_language_default', _app.language);
546		// }
547	},
548
549	/*Init Elements post view creation*/
550	elements: function () {
551
552		//Custom CSS
553		$('#custom-css-radio-group').remove();
554		$('#custom-css-radio-id').remove();
555
556		$('head').append($('<link id="custom-css-radio-group" rel="stylesheet" type="text/css" />').attr('href', '/whitelabel/group-' + _config.app.radio.group + '/css/style.css'));
557
558		if (_config.app.radio.id !== null) {
559			$('head').append($('<link id="custom-css-radio-id" rel="stylesheet" type="text/css" />').attr('href', '/whitelabel/radio-' + _config.app.radio.id + '/css/style.css'));
560		}
561
562		if (_system.isOS()) {
563			if ($('#custom-css-app-ios').length == 0) {
564				$('head').append($('<link id="custom-css-app-ios" rel="stylesheet" type="text/css" />').attr('href', '/vendors/tildeapp/css/ios.css'));
565			}
566		}
567		if (_system.isAndroid()) {
568			if ($('#custom-css-app-ios').length == 0) {
569				$('head').append($('<link id="custom-css-app-android" rel="stylesheet" type="text/css" />').attr('href', '/vendors/tildeapp/css/android.css'));
570			}
571		}
572		if (_system.isCordova()) {
573			if ($('#custom-css-app-ios').length == 0) {
574				$('head').append($('<link id="custom-css-app-cordova" rel="stylesheet" type="text/css" />
574').attr('href', '/vendors/tildeapp/css/cordova.css'));
575			}
576		}
577
578		//add bootstrap
579		// $('head').append($('<link id="bootstrap-css" rel="stylesheet" type="text/css" />').attr('href', '/vendors/bootstrap/bootstrap.min.css'));
580
581		//screen.lockOrientation('portrait');
582		setTimeout(function () {
583
584			//Init show/hide password fields
585			$('#login-password, #reg-password, #edit-profile-old-password, #edit-profile-new-password, #edit-profile-new-password-confirm').after("<div class='icon show-password'></div>");
586
587		}, 1000);
588	},
589
590	/*Init Events post view creation*/
591	events: function () {
592		$.event.special.tap.tapholdThreshold = 400;
593		if (window.screen.orientation !== undefined) {
594			window.screen.orientation.lock('portrait-primary');
595			if (_system.isAndroid()) {
596				$(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function (e) {
597					var state = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
598					var event = state ? 'FullscreenOn' : 'FullscreenOff';
599					if (event == "FullscreenOn") {
600						window.screen.orientation.lock('landscape');
601						$('#player-full').addClass("fullscreen-video");
602						$('.player-commands').detach().appendTo('video-js');
603					} else {
604						window.screen.orientation.lock('portrait');
605						$('#player-full').removeClass("fullscreen-video");
606						$('.player-commands').detach().insertAfter('#player-full .player-info-main');
607						if (_player._tag) {
608							setTimeout(function () {
609								_player._tag.width((screen.width > 981 ? 640 : screen.width));
610								_player._tag.height(((screen.width > 981 ? 640 : screen.width)) * 9 / 16);
611							}, 400);
612						}
613					}
614				});
615			}
616		}
617	},
618
619	/*Init structure for PWA*/
620	standalone: function () {
621		$('footer').removeClass("d-none");
622	},
623
624	/*Init url routing*/
625	routing: function () {
626		_app.routing = true;
627		return _navigator.routing();
628	},
629
630	meta: function (sections) {
631		var temp = {}
632		for (var i in sections) {
633			temp[sections[i]['section_vanity']] = sections[i];
634		}
635		return temp;
636	},
637
638	/*Init radio settings config*/
639	settings: function () {
640		var _this = this;
641		return new Promise(function (resolve, reject) {
642			if (sessionStorage.getItem("__settings") !== null && _system.isNull(_system.getVar("sID"))) {
643				//&& window.location.href.indexOf("localhost") === -1) {
644				console.log("[INIT] Load settings from sessionStorage");
645				_this._data = JSON.parse(sessionStorage.getItem("__settings"));
646				_home.items._dataPrograms = JSON.parse(sessionStorage.getItem("_dataPrograms"));
647				_home.items._programsSorted = JSON.parse(sessionStorage.getItem("_programsSorted"));
648				_programs.categories._data = JSON.parse(sessionStorage.getItem("_programsCategories"));
649				_programs.categories._dataSorted = JSON.parse(sessionStorage.getItem("_programsCategoriesSorted"));
650				_speakers.items._data = JSON.parse(sessionStorage.getItem("_dataSpeakers"));
651				_speakers.items._dataSorted = JSON.parse(sessionStorage.getItem("_speakersSorted"));
652				resolve();
653			} else {
654				console.log("[INIT] Load settings from service");
655				_data.get(["configs", "radio", "groups", _config.app.radio.group, "radios", _config.app.radio.id], "jsonget").then(function (value) {
656					_this._data = value['data'];
657					_this._data["_id"] = _config.app.radio.id;
658					_this._data['meta_sections'] = _this.meta(value['data']['meta_sections']);
659					_data.get(["_radios", _config.app.radio.id], "jsonget").then(function (value) {
660						_this._data['name'] = value['data']['name'];
661						_this._data['policy'] = value['data']['policy'];
662						_this._data['url'] = value['data']['url'];
663						_this._data['modules'] = value['data']['modules'];
664						_this._data['wowza_name'] = value['data']['wowza_name'];
665						_this._data['is_dvr_audio'] = value['data']['is_dvr_audio'];
666						_this._data['is_dvr_video'] = value['data']['is_dvr_video'];
667						_this._data["is_metadata"] = value['data']['is_metadata'];
668						_init._data['palimpsest_days_before'] = 90;
669						sessionStorage.setItem("__settings", JSON.stringify(_this._data));
670						_data.get(["categories", "programs", "groups", _config.app.radio.group, "radios", _config.app.radio.id], "zrange", 0, -1, 'id_order').then(function (value) {
671							_programs.categories._data = {};
672							_programs.categories._dataSorted = [];
673							var item = {};
674							for (i = 0; i < value['data'].length; i++) {
675								item = JSON.parse(value['data'][i]);
676								if (_system.isNull(item)) {
677									continue;
678								}
679								_programs.categories._data[item['_id']] = item;
680							}
681							_programs.categories._dataSorted = _system.dataSorting(_programs.categories._data, "id_order")["sorted"];
682							sessionStorage.setItem("_programsCategories", JSON.stringify(_programs.categories._data));
683							sessionStorage.setItem("_programsCategoriesSorted", JSON.stringify(_programs.categories._dataSorted));
684							var key = ["modules", "speakers", "groups", _config.app.radio.group, "radios", _config.app.radio.id]
685							if (_config.app._mode == "group") {
686								key = ["modules", "speakers", "groups", _config.app.radio.group]
687							}
688							_data.get(key, "search", 0, -1, "title", "-inf", "+inf", _system.isNull(_system.getVar("sID")) ? "@status:live" : "*", "asc").then(function (value) {
689								_speakers.items._data = {};
690								_speakers.items._dataSorted = [];
691								var item = {};
692								for (i = 2; i <= value['data'].length; i += 2) {
693									item = JSON.parse(value['data'][i][3]);
694									if (_system.isNull(item['_id'])) {
695										item['_id'] = (value['data'][i - 1].split(":"))[value['data'][i - 1].split(":").length - 1]
696									}
697									_speakers.items._data[item['_id']] = item;
698									_speakers.items._dataSorted.push(item['_id'])
699								}
700								sessionStorage.setItem("_dataSpeakers", JSON.stringify(_speakers.items._data));
701								sessionStorage.setItem("_speakersSorted", JSON.stringify(_speakers.items._dataSorted));
702								var key = ["modules", "programs", "groups", _config.app.radio.group, "radios", _config.app.radio.id]
703								if (_config.app._mode == "group") {
704									key = ["modules", "programs", "groups", _config.app.radio.group]
705								}
706								_data.get(key, "search", 0, -1, "title", "-inf", "+inf", _system.isNull(_system.getVar("sID")) ? "@status:live" : "*", "asc").then(function (value) {
707									_home.items._dataPrograms = {};
708									_home.items._programsSorted = [];
709									var item = {};
710									for (i = 2; i <= value['data'].length; i += 2) {
711										item = JSON.parse(value['data'][i][3]);
712										if (_system.isNull(item['_id'])) {
713											item['_id'] = (value['data'][i - 1].split(":"))[value['data'][i - 1].split(":").length - 1]
714										}
715										_home.items._dataPrograms[item['_id']] = item;
716										if (_system.isVisible(item)) {
717											_home.items._programsSorted.push(item['_id'])
718										}
719									}
720									sessionStorage.setItem("_dataPrograms", JSON.stringify(_home.items._dataPrograms));
721									sessionStorage.setItem("_programsSorted", JSON.stringify(_home.items._programsSorted));
722									resolve();
723								});
724							});
725						})
726					}).catch(function () {
727						resolve();
728					});
729				}).catch(function () {
730					resolve();
731				});
732			}
733		});
734	},
735
736	toolbar: function () {
737		if ($('#toolbar-home').length > 0) $('#toolbar-home').remove();
738		_toolbar.create("toolbar-home");
739		// socials on toolbar
740		_toolbar.setDescription("");
741		// _toolbar.setDescription('<div class="footer-socials"><div class="t-gray m-r-10">Segui Radio Nerazzurra su:</div><div><a href="https://twitter.com/rnerazzurrait" aria-label="Twitter" target="_blank"><span class="icon fa-brands fa-x-twitter"></span></a></div><div><a href="https://www.facebook.com/radionerazzurrait/" aria-label="Facebook" target="_blank"><span class="icon fa-brands fa-facebook-f"></span></a></div><div><a href="https://www.youtube.com/c/RadioNerazzurra" aria-label="Youtube" target="_blank"><span class="icon fa-brands fa-youtube"></span></a></div><div><a href="https://www.instagram.com/radionerazzurra/" aria-label="Instagram" target="_blank"><span class="icon fa-brands fa-instagram"></span></a></div><div><a href="https://www.tiktok.com/@radionerazzurra" aria-label="Tiktok" target="_blank"><span class="icon fa-brands fa-tiktok"></span></a></div><div><a href="https://www.twitch.tv/radionerazzurratw" aria-label="Twitch" target="_blank"><span class="icon fa-brands fa-twitch"></span></a></div></div>');
742
743		var maxSize = ($(document).width() < 980 ? 5 : 7);
744		if (_init._data === undefined || _init._data === null || _init._data.tabbar === undefined) return;
745
746		//_init._data.tabbar.sort(function (a, b) { return (a['order'] > b['order']) ? 1 : ((b['order'] > a['order']) ? -1 : 0); });
747		var size = Object.keys(_init._data.tabbar).length;
748		var othersString = []
749
750		var controlPlatformFlag = (_system.isBrowserOrApp() == "app" ? _system.isSmartTv() == true ? "is_connected_tv" : "is_app" : (_system.isDesktop() == true ? "is_website" : "is_pwa"));
751
752		if (size <= maxSize) {
753			for (var i in _init._data.tabbar) {
754				var item = _init._data.tabbar[i];
755				if (item[controlPlatformFlag] !== false) _toolbar.addButton(item['title'], item['icon'], item['action'], item['webview']);
756			}
757			if (_system.isDesktop()) {
758				// _toolbar.addButton("", "search", "search", "search");
759
760				_toolbar.addButton("", "account_circle", "account", "profile");
761			}
762		} else {
763			for (var i = size - 1; i >= maxSize - 1; i--) {
764				var item = _init._data.tabbar[i];
765				if (i >= maxSize - 1) {
766					//othersString.push({ action: item['action'] + ";_floatingmenu.hide();", label: item['title'], id: "toolbar-button-" + item['webview'] });
767					if (item[controlPlatformFlag] !== false) othersString.push({ action: item['action'], label: item['title'], id: "toolbar-button-" + item['webview'], callback: "_floatingmenu.hide();" });
768				} else {
769					if (item[controlPlatformFlag] !== false) _toolbar.addButton(item['title'], item['icon'], item['action'], item['webview']);
770				}
771			}
772			for (var i = 0; i < maxSize - 1; i++) {
773				var item = _init._data.tabbar[i];
774				if (item[controlPlatformFlag] !== false) _toolbar.addButton(item['title'], item['icon'], item['action'], item['webview']);
775			}
776			_toolbar.addButton(_system.label("other"), "more_horiz", "_navigator.others.create()", "others");
777			othersString.push({ action: "", label: _system.label("close"), c
777olor: "#e95344", callback: "_floatingmenu.hide(); " });
778			_navigator.others._items = othersString;
779		}
780
781		if (_config.app._mode == "group") {
782			_filterRadios.init();
783		}
784	},
785
786	push: function (radioId) {
787		if (radioId === undefined) radioId = _config.app.radio.id;
788		if (window.cordova !== undefined && !_system.isBrowser()) {
789			if (_system.isAndroid()) {
790				cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.POST_NOTIFICATIONS, function (status) {
791					if (status.hasPermission) {
792						console.log("Permission successful NOTIFICATIONS");
793					} else {
794						cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.POST_NOTIFICATIONS, function (status) {
795							if (status.hasPermission) {
796								console.log("Permission successful NOTIFICATIONS");
797							} else {
798								console.log("Permission denied NOTIFICATIONS");
799							}
800						});
801					}
802				});
803			}
804
805			cordova.plugins.firebase.messaging.requestPermission({ forceShow: true }).then(function () {
806				cordova.plugins.firebase.messaging.getToken().then(function (token) {
807					cordova.plugins.firebase.messaging.subscribe(_config.app.radio.id + 'allUsers-allUsers', function () {
808						console.log("subscribe good");
809					}, function (error) {
810						console.log("subscribe bad");
811					});
812				});
813			});
814		}
815	},
816
817	contest: function () {//chiamare checkSchedulation()
818		firebase.database().ref("groups/" + _config.app.radio.group + "/radios/" + _config.app.radio.id + "/modules/contests").orderByChild("status").equalTo("live").once("value").then(function (data) {
819			var contests = data.val();
820			if (contests !== null) {
821				for (var key in contests) {
822					if (_system.dateStandard(_system.dateFromUnix(contests[key]['date']['from'])) <= _time.dateNow()
823						&& _time.dateNow() <= _system.dateStandard(_system.dateFromUnix(contests[key]['date']['to']))) {
824						//aggiungere controllo sulla sessione. se la dateNow non è compresa in nessuna sessione, non faccio l'init
825						_init._contest = contests[key];
826						_init._contest['_id'] = key;
827					}
828				}
829			}
830		});
831	},
832
833	modules: function () {
834		var _this = this;
835		if (_this._data !== null && _this._data["modules"] !== undefined && _this._data["modules"]["flag_2"] !== true) {
836			$('body').addClass("hide-chats-function");
837			$('body').addClass("hide-prefs-function");
838		} else {
839			$('body').removeClass("hide-chats-function");
840			$('body').removeClass("hide-prefs-function");
841		}
842	},
843
844	cache: function () {
845		//Check if active Cordova
846		if (_system.isCordova()) {
847			ImgCache.options.debug = false;
848			ImgCache.options.chromeQuota = 500 * 1024 * 1024;
849			// ImgCache.options.cordovaFilesystemRoot = cordova.file.dataDirectory;
850			ImgCache.options.cordovaFilesystemRoot = cordova.file.cacheDirectory;
851			// ImgCache.options.headers = { 'Connection': 'close' };
852			// if (window.cordova.platformId !== 'browser') {
853			// ImgCache.init(function () {
854			// console.log('ImgCache init: success!');
855			// });
856			// }
857		}
858	},
859
860	adswizz: function () {
861		// if (_app.isOffline) return;
862		_adswizz.init();
863	},
864
865	downloads: function () {
866		_downloads.resumeDownloads();
867	},
868
869	header: function () {
870		if (_init._data !== null && _init._data.header !== undefined && _init._data.header.length > 0) {
871			$('#home-header-carousel').show();
872			$("header.single-header").hide();
873			clearInterval(_home.live._interval);
874			_home.carousel.init();
875		} else {
876			$('#home-header-carousel').hide();
877			$("header.single-header").show();
878			_home.live.init();
879		}
880	},
881
882	permissions: function () {
883		if (!_system.isBrowser()) {
884			if (_system.isAndroid()) {
885				cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.ACCESS_FINE_LOCATION, function (status) {
886					if (status.hasPermission) {
887						console.log("Permission successful ACCESS_FINE_LOCATION");
888					} else {
889						cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.ACCESS_COARSE_LOCATION, function (status) {
890							if (status.hasPermission) {
891								console.log("Permission successful ACCESS_COARSE_LOCATION");
892							} else {
893								_system.currentPosition();
894							}
895						})
896
897					}
898				});
899
900				cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.WRITE_EXTERNAL_STORAGE, function (status) {
901					if (status.hasPermission) {
902						console.log("Permission successful STORAGE");
903					} else {
904						cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.WRITE_EXTERNAL_STORAGE, function (status) {
905							if (status.hasPermission) {
906								console.log("Permission successful STORAGE");
907							} else {
908								console.log("Permission denied STORAGE");
909							}
910						});
911					}
912				});
913			} else if (_system.isOS()) {
914				_system.currentPosition();
915			}
916		}
917		// cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.ACCESS_FINE_LOCATION, function( status ){
918		// 	if ( status.hasPermission ) {
919		// 	  console.log("Permission ACCESS_FINE_LOCATION");
920		// 	}else {
921		// 		cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.ACCESS_FINE_LOCATION, function( status ){
922		// 			if ( status.hasPermission ) {
923		// 			  console.log("Permission ACCESS_FINE_LOCATION");
924		// 			}else {
925
926		// 			}
927		// 		});
928		// 	}
929		// });
930	}
931}

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.