summaryrefslogtreecommitdiffstats
path: root/sitestatic
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-10-01 01:18:19 +0200
committerDan McGee <dan@archlinux.org>2012-10-01 01:18:19 +0200
commitfebf5e92233738198107a69f66c9f3443b4306c7 (patch)
tree0c8e069360e26314d498251e15cf672743f8a03b /sitestatic
parent58ecb90c3f0254cdfab290234d309cad14a17723 (diff)
downloadarchweb-febf5e92233738198107a69f66c9f3443b4306c7.tar.gz
archweb-febf5e92233738198107a69f66c9f3443b4306c7.tar.xz
Collapse long lists of related packages
Just like we did with the rows of depends and required by, collapse down conflicts, provides, etc. comma-separated lists if they grow too large. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'sitestatic')
-rw-r--r--sitestatic/archweb.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js
index 783f75c..a42e020 100644
--- a/sitestatic/archweb.js
+++ b/sitestatic/archweb.js
@@ -206,7 +206,7 @@ function collapseDependsList(list) {
// enough items, or the link already exists.
var linkid = list.attr('id') + 'link';
var items = list.find('li').slice(limit);
- if (items.length == 0 || $('#' + linkid).length > 0) {
+ if (items.length <= 1 || $('#' + linkid).length > 0) {
return;
}
items.hide();
@@ -221,6 +221,28 @@ function collapseDependsList(list) {
});
}
+function collapseRelatedTo(elements) {
+ var limit = 5;
+ $(elements).each(function(idx, ele) {
+ ele = $(ele);
+ // Hide everything past a given limit. Don't do anything if we don't
+ // have enough items, or the link already exists.
+ var items = ele.find('span.related').slice(limit);
+ if (items.length <= 1 || ele.find('a.morelink').length > 0) {
+ return;
+ }
+ items.hide();
+ ele.append('<a class="morelink" href="#">Moreā€¦</a>');
+
+ // add link and wire it up to show the hidden items
+ ele.find('a.morelink').click(function(event) {
+ event.preventDefault();
+ ele.find('span.related').show();
+ $(this).remove();
+ });
+ });
+}
+
/* packages/differences.html */
function filter_packages() {
/* start with all rows, and then remove ones we shouldn't show */