From b04eea907242bb895f9578638f5f05612311fa66 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Sat, 28 Jun 2014 12:22:17 -0400 Subject: fix bug where personal mutes didnt affect .oldmsg divs --- static/js/pichat.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'static/js/pichat.js') diff --git a/static/js/pichat.js b/static/js/pichat.js index b0bba88..1003880 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -281,6 +281,7 @@ window.Away = { function initChat() { Search.initInpage() + initMutes() $('#textbutton input').attr('checked', TextEnabled).change(setTextEnable); $('#imgbutton input').attr('checked', ImgsEnabled).change(setImgsEnable); @@ -298,10 +299,17 @@ function initChat() { MessageContentCache[dump.attr("id").substr(8)] = content.text() content.html(buildMsgContent(content.text(), Recips)); - if ((ImgsEnabled && dump.hasClass('contains-image')) || (TextEnabled && !dump.hasClass('contains-image'))) - dump.show(); - else + if ((ImgsEnabled && dump.hasClass('contains-image')) || (TextEnabled && !dump.hasClass('contains-image'))) { + if (dump.attr('nick') in MUTES) { + dump.hide(); + } + else { + dump.show(); + } + } + else { dump.hide(); + } }); Drag.bindImages(); @@ -2248,11 +2256,14 @@ function linkReplaceWithoutImage(url){ return "" + url + "" } -try { - var MUTES = localStorage["mutes"] ? JSON.parse(localStorage["mutes"]) : {}; -} -catch (e) { - delete localStorage["mutes"] +function initMutes(){ + try { + window.MUTES = localStorage["mutes"] ? JSON.parse(localStorage["mutes"]) : {}; + } + catch (e) { + delete localStorage["mutes"] + window.MUTES = {} + } } $(".mute").live("click", function(){ $(this).removeClass("mute"); -- cgit v1.2.3-70-g09d2