Merge pull request #135 from zoff-music/fancy

Fancy
This commit is contained in:
KasperRT
2015-11-26 12:13:49 +01:00
8 changed files with 258 additions and 25 deletions

14
php/imageblob.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
$url = file_get_contents("https://img.youtube.com/vi/" . $_POST['id'] . "/mqdefault.jpg");
$image = new Imagick();
$image->readImageBlob($url);
$image->blurImage(30,50);
$output = $image->getimageblob();
echo base64_encode($output);
?>

View File

@@ -71,30 +71,37 @@ if(isset($_GET['chan'])){
</div>
</header>
<main class="center-align container">
<div class="section">
<form class="row" id="base" method="get">
<div class="input-field col s12">
<input
class="input-field"
type="text"
id="search"
name="chan"
title="Type channel name here to create or listen to a channel. Only alphanumerical chars. [a-zA-Z0-9]+"
autocomplete="off"
list="searches"
required pattern="[a-zA-Z0-9]+"
spellcheck="false"
maxlength="18"
data-length="18"
/>
<label for="search" class="noselect">Find or create radio channel</label>
<datalist id="searches">
</datalist>
</div>
<div class="section mega">
<div id="mega-background"></div>
<h5>Create a radio channel, collaborate and listen</h5>
<form class="">
<p class="prething">zoff.no/</p>
<input
class="input-field room-namer"
type="text"
id="search"
name="chan"
placeholder="chill"
title="Type channel name here to create or listen to a channel. Only alphanumerical chars. [a-zA-Z0-9]+"
autocomplete="off"
autofocus=""
list="searches"
required
pattern="[a-zA-Z0-9]+"
spellcheck="false"
maxlength="18"
/>
<datalist id="searches"></datalist>
<a class="refresh-button"><i class="small cached"></i></a>
<button class="listen-button" action="submit">Listen</button>
</form>
</div>
<div class="pitch outline">
<div>Live &amp; democratic playlists with YouTube Music</div>
<div>Play everywhere — No login required</div>
</div>
</div>
<main class="center-align container">
<div class="section">
<div id="preloader" class="progress">
<div class="indeterminate"></div>

View File

@@ -283,6 +283,170 @@ hide mdi-action-visibility mdi-action-visibility-off
margin:-1px;
}
@font-face {
font-family:"futura-pt";
src:url('../font/futura.woff2') format('woff2'),url('../font/futura.woff') format('woff');
font-style:normal;font-weight:300;
}
.mega{
padding: 6% 0px;
height: 100%;
position: relative;
z-index: 1;
background-color:grey;
}
#mega-background{
-webkit-transition:opacity 0.5s;
height:400px;
width:400px;
position: absolute;
top: 0px;
left:0px;
z-index: -1;
height: 100%;
width: 100%;
}
.room-namer::-webkit-input-placeholder{
/*color:rgb(155, 155, 155) !important;*/
-webkit-transition:opacity 0.5s;
color: rgb(255, 255, 255) !important;
}
.mega h5{
/*box-sizing: border-box; */
color: rgb(255, 255, 255); cursor: default; display: inline;
/*font-family: futura-pt, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; */
font-size: 50px;
font-weight: 100;
height: auto;
line-height: 90.069229px; text-align: center;
text-shadow: rgba(18, 18, 18, 0.76) 0px 1px 4px; width: auto;
margin-left: auto;
margin-right: auto;
display: block;
}
.mega form{
display: flex;
/*-webkit-background-clip: border-box; -webkit-background-origin: padding-box; -webkit-background-size: auto; -webkit-box-shadow: rgb(68, 68, 68) 0px 0px 8px 0px; background-attachment: scroll; background-clip: border-box; background-color: rgb(255, 255, 255); background-image: none; background-origin: padding-box; background-size: auto; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-shadow: rgb(68, 68, 68) 0px 0px 8px 0px; box-sizing: border-box; color: rgb(255, 255, 255); cursor: text; display: flex; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 17px; font-weight: normal; height: 50px; line-height: 24.2857151031494px; margin-top: 0px; padding-bottom: 5px; padding-left: 20px; padding-right: 5px; padding-top: 5px; text-align: center; width: 507.8125px;
margin-left: auto;
margin-right: auto;
margin-top: 1%;
margin-bottom: 2%;*/
width: 41vw;
margin-right: auto;
margin-left: auto;
text-align: center;
}
.mega .prething{
box-sizing: border-box;
/*color: rgb(155, 155, 155);*/
cursor: text; display: block;
text-shadow: rgba(18, 18, 18, 0.76) 0px 1px 4px;
color: rgb(255, 255, 255);
/*font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; */
font-size: 17px;
/*font-weight: 200; */
height: 24px; line-height: 26px; margin-bottom: 8px; margin-left: 0px; margin-right: 8.5px; margin-top: 8px;
min-width: 56px; text-align: center;
width: 40px;
margin-right: -85px;
}
.mega input{
/*color: rgb(0, 0, 0);*/
/*font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;*/
font-size: 17px;
height: 42px;
line-height: 25px;
min-width: 307px;
width: 400px;
word-spacing: 0px;
box-shadow: none !important;
border:none !important;
color: rgb(255, 255, 255);
text-shadow: rgba(18, 18, 18, 0.76) 0px 1px 4px;
border-bottom: 1px solid white !important;
padding-left: 100px;
}
.mega .refresh-button{
box-sizing: border-box; color: rgb(175, 175, 175); cursor: pointer; display: block; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 25.5px; font-weight: normal; height: 40px; line-height: 36.4285736083984px; margin-left: -40px; text-align: center; text-decoration: none; width: 40px;
}
.mega .listen-button{
/*-webkit-appearance: none; -webkit-background-clip: border-box; -webkit-background-origin: padding-box; -webkit-background-size: auto; -webkit-writing-mode: horizontal-tb; align-items: flex-start; background-attachment: scroll; background-clip: border-box;
background-color: rgb(45, 45, 45); background-image: none; background-origin: padding-box; background-size: auto; border-bottom-color: rgb(250, 70, 104); border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0px; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(250, 70, 104); border-left-style: none; border-left-width: 0px; border-right-color: rgb(250, 70, 104); border-right-style: none; border-right-width: 0px; border-top-color: rgb(250, 70, 104); border-top-left-radius: 3px; border-top-right-radius: 3px; border-top-style: none; border-top-width: 0px; box-sizing: border-box; color: rgb(255, 255, 255); cursor: pointer; display: block; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; height: 40px; letter-spacing: normal; line-height: 35.625px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 30px; padding-right: 30px; padding-top: 0px; text-align: center; text-decoration: none; text-indent: 0px; text-shadow: none;
text-transform: none;
word-spacing: 0px;
color: rgb(255, 255, 255);
text-shadow: rgba(18, 18, 18, 0.76) 0px 1px 4px;
height:41px;*/
background: none;
border: none;
background-size: auto;
border-bottom: 1px solid white;
border-left:1px solid rgba(255,255,255,0);
border-right:1px solid rgba(255,255,255,0);
border-top:1px solid rgba(255,255,255,0);
cursor: pointer;
height: 43px;
line-height: 35.625px;
margin-left: 20px;
padding-left: 30px;
padding-right: 30px;
text-shadow: none;
color: rgb(255, 255, 255);
text-shadow: rgba(18, 18, 18, 0.76) 0px 1px 4px;
-webkit-transition : border 500ms ease-out;
-moz-transition : border 500ms ease-out;
-o-transition : border 500ms ease-out;
transition : border 500ms ease-out;
border-left:1px solid rgba(255,255,255,1);
border-right:1px solid rgba(255,255,255,1);
border-top:1px solid rgba(255,255,255,1);
border-radius: 2px;
}
.listen-button:hover{
border-left:1px solid rgba(255,255,255,1);
border-right:1px solid rgba(255,255,255,1);
border-top:1px solid rgba(255,255,255,1);
border-radius: 2px;
background-color:white;
color:rgba(255,255,255,0);
text-shadow: rgba(18, 18, 18, 0.76) 0px 0px 0px;
}
.listen-button:focus{
border-left:1px solid rgba(255,255,255,1);
border-right:1px solid rgba(255,255,255,1);
border-top:1px solid rgba(255,255,255,1);
border-radius: 2px;
background-color:rgba(255,255,255,0);
color:rgba(255,255,255,1);
text-shadow: rgba(18, 18, 18, 0.76) 0px 1px 4px;
}
.mega .pitch{
box-sizing: border-box;
color: rgba(255, 255, 255, 0.85);
display: inline;
/* font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; */
font-size: 18px;
font-weight: 300;
height: auto;
/*line-height: 24.2857151031494px;*/
text-align: center;
text-shadow: rgba(81, 81, 81, 0.05) 0px 1px 4px;
width: auto;
margin-top: 20px;
}
/*#channels li{opacity: 0;}*/
/*------------------- Channel page ---------------------------------------------------------------------------- */

