Eliminate jQuery event shorthands

This commit is contained in:
Xaekai 2022-01-22 16:18:51 -08:00 committed by Calvin Montgomery
parent f929758bfd
commit 7441892235
7 changed files with 129 additions and 119 deletions

View file

@ -60,6 +60,7 @@
"babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-add-module-exports": "^1.0.4",
"coffeescript": "^1.9.2", "coffeescript": "^1.9.2",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-plugin-no-jquery": "^2.7.0",
"mocha": "^9.2.2", "mocha": "^9.2.2",
"sinon": "^10.0.0" "sinon": "^10.0.0"
}, },

View file

@ -21,7 +21,7 @@ window.CustomEmbedPlayer = class CustomEmbedPlayer extends EmbedPlayer
.removeClass('col-md-12') .removeClass('col-md-12')
$('<button/>').addClass('btn btn-default') $('<button/>').addClass('btn btn-default')
.text('Embed') .text('Embed')
.click(=> .on('click', =>
super(data) super(data)
) )
.appendTo(alert.find('.alert')) .appendTo(alert.find('.alert'))

View file

@ -46,5 +46,14 @@
"getOpt": "writable", "getOpt": "writable",
"setOpt": "writable", "setOpt": "writable",
"socket": "writable" "socket": "writable"
},
"plugins": [
"no-jquery"
],
"extends": [
"plugin:no-jquery/deprecated"
],
"rules": {
"no-jquery/no-event-shorthand": "error"
} }
} }

View file

