From 3d01a4b5e460c021554f0519722e558a5f12f1fd Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Tue, 24 Jun 2014 18:59:32 -0400 Subject: forgot localstorage was a flat hash --- static/js/pichat2.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'static/js/pichat2.js') diff --git a/static/js/pichat2.js b/static/js/pichat2.js index f678cc1..61ddf3c 100644 --- a/static/js/pichat2.js +++ b/static/js/pichat2.js @@ -2248,16 +2248,15 @@ function linkReplaceWithoutImage(url){ return "" + url + "" } -var MUTES = localStorage['mutes'] || {}; +var MUTES = localStorage["mutes"] ? JSON.parse(localStorage["mutes"]) : {} $(".mute").live("click", function(){ $(this).removeClass("mute"); $(this).addClass("unmute"); $(this).html("o"); var nick = $(this).parent().children("a").html().replace(/]+>/,""); $(".nick_" + nick).hide(); - MUTES[nick] = true; - localStorage['mutes'] = localStorage['mutes'] || {} - localStorage['mutes'][nick] = true + MUTES[nick] = true + localStorage['mutes'] = JSON.stringify(MUTES) }); $(".unmute").live("click", function(){ $(this).removeClass("unmute"); @@ -2266,8 +2265,7 @@ $(".unmute").live("click", function(){ var nick = $(this).parent().children("a").html().replace(/]+>/,""); $(".nick_" + nick).show(); delete MUTES[nick]; - localStorage['mutes'] = localStorage['mutes'] || {} - delete localStorage['mutes'][nick] + localStorage['mutes'] = JSON.stringify(MUTES) }); function buildUserDiv(user) { -- cgit v1.2.3-70-g09d2