Way of notifying admins of suggested songs, closes #140

This commit is contained in:
Kasper Rynning-Tønnesen
2017-03-03 10:49:06 +01:00
parent 60b2016fdf
commit df44f83341
8 changed files with 73 additions and 20 deletions

View File

@@ -523,6 +523,15 @@ span.badge.new.white{
margin-left: -15px; margin-left: -15px;
} }
.suggested-link span.badge.new.white{
min-width: initial;
margin-left: 0px;
}
.suggested-link span.badge:after{
content: "";
}
input[type=text]:focus:not([readonly]), input[type=password]:focus:not([readonly]), input[type=email]:focus:not([readonly]), input[type=url]:focus:not([readonly]), input[type=time]:focus:not([readonly]), input[type=date]:focus:not([readonly]), input[type=datetime-local]:focus:not([readonly]), input[type=tel]:focus:not([readonly]), input[type=number]:focus:not([readonly]), input[type=search]:focus:not([readonly]), textarea.materialize-textarea:focus:not([readonly]) { input[type=text]:focus:not([readonly]), input[type=password]:focus:not([readonly]), input[type=email]:focus:not([readonly]), input[type=url]:focus:not([readonly]), input[type=time]:focus:not([readonly]), input[type=date]:focus:not([readonly]), input[type=datetime-local]:focus:not([readonly]), input[type=tel]:focus:not([readonly]), input[type=number]:focus:not([readonly]), input[type=search]:focus:not([readonly]), textarea.materialize-textarea:focus:not([readonly]) {
border-bottom: 1px solid #9D9D9D; border-bottom: 1px solid #9D9D9D;
box-shadow: 0 1px 0 0 #9D9D9D; box-shadow: 0 1px 0 0 #9D9D9D;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -83,11 +83,11 @@ var Chat = {
$("#favicon").attr("href", "public/images/highlogo.png"); $("#favicon").attr("href", "public/images/highlogo.png");
unseen = true; unseen = true;
chat_unseen = true; chat_unseen = true;
if($("span.badge.new.white").hasClass("hide")){ if($(".chat-link span.badge.new.white").hasClass("hide")){
$("span.badge.new.white").removeClass("hide"); $(".chat-link span.badge.new.white").removeClass("hide");
} }
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received; var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
$("span.badge.new.white").html(to_display); $(".chat-link span.badge.new.white").html(to_display);
//if(!blinking) Chat.chat_blink(); //if(!blinking) Chat.chat_blink();
//blink_interval = setTimeout(Chat.chat_blink, 2000); //blink_interval = setTimeout(Chat.chat_blink, 2000);
} }
@@ -123,11 +123,11 @@ var Chat = {
chat_unseen = true; chat_unseen = true;
Chat.channel_received += 1; Chat.channel_received += 1;
//blink_interval = setTimeout(Chat.chat_blink, 1000); //blink_interval = setTimeout(Chat.chat_blink, 1000);
if($("span.badge.new.white").hasClass("hide")){ if($(".chat-link span.badge.new.white").hasClass("hide")){
$("span.badge.new.white").removeClass("hide"); $(".chat-link span.badge.new.white").removeClass("hide");
} }
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received; var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
$("span.badge.new.white").html(to_display); $(".chat-link span.badge.new.white").html(to_display);
} }
if($("#chatchannel").children().length > 100){ if($("#chatchannel").children().length > 100){

View File

@@ -301,6 +301,19 @@ var List = {
if(now_playing){ if(now_playing){
full_playlist.push(now_playing); full_playlist.push(now_playing);
} }
if($("#suggested-"+added.id).length > 0) {
number_suggested = number_suggested - 1;
if(number_suggested < 0) number_suggested = 0;
var to_display = number_suggested > 9 ? "9+" : number_suggested;
if(!$(".suggested-link span.badge.new.white").hasClass("hide") && to_display == 0){
$(".suggested-link span.badge.new.white").addClass("hide");
}
$(".suggested-link span.badge.new.white").text(to_display);
}
$("#suggested-"+added.id).remove(); $("#suggested-"+added.id).remove();
if(List.empty){ if(List.empty){
List.empty = false; List.empty = false;
@@ -855,18 +868,20 @@ var List = {
//song.find(".card-duration").remove(); //song.find(".card-duration").remove();
song.find(".vote-text").text(""); song.find(".vote-text").text("");
song.find(".card-duration").text(Helper.pad(_song_info.duration[0]) + ":" + Helper.pad(_song_info.duration[1])); song.find(".card-duration").text(Helper.pad(_song_info.duration[0]) + ":" + Helper.pad(_song_info.duration[1]));
var added_by = "user";
attr = ".add-suggested"; attr = ".add-suggested";
if(user) if(user){
del_attr = "del_user_suggested"; del_attr = "del_user_suggested";
else } else{
del_attr = "del_suggested"; del_attr = "del_suggested";
added_by = "system";
}
song.find(".vote-container").attr("class", "clickable add-suggested"); song.find(".vote-container").attr("class", "clickable add-suggested");
song.find(".add-suggested").attr("title", video_title); song.find(".add-suggested").attr("title", video_title);
song.find(".delete_button").addClass(del_attr); song.find(".delete_button").addClass(del_attr);
song.find(attr).attr("data-video-title", video_title); song.find(attr).attr("data-video-title", video_title);
song.find(attr).attr("data-video-length", _song_info.length); song.find(attr).attr("data-video-length", _song_info.length);
song.find(attr).attr("data-added-by", added_by);
song.find("#list-song").attr("id", "suggested-" + video_id); song.find("#list-song").attr("id", "suggested-" + video_id);
song.find(".list-image").attr("class", song.find(".list-image").attr("class").replace("list-image", "list-suggested-image")); song.find(".list-image").attr("class", song.find(".list-image").attr("class").replace("list-image", "list-suggested-image"));

View File

@@ -45,6 +45,7 @@ var find_start = false;
var find_started = false; var find_started = false;
var offline = false; var offline = false;
var cast_ready_connect = false; var cast_ready_connect = false;
var number_suggested = 0;
var prev_chan_list = ""; var prev_chan_list = "";
var prev_chan_player = ""; var prev_chan_player = "";
var chromecastReady = false; var chromecastReady = false;
@@ -1314,8 +1315,8 @@ $(document).on("click", ".chat-link", function(){
//blink_interval_exists = false; //blink_interval_exists = false;
Chat.channel_received = 0; Chat.channel_received = 0;
Chat.all_received = 0; Chat.all_received = 0;
if(!$("span.badge.new.white").hasClass("hide")){ if(!$(".chat-link span.badge.new.white").hasClass("hide")){
$("span.badge.new.white").addClass("hide"); $(".chat-link span.badge.new.white").addClass("hide");
} }
unseen = false; unseen = false;
$("#favicon").attr("href", "public/images/favicon.png"); $("#favicon").attr("href", "public/images/favicon.png");
@@ -1522,8 +1523,19 @@ $(document).on( "click", ".add-suggested", function(e){
var id = $(this).attr("data-video-id"); var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title"); var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length"); var length = $(this).attr("data-video-length");
var added_by = $(this).attr("data-added-by");
Search.submit(id, title, length); Search.submit(id, title, length);
if(added_by == "user") {
number_suggested = number_suggested - 1;
if(number_suggested < 0) number_suggested = 0;
var to_display = number_suggested > 9 ? "9+" : number_suggested;
if(!$(".suggested-link span.badge.new.white").hasClass("hide") && to_display == 0){
$(".suggested-link span.badge.new.white").addClass("hide");
}
$(".suggested-link span.badge.new.white").text(to_display);
}
$("#suggested-" + id).remove(); $("#suggested-" + id).remove();
}); });
@@ -1536,6 +1548,17 @@ $(document).on( "click", ".del_suggested", function(e){
$(document).on( "click", ".del_user_suggested", function(e){ $(document).on( "click", ".del_user_suggested", function(e){
var id = $(this).attr("data-video-id"); var id = $(this).attr("data-video-id");
$("#suggested-" + id).remove(); $("#suggested-" + id).remove();
number_suggested = number_suggested - 1;
if(number_suggested < 0) number_suggested = 0;
var to_display = number_suggested > 9 ? "9+" : number_suggested;
if(!$(".suggested-link span.badge.new.white").hasClass("hide") && to_display == 0){
$(".suggested-link span.badge.new.white").addClass("hide");
}
$(".suggested-link span.badge.new.white").text(to_display);
List.vote(id, "del"); List.vote(id, "del");
}); });

View File

@@ -1,6 +1,12 @@
var Suggestions = { var Suggestions = {
catchUserSuggests: function(params, single){ catchUserSuggests: function(params, single){
number_suggested = number_suggested + params.length;
var to_display = number_suggested > 9 ? "9+" : number_suggested;
if($(".suggested-link span.badge.new.white").hasClass("hide")){
$(".suggested-link span.badge.new.white").removeClass("hide");
}
$(".suggested-link span.badge.new.white").text(to_display);
if(single){ if(single){
Suggestions.createSuggested(params); Suggestions.createSuggested(params);
}else{ }else{

View File

@@ -204,7 +204,7 @@
</ul> </ul>
<ul class="tabs playlist-tabs-loggedIn hide tabs-fixed-width" style="width: 96%;"> <ul class="tabs playlist-tabs-loggedIn hide tabs-fixed-width" style="width: 96%;">
<li class="tab col s3"><a class="playlist-tab-links playlist-link active truncate" href="#wrapper">Playlist</a></li> <li class="tab col s3"><a class="playlist-tab-links playlist-link active truncate" href="#wrapper">Playlist</a></li>
<li class="tab col s3"><a class="playlist-tab-links suggested-link truncate" href="#suggestions">Suggested</a></li> <li class="tab col s3"><a class="playlist-tab-links suggested-link truncate" href="#suggestions">Suggested<span class="new badge white hide"></a></li>
<li class="tab col s3"><a class="playlist-tab-links chat-link truncate" href="#chat">Chat<span class="new badge white hide"></span></a></li> <li class="tab col s3"><a class="playlist-tab-links chat-link truncate" href="#chat">Chat<span class="new badge white hide"></span></a></li>
</ul> </ul>
<div id="find_div" class="hide"> <div id="find_div" class="hide">