From: Jason Skomorowski Date: Thu, 3 Mar 2011 06:52:22 +0000 (+0100) Subject: mkdru.removeLimits() no longer leaves dangling limit_subject X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=c0ec0ac847e2587a3efccdb7e47958451765a9a5;p=mkdru-moved-to-drupal.org.git mkdru.removeLimits() no longer leaves dangling limit_subject --- diff --git a/mkdru.client.js b/mkdru.client.js index f6188ea..5c2d0d0 100644 --- a/mkdru.client.js +++ b/mkdru.client.js @@ -272,7 +272,8 @@ mkdru.addLimit = function (facet, limit) { mkdru.removeLimit = function (facet, limit) { var newHash = $.deparam.fragment(); delete newHash['page']; - if (!newHash['limit_' + facet].indexOf(';') || !mkdru.facets[facet].multiLimit) { + if (!newHash['limit_' + facet].indexOf(';') + || !mkdru.facets[facet].multiLimit) { delete newHash['limit_' + facet]; } else { @@ -280,7 +281,10 @@ mkdru.removeLimit = function (facet, limit) { for (var i = 0; i < limits.length; i++) { if (limits[i] == limit) { limits.splice(i, 1); - newHash['limit_' + facet] = limits.join(';'); + if (limits.length < 1) + delete newHash['limit_' + facet]; + else + newHash['limit_' + facet] = limits.join(';'); break; } }