From d5ce1020b2e4a292ae5a396b0ac5734952ae4fde Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 11 Apr 2013 12:51:08 -0500 Subject: [PATCH] Add mute function, tweak playlist button display --- www/assets/js/callbacks.js | 3 + www/assets/js/client.js | 13 ++- www/assets/js/functions.js | 231 ++++++++++++++++++++----------------- 3 files changed, 138 insertions(+), 109 deletions(-) diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index f9395e49..fddd96f0 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -124,6 +124,9 @@ function initCallbacks() { }); socket.on("chatMsg", function(data) { + if(IGNORED.indexOf(data.username) != -1) { + return; + } var div = formatChatMessage(data); div.appendTo($("#messagebuffer")); // Cap chatbox at most recent 100 messages diff --git a/www/assets/js/client.js b/www/assets/js/client.js index 3f30e15f..5c0415e6 100644 --- a/www/assets/js/client.js +++ b/www/assets/js/client.js @@ -1,11 +1,11 @@ /* The MIT License (MIT) Copyright (c) 2013 Calvin Montgomery - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @@ -27,6 +27,7 @@ var PAGETITLE = "Sync"; var TITLE_BLINK; var VWIDTH = "670"; var VHEIGHT = "377"; +var IGNORED = []; var uname = readCookie("sync_uname"); var pw = readCookie("sync_pw"); @@ -46,7 +47,7 @@ catch(e) { handleDisconnect(); } -$(window).focus(function() { +$(window).focus(function() { FOCUSED = true; onWindowFocus(); }) @@ -245,7 +246,7 @@ $("#chatline").keydown(function(ev) { CHATHISTIDX--; $("#chatline").val(CHATHIST[CHATHISTIDX]); } - + ev.preventDefault(); return false; } @@ -254,7 +255,7 @@ $("#chatline").keydown(function(ev) { CHATHISTIDX++; $("#chatline").val(CHATHIST[CHATHISTIDX]); } - + ev.preventDefault(); return false; } diff --git a/www/assets/js/functions.js b/www/assets/js/functions.js index 992c5809..fe704184 100644 --- a/www/assets/js/functions.js +++ b/www/assets/js/functions.js @@ -22,8 +22,7 @@ function addUser(name, rank, leader) { var flair = $("").appendTo(div); var nametag = $("").text(name).appendTo(div); fmtUserlistItem(div[0], rank, leader); - if(RANK >= Rank.Moderator) - addUserDropdown(div, name); + addUserDropdown(div, name); var users = $("#userlist").children(); for(var i = 0; i < users.length; i++) { var othername = users[i].children[1].innerHTML; @@ -58,66 +57,90 @@ function fmtUserlistItem(div, rank, leader) { // Adds a dropdown with user actions (promote/demote/leader) function addUserDropdown(entry, name) { + $(entry).find("dropdown").remove(); var div = $("
").addClass("dropdown").appendTo(entry); var ul = $("