From ecad3b9891d14933e0edc8e4c98e5bbbf4a31a9d Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 22 Mar 2012 16:35:44 +0000 Subject: [PATCH] only refresh if needed --- ext/index/script.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/index/script.js b/ext/index/script.js index b446f72b..605d32d5 100644 --- a/ext/index/script.js +++ b/ext/index/script.js @@ -1,14 +1,20 @@ $(function() { var blocked_tags = ($.cookie("blocked-tags") || "").split(" "); + var needs_refresh = false; for(i in blocked_tags) { var tag = blocked_tags[i]; - if(tag) $(".thumb[data-tags~='"+tag+"']").hide(); + if(tag) { + $(".thumb[data-tags~='"+tag+"']").hide(); + needs_refresh = true; + } } // need to trigger a reflow in opera, because opera implements // text-align: justify with element margins and doesn't recalculate // these margins when part of the line disappears... - $('#image-list').hide(); - $('#image-list').show(); + if(needs_refresh) { + $('#image-list').hide(); + $('#image-list').show(); + } }); function select_blocked_tags() {