From ef8fb7c7f242fc0f081f86d283e2fac22504a6b5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 8 Jul 2012 21:24:36 -0500 Subject: Make collapseDependsList() a bit smarter Signed-off-by: Dan McGee --- sitestatic/archweb.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sitestatic') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 12b7c70..01d5b26 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -172,18 +172,18 @@ function ajaxifyFiles() { function collapseDependsList(list) { var limit = 20; - // hide everything past a given limit, but don't do anything if we don't - // enough items that it is worth adding the link list = $(list); + // Hide everything past a given limit. Don't do anything if we don't have + // enough items, or the link already exists. + var linkid = list.attr('id') + 'link'; var items = list.find('li').slice(limit); - if (items.length == 0) { + if (items.length == 0 || $('#' + linkid).length > 0) { return; } items.hide(); - var linkid = list.attr('id') + 'link'; list.after('

Show Moreā€¦

'); - // add links and wire them up to show the hidden items + // add link and wire it up to show the hidden items $('#' + linkid).click(function(event) { event.preventDefault(); list.find('li').show(); -- cgit v1.2.3-24-g4f1b