Removed all global functions

This commit is contained in:
Kasper Rynning-Tønnesen
2015-12-10 20:23:30 +01:00
parent 25ce1db098
commit d9e2f7ab6c
6 changed files with 51 additions and 17 deletions

View File

@@ -219,10 +219,12 @@ var List = {
song.find(".list-title").text(video_title);
song.find(".list-title").attr("title", video_title);
song.find(".list-votes").text(video_votes);
song.find(".vote-container").attr("onclick", "vote('"+video_id+"','pos')");
//song.find(".vote-container").attr("onclick", "vote('"+video_id+"','pos')");
song.find(".vote-container").attr("data-video-id", video_id);
song.find(".list-image").attr(image_attr,video_thumb);
song.find("#list-song").attr("id", video_id);
song.find("#del").attr("onclick", "vote('"+video_id+"', 'del')");
song.find("#del").attr("data-video-id", video_id);
//song.find("#del").attr("onclick", "vote('"+video_id+"', 'del')");
return song.html();
},

View File

@@ -53,9 +53,9 @@ socket.on("get_list", function(){
$(document).ready(function()
{
window.vote = List.vote;
window.submit = Search.submit;
window.submitAndClose = Search.submitAndClose;
//window.vote = List.vote;
//window.submit = Search.submit;
//window.submitAndClose = Search.submitAndClose;
if(!localStorage["list_update"] || localStorage["list_update"] != "13.06.15")
{
@@ -98,7 +98,6 @@ $(document).ready(function()
document.getElementById("search").blur();
Youtube.readyLooks();
}else{
Chat.setup_chat_listener(chan);
Chat.allchat_listener();
Hostcontroller.host_listener();
@@ -243,6 +242,7 @@ $(".chat-tab").click(function(){
$("#text-chat-input").focus();
});
$("#skip").on("click", function(){
List.skip();
});
@@ -282,4 +282,30 @@ $("#admin-lock").on("click", function()
$("#closeSettings").on("click", function()
{
Admin.hide_settings();
});
$("#results").on( "click", "#temp-results", function(e){
if($(e.target).html() != $("<i class='mdi-av-playlist-add'></i>").html()){
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length")
Search.submitAndClose(id, title, length);
}
});
$("#results").on( "click", "#add-many", function(e){
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length")
Search.submit(id, title, length);
});
$("#wrapper").on( "click", ".vote-container", function(e){
var id = $(this).attr("data-video-id");
List.vote(id, "pos");
});
$("#wrapper").on( "click", "#del", function(e){
var id = $(this).attr("data-video-id");
List.vote(id, "del");
});

View File

@@ -81,8 +81,14 @@ var Search = {
songs.find(".search-title").text(title);
songs.find(".result_info").text(duration);
songs.find(".thumb").attr("data-original", thumb);
songs.find(".add-many").attr("onclick", "submit('"+id+"','"+enc_title+"',"+secs+");");
$($(songs).find("div")[0]).attr("onclick", "submitAndClose('"+id+"','"+enc_title+"',"+secs+");");
//songs.find(".add-many").attr("onclick", "submit('"+id+"','"+enc_title+"',"+secs+");");
songs.find("#add-many").attr("data-video-id", id);
songs.find("#add-many").attr("data-video-title", enc_title);
songs.find("#add-many").attr("data-video-length", secs);
//$($(songs).find("div")[0]).attr("onclick", "submitAndClose('"+id+"','"+enc_title+"',"+secs+");");
songs.find("#temp-results").attr("data-video-id", id);
songs.find("#temp-results").attr("data-video-title", enc_title);
songs.find("#temp-results").attr("data-video-length", secs);
//$($(songs).find("div")[0]).attr("id", id)
output += songs.html();