From 9256928d826c5b408935dc0f367eef94950be9c1 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 8 Aug 2013 10:57:46 -0400 Subject: [PATCH] Handle user impersonation using bold filter differently --- channel.js | 2 +- www/assets/js/util.js | 57 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/channel.js b/channel.js index 63a72c28..cb50d1c6 100644 --- a/channel.js +++ b/channel.js @@ -88,7 +88,7 @@ var Channel = function(name, Server) { }; this.filters = [ new Filter("monospace", "`([^`]+)`", "g", "$1"), - new Filter("bold", "(.)\\*([^\\*]+)\\*", "g", "$1$2"), + new Filter("bold", "(^|\\s)\\*([^\\*]+)\\*", "g", "$1$2"), new Filter("italic", "(^| )_([^_]+)_", "g", "$1$2"), new Filter("strikethrough", "~~([^~]+)~~", "g", "$1"), new Filter("inline spoiler", "\\[spoiler\\](.*)\\[\\/spoiler\\]", "ig", "$1"), diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 0fc77531..b2aae050 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -272,6 +272,42 @@ function calcUserBreakdown() { return breakdown; } +function sortUserlist() { + var slice = Array.prototype.slice; + var list = slice.call($("#userlist .userlist_item")); + list.sort(function (a, b) { + var r1 = $(a).data("dropdown-info").rank; + var r2 = $(b).data("dropdown-info").rank; + var afk1 = $(a).find(".icon-time").length > 0; + var afk2 = $(b).find(".icon-time").length > 0; + var name1 = a.children[1].innerHTML.toLowerCase(); + var name2 = b.children[1].innerHTML.toLowerCase(); + + if(USEROPTS.sort_afk) { + if(afk1 && !afk2) + return 1; + if(!afk1 && afk2) + return -1; + } + + if(USEROPTS.sort_rank) { + if(r1 < r2) + return 1; + if(r1 > r2) + return -1; + } + + return name1 === name2 ? 0 : (name1 < name2 ? -1 : 1); + }); + + list.forEach(function (item) { + $(item).detach(); + }); + list.forEach(function (item) { + $(item).appendTo($("#userlist")); + }); +} + /* queue stuff */ function scrollQueue() { @@ -541,6 +577,18 @@ function showOptionsMenu() { showts.prop("checked", USEROPTS.show_timestamps); addOption("Show timestamps", tscontainer); + var srcontainer = $("