Removing toasts when new toasts appear, and added a small fix for w3cvalidator

This commit is contained in:
Kasper Rynning-Tønnesen
2017-02-22 22:55:30 +01:00
parent 4efa995599
commit 7f23474b6d
11 changed files with 50 additions and 32 deletions

View File

@@ -91,6 +91,7 @@ var Admin = {
msg="Seems the song you want is already playing. No fooling the system!";
break;
}
before_toast();
Materialize.toast(msg, 4000);
},
@@ -167,6 +168,7 @@ var Admin = {
},
log_out: function(){
before_toast();
if(Crypt.get_pass(chan.toLowerCase())){
Crypt.remove_pass(chan.toLowerCase());
Admin.display_logged_out();

View File

@@ -423,8 +423,10 @@ function initfp(){
}
//window.channel_list = channel_list;
if(!localStorage.ok_cookie)
if(!localStorage.ok_cookie){
before_toast();
Materialize.toast("We're using cookies to enhance your experience! <a class='waves-effect waves-light btn light-green' href='#' id='cookieok' style='cursor:pointer;pointer-events:all;'> ok</a>", 10000);
}
var pad = 0;
document.getElementById("zicon").addEventListener("click", function(){

View File

@@ -265,8 +265,7 @@ var List = {
} else {
$("#wrapper").children().slice(List.page - List.can_fit, List.page).show();
$("#wrapper").children().slice(List.page, List.page + List.can_fit).hide();
List.page = List.page - List.can_fit;
//$("#wrapper").scrollTop(0);
List.page = List.page - List.can_fit < 0 ? 0 : List.page - List.can_fit;
if(List.page == 0 && $(".prev_page").css("display") != "none"){
$(".prev_page").css("display", "none");
$(".prev_page_hide").css("display", "inline-flex");
@@ -286,6 +285,7 @@ var List = {
$(".last_page_hide").css("display", "none");
$(".last_page").css("display", "inline-flex");
}
}
$("#pageNumber").html((List.page / List.can_fit) + 1);
},
@@ -847,7 +847,7 @@ var List = {
song.find(".card").css("display", "none");
}
attr = ".vote-container";
del_attr = "del";
del_attr = "delete_button";
var _temp_duration = Helper.secondsToOther(_song_info.duration);
song.find(".card-duration").text(Helper.pad(_temp_duration[0]) + ":" + Helper.pad(_temp_duration[1]));
@@ -864,7 +864,7 @@ var List = {
song.find(".vote-container").attr("class", "clickable add-suggested");
song.find(".add-suggested").attr("title", video_title);
song.find("#del").attr("id", del_attr);
song.find(".delete_button").addClass(del_attr);
song.find(attr).attr("data-video-title", video_title);
song.find(attr).attr("data-video-length", _song_info.length);
song.find("#list-song").attr("id", "suggested-" + video_id);
@@ -878,7 +878,7 @@ var List = {
song.find(attr).attr("data-video-id", video_id);
song.find(".list-image").attr(image_attr,video_thumb);
song.find(".list-suggested-image").attr(image_attr,video_thumb);
song.find("#"+del_attr).attr("data-video-id", video_id);
song.find("."+del_attr).attr("data-video-id", video_id);
//song.find("#del").attr("onclick", "vote('"+video_id+"', 'del')");
return song.html();

View File

@@ -1140,6 +1140,7 @@ $(document).on("submit", "#listImport", function(e){
$("#import").addClass("hide");
$("#playlist_loader").removeClass("hide");
} else {
before_toast();
Materialize.toast("It seems you've entered a invalid url.", 4000);
}
document.getElementById("import").value = "";
@@ -1161,6 +1162,7 @@ $(document).on("submit", "#listImportSpotify", function(e){
Search.importSpotifyPlaylist('https://api.spotify.com/v1/users/' + user + '/playlists/' + playlist_id + '/tracks');
} else {
before_toast();
Materialize.toast("It seems you've entered a invalid url.", 4000);
}
}
@@ -1403,7 +1405,7 @@ $(document).on( "click", ".vote-container", function(e){
List.vote(id, "pos");
});
$(document).on( "click", "#del", function(e){
$(document).on( "click", ".delete_button", function(e){
var id = $(this).attr("data-video-id");
List.vote(id, "del");
});
@@ -1418,13 +1420,13 @@ $(document).on( "click", ".add-suggested", function(e){
$("#suggested-" + id).remove();
});
$(document).on( "click", "#del_suggested", function(e){
$(document).on( "click", ".del_suggested", function(e){
var id = $(this).attr("data-video-id");
$("#suggested-" + id).remove();
});
$(document).on( "click", "#del_user_suggested", function(e){
$(document).on( "click", ".del_user_suggested", function(e){
var id = $(this).attr("data-video-id");
$("#suggested-" + id).remove();
List.vote(id, "del");
@@ -1550,6 +1552,10 @@ function share_link_modifier_channel(){
$("#qr-code-image-link").attr("src", "//chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.no/" + chan.toLowerCase() + "&choe=UTF-8&chld=L%7C1");
}
function before_toast(){
$("#toast-container").remove();
}
function onepage_load(){
var url_split = window.location.href.split("/");

View File

@@ -315,6 +315,7 @@ var Search = {
document.getElementById("import").disabled = false;
$("#playlist_loader").addClass("hide");
$("#import").removeClass("hide");
before_toast();
Materialize.toast("It seems you've entered a invalid url.", 4000);
}
@@ -356,6 +357,7 @@ var Search = {
document.getElementById("import_spotify").disabled = false;
$("#import_spotify").removeClass("hide");
$("#playlist_loader_spotify").addClass("hide");
before_toast();
Materialize.toast("It seems you've entered a invalid url.", 4000);
}
});