var actId; var liveStreamAvailable = false; var stories = []; var storiesWorkaround = []; var storiesBarSize = 0; var storiesTimeout = 10000; var storiesBarStepsPercent = 0; var loadStoriesBarInterval; var loadStoriesTimeout; var loadStoryInterval; var previousStory; var actualStory; function makeRequest(parameters) { httpRequest = new XMLHttpRequest(); if (!httpRequest) { alert('Problem creating connection.'); return false; } httpRequest.onreadystatechange = makeContents; httpRequest.open('GET','/handler.php?unique=1714232111' + parameters); httpRequest.send(); } function makeContents(htmlId) { if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.status === 200) { if(httpRequest.responseText.length == 0){ liveStreamAvailable = false; if(document.getElementById(actId)){ document.getElementById(actId).innerHTML = " "; } if(document.getElementById("nxtLive")){ document.getElementById("nxtLive").style.display = "block"; } }else{ liveStreamAvailable = true; if(document.getElementById(actId)){ document.getElementById(actId).innerHTML = httpRequest.responseText; } if(document.getElementById("nxtLive")){ document.getElementById("nxtLive").style.display = "none"; } } } } } function getCWD(){ actId = "cwd"; var parameters = "&a=checkLiveAvailable"; makeRequest(parameters); } function checkLiveAvailable(){ if(liveStreamAvailable == true){ document.getElementById('headLiveEye').style.display = "block"; }else{ document.getElementById('headLiveEye').style.display = "none"; } } function initScan(){ getCWD(); setInterval(getCWD, 5000); setInterval(checkLiveAvailable, 1000); } function hideStories(){ storiesBarSize = 0; document.getElementById('story').style.display='none'; clearInterval(loadStoryInterval); clearInterval(loadStoriesBarInterval); clearTimeout(loadStoriesTimeout); previousStory = null; storiesWorkaround = []; for (let i = 0; i < stories.length; i++) { document.getElementById('story-'+stories[i]).style.display='none'; } } function loadStoriesBar(){ storiesBarSize = storiesBarSize + storiesBarStepsPercent; document.getElementById("storiesbar").style.width=storiesBarSize + "%"; } function showStory(){ if(storiesWorkaround[0] > 0){ actualStory = storiesWorkaround[0]; if(previousStory > 0){ document.getElementById('story-' + previousStory).style.display='none'; } localStorage.setItem("story", storiesWorkaround[0]); document.getElementById('story-' + storiesWorkaround[0]).style.display='block'; previousStory = storiesWorkaround[0]; storiesWorkaround.shift(); }else{ clearInterval(loadStoryInterval); } } function skipStory(){ var indexOfActualStory = storiesWorkaround.indexOf(actualStory); var storiesFullTime = stories.length * storiesTimeout; var storiesFullSkipTime = storiesWorkaround.length * storiesTimeout; clearInterval(loadStoryInterval); clearTimeout(loadStoriesTimeout); clearInterval(loadStoriesBarInterval); loadStoriesTimeout = setTimeout(hideStories, storiesFullSkipTime); storiesBarSize = ( ( 100 / ( stories.length ) ) * (stories.length - storiesWorkaround.length) ); document.getElementById("storiesbar").style.width = storiesBarSize + "%"; storiesBarStepsPercent = 1; FortschrittNachÜbersprungenenTeilen = (stories.length - (stories.length - storiesWorkaround.length)) / stories.length; GesamtzeitVerbleibendeTeile = storiesTimeout * (stories.length - (stories.length - storiesWorkaround.length)); VerbleibendeZeitProProzentNachÜbersprungenenTeilen = GesamtzeitVerbleibendeTeile / FortschrittNachÜbersprungenenTeilen / 100; FortschrittAufDemLadebalken = FortschrittNachÜbersprungenenTeilen * 100; timeValue = VerbleibendeZeitProProzentNachÜbersprungenenTeilen; loadStoriesBarInterval = setInterval(loadStoriesBar, timeValue); showStory(); loadStoryInterval = setInterval(showStory, storiesTimeout); } function showStories(){ hideStories(); storiesWorkaround = stories.slice(); document.getElementById('story').style.display='flex'; var storiesFullTime = stories.length * storiesTimeout; loadStoriesTimeout = setTimeout(hideStories, storiesFullTime); showStory(); loadStoryInterval = setInterval(showStory, storiesTimeout); storiesBarSize = 0; storiesBarStepsPercent = 1; timeValue = storiesFullTime / 100; loadStoriesBarInterval = setInterval(loadStoriesBar, timeValue); document.getElementById('stories').style.opacity='0.35'; } window.addEventListener("load", (event) => { initScan(); if(stories[ stories.length - 1 ] > localStorage.getItem("story")){ }else{ if(document.getElementById('stories')){ document.getElementById('stories').style.opacity='0.35'; } } }); if(typeof AndroidInterface !== 'undefined'){ document.addEventListener('touchstart', handleTouchStart, false); document.addEventListener('touchmove', handleTouchMove, false); var xDown = null; var yDown = null; var sensitivityThreshold = 10; function getTouches(evt) { return evt.touches || evt.originalEvent.touches; } function handleTouchStart(evt) { const firstTouch = getTouches(evt)[0]; xDown = firstTouch.clientX; yDown = firstTouch.clientY; }; function handleTouchMove(evt) { if ( ! xDown || ! yDown ) { return; } var xUp = evt.touches[0].clientX; var yUp = evt.touches[0].clientY; var xDiff = xDown - xUp; var yDiff = yDown - yUp; if (Math.abs(xDiff) > Math.abs(yDiff) && Math.abs(xDiff) > sensitivityThreshold) { if (xDiff > 0) { // Handle swipe to the left } else if (xDiff < -sensitivityThreshold) { history.back(); } } xDown = null; yDown = null; }; }