Added function for pinning playlists during festivities

This commit is contained in:
Kasper Rynning-Tønnesen
2015-11-13 16:30:02 +01:00
parent 9dca29648e
commit 30b6c2b888
7 changed files with 34 additions and 5 deletions

View File

@@ -106,6 +106,7 @@ if(isset($_GET['chan'])){
<a class="chan-link"> <a class="chan-link">
<div class="chan-bg card-image cardbg"></div> <div class="chan-bg card-image cardbg"></div>
<div class="card-content"> <div class="card-content">
<i class="mdi-action-star-rate pin"></i>
<p class="left-align"> <p class="left-align">
<span class="chan-name flow-text truncate"></span> <span class="chan-name flow-text truncate"></span>
<br> <br>

View File

@@ -138,11 +138,16 @@ io.on('connection', function(socket){
{ {
var id = list[0]["id"]; var id = list[0]["id"];
var title = list[0]["title"]; var title = list[0]["title"];
var pinned = 0;
if(conf[0].pinned == 1) pinned = 1;
try{ try{
var viewers = lists[name].length; var viewers = lists[name].length;
}catch(err){var viewers = 0;} }catch(err){var viewers = 0;}
var to_push = [viewers, id, title, name, count]; var to_push = [viewers, id, title, name, count, pinned];
if(conf[0]["frontpage"]) if(conf[0].pinned == 1)
{
playlists_to_send.unshift(to_push);
}else if(conf[0]["frontpage"])
playlists_to_send.push(to_push); playlists_to_send.push(to_push);
} }
if(curr == tot) if(curr == tot)

View File

@@ -78,6 +78,12 @@ input[type=text]:focus:not([readonly]) + label, input[type=password]:focus:not([
color: #2D2D2D; color: #2D2D2D;
} }
.pin {
position:absolute;
right:10px;
font-size:25px;
}
.field-settings{ .field-settings{
margin-left: 25px !important; margin-left: 25px !important;
color: rgb(68,68,68); color: rgb(68,68,68);

View File

@@ -1 +1 @@
!function(){var e,t,o={populate_channels:function(t){var n="",a=0;t.sort(o.sortFunction),pre_card=$(e);for(x in t){var i=t[x][3];if(20>a){var s=t[x][1],l=t[x][0],r="background-image:url('https://img.youtube.com/vi/"+s+"/hqdefault.jpg');",c=t[x][4],d=pre_card;d.find(".chan-name").text(i),d.find(".chan-name").attr("title",i),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",i),$("#channels").append(d.html())}n+="<option value='"+i+"'> ",a++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=n,$("#channels").fadeIn(800),$("#search").focus()},sortFunction:function(e,t){var o=e[0],n=t[0],a=e[4],i=t[4];return n>o?1:o>n?-1:i>a?1:a>i?-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)});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 i=confirm("Do you want to download the native app for this webpage?");if(i)window.location.href="https://play.google.com/store/apps/details?id=no.lqasse.zoff";else{var s=new Date;s.setTime(s.getTime()+864e6);var l="expires="+s.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={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)});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")})}();

File diff suppressed because one or more lines are too long

BIN
static/images/pin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

View File

@@ -20,8 +20,14 @@ var Nochan = {
{ {
var output = ""; var output = "";
var num = 0; var num = 0;
var pinned;
if(lists[0][5] == 1){
pinned = lists.shift();
}
lists.sort(Nochan.sortFunction); lists.sort(Nochan.sortFunction);
if(pinned !== undefined){
lists.unshift(pinned);
}
pre_card = $(list_html); pre_card = $(list_html);
for(x in lists) for(x in lists)
@@ -38,6 +44,17 @@ var Nochan = {
//$("#channels").append(list_html); //$("#channels").append(list_html);
var card = pre_card; var card = pre_card;
if(lists[x][5] == 1)
{
card.find(".pin").attr("style", "display:block;");
card.find(".card").attr("title", "Pinned!");
}
else
{
card.find(".pin").attr("style", "display:none;");
card.find(".card").attr("title", "");
}
card.find(".chan-name").text(chan); card.find(".chan-name").text(chan);
card.find(".chan-name").attr("title", chan); card.find(".chan-name").attr("title", chan);
card.find(".chan-views").text(viewers); card.find(".chan-views").text(viewers);