2
static/dist/frontpage.min.js vendored Executable file → Normal file
View File

@@ -1 +1 @@
!function(){var e,t,o={populate_channels:function(t){var n,a="",s=0;1==t[0][5]&&(n=t.shift()),t.sort(o.sortFunction),void 0!==n&&t.unshift(n),pre_card=$(e);for(x in t){var i=t[x][3];if(20>s){var l=t[x][1],r=t[x][0],c="background-image:url('https://img.youtube.com/vi/"+l+"/hqdefault.jpg');",d=t[x][4],u=pre_card;1==t[x][5]?(u.find(".pin").attr("style","display:block;"),u.find(".card").attr("title","Pinned!")):(u.find(".pin").attr("style","display:none;"),u.find(".card").attr("title","")),u.find(".chan-name").text(i),u.find(".chan-name").attr("title",i),u.find(".chan-views").text(r),u.find(".chan-songs").text(d),u.find(".chan-bg").attr("style",c),u.find(".chan-link").attr("href",i),$("#channels").append(u.html())}a+="<option value='"+i+"'> ",s++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=a,$("#channels").fadeIn(800),$("#search").focus()},sortFunction:function(e,t){var o=e[0],n=t[0],a=e[4],s=t[4];return n>o?1:o>n?-1:s>a?1:a>s?-1:0},getCookie:function(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var a=o[n];" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){"#donation"==window.location.hash&&$("#donation").openModal(),e=$("#channel-list-container").html(),window.list_html=e,$("#channels").empty();var n=io.connect("//"+window.location.hostname+":8880");n.emit("frontpage_lists"),n.on("playlists",function(e){o.populate_channels(e)}),window.socket=n;var a=0;if(document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),navigator.userAgent.toLowerCase().indexOf("android")>-1&&""==o.getCookie("show_prompt")){var s=confirm("Do you want to download the native app for this webpage?");if(s)window.location.href="https://play.google.com/store/apps/details?id=no.lqasse.zoff";else{var i=new Date;i.setTime(i.getTime()+864e6);var l="expires="+i.toUTCString();document.cookie="show_prompt=false;"+l}}t=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,t=$.parseJSON(t),$("#latest-commit").html("Latest Commit: <br>"+t[0].commit.author.date.substring(0,10)+": "+t[0].committer.login+"<br><a href='"+t[0].html_url+"'>"+t[0].sha.substring(0,10)+"</a>: "+t[0].commit.message+"<br")})}();
!function(){var e,t,o={blob_list:[],populate_channels:function(t){var n,a="",s=0;1==t[0][5]&&(n=t.shift()),t.sort(o.sortFunction),void 0!==n&&t.unshift(n),pre_card=$(e),o.add_backdrop(t,0);for(x in t){var i=t[x][3];if(20>s){var l=t[x][1],r=t[x][0],c="background-image:url('https://img.youtube.com/vi/"+l+"/hqdefault.jpg');",d=t[x][4],u=pre_card;1==t[x][5]?(u.find(".pin").attr("style","display:block;"),u.find(".card").attr("title","Pinned!")):(u.find(".pin").attr("style","display:none;"),u.find(".card").attr("title","")),u.find(".chan-name").text(i),u.find(".chan-name").attr("title",i),u.find(".chan-views").text(r),u.find(".chan-songs").text(d),u.find(".chan-bg").attr("style",c),u.find(".chan-link").attr("href",i),$("#channels").append(u.html())}a+="<option value='"+i+"'> ",s++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=a,$("#channels").fadeIn(800),$("#search").focus()},sortFunction:function(e,t){var o=e[0],n=t[0],a=e[4],s=t[4];return n>o?1:o>n?-1:s>a?1:a>s?-1:0},getCookie:function(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var a=o[n];" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},add_backdrop:function(e,t){(t>=e.length||t>=8)&&(t=0);var n=e[t][1];void 0!==o.blob_list[t]?($("#mega-background").css("opacity",0),$(".room-namer").css("opacity",0),setTimeout(function(){$("#mega-background").css("background","url(data:image/png;base64,"+o.blob_list[t]+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$("#search").attr("placeholder",e[t][3]),$(".room-namer").css("opacity",1)},500)):$.ajax({type:"POST",data:{id:n},url:"/php/imageblob.php",success:function(n){o.blob_list.push(n),$("#mega-background").css("opacity",0),setTimeout(function(){$("#mega-background").css("background","url(data:image/png;base64,"+n+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$("#search").attr("placeholder",e[t][3])},500)}}),setTimeout(function(){o.add_backdrop(e,t+1)},6e3)}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){"#donation"==window.location.hash&&$("#donation").openModal(),e=$("#channel-list-container").html(),window.list_html=e,$("#channels").empty();var n=io.connect("//"+window.location.hostname+":8880");n.emit("frontpage_lists"),n.on("playlists",function(e){o.populate_channels(e)}),window.socket=n;var a=0;if(document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),navigator.userAgent.toLowerCase().indexOf("android")>-1&&""==o.getCookie("show_prompt")){var s=confirm("Do you want to download the native app for this webpage?");if(s)window.location.href="https://play.google.com/store/apps/details?id=no.lqasse.zoff";else{var i=new Date;i.setTime(i.getTime()+864e6);var l="expires="+i.toUTCString();document.cookie="show_prompt=false;"+l}}t=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,t=$.parseJSON(t),$("#latest-commit").html("Latest Commit: <br>"+t[0].commit.author.date.substring(0,10)+": "+t[0].committer.login+"<br><a href='"+t[0].html_url+"'>"+t[0].sha.substring(0,10)+"</a>: "+t[0].commit.message+"<br")})}();

4
static/dist/main.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

BIN
static/font/futura.woff Normal file

Binary file not shown.

BIN
static/font/futura.woff2 Normal file

Binary file not shown.

View File

@@ -16,6 +16,8 @@ function getCookie(cname) {
var Nochan = {
blob_list: [],
populate_channels: function(lists)
{
var output = "";
@@ -30,6 +32,8 @@ var Nochan = {
}
pre_card = $(list_html);
Nochan.add_backdrop(lists, 0);
for(x in lists)
{
@@ -101,6 +105,50 @@ var Nochan = {
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
},
add_backdrop: function(list, i) {
if(i >= list.length || i >= 8) i = 0;
var id = list[i][1];
if(Nochan.blob_list[i] !== undefined){
$("#mega-background").css("opacity", 0);
$(".room-namer").css("opacity", 0);
setTimeout(function(){
$("#mega-background").css("background", "url(data:image/png;base64,"+Nochan.blob_list[i]+")");
$("#mega-background").css("background-size" , "200%");
$("#mega-background").css("opacity", 1);
$("#search").attr("placeholder", list[i][3]);
$(".room-namer").css("opacity", 1);
},500);
}else{
$.ajax({
type: "POST",
data: {id:id},
url: "/php/imageblob.php",
success: function(data){
Nochan.blob_list.push(data);
//data will contain the vote count echoed by the controller i.e.
$("#mega-background").css("opacity", 0);
//$(".room-namer").css("opacity", 0);
setTimeout(function(){
$("#mega-background").css("background", "url(data:image/png;base64,"+data+")");
$("#mega-background").css("background-size" , "200%");
$("#mega-background").css("opacity", 1);
$("#search").attr("placeholder", list[i][3]);
//$(".room-namer").css("opacity", 1);
},500);
//then append the result where ever you want like
//$("span#votes_number").html(data); //data will be containing the vote count which you have echoed from the controller
}
});
}
setTimeout(function(){
Nochan.add_backdrop(list, i+1);
},6000);
}