@ -82,7 +82,7 @@ Callbacks = {
var announcement = makeAlert(data.title, data.text + signature) var announcement = makeAlert(data.title, data.text + signature)
.appendTo($("#announcements")); .appendTo($("#announcements"));
if (data.id) { if (data.id) {
announcement.find(".close").click(function suppressThisAnnouncement() { announcement.find(".close").on('click', function suppressThisAnnouncement() {
CyTube.ui.suppressedAnnouncementId = data.id; CyTube.ui.suppressedAnnouncementId = data.id;
setOpt("suppressed_announcement_id", data.id); setOpt("suppressed_announcement_id", data.id);
}); });
@ -179,7 +179,7 @@ Callbacks = {
$("<button/>").addClass("close pull-right") $("<button/>").addClass("close pull-right")
.appendTo(div) .appendTo(div)
.click(function () { .on('click', function () {
div.parent().remove(); div.parent().remove();
}) })
.html("&times;"); .html("&times;");
@ -444,7 +444,7 @@ Callbacks = {
var li = $("<li/>").appendTo(menu); var li = $("<li/>").appendTo(menu);
$("<a/>").attr("href", "javascript:void(0)") $("<a/>").attr("href", "javascript:void(0)")
.html(disp) .html(disp)
.click(function() { .on('click', function() {
socket.emit("borrow-rank", r); socket.emit("borrow-rank", r);
}) })
.appendTo(li); .appendTo(li);
@ -886,7 +886,7 @@ Callbacks = {
.css("margin-left", "0") .css("margin-left", "0")
.attr("id", "search_clear") .attr("id", "search_clear")
.text("Clear Results") .text("Clear Results")
.click(function() { .on('click', function() {
clearSearchResults(); clearSearchResults();
}) })
.insertBefore($("#library")); .insertBefore($("#library"));
@ -927,11 +927,11 @@ Callbacks = {
var poll = $("<div/>").addClass("well active").prependTo($("#pollwrap")); var poll = $("<div/>").addClass("well active").prependTo($("#pollwrap"));
$("<button/>").addClass("close pull-right").html("&times;") $("<button/>").addClass("close pull-right").html("&times;")
.appendTo(poll) .appendTo(poll)
.click(function() { poll.remove(); }); .on('click', function() { poll.remove(); });
if(hasPermission("pollctl")) { if(hasPermission("pollctl")) {
$("<button/>").addClass("btn btn-danger btn-sm pull-right").text("End Poll") $("<button/>").addClass("btn btn-danger btn-sm pull-right").text("End Poll")
.appendTo(poll) .appendTo(poll)
.click(function() { .on('click', function() {
socket.emit("closePoll") socket.emit("closePoll")
}); });
} }
@ -953,7 +953,7 @@ Callbacks = {
$("<button/>").addClass("btn btn-default btn-sm").text(data.counts[i]) $("<button/>").addClass("btn btn-default btn-sm").text(data.counts[i])
.prependTo($("<div/>").addClass("option").html(data.options[i]) .prependTo($("<div/>").addClass("option").html(data.options[i])
.appendTo(poll)) .appendTo(poll))
.click(callback); .on('click', callback);
})(i); })(i);
} }

View file

@ -34,7 +34,7 @@
var li = $("<li/>").appendTo(ul); var li = $("<li/>").appendTo(ul);
$("<a/>").attr("href", "javascript:void(0)") $("<a/>").attr("href", "javascript:void(0)")
.html("&laquo;") .html("&laquo;")
.click(function () { .on('click', function () {
this.loadPage(0); this.loadPage(0);
}.bind(this)) }.bind(this))
.appendTo(li); .appendTo(li);
@ -57,7 +57,7 @@
li.addClass("active"); li.addClass("active");
$("<a/>").attr("href", "javascript:void(0)") $("<a/>").attr("href", "javascript:void(0)")
.text(i + 1) .text(i + 1)
.click(function () { .on('click', function () {
this.loadPage(i); this.loadPage(i);
}.bind(this)) }.bind(this))
.appendTo(li); .appendTo(li);
@ -75,7 +75,7 @@
var li = $("<li/>").appendTo(ul); var li = $("<li/>").appendTo(ul);
$("<a/>").attr("href", "javascript:void(0)") $("<a/>").attr("href", "javascript:void(0)")
.html("&raquo;") .html("&raquo;")
.click(function () { .on('click', function () {
this.loadPage(pages - 1); this.loadPage(pages - 1);
}.bind(this)) }.bind(this))
.appendTo(li); .appendTo(li);

View file

@ -10,11 +10,11 @@ CyTube.ui.onPageBlur = function (event) {
FOCUSED = false; FOCUSED = false;
}; };
$(window).focus(CyTube.ui.onPageFocus).blur(CyTube.ui.onPageBlur); $(window).on('focus', CyTube.ui.onPageFocus).on('blur', CyTube.ui.onPageBlur);
// See #783 // See #783
$(".modal").focus(CyTube.ui.onPageFocus); $(".modal").on('focus', CyTube.ui.onPageFocus);
$("#togglemotd").click(function () { $("#togglemotd").on('click', function () {
var hidden = $("#motd")[0].style.display === "none"; var hidden = $("#motd")[0].style.display === "none";
$("#motd").toggle(); $("#motd").toggle();
if (hidden) { if (hidden) {
@ -30,7 +30,7 @@ $("#togglemotd").click(function () {
/* chatbox */ /* chatbox */
$("#modflair").click(function () { $("#modflair").on('click', function () {
var m = $("#modflair"); var m = $("#modflair");
if (m.hasClass("label-success")) { if (m.hasClass("label-success")) {
USEROPTS.modhat = false; USEROPTS.modhat = false;
@ -54,7 +54,7 @@ $("#modflair").click(function () {
setOpt('modhat', USEROPTS.modhat); setOpt('modhat', USEROPTS.modhat);
}); });
$("#usercount").mouseenter(function (ev) { $("#usercount").on('mouseenter', function (ev) {
var breakdown = calcUserBreakdown(); var breakdown = calcUserBreakdown();
// re-using profile-box class for convenience // re-using profile-box class for convenience
var popup = $("<div/>") var popup = $("<div/>")
@ -72,7 +72,7 @@ $("#usercount").mouseenter(function (ev) {
popup.html(contents); popup.html(contents);
}); });
$("#usercount").mousemove(function (ev) { $("#usercount").on('mousemove', function (ev) {
var popup = $("#usercount").find(".profile-box"); var popup = $("#usercount").find(".profile-box");
if(popup.length == 0) if(popup.length == 0)
return; return;
@ -81,11 +81,11 @@ $("#usercount").mousemove(function (ev) {
popup.css("left", (ev.clientX) + "px"); popup.css("left", (ev.clientX) + "px");
}); });
$("#usercount").mouseleave(function () { $("#usercount").on('mouseleave', function () {
$("#usercount").find(".profile-box").remove(); $("#usercount").find(".profile-box").remove();
}); });
$("#messagebuffer").scroll(function (ev) { $("#messagebuffer").on('scroll', function (ev) {
if (IGNORE_SCROLL_EVENT) { if (IGNORE_SCROLL_EVENT) {
// Skip event, this was triggered by scrollChat() and not by a user action. // Skip event, this was triggered by scrollChat() and not by a user action.
// Reset for next event. // Reset for next event.
@ -109,7 +109,7 @@ $("#messagebuffer").scroll(function (ev) {
} }
}); });
$("#guestname").keydown(function (ev) { $("#guestname").on('keydown', function (ev) {
if (ev.keyCode === 13) { if (ev.keyCode === 13) {
socket.emit("login", { socket.emit("login", {
name: $("#guestname").val() name: $("#guestname").val()
@ -165,7 +165,7 @@ function chatTabComplete(chatline) {
chatline.setSelectionRange(result.newPosition, result.newPosition); chatline.setSelectionRange(result.newPosition, result.newPosition);
} }
$("#chatline").keydown(function(ev) { $("#chatline").on('keydown', function(ev) {
// Enter/return // Enter/return
if(ev.keyCode == 13) { if(ev.keyCode == 13) {
if (CHATTHROTTLE) { if (CHATTHROTTLE) {
@ -229,10 +229,10 @@ $("#chatline").keydown(function(ev) {
}); });
/* poll controls */ /* poll controls */
$("#newpollbtn").click(showPollMenu); $("#newpollbtn").on('click', showPollMenu);
/* search controls */ /* search controls */
$("#library_search").click(function() { $("#library_search").on('click', function() {
if (!hasPermission("seeplaylist")) { if (!hasPermission("seeplaylist")) {
$("#searchcontrol .alert").remove(); $("#searchcontrol .alert").remove();
var al = makeAlert("Permission Denied", var al = makeAlert("Permission Denied",
@ -248,7 +248,7 @@ $("#library_search").click(function() {
}); });
}); });
$("#library_query").keydown(function(ev) { $("#library_query").on('keydown', function(ev) {
if(ev.keyCode == 13) { if(ev.keyCode == 13) {
if (!hasPermission("seeplaylist")) { if (!hasPermission("seeplaylist")) {
$("#searchcontrol .alert").remove(); $("#searchcontrol .alert").remove();
@ -266,7 +266,7 @@ $("#library_query").keydown(function(ev) {
} }
}); });
$("#youtube_search").click(function () { $("#youtube_search").on('click', function () {
var query = $("#library_query").val().toLowerCase(); var query = $("#library_query").val().toLowerCase();
try { try {
parseMediaLink(query); parseMediaLink(query);
@ -285,7 +285,7 @@ $("#youtube_search").click(function () {
/* user playlists */ /* user playlists */
$("#userpl_save").click(function() { $("#userpl_save").on('click', function() {
if($("#userpl_name").val().trim() == "") { if($("#userpl_name").val().trim() == "") {
makeAlert("Invalid Name", "Playlist name cannot be empty", "alert-danger") makeAlert("Invalid Name", "Playlist name cannot be empty", "alert-danger")
.insertAfter($("#userpl_save").parent()); .insertAfter($("#userpl_save").parent());
@ -298,7 +298,7 @@ $("#userpl_save").click(function() {
/* video controls */ /* video controls */
$("#mediarefresh").click(function() { $("#mediarefresh").on('click', function() {
PLAYER.mediaType = ""; PLAYER.mediaType = "";
PLAYER.mediaId = ""; PLAYER.mediaId = "";
// playerReady triggers the server to send a changeMedia. // playerReady triggers the server to send a changeMedia.
@ -459,12 +459,12 @@ function queue(pos, src) {
} }
} }
$("#queue_next").click(queue.bind(this, "next", "url")); $("#queue_next").on('click', queue.bind(this, "next", "url"));
$("#queue_end").click(queue.bind(this, "end", "url")); $("#queue_end").on('click', queue.bind(this, "end", "url"));
$("#ce_queue_next").click(queue.bind(this, "next", "customembed")); $("#ce_queue_next").on('click', queue.bind(this, "next", "customembed"));
$("#ce_queue_end").click(queue.bind(this, "end", "customembed")); $("#ce_queue_end").on('click', queue.bind(this, "end", "customembed"));
$("#mediaurl").keyup(function(ev) { $("#mediaurl").on('keyup', function(ev) {
if (ev.keyCode === 13) { if (ev.keyCode === 13) {
queue("end", "url"); queue("end", "url");
} else { } else {
@ -487,7 +487,7 @@ $("#mediaurl").keyup(function(ev) {
$("<input/>").addClass("form-control") $("<input/>").addClass("form-control")
.attr("type", "text") .attr("type", "text")
.attr("id", "addfromurl-title-val") .attr("id", "addfromurl-title-val")
.keydown(function (ev) { .on('keydown', function (ev) {
if (ev.keyCode === 13) { if (ev.keyCode === 13) {
queue("end", "url"); queue("end", "url");
} }
@ -500,22 +500,22 @@ $("#mediaurl").keyup(function(ev) {
} }
}); });
$("#customembed-content").keydown(function(ev) { $("#customembed-content").on('keydown', function(ev) {
if (ev.keyCode === 13) { if (ev.keyCode === 13) {
queue("end", "customembed"); queue("end", "customembed");
} }
}); });
$("#qlockbtn").click(function() { $("#qlockbtn").on('click', function() {
socket.emit("togglePlaylistLock"); socket.emit("togglePlaylistLock");
}); });
$("#voteskip").click(function() { $("#voteskip").on('click', function() {
socket.emit("voteskip"); socket.emit("voteskip");
$("#voteskip").attr("disabled", true); $("#voteskip").attr("disabled", true);
}); });
$("#getplaylist").click(function() { $("#getplaylist").on('click', function() {
var callback = function(data) { var callback = function(data) {
var idx = socket.listeners("errorMsg").indexOf(errCallback); var idx = socket.listeners("errorMsg").indexOf(errCallback);
if (idx >= 0) { if (idx >= 0) {
@ -574,14 +574,14 @@ $("#getplaylist").click(function() {
socket.emit("requestPlaylist"); socket.emit("requestPlaylist");
}); });
$("#clearplaylist").click(function() { $("#clearplaylist").on('click', function() {
var clear = confirm("Are you sure you want to clear the playlist?"); var clear = confirm("Are you sure you want to clear the playlist?");
if(clear) { if(clear) {
socket.emit("clearPlaylist"); socket.emit("clearPlaylist");
} }
}); });
$("#shuffleplaylist").click(function() { $("#shuffleplaylist").on('click', function() {
var shuffle = confirm("Are you sure you want to shuffle the playlist?"); var shuffle = confirm("Are you sure you want to shuffle the playlist?");
if(shuffle) { if(shuffle) {
socket.emit("shufflePlaylist"); socket.emit("shufflePlaylist");
@ -596,13 +596,13 @@ function chanrankSubmit(rank) {
rank: rank rank: rank
}); });
} }
$("#cs-chanranks-mod").click(chanrankSubmit.bind(this, 2)); $("#cs-chanranks-mod").on('click', chanrankSubmit.bind(this, 2));
$("#cs-chanranks-adm").click(chanrankSubmit.bind(this, 3)); $("#cs-chanranks-adm").on('click', chanrankSubmit.bind(this, 3));
$("#cs-chanranks-owner").click(chanrankSubmit.bind(this, 4)); $("#cs-chanranks-owner").on('click', chanrankSubmit.bind(this, 4));
["#showmediaurl", "#showsearch", "#showcustomembed", "#showplaylistmanager"] ["#showmediaurl", "#showsearch", "#showcustomembed", "#showplaylistmanager"]
.forEach(function (id) { .forEach(function (id) {
$(id).click(function () { $(id).on('click', function () {
var wasActive = $(id).hasClass("active"); var wasActive = $(id).hasClass("active");
$(".plcontrol-collapse").collapse("hide"); $(".plcontrol-collapse").collapse("hide");
$("#plcontrol button.active").button("toggle"); $("#plcontrol button.active").button("toggle");
@ -616,7 +616,7 @@ $("#plcontrol button").button("hide");
$(".plcontrol-collapse").collapse(); $(".plcontrol-collapse").collapse();
$(".plcontrol-collapse").collapse("hide"); $(".plcontrol-collapse").collapse("hide");
$(".cs-checkbox").change(function () { $(".cs-checkbox").on('change', function () {
var box = $(this); var box = $(this);
var key = box.attr("id").replace("cs-", ""); var key = box.attr("id").replace("cs-", "");
var value = box.prop("checked"); var value = box.prop("checked");
@ -625,7 +625,7 @@ $(".cs-checkbox").change(function () {
socket.emit("setOptions", data); socket.emit("setOptions", data);
}); });
$(".cs-textbox").keyup(function () { $(".cs-textbox").on('keyup', function () {
var box = $(this); var box = $(this);
var key = box.attr("id").replace("cs-", ""); var key = box.attr("id").replace("cs-", "");
var value = box.val(); var value = box.val();
@ -652,7 +652,7 @@ $(".cs-textbox").keyup(function () {
}, 1000); }, 1000);
}); });
$(".cs-textbox-timeinput").keyup(function (event) { $(".cs-textbox-timeinput").on('keyup', function (event) {
var box = $(this); var box = $(this);
var key = box.attr("id").replace("cs-", ""); var key = box.attr("id").replace("cs-", "");
var value = box.val(); var value = box.val();
@ -682,31 +682,31 @@ $(".cs-textbox-timeinput").keyup(function (event) {
}, 1000); }, 1000);
}); });
$("#cs-chanlog-refresh").click(function () { $("#cs-chanlog-refresh").on('click', function () {
socket.emit("readChanLog"); socket.emit("readChanLog");
}); });
$("#cs-chanlog-filter").change(filterChannelLog); $("#cs-chanlog-filter").on('change', filterChannelLog);
$("#cs-motdsubmit").click(function () { $("#cs-motdsubmit").on('click', function () {
socket.emit("setMotd", { socket.emit("setMotd", {
motd: $("#cs-motdtext").val() motd: $("#cs-motdtext").val()
}); });
}); });
$("#cs-csssubmit").click(function () { $("#cs-csssubmit").on('click', function () {
socket.emit("setChannelCSS", { socket.emit("setChannelCSS", {
css: $("#cs-csstext").val() css: $("#cs-csstext").val()
}); });
}); });
$("#cs-jssubmit").click(function () { $("#cs-jssubmit").on('click', function () {
socket.emit("setChannelJS", { socket.emit("setChannelJS", {
js: $("#cs-jstext").val() js: $("#cs-jstext").val()
}); });
}); });
$("#cs-chatfilters-newsubmit").click(function () { $("#cs-chatfilters-newsubmit").on('click', function () {
var name = $("#cs-chatfilters-newname").val(); var name = $("#cs-chatfilters-newname").val();
var regex = $("#cs-chatfilters-newregex").val(); var regex = $("#cs-chatfilters-newregex").val();
var flags = $("#cs-chatfilters-newflags").val(); var flags = $("#cs-chatfilters-newflags").val();
@ -735,7 +735,7 @@ $("#cs-chatfilters-newsubmit").click(function () {
}); });
}); });
$("#cs-emotes-newsubmit").click(function () { $("#cs-emotes-newsubmit").on('click', function () {
var name = $("#cs-emotes-newname").val(); var name = $("#cs-emotes-newname").val();
var image = $("#cs-emotes-newimage").val(); var image = $("#cs-emotes-newimage").val();
@ -748,7 +748,7 @@ $("#cs-emotes-newsubmit").click(function () {
$("#cs-emotes-newimage").val(""); $("#cs-emotes-newimage").val("");
}); });
$("#cs-chatfilters-export").click(function () { $("#cs-chatfilters-export").on('click', function () {
var callback = function (data) { var callback = function (data) {
socket.listeners("chatFilters").splice( socket.listeners("chatFilters").splice(
socket.listeners("chatFilters").indexOf(callback) socket.listeners("chatFilters").indexOf(callback)
@ -761,7 +761,7 @@ $("#cs-chatfilters-export").click(function () {
socket.emit("requestChatFilters"); socket.emit("requestChatFilters");
}); });
$("#cs-chatfilters-import").click(function () { $("#cs-chatfilters-import").on('click', function () {
var text = $("#cs-chatfilters-exporttext").val(); var text = $("#cs-chatfilters-exporttext").val();
var choose = confirm("You are about to import filters from the contents of the textbox below the import button. If this is empty, it will clear all of your filters. Are you sure you want to continue?"); var choose = confirm("You are about to import filters from the contents of the textbox below the import button. If this is empty, it will clear all of your filters. Are you sure you want to continue?");
if (!choose) { if (!choose) {
@ -783,7 +783,7 @@ $("#cs-chatfilters-import").click(function () {
socket.emit("importFilters", data); socket.emit("importFilters", data);
}); });
$("#cs-emotes-export").click(function () { $("#cs-emotes-export").on('click', function () {
var em = CHANNEL.emotes.map(function (f) { var em = CHANNEL.emotes.map(function (f) {
return { return {
name: f.name, name: f.name,
@ -793,7 +793,7 @@ $("#cs-emotes-export").click(function () {
$("#cs-emotes-exporttext").val(JSON.stringify(em)); $("#cs-emotes-exporttext").val(JSON.stringify(em));
}); });
$("#cs-emotes-import").click(function () { $("#cs-emotes-import").on('click', function () {
var text = $("#cs-emotes-exporttext").val(); var text = $("#cs-emotes-exporttext").val();
var choose = confirm("You are about to import emotes from the contents of the textbox below the import button. If this is empty, it will clear all of your emotes. Are you sure you want to continue?"); var choose = confirm("You are about to import emotes from the contents of the textbox below the import button. If this is empty, it will clear all of your emotes. Are you sure you want to continue?");
if (!choose) { if (!choose) {
@ -827,10 +827,10 @@ var toggleUserlist = function () {
scrollChat(); scrollChat();
}; };
$("#usercount").click(toggleUserlist); $("#usercount").on('click', toggleUserlist);
$("#userlisttoggle").click(toggleUserlist); $("#userlisttoggle").on('click', toggleUserlist);
$(".add-temp").change(function () { $(".add-temp").on('change', function () {
$(".add-temp").prop("checked", $(this).prop("checked")); $(".add-temp").prop("checked", $(this).prop("checked"));
}); });
@ -878,7 +878,7 @@ applyOpts();
})(); })();
var EMOTELISTMODAL = $("#emotelist"); var EMOTELISTMODAL = $("#emotelist");
$("#emotelistbtn").click(function () { $("#emotelistbtn").on('click', function () {
EMOTELISTMODAL.modal(); EMOTELISTMODAL.modal();
}); });
@ -888,7 +888,7 @@ EMOTELISTMODAL.find(".emotelist-alphabetical").change(function () {
}); });
EMOTELISTMODAL.find(".emotelist-alphabetical").prop("checked", USEROPTS.emotelist_sort); EMOTELISTMODAL.find(".emotelist-alphabetical").prop("checked", USEROPTS.emotelist_sort);
$("#fullscreenbtn").click(function () { $("#fullscreenbtn").on('click', function () {
var elem = document.querySelector("#videowrap .embed-responsive"); var elem = document.querySelector("#videowrap .embed-responsive");
// this shit is why frontend web development sucks // this shit is why frontend web development sucks
var fn = elem.requestFullscreen || var fn = elem.requestFullscreen ||
@ -923,7 +923,7 @@ $("#cs-csstext").bind("input", handleCSSJSTooLarge.bind($("#cs-csstext")[0],
$("#cs-jstext").bind("input", handleCSSJSTooLarge.bind($("#cs-jstext")[0], $("#cs-jstext").bind("input", handleCSSJSTooLarge.bind($("#cs-jstext")[0],
"#cs-jstext-too-big")); "#cs-jstext-too-big"));
$("#resize-video-larger").click(function () { $("#resize-video-larger").on('click', function () {
try { try {
CyTube.ui.changeVideoWidth(1); CyTube.ui.changeVideoWidth(1);
} catch (error) { } catch (error) {
@ -931,7 +931,7 @@ $("#resize-video-larger").click(function () {
} }
}); });
$("#resize-video-smaller").click(function () { $("#resize-video-smaller").on('click', function () {
try { try {
CyTube.ui.changeVideoWidth(-1); CyTube.ui.changeVideoWidth(-1);
} catch (error) { } catch (error) {

View file

@ -13,7 +13,7 @@ function makeAlert(title, text, klass, textOnly) {
$("<br/>").prependTo(al); $("<br/>").prependTo(al);
$("<strong/>").text(title).prependTo(al); $("<strong/>").text(title).prependTo(al);
$("<button/>").addClass("close pull-right").html("&times;") $("<button/>").addClass("close pull-right").html("&times;")
.click(function() { .on('click', function() {
al.hide("fade", function() { al.hide("fade", function() {
wrap.remove(); wrap.remove();
}); });
@ -125,7 +125,7 @@ function formatUserlistItem(div) {
name.unbind("mousemove"); name.unbind("mousemove");
name.unbind("mouseleave"); name.unbind("mouseleave");
name.mouseenter(function(ev) { name.on('mouseenter', function(ev) {
if (profile) if (profile)
profile.remove(); profile.remove();
@ -158,7 +158,7 @@ function formatUserlistItem(div) {
if ($("body").hasClass("synchtube")) horiz -= profile.outerWidth(); if ($("body").hasClass("synchtube")) horiz -= profile.outerWidth();
profile.css("left", horiz + "px") profile.css("left", horiz + "px")
}); });
name.mousemove(function(ev) { name.on('mousemove', function(ev) {
var top = ev.clientY + 5; var top = ev.clientY + 5;
var horiz = ev.clientX; var horiz = ev.clientX;
@ -166,7 +166,7 @@ function formatUserlistItem(div) {
profile.css("left", horiz + "px") profile.css("left", horiz + "px")
.css("top", top + "px"); .css("top", top + "px");
}); });
name.mouseleave(function() { name.on('mouseleave', function() {
profile.remove(); profile.remove();
}); });
var icon = div.children()[0]; var icon = div.children()[0];
@ -217,7 +217,7 @@ function addUserDropdown(entry) {
if (name !== CLIENT.name) { if (name !== CLIENT.name) {
var ignore = $("<button/>").addClass("btn btn-xs btn-default") var ignore = $("<button/>").addClass("btn btn-xs btn-default")
.appendTo(btngroup) .appendTo(btngroup)
.click(function () { .on('click', function () {
if(IGNORED.indexOf(name) == -1) { if(IGNORED.indexOf(name) == -1) {
ignore.text("Unignore User"); ignore.text("Unignore User");
IGNORED.push(name); IGNORED.push(name);
@ -243,7 +243,7 @@ function addUserDropdown(entry) {
var pm = $("<button/>").addClass("btn btn-xs btn-default") var pm = $("<button/>").addClass("btn btn-xs btn-default")
.text("Private Message") .text("Private Message")
.appendTo(btngroup) .appendTo(btngroup)
.click(function () { .on('click', function () {
initPm(name).find(".panel-heading").click(); initPm(name).find(".panel-heading").click();
menu.hide(); menu.hide();
}); });
@ -255,14 +255,14 @@ function addUserDropdown(entry) {
.appendTo(btngroup); .appendTo(btngroup);
if(leader) { if(leader) {
ldr.text("Remove Leader"); ldr.text("Remove Leader");
ldr.click(function () { ldr.on('click', function () {
socket.emit("assignLeader", { socket.emit("assignLeader", {
name: "" name: ""
}); });
}); });
} else { } else {
ldr.text("Give Leader"); ldr.text("Give Leader");
ldr.click(function () { ldr.on('click', function () {
socket.emit("assignLeader", { socket.emit("assignLeader", {
name: name name: name
}); });
@ -274,7 +274,7 @@ function addUserDropdown(entry) {
if(hasPermission("kick")) { if(hasPermission("kick")) {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("Kick") .text("Kick")
.click(function () { .on('click', function () {
var reason = prompt("Enter kick reason (optional)"); var reason = prompt("Enter kick reason (optional)");
if (reason === null) { if (reason === null) {
return; return;
@ -291,7 +291,7 @@ function addUserDropdown(entry) {
if (hasPermission("mute")) { if (hasPermission("mute")) {
var mute = $("<button/>").addClass("btn btn-xs btn-default") var mute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Mute") .text("Mute")
.click(function () { .on('click', function () {
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/mute " + name, msg: "/mute " + name,
meta: {} meta: {}
@ -300,7 +300,7 @@ function addUserDropdown(entry) {
.appendTo(btngroup); .appendTo(btngroup);
var smute = $("<button/>").addClass("btn btn-xs btn-default") var smute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Shadow Mute") .text("Shadow Mute")
.click(function () { .on('click', function () {
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/smute " + name, msg: "/smute " + name,
meta: {} meta: {}
@ -309,7 +309,7 @@ function addUserDropdown(entry) {
.appendTo(btngroup); .appendTo(btngroup);
var unmute = $("<button/>").addClass("btn btn-xs btn-default") var unmute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Unmute") .text("Unmute")
.click(function () { .on('click', function () {
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/unmute " + name, msg: "/unmute " + name,
meta: {} meta: {}
@ -328,7 +328,7 @@ function addUserDropdown(entry) {
if(hasPermission("ban")) { if(hasPermission("ban")) {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("Name Ban") .text("Name Ban")
.click(function () { .on('click', function () {
var reason = prompt("Enter ban reason (optional)"); var reason = prompt("Enter ban reason (optional)");
if (reason === null) { if (reason === null) {
return; return;
@ -341,7 +341,7 @@ function addUserDropdown(entry) {
.appendTo(btngroup); .appendTo(btngroup);
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("IP Ban") .text("IP Ban")
.click(function () { .on('click', function () {
var reason = prompt("Enter ban reason (optional)"); var reason = prompt("Enter ban reason (optional)");
if (reason === null) { if (reason === null) {
return; return;
@ -523,7 +523,7 @@ function addQueueButtons(li) {
if(hasPermission("playlistjump")) { if(hasPermission("playlistjump")) {
$("<button/>").addClass("btn btn-xs btn-default qbtn-play") $("<button/>").addClass("btn btn-xs btn-default qbtn-play")
.html("<span class='glyphicon glyphicon-play'></span>Play") .html("<span class='glyphicon glyphicon-play'></span>Play")
.click(function() { .on('click', function() {
socket.emit("jumpTo", li.data("uid")); socket.emit("jumpTo", li.data("uid"));
}) })
.appendTo(menu); .appendTo(menu);
@ -532,7 +532,7 @@ function addQueueButtons(li) {
if(hasPermission("playlistmove")) { if(hasPermission("playlistmove")) {
$("<button/>").addClass("btn btn-xs btn-default qbtn-next") $("<button/>").addClass("btn btn-xs btn-default qbtn-next")
.html("<span class='glyphicon glyphicon-share-alt'></span>Queue Next") .html("<span class='glyphicon glyphicon-share-alt'></span>Queue Next")
.click(function() { .on('click', function() {
socket.emit("moveMedia", { socket.emit("moveMedia", {
from: li.data("uid"), from: li.data("uid"),
after: PL_CURRENT after: PL_CURRENT
@ -545,7 +545,7 @@ function addQueueButtons(li) {
var tempstr = li.data("temp")?"Make Permanent":"Make Temporary"; var tempstr = li.data("temp")?"Make Permanent":"Make Temporary";
$("<button/>").addClass("btn btn-xs btn-default qbtn-tmp") $("<button/>").addClass("btn btn-xs btn-default qbtn-tmp")
.html("<span class='glyphicon glyphicon-flag'></span>" + tempstr) .html("<span class='glyphicon glyphicon-flag'></span>" + tempstr)
.click(function() { .on('click', function() {
socket.emit("setTemp", { socket.emit("setTemp", {
uid: li.data("uid"), uid: li.data("uid"),
temp: !li.data("temp") temp: !li.data("temp")
@ -557,7 +557,7 @@ function addQueueButtons(li) {
if(hasPermission("playlistdelete")) { if(hasPermission("playlistdelete")) {
$("<button/>").addClass("btn btn-xs btn-default qbtn-delete") $("<button/>").addClass("btn btn-xs btn-default qbtn-delete")
.html("<span class='glyphicon glyphicon-trash'></span>Delete") .html("<span class='glyphicon glyphicon-trash'></span>Delete")
.click(function() { .on('click', function() {
socket.emit("delete", li.data("uid")); socket.emit("delete", li.data("uid"));
}) })
.appendTo(menu); .appendTo(menu);
@ -661,7 +661,7 @@ function showUserOptions() {
formatScriptAccessPrefs(); formatScriptAccessPrefs();
$("a[href='#us-general']").click(); $("a[href='#us-general']").trigger("click");
$("#useroptions").modal(); $("#useroptions").modal();
} }
@ -750,7 +750,7 @@ function applyOpts() {
.text("Send") .text("Send")
.attr("id", "chatbtn") .attr("id", "chatbtn")
.appendTo($("#chatwrap")); .appendTo($("#chatwrap"));
btn.click(function() { btn.on('click', function() {
if($("#chatline").val().trim()) { if($("#chatline").val().trim()) {
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: $("#chatline").val(), msg: $("#chatline").val(),
@ -807,7 +807,7 @@ function showPollMenu() {
$("<button/>").addClass("btn btn-sm btn-danger pull-right") $("<button/>").addClass("btn btn-sm btn-danger pull-right")
.text("Cancel") .text("Cancel")
.appendTo(menu) .appendTo(menu)
.click(function() { .on('click', function() {
menu.remove(); menu.remove();
}); });
@ -864,7 +864,7 @@ function showPollMenu() {
$("<button/>").addClass("btn btn-default btn-block") $("<button/>").addClass("btn btn-default btn-block")
.text("Open Poll") .text("Open Poll")
.appendTo(menu) .appendTo(menu)
.click(function() { .on('click', function() {
var t = timeout.val().trim(); var t = timeout.val().trim();
if (t) { if (t) {
try { try {
@ -1037,7 +1037,7 @@ function handlePermissionChange() {
$("<button/>").addClass("btn btn-primary") $("<button/>").addClass("btn btn-primary")
.text("Dismiss") .text("Dismiss")
.appendTo(al.find(".alert")) .appendTo(al.find(".alert"))
.click(function() { .on('click', function() {
USEROPTS.first_visit = false; USEROPTS.first_visit = false;
storeOpts(); storeOpts();
al.hide("fade", function() { al.hide("fade", function() {
@ -1078,7 +1078,7 @@ function handlePermissionChange() {
$("<button/>").addClass("btn btn-danger pull-right") $("<button/>").addClass("btn btn-danger pull-right")
.text("End Poll") .text("End Poll")
.insertAfter(poll.find(".close")) .insertAfter(poll.find(".close"))
.click(function() { .on('click', function() {
socket.emit("closePoll"); socket.emit("closePoll");
}); });
} }
@ -1134,7 +1134,7 @@ function addLibraryButtons(li, item, source) {
if(hasPermission("playlistnext")) { if(hasPermission("playlistnext")) {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("Next") .text("Next")
.click(function() { .on('click', function() {
socket.emit("queue", { socket.emit("queue", {
id: id, id: id,
pos: "next", pos: "next",
@ -1146,7 +1146,7 @@ function addLibraryButtons(li, item, source) {
} }
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("End") .text("End")
.click(function() { .on('click', function() {
socket.emit("queue", { socket.emit("queue", {
id: id, id: id,
pos: "end", pos: "end",
@ -1159,7 +1159,7 @@ function addLibraryButtons(li, item, source) {
if(hasPermission("deletefromchannellib") && source === "library") { if(hasPermission("deletefromchannellib") && source === "library") {
$("<button/>").addClass("btn btn-xs btn-danger") $("<button/>").addClass("btn btn-xs btn-danger")
.html("<span class='glyphicon glyphicon-trash'></span>") .html("<span class='glyphicon glyphicon-trash'></span>")
.click(function() { .on('click', function() {
socket.emit("uncache", { socket.emit("uncache", {
id: id id: id
}); });
@ -1536,10 +1536,10 @@ function addChatMessage(data) {
var safeUsername = data.username.replace(/[^\w-]/g, '\\$'); var safeUsername = data.username.replace(/[^\w-]/g, '\\$');
div.addClass("chat-msg-" + safeUsername); div.addClass("chat-msg-" + safeUsername);
div.appendTo(msgBuf); div.appendTo(msgBuf);
div.mouseover(function() { div.on('mouseover', function() {
$(".chat-msg-" + safeUsername).addClass("nick-hover"); $(".chat-msg-" + safeUsername).addClass("nick-hover");
}); });
div.mouseleave(function() { div.on('mouseleave', function() {
$(".nick-hover").removeClass("nick-hover"); $(".nick-hover").removeClass("nick-hover");
}); });
var oldHeight = msgBuf.prop("scrollHeight"); var oldHeight = msgBuf.prop("scrollHeight");
@ -1559,7 +1559,7 @@ function addChatMessage(data) {
$("<span/>").text("New Messages Below").appendTo(bgHack); $("<span/>").text("New Messages Below").appendTo(bgHack);
$("<span/>").addClass("glyphicon glyphicon-chevron-down") $("<span/>").addClass("glyphicon glyphicon-chevron-down")
.appendTo(bgHack); .appendTo(bgHack);
newMessageDiv.click(function () { newMessageDiv.on('click', function () {
SCROLLCHAT = true; SCROLLCHAT = true;
scrollChat(); scrollChat();
}); });
@ -1802,18 +1802,18 @@ function chatOnly() {
$("<span/>").addClass("label label-default pull-right pointer") $("<span/>").addClass("label label-default pull-right pointer")
.text("User Options") .text("User Options")
.appendTo($("#chatheader")) .appendTo($("#chatheader"))
.click(showUserOptions); .on('click', showUserOptions);
$("<span/>").addClass("label label-default pull-right pointer") $("<span/>").addClass("label label-default pull-right pointer")
.attr("id", "showchansettings") .attr("id", "showchansettings")
.text("Channel Settings") .text("Channel Settings")
.appendTo($("#chatheader")) .appendTo($("#chatheader"))
.click(function () { .on('click', function () {
$("#channeloptions").modal(); $("#channeloptions").modal();
}); });
$("<span/>").addClass("label label-default pull-right pointer") $("<span/>").addClass("label label-default pull-right pointer")
.text("Emote List") .text("Emote List")
.appendTo($("#chatheader")) .appendTo($("#chatheader"))
.click(function () { .on('click', function () {
EMOTELISTMODAL.modal(); EMOTELISTMODAL.modal();
}); });
setVisible("#showchansettings", CLIENT.rank >= 2); setVisible("#showchansettings", CLIENT.rank >= 2);
@ -1857,7 +1857,7 @@ function handleVideoResize() {
else intv = setInterval(resize, 500); else intv = setInterval(resize, 500);
} }
$(window).resize(handleWindowResize); $(window).on('resize', handleWindowResize);
handleWindowResize(); handleWindowResize();
function removeVideo(event) { function removeVideo(event) {
@ -1994,7 +1994,7 @@ function genPermissionsEditor() {
var sgroupinner = $("<div/>").addClass("col-sm-8 col-sm-offset-4").appendTo(sgroup); var sgroupinner = $("<div/>").addClass("col-sm-8 col-sm-offset-4").appendTo(sgroup);
var submit = $("<button/>").addClass("btn btn-primary").appendTo(sgroupinner); var submit = $("<button/>").addClass("btn btn-primary").appendTo(sgroupinner);
submit.text("Save"); submit.text("Save");
submit.click(function() { submit.on('click', function() {
var perms = {}; var perms = {};
form.find("select").each(function() { form.find("select").each(function() {
perms[$(this).data("key")] = parseFloat($(this).val()); perms[$(this).data("key")] = parseFloat($(this).val());
@ -2053,7 +2053,7 @@ function errDialog(err) {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.css("width", "100%") .css("width", "100%")
.text("OK") .text("OK")
.click(function () { div.remove(); }) .on('click', function () { div.remove(); })
.appendTo(div); .appendTo(div);
var cw = $("#chatwrap").width(); var cw = $("#chatwrap").width();
var ch = $("#chatwrap").height(); var ch = $("#chatwrap").height();
@ -2150,7 +2150,7 @@ function queueMessage(data, type) {
.text(data.link) .text(data.link)
.appendTo(morelinks); .appendTo(morelinks);
$("<br/>").appendTo(morelinks); $("<br/>").appendTo(morelinks);
tag.click(function () { tag.on('click', function () {
morelinks.toggle(); morelinks.toggle();
}); });
} }
@ -2298,7 +2298,7 @@ function formatCSModList() {
.text(r.name) .text(r.name)
.appendTo(li); .appendTo(li);
if (r.rank !== entry.rank) { if (r.rank !== entry.rank) {
a.click(function () { a.on('click', function () {
socket.emit("setChannelRank", { socket.emit("setChannelRank", {
name: entry.name, name: entry.name,
rank: r.rank rank: r.rank
@ -2355,7 +2355,7 @@ function formatCSBanlist() {
} }
var unban = $("<button/>").addClass("btn btn-xs btn-danger") var unban = $("<button/>").addClass("btn btn-xs btn-danger")
.appendTo($("<td/>").appendTo(tr)); .appendTo($("<td/>").appendTo(tr));
unban.click(function () { unban.on('click', function () {
socket.emit("unban", { socket.emit("unban", {
id: entry.id, id: entry.id,
name: entry.name name: entry.name
@ -2379,7 +2379,7 @@ function formatCSBanlist() {
$("<span/>").addClass("glyphicon glyphicon-list").appendTo(showmore); $("<span/>").addClass("glyphicon glyphicon-list").appendTo(showmore);
showmore.appendTo(first.find("td")[1]); showmore.appendTo(first.find("td")[1]);
showmore.click(function () { showmore.on('click', function () {
if (showmore.data("elems")) { if (showmore.data("elems")) {
showmore.data("elems").forEach(function (e) { showmore.data("elems").forEach(function (e) {
e.remove(); e.remove();
@ -2432,7 +2432,7 @@ function formatCSChatFilterList() {
var del = $("<button/>").addClass("btn btn-xs btn-danger") var del = $("<button/>").addClass("btn btn-xs btn-danger")
.appendTo(controlgroup); .appendTo(controlgroup);
$("<span/>").addClass("glyphicon glyphicon-trash").appendTo(del); $("<span/>").addClass("glyphicon glyphicon-trash").appendTo(del);
del.click(function () { del.on('click', function () {
socket.emit("removeFilter", f); socket.emit("removeFilter", f);
}); });
var name = $("<code/>").text(f.name).appendTo($("<td/>").appendTo(tr)); var name = $("<code/>").text(f.name).appendTo($("<td/>").appendTo(tr));
@ -2440,7 +2440,7 @@ function formatCSChatFilterList() {
var active = $("<input/>").attr("type", "checkbox") var active = $("<input/>").attr("type", "checkbox")
.prop("checked", f.active) .prop("checked", f.active)
.appendTo(activetd) .appendTo(activetd)
.change(function () { .on('change', function () {
f.active = $(this).prop("checked"); f.active = $(this).prop("checked");
socket.emit("updateFilter", f); socket.emit("updateFilter", f);
}); });
@ -2455,7 +2455,7 @@ function formatCSChatFilterList() {
} }
}; };
control.click(function () { control.on('click', function () {
if (control.data("editor")) { if (control.data("editor")) {
return reset(); return reset();
} }
@ -2490,7 +2490,7 @@ function formatCSChatFilterList() {
.attr("title", "Save changes") .attr("title", "Save changes")
.insertAfter(control); .insertAfter(control);
$("<span/>").addClass("glyphicon glyphicon-floppy-save").appendTo(save); $("<span/>").addClass("glyphicon glyphicon-floppy-save").appendTo(save);
save.click(function () { save.on('click', function () {
f.source = regex.val(); f.source = regex.val();
var entcheck = checkEntitiesInStr(f.source); var entcheck = checkEntitiesInStr(f.source);
if (entcheck) { if (entcheck) {
@ -2574,7 +2574,7 @@ function formatUserPlaylistList() {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("End") .text("End")
.appendTo(btns) .appendTo(btns)
.click(function () { .on('click', function () {
socket.emit("queuePlaylist", { socket.emit("queuePlaylist", {
name: pl.name, name: pl.name,
pos: "end", pos: "end",
@ -2587,7 +2587,7 @@ function formatUserPlaylistList() {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("Next") .text("Next")
.prependTo(btns) .prependTo(btns)
.click(function () { .on('click', function () {
socket.emit("queuePlaylist", { socket.emit("queuePlaylist", {
name: pl.name, name: pl.name,
pos: "next", pos: "next",
@ -2600,7 +2600,7 @@ function formatUserPlaylistList() {
.html("<span class='glyphicon glyphicon-trash'></span>") .html("<span class='glyphicon glyphicon-trash'></span>")
.attr("title", "Delete playlist") .attr("title", "Delete playlist")
.appendTo(btns) .appendTo(btns)
.click(function () { .on('click', function () {
var really = confirm("Are you sure you want to delete" + var really = confirm("Are you sure you want to delete" +
" this playlist? This cannot be undone."); " this playlist? This cannot be undone.");
if (!really) { if (!really) {
@ -2687,14 +2687,14 @@ function initPm(user) {
var title = $("<div/>").addClass("panel-heading").text(user).appendTo(pm); var title = $("<div/>").addClass("panel-heading").text(user).appendTo(pm);
var close = $("<button/>").addClass("close pull-right") var close = $("<button/>").addClass("close pull-right")
.html("&times;") .html("&times;")
.appendTo(title).click(function () { .appendTo(title).on('click', function () {
pm.remove(); pm.remove();
$("#pm-placeholder-" + user).remove(); $("#pm-placeholder-" + user).remove();
}); });
var body = $("<div/>").addClass("panel-body").appendTo(pm).hide(); var body = $("<div/>").addClass("panel-body").appendTo(pm).hide();
var placeholder; var placeholder;
title.click(function () { title.on('click', function () {
body.toggle(); body.toggle();
pm.removeClass("panel-primary").addClass("panel-default"); pm.removeClass("panel-primary").addClass("panel-default");
if (!body.is(":hidden")) { if (!body.is(":hidden")) {
@ -2794,13 +2794,13 @@ function checkScriptAccess(viewSource, type, cb) {
"</label></div>"); "</label></div>");
var dialog = chatDialog(div); var dialog = chatDialog(div);
close.click(function () { close.on('click', function () {
dialog.remove(); dialog.remove();
/* Implicit denial of script access */ /* Implicit denial of script access */
cb("DENY"); cb("DENY");
}); });
$("#chanjs-allow").click(function () { $("#chanjs-allow").on('click', function () {
var save = $("#chanjs-save-pref").is(":checked"); var save = $("#chanjs-save-pref").is(":checked");
dialog.remove(); dialog.remove();
if (save) { if (save) {
@ -2810,7 +2810,7 @@ function checkScriptAccess(viewSource, type, cb) {
cb("ALLOW"); cb("ALLOW");
}); });
$("#chanjs-deny").click(function () { $("#chanjs-deny").on('click', function () {
var save = $("#chanjs-save-pref").is(":checked"); var save = $("#chanjs-save-pref").is(":checked");
dialog.remove(); dialog.remove();
if (save) { if (save) {
@ -2883,7 +2883,7 @@ function formatScriptAccessPrefs() {
var clearpref = $("<button/>").addClass("btn btn-sm btn-danger") var clearpref = $("<button/>").addClass("btn btn-sm btn-danger")
.text("Clear Preference") .text("Clear Preference")
.appendTo($("<td/>").appendTo(tr)) .appendTo($("<td/>").appendTo(tr))
.click(function () { .on('click', function () {
delete JSPREF[channel]; delete JSPREF[channel];
setOpt("channel_js_pref", JSPREF); setOpt("channel_js_pref", JSPREF);
tr.remove(); tr.remove();
@ -3085,7 +3085,7 @@ CSEmoteList.prototype.loadPage = function (page) {
row.appendChild(tdName); row.appendChild(tdName);
var $nameDisplay = $(nameDisplay); var $nameDisplay = $(nameDisplay);
$nameDisplay.click(function (clickEvent) { $nameDisplay.on('click', function (clickEvent) {
$nameDisplay.detach(); $nameDisplay.detach();
var editInput = document.createElement("input"); var editInput = document.createElement("input");
@ -3155,7 +3155,7 @@ CSEmoteList.prototype.loadPage = function (page) {
}); });
// Change the image for an emote // Change the image for an emote
$urlDisplay.click(function (clickEvent) { $urlDisplay.on('click', function (clickEvent) {
$(tdImage).find(".popover").remove(); $(tdImage).find(".popover").remove();
$urlDisplay.detach(); $urlDisplay.detach();