summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-07-08 21:24:36 -0500
committerDan McGee <dan@archlinux.org>2012-07-08 21:24:36 -0500
commitef8fb7c7f242fc0f081f86d283e2fac22504a6b5 (patch)
treec49c019711c4457e8c70d603b894afb5bed14b8c
parent3c4ceb16331b37fd334dc9682d4cde6430838942 (diff)
downloadarchweb-ef8fb7c7f242fc0f081f86d283e2fac22504a6b5.tar.gz
archweb-ef8fb7c7f242fc0f081f86d283e2fac22504a6b5.zip
Make collapseDependsList() a bit smarter
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitestatic/archweb.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js
index 12b7c702..01d5b269 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('<p><a id="' + linkid + '" href="#">Show Moreā€¦</a></p>');
- // 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();