summaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authordumpfmprod <dumpfmprod@ubuntu.(none)>2014-06-28 12:22:17 -0400
committerdumpfmprod <dumpfmprod@ubuntu.(none)>2014-06-28 12:22:17 -0400
commitb04eea907242bb895f9578638f5f05612311fa66 (patch)
tree8af5175552815e15149cdfe9b7d31aab273946b7 /static/js
parent0f957d316cfae62f9cfabc8df1d26e906de3e553 (diff)
fix bug where personal mutes didnt affect .oldmsg divs
Diffstat (limited to 'static/js')
-rw-r--r--static/js/pichat.js27
-rw-r--r--static/js/src/chat.js14
-rw-r--r--static/js/src/userlist.js13
3 files changed, 38 insertions, 16 deletions
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 "<a target='_blank' href='" + linkUrl + "'>" + url + "</a>"
}
-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");
diff --git a/static/js/src/chat.js b/static/js/src/chat.js
index e59e948..b2816c7 100644
--- a/static/js/src/chat.js
+++ b/static/js/src/chat.js
@@ -2,6 +2,7 @@
function initChat() {
Search.initInpage()
+ initMutes()
$('#textbutton input').attr('checked', TextEnabled).change(setTextEnable);
$('#imgbutton input').attr('checked', ImgsEnabled).change(setImgsEnable);
@@ -19,10 +20,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();
diff --git a/static/js/src/userlist.js b/static/js/src/userlist.js
index 3ccb9b2..5ed34be 100644
--- a/static/js/src/userlist.js
+++ b/static/js/src/userlist.js
@@ -1,8 +1,11 @@
-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");