Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
3.9 kB
2
Indexable
Never
function dateNow(daten) {
	try {
		verifyStandByMode();
		setTimeout(function () {
			dateNow(parseInt(daten) + 60);
		}, 60000);
		if (FreeChannelsXml) {
			if (FreeChannelsEndDate != null && FreeChannelsStartDate != null) {
				if (FreeChannelsActive) {
					//Free channels are currently active
					if (!(FreeChannelsStartDate.isSameOrBefore(moment(), 'minute') && FreeChannelsEndDate.isSameOrAfter(moment(), 'minute'))) {
						FreeChannelsActive = false;
						if ($("#sceneTV").is(':visible') && Checktest == "0") {
							ChangeScene(TVScene, SurveyScene, "ilsf");
						}
					}
				} else {
					//Free channels are currently not active
					if (FreeChannelsStartDate.isSameOrBefore(moment(), 'minute') && FreeChannelsEndDate.isSameOrAfter(moment(), 'minute')) {
						FreeChannelsActive = true;
					}
				}
			}
		}

		if (Checktest == 0 || Checktest == "0") {
			if (FreeChannelsActive && FreeChannelsXml) {
				$("#message_accueil_1_expired").hide();
				$("#message_accueil_1_expired_free_channel").show();
			} else {
				$("#message_accueil_1_expired_free_channel").hide();
				$("#message_accueil_1_expired").show();
			}
			$("#message_accueil_1").hide();
		} else {
			$("#message_accueil_1_expired").hide();
			$("#message_accueil_1").show();
		}

		var now = new Date(daten * 1000);

		moment.now = function () {
			return +new Date(parseInt(daten, 10) * 1000);
		}
		for (var i = 0; i < 8; i++) {
			ListJours[i] = moment().add(i, 'days').format("dddd");
			ListJoursValues[i] = moment().add(i, 'days').format("DD/MM/Y HH:mm");
		}
		//-------------------
		var newdate = moment().format("dddd DD MMMM Y");
		var newHour = moment().format("HH");
		newHour += "<span class='blink'>:</span>";
		newHour += moment().format("mm");
		$("#getdate").html(newdate + "&nbsp;&nbsp;&nbsp;" + newHour);
		$(".horoscopedate").html(newdate + "&nbsp;&nbsp;&nbsp;" + newHour);

		$.post(LocalUrlFiles + "/Package/Dauntless_logger/libs/postmaster.php", {
			function: "SetTemps",
			result: newdate + "&nbsp;&nbsp;&nbsp;" + newHour,
			FreeChannelsActive: FreeChannelsActive
		}, function (result) {
			ProcessLoggerRequests(result);
		});
		$("#hourNow").html(newHour);
		$("#DayNow").html(moment().format("dddd DD MMMM YYYY"));
		if (localStorage.getItem("numH") != "null") {
			//alert(h+" "+m+" "+an+" "+ms+" "+jr);
			var AlarmValues = JSON.parse(localStorage.getItem("AlarmStoredValues"));
			for (var i = 0; i < AlarmValues.length; i++) {
				if (moment().isSame(moment(AlarmValues[i], "DD/MM/Y HH:mm"), 'minute')) {
					if (localStorage.getItem("tv_state") == "false") {
						switchOnOffTV();
					}
					playWakeupSong();
					//clear current or before dates
					for (var j = 0; j < AlarmValues.length; j++) {
						if (moment().isSameOrAfter(moment(AlarmValues[j], "DD/MM/Y HH:mm"), 'minute')) {
							AlarmValues.splice(j, 1);
							AlarmValues = SortByDate(AlarmValues);
							localStorage.setItem("AlarmStoredValues", JSON.stringify(AlarmValues));
						}
					}
					TestRunPlayer = true;
					if (StateStandByScene == true) {

						StandScene.unload();
						SurveyScene.init();
						SurveyScene.load();
						SurveyScene.show();
						SurveyScene.focus();
						StateStandByScene = false;

					}
					break;
				}
			}
			SetNextAlarmDate();
		}
	} catch (e) {
		$.post(LocalUrlFiles + "/Package/Dauntless_logger/libs/postmaster.php", {
			function: "SetTemps",
			result: daten
		}, function (result) {
		});
		setTimeout(function () {
			dateNow(parseInt(daten) + 60);
		}, 60000);
	}
	if (DateOut != "null" && DateOut != " ") {
		var DateOutasDate = Date.parseString(DateOut, "dd-MM-yyyy HH:mm:ss");
		if (firstTvCheckoutValidity) {
			firstTvCheckoutValidity = false;
		} else {
			checkInValidity(now, DateOutasDate);
		}

	}


}
Leave a Comment