mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
More info on suggested songs
This commit is contained in:
@@ -2007,7 +2007,7 @@ nav ul li:hover, nav ul li.active {
|
||||
}
|
||||
|
||||
.add-suggested .card-content .list-title{
|
||||
line-height: 3.5rem;
|
||||
/*line-height: 3.5rem;*/
|
||||
}
|
||||
|
||||
.card-image{cursor:pointer}
|
||||
|
||||
@@ -32,6 +32,8 @@ var Channel = {
|
||||
}
|
||||
//Player.soundcloud_player = document.querySelector("#soundcloud_player");
|
||||
}
|
||||
|
||||
List.calculate_song_heights();
|
||||
Admin.logged_in = false;
|
||||
Admin.display_logged_out();
|
||||
number_suggested = 0;
|
||||
|
||||
@@ -152,9 +152,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
populate_list: function(msg, no_reset) {
|
||||
if(document.querySelector("#wrapper") == null) return;
|
||||
// This math is fucked and I don't know how it works. Should be fixed sometime
|
||||
calculate_song_heights: function(){
|
||||
if(!Helper.mobilecheck() && !embed && !client){
|
||||
List.can_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71);
|
||||
List.element_height = (Helper.computedStyle("#wrapper", "height") / List.can_fit)-5.3;
|
||||
@@ -174,6 +172,11 @@ var List = {
|
||||
List.can_fit = Math.round((window.innerHeight - Helper.computedStyle(".tabs", "height") - Helper.computedStyle("header", "height") - 64 - 40) / 71);
|
||||
List.element_height = ((window.innerHeight - Helper.computedStyle(".tabs", "height") - Helper.computedStyle("header", "height") - 64 - 40) / List.can_fit)-5;
|
||||
}
|
||||
},
|
||||
|
||||
populate_list: function(msg, no_reset) {
|
||||
if(document.querySelector("#wrapper") == null) return;
|
||||
// This math is fucked and I don't know how it works. Should be fixed sometime
|
||||
if(list_html === undefined) list_html = Helper.html("#list-song-html");
|
||||
full_playlist = msg;
|
||||
if(offline && !no_reset){
|
||||
@@ -1107,6 +1110,7 @@ var List = {
|
||||
var _temp_duration = Helper.secondsToOther(_song_info.duration);
|
||||
song.querySelector(".card-duration").innerText = Helper.pad(_temp_duration[0]) + ":" + Helper.pad(_temp_duration[1]);
|
||||
}else if(!list){
|
||||
|
||||
//song.querySelector(".card-duration").remove();
|
||||
//song.querySelector(".list-song").removeClass("playlist-element");
|
||||
//song.querySelector(".more_button").addClass("hide");
|
||||
@@ -1124,6 +1128,18 @@ var List = {
|
||||
song.querySelector(".vote-container").setAttribute("class", "clickable add-suggested");
|
||||
song.querySelector(".add-suggested").setAttribute("title", video_title);
|
||||
//Helper.addClass(song.querySelector(".delete_button"), del_attr);
|
||||
|
||||
song.querySelector(".list-votes").innerText = _song_info.extra;
|
||||
if(_song_info.extra == "Added") {
|
||||
var date = new Date(video_votes * 1000);
|
||||
song.querySelector(".vote-text").innerText = Helper.pad(date.getHours()) + ":"
|
||||
+ Helper.pad(date.getMinutes()) + " - "
|
||||
+ Helper.pad(date.getDate()) + "."
|
||||
+ Helper.pad(date.getMonth()) + "."
|
||||
+ Helper.pad((date.getYear()-100));
|
||||
} else if(_song_info.extra == "Views") {
|
||||
song.querySelector(".vote-text").innerText = video_votes.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
song.querySelector(attr).setAttribute("data-video-title", video_title);
|
||||
song.querySelector(attr).setAttribute("data-video-length", _song_info.length);
|
||||
song.querySelector(attr).setAttribute("data-added-by", added_by);
|
||||
|
||||
@@ -30,7 +30,7 @@ var Suggestions = {
|
||||
var duration = Helper.secondsToOther(params.duration);
|
||||
var video_id = params.id;
|
||||
var video_title = params.title;
|
||||
var toSend = {id: video_id, title: video_title, length: params.duration, duration: duration};
|
||||
var toSend = {id: video_id, title: video_title, length: params.duration, duration: duration, votes: params.added, extra: "Added"};
|
||||
if(params.source) toSend.source = params.source;
|
||||
if(params.thumbnail) toSend.thumbnail = params.thumbnail;
|
||||
var song = List.generateSong(toSend, false, false, false, true);
|
||||
@@ -54,7 +54,7 @@ var Suggestions = {
|
||||
Helper.removeClass("#suggest-song-html", "hide");
|
||||
}
|
||||
var get_url = "https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId="+id+"&type=video&key="+api_key.youtube;
|
||||
var video_urls = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+api_key.youtube+"&id=";
|
||||
var video_urls = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id,statistics&key="+api_key.youtube+"&id=";
|
||||
|
||||
Helper.ajax({
|
||||
type: "GET",
|
||||
@@ -86,7 +86,7 @@ var Suggestions = {
|
||||
var video_title = song.snippet.title;
|
||||
|
||||
try {
|
||||
document.getElementById("suggest-song-html").insertAdjacentHTML("beforeend", List.generateSong({id: video_id, title: video_title, length: length, duration: duration}, false, false, false));
|
||||
document.getElementById("suggest-song-html").insertAdjacentHTML("beforeend", List.generateSong({id: video_id, title: video_title, length: length, duration: duration, votes: song.statistics.viewCount, extra: "Views"}, false, false, false));
|
||||
} catch(e) {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user