From dfaf298809abbf4d37d484f99bbd969cc5d29d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Mon, 9 Feb 2015 00:36:09 +0100 Subject: [PATCH] Removed the player fully from mobile website, and prevents the mobile from loading the video in the first place --- js/list.js | 4 ++-- js/youtube.js | 25 +++++++++++++++---------- static/style.css | 2 ++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/js/list.js b/js/list.js index 3f5a9aa5..c45ca5ee 100755 --- a/js/list.js +++ b/js/list.js @@ -76,8 +76,8 @@ function updateList() } if(window.mobilecheck()) { - document.getElementById("player").style.display="none"; - ytplayer.pauseVideo(); + //document.getElementById("player").style.display="none"; + //ytplayer.pauseVideo(); }else{ myScroll.refresh(); } diff --git a/js/youtube.js b/js/youtube.js index c5aa46ce..510fd4eb 100755 --- a/js/youtube.js +++ b/js/youtube.js @@ -74,18 +74,18 @@ $(document).ready(function() console.log("timediff:"+timeDifference[0]); - - tag = document.createElement('script'); - tag.src = "https://www.youtube.com/iframe_api"; - firstScriptTag = document.getElementsByTagName('script')[0]; - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); if(window.mobilecheck()){ //syncInterval = setInterval(getTime, 50000); //listInterval = setInterval(updateList, 50000); mobileSync = setInterval(function(){getTime();updateList();}, 10000); //listKillInterval = setInterval(ks, 50000); document.getElementById("search").blur(); + readyLooks(); }else{ + tag = document.createElement('script'); + tag.src = "https://www.youtube.com/iframe_api"; + firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); if(!syncInterval) syncInterval = setInterval(getTime, 5000); listInterval = setInterval(updateList, 10000); @@ -220,7 +220,7 @@ function startNextSong() function getTime() { console.log("utenfor if test" + wasPaused); - if(ytplayer.getCurrentTime() > 2 && ytplayer.getPlayerState() == 1) wasPaused = false; + if(!window.mobilecheck() && ytplayer.getCurrentTime() > 2 && ytplayer.getPlayerState() == 1) wasPaused = false; if(!wasPaused) { console.log("sjekker om brukeren spolte"); @@ -263,9 +263,9 @@ function getTime() //clearInterval(syncInterval); wasPaused = true; console.log("forskjellige videoer!!"); - ytplayer.pauseVideo(); if(!window.mobilecheck()) { + ytplayer.pauseVideo(); ytplayer.loadVideoById(timeDifference[1]); } setBGimage(timeDifference[1]); @@ -350,11 +350,16 @@ function onPlayerReady(event) { ytplayer.playVideo(); } initYoutubeControls(ytplayer); - getTitle(); - setBGimage(response); + readyLooks(); initSlider(); //durationFixer = setInterval(durationSetter, 1000); - } +} + +function readyLooks() +{ + getTitle(); + setBGimage(response); +} function setBGimage(id){ if(window.mozInnerScreenX == null && !window.mobilecheck()){ diff --git a/static/style.css b/static/style.css index 3898947d..593e81fb 100755 --- a/static/style.css +++ b/static/style.css @@ -199,6 +199,8 @@ margin: 0;} #title, .result_info{color:#000 !important;}*/ /*.blurT{-webkit-filter: blur(0px);}*/ #eBar, #sBar{font-size:40px; height:50px;} + #zicon{width:35%;} + .fchan{font-size: 7vw;} } @media only screen and (min-width: 1000px) {