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",
"coffeescript": "^1.9.2",
"eslint": "^7.32.0",
"eslint-plugin-no-jquery": "^2.7.0",
"mocha": "^9.2.2",
"sinon": "^10.0.0"
},

View File

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

View File

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

View File

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

View File

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

View File

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