From f98415c5b138ec088671ee57578375b20572d059 Mon Sep 17 00:00:00 2001 From: "Nicolas A. Tonne" Date: Thu, 9 Oct 2014 21:21:21 +0200 Subject: [PATCH] New release --- .htaccess | 12 +++++ README.md | 19 -------- change.php | 3 +- channel.php | 3 -- index.php | 13 ++--- list.js | 29 ++++++----- lists/index.php | 47 ++++++++++++++++++ lists/yali.json | 1 + nochan.php | 43 +++++++---------- style.css | 38 ++++++++++++--- videos.php | 14 +++--- youtube.js | 126 ++++++++++++++++++++++++++---------------------- 12 files changed, 209 insertions(+), 139 deletions(-) create mode 100644 .htaccess delete mode 100644 README.md delete mode 100644 channel.php create mode 100644 lists/yali.json diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..952ded2a --- /dev/null +++ b/.htaccess @@ -0,0 +1,12 @@ +Options +FollowSymLinks +RewriteEngine on +RewriteBase / +RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] +RewriteRule ^(.*)$ http://%1/$1 [R=301,L] + +RewriteCond %{REQUEST_URI} !(/$|\.) +RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule /(.*)$ /$1 [L] \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 670e71a2..00000000 --- a/README.md +++ /dev/null @@ -1,19 +0,0 @@ -Zoff -==== - -The shared youtube radio - -## About the specific files - -### change.php -Does all the serverside handling, updating lists, voting, serving the list, adding songs etc. - -### Everything else -Is pretty much self explanatory. :D -The important files are: - * youtube.js - * list.js - * search.js - * change.php - * index.php - diff --git a/change.php b/change.php index 9ea81167..b9dd4856 100644 --- a/change.php +++ b/change.php @@ -75,7 +75,8 @@ else if(isset($_GET['vote'])){ //add vote unset($data[3][$i]); unset($data[0][$i]); unset($data[2][$i]); - $underVote = array_search($votes-1, $data[2]); + $underVote = array_search($votes-1, $data[2]); #nenennenenen feiiiiiiiiiiiiiiiiil + if($underVote == 0)$underVote=1; else if($underVote == false)$underVote=count($data[2]); array_splice($data[3], $underVote, 0, array($name)); diff --git a/channel.php b/channel.php deleted file mode 100644 index 64afe2d7..00000000 --- a/channel.php +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/index.php b/index.php index 50661cb6..e60b78ce 100644 --- a/index.php +++ b/index.php @@ -9,12 +9,13 @@
-
+
+ Zöff
diff --git a/list.js b/list.js index 45cd1d46..0e07f58b 100644 --- a/list.js +++ b/list.js @@ -38,21 +38,24 @@ function updateList() }); if($("#playlist").height() > $("#player").height()) { - if(!window.mobilecheck()){ $("#playlist").css({height: $("#player").height() - $("#buttons").height()-4});} - if(scroller == false) + if(!window.mobilecheck()) { - myScroll = new IScroll('#playlist', { - mouseWheel: true, - scrollbars: false, - scrollY: true, - interactiveScrollbars: false - }); - scroller = true; - }else - { - myScroll.refresh(); + $("#playlist").css({height: $("#player").height() - $("#buttons").height()-4}); + $("#playlist").css({overflow: "hidden"}); + if(scroller == false) + { + myScroll = new IScroll('#playlist', { + mouseWheel: true, + scrollbars: false, + scrollY: true, + interactiveScrollbars: false + }); + scroller = true; + }else + { + myScroll.refresh(); + } } - } if(window.mobilecheck()) { diff --git a/lists/index.php b/lists/index.php index e69de29b..50661cb6 100644 --- a/lists/index.php +++ b/lists/index.php @@ -0,0 +1,47 @@ + + + Zöff + + + + + + + +
+
+ Zöff +
+ +
+
+
+ +
+
+ Skip +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/lists/yali.json b/lists/yali.json new file mode 100644 index 00000000..c17ade28 --- /dev/null +++ b/lists/yali.json @@ -0,0 +1 @@ +[["Sb3XfrCtjVU","vMwFFENUOQk","RCB5yWVKx-Q","LS18kZR1X5I","3O1_3zBUKM8","Ms5eSsOKk14","cV9dsOJXt3g","mG6pm1WZ2uc","y6DHE_5drbM","uPOUgobWTT0","UY-NlQH8vjs","aHGcfmnDm3U","p0B26wv22ao","wyx6JDQCslE","IYH7_GzP4Tg","Ac08rCzDUB0","CRGl33OTY74","V40EjCjP3VU","L53gjP-TtGE","YLx11xq6X7Q"],[1412548839],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],["The Notorious BIG ft. Ja Rule - Old Thing Back (Matoma Remix)","Mandeh - Sandbank","Philter - Untitled","Philter - Adventure Time","Naughty Boy - La La La ft. Sam Smith","DMX - Where The Hood At (Dirty)","Notorious BIG - Juicy (Sh\u00e8mce Remix)","Sade - No Ordinary Love (R\u00c6VE ","The Notorious B.I.G. - Party ","(I Wanna) Channing All Over Your Tatum - Official Music Video","Foreground Set - Challo! (FULL)","Foreground Set - Good luck","Opeth - Eternal Rains Will Come (Audio)","LMFAO - Sexy and I Know It","Lil Jon ","M83 - Midnight City","Naughty Boy Feat. Sam Smith - La La La Remix - Shahaf Moran","Philter - The Seven Seas","Kanye West - POWER","Kanye West - Black Skinhead (Blkkk SkkkN Head) Official Video HD"],[1],[]] \ No newline at end of file diff --git a/nochan.php b/nochan.php index b5ae2219..aff0e9fc 100644 --- a/nochan.php +++ b/nochan.php @@ -1,40 +1,33 @@ -Zöff -
- -
-
-
Channels:
- ".$channel.""; - } - ?> -
- - +
Zöff
+
+ +
+ +
+
+
Channels:
+ ".urldecode($channel)."";} ?> +
+
+
+ + + \ No newline at end of file diff --git a/style.css b/style.css index eee067a7..204bcc95 100644 --- a/style.css +++ b/style.css @@ -5,7 +5,7 @@ body{background:#FFF; margin:0;} } .top, .top a{color:#ed207f; text-decoration: none;} .vcent{position: relative; top: 50%; -webkit-transform: translateY(-50%);} -.channels{padding:10px;} + .innbox, .innbox a{ width:90%; height: 50px; border-radius:7px; border:none; font-family: 'Open Sans', sans-serif; font-size: 25px; margin-bottom: 20px; @@ -18,7 +18,12 @@ body{background:#FFF; margin:0;} .big{font-size:180vh; position:absolute; top:-50%; color:#330A00 !important; z-index:-1; width: 100%; overflow: hidden; display: none;} .footer a{color:#696969; text-decoration: none;}.footer a:hover {color:#ed207f;} .footer{font-size: 15px; position:absolute; width:99%;color:#c0c0c0 !important; margin-top: 0; word-spacing: 2px;} -.nomargin{padding: 0;margin:0;} +.bottom{bottom:10px;} +#channels{width:40%; min-width: 300px; padding-top: 4%; font-size: 25px;} +.channel{padding: 7px; display: inline-block; font-weight: bold; color: #646464 !important;font-size: 18px;} +.channel:hover{color:#ed207f !important;} + + .anim{transition: all .20s ease-in-out; -moz-transition: all .20s ease-in-out; -webkit-transition: all .20s ease-in-out;} .chan{color:#CCC; cursor:pointer; display: inline;} .bigchan{color: #ed207f; font-size: 10vw; padding-top: 25%;} @@ -26,35 +31,52 @@ body{background:#FFF; margin:0;} #buttons{cursor: default; text-align: right;} .skip{cursor: pointer; height: 25px; padding:8px 21px 0 0;} -#results{position:absolute; background-color: white; font-size: 14px; width:90%; margin-left: 5%; margin-top:-5px; z-index: 1; } -.result{border: 1px solid #EEE; border-bottom:none; padding: 3px 0 3px 10%; text-align: left; height: 40px; cursor: pointer;} +#results{position:absolute; background-color: white; font-size: 14px; width:90%; margin-left: 5%; margin-top:-5px; z-index: 1; font-family: sans-serif;} +.result{border-bottom:none; padding: 3px 0 3px 10%; text-align: left; height: 55px; cursor: pointer;} .result:hover{background-color: #DDD;} -#title{ padding-left: 20%; padding-top:10px; max-width: 76%; color:#ed207f;} +#title{ padding-left: 20%; padding-top:10px; max-width: 76%; color:#ed207f; height: 36px;} .result_info{color:#888; font-size: 12px; float:right;} .thumb{height: 40px; width:80px; float: left;} + .main{width:90%; margin: 0 auto 0 auto;} -.playlist{background-color: #DADADA; width:20%; margin-left: 0px; display: inline-block; font-size: 14px; border-radius: 3px; vertical-align: top; overflow: hidden; height: calc(87% - 183px); border-bottom:solid #c9c9c9 4px;} +.playlist{background-color: #DADADA; width:20%; margin-left: 0px; display: inline-block; font-size: 14px; border-radius: 3px; vertical-align: top; /*overflow: hidden;*/ height: calc(87% - 183px); border-bottom:solid #c9c9c9 4px;} .lresult{padding:0; height: 60px; border-top: none; cursor: default; background-color: #DADADA;} .lthumb{height: 60px; margin-right: 10px; display: inline;} .ltitle{ color:#ed207f; overflow: hidden; height: 60px; } .oddlist{background-color: #EEE;} -.votes{float: right; position: relative; margin-top: -1.4em; padding:0 3 0 4; background-color: #333; border-radius: 3px;} +.votes{float: right; position: relative; margin-top: -1.4em; padding:0 3 0 4; background-color: rgba(50,50,50,0.45); color:#000; border-radius: 1px;} #plus, #minus {text-decoration: none; color:white; margin-left: 2px; padding-left: 3px; padding-right: 3px; } #plus:hover,#minus:hover{background-color: #111;} #player{height: 68%; height: calc(87% - 183px); width: 78%; border-radius: 3px; border-bottom:solid #c9c9c9 4px;} #playlist{} +.nomargin{padding: 0;margin:0;} @media (max-width: 1000px) { #player{width: 100%; height:45%; margin-bottom: 20px;} .playlist{width: 100%;} .lresult{font-size: 40px; height: 90px; font-size: 50px;} - .votes{font-size: 42px; padding-right: 8px; height: 89px; line-height: 89px; padding-left: 20px; border-radius: 15px;} + .votes{font-size: 42px; padding-right: 8px; height: 89px; line-height: 89px; padding-left: 20px; border-radius: 1px;} .lthumb{height: 90px;} #plus,#minus{padding-left: 24px; margin-left: 0; padding-right: 24px;} #plus{border-right:solid 3px rgb(172, 172, 172);} + #search{text-align: left; height: 100px; font-size: 40px; border: solid 2px #ccc;} + #buttons{text-align: center; height: 80px;} + .skip{height: 50px;} + .vcent{ + top: inherit; + -webkit-transform: translateY(0%); + } + #title{ + font-size: 30px; + font-weight: bold; + overflow: hidden; + padding-left: 2%; + padding-top: 0; + } + .footer{font-size: 40px; margin-top: 150px;} } @-webkit-keyframes fadein{from {opacity:0;}to{opacity:1;}}@keyframes fadein{from{opacity:0;}to{opacity:1;}}@-moz-keyframes fadein{from{opacity:0;}to{opacity:1;}}@-o-keyframes fadein{from{opacity:0;}to{opacity:1;}} diff --git a/videos.php b/videos.php index f1dda2cf..6220e7b8 100644 --- a/videos.php +++ b/videos.php @@ -1,8 +1,8 @@ - \ No newline at end of file diff --git a/youtube.js b/youtube.js index b330aaef..b13e92df 100644 --- a/youtube.js +++ b/youtube.js @@ -59,9 +59,14 @@ $(document).ready(function() tag.src = "https://www.youtube.com/iframe_api"; firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); - syncInterval = setInterval(getTime, 5000); - listInterval = setInterval(updateList, 10000); - if(window.mobilecheck()){document.getElementById("search").blur();} + if(window.mobilecheck()){ + syncInterval = setInterval(getTime, 50000); + listInterval = setInterval(updateList, 50000); + document.getElementById("search").blur(); + }else{ + syncInterval = setInterval(getTime, 5000); + listInterval = setInterval(updateList, 10000); + } }); function onYouTubeIframeAPIReady() { @@ -100,11 +105,13 @@ function onPlayerStateChange(newState) { console.log("nummer 1"); startNextSong(); ytplayer.pauseVideo(); + wasPaused = false; }else if(newState.data == 1 && (wasPaused && !beginning)) { console.log("unpaused"); beginning = false; wasPaused = false; + syncInterval = setInterval(getTime, 5000); getTime(); }else if(newState.data == 2) { @@ -136,7 +143,7 @@ function checkEnd() function startNextSong() { - clearInterval(syncInterval); + //console.log(getTime()); if(checkEnd() && !changed) { @@ -156,74 +163,79 @@ function startNextSong() getTitle(response); ytplayer.loadVideoById(response); beginning = true; - syncInterval = setInterval(getTime, 5000); + },2500); updateList(); changed = true setTimeout(function() { changed = false; + syncInterval = setInterval(getTime, 5000); + interval = true; + console.log("starter intervallen. Interval: " + interval); }, 2500); } + } function getTime() { + console.log("utenfor if test" + wasPaused); if(!wasPaused) { - console.log("sjekker om brukeren spolte"); + console.log("sjekker om brukeren spolte"); - $.ajax({ - type: 'get', - url: 'timedifference.php', - data: "abcde", - async: false, - success: function(data) { - timeDifference = $.parseJSON(data); - } - }); - console.log("current song: "+response); - console.log("song in database: "+timeDifference[1]); - if(parseInt(timeDifference[2]) + 1> ytplayer.getCurrentTime() + parseInt(timeDifference[3]) && ytplayer.getPlayerState() == 0) - { - return true; - }else if(ytplayer.getCurrentTime() + parseInt(timeDifference[3]) > parseInt(timeDifference[2]) + 5 || (ytplayer.getCurrentTime() + parseInt(timeDifference[3]) < parseInt(timeDifference[2]) - 5 && ytplayer.getPlayerState() != 0 && ytplayer.getPlayerState() != 3)) - { - if(parseInt(timeDifference[0]) > ytplayer.getDuration()) - { - console.log("burde ikke søke, men hoppe til neste sang"); + $.ajax({ + type: 'get', + url: 'timedifference.php', + data: "abcde", + async: false, + success: function(data) { + timeDifference = $.parseJSON(data); + } + }); + console.log("current song: "+response); + console.log("song in database: "+timeDifference[1]); + if(parseInt(timeDifference[2]) + 1> ytplayer.getCurrentTime() + parseInt(timeDifference[3]) && ytplayer.getPlayerState() == 0) + { + return true; + }else if(ytplayer.getCurrentTime() + parseInt(timeDifference[3]) > parseInt(timeDifference[2]) + 5 || (ytplayer.getCurrentTime() + parseInt(timeDifference[3]) < parseInt(timeDifference[2]) - 5 && ytplayer.getPlayerState() != 0 && ytplayer.getPlayerState() != 3)) + { + if(parseInt(timeDifference[0]) > ytplayer.getDuration()) + { + console.log("burde ikke søke, men hoppe til neste sang"); + } + ytplayer.seekTo(timeDifference[0]); + ytplayer.pauseVideo(); + ytplayer.playVideo(); + getTitle(); + return false; + } + //if(interval){syncInterval = setInterval(getTime, 5000);interval = false;} + + if(response != timeDifference[1]) + { + clearInterval(syncInterval); + console.log("forskjellige videoer!!"); + ytplayer.pauseVideo(); + ytplayer.loadVideoById(timeDifference[1]); + setTimeout(function(){ + //console.log(response); + diffVideo = true; + beginning = true; + $.ajax({ + type: "POST", + url: "change.php", + async: false, + data: "thisUrl=123abcprompeprompe&act=save", + success: function(data) + { + response = timeDifference[1]; + getTitle(); + } + }); + syncInterval = setInterval(getTime, 5000); + },2500); } - ytplayer.seekTo(timeDifference[0]); - ytplayer.pauseVideo(); - ytplayer.playVideo(); - getTitle(); - return false; - } - //if(interval){syncInterval = setInterval(getTime, 5000);interval = false;} - - if(response != timeDifference[1]) - { - clearInterval(syncInterval); - console.log("forskjellige videoer!!"); - ytplayer.pauseVideo(); - ytplayer.loadVideoById(timeDifference[1]); - setTimeout(function(){ - //console.log(response); - diffVideo = true; - beginning = true; - $.ajax({ - type: "POST", - url: "change.php", - async: false, - data: "thisUrl=123abcprompeprompe&act=save", - success: function(data) - { - response = timeDifference[1]; - getTitle(); - } - }); - syncInterval = setInterval(getTime, 5000); - },2500); - } } }