diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-06-28 20:59:10 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-07-04 12:32:26 +0200 |
commit | 5cd77a826f5a52168335e1db0926215da6e23ad0 (patch) | |
tree | 424b9b7f3cb927dd1af8f204e544bf016fa99a38 /web/html | |
parent | 062fa097c9adb1254fa215fa1735cac9195f71bf (diff) | |
download | aurweb-checked-count.tar.xz |
Show number of selected packages on search pagechecked-count
Fixes FS#45379.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'web/html')
-rw-r--r-- | web/html/packages.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/web/html/packages.php b/web/html/packages.php index bf3daf8..4b11f09 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -71,6 +71,22 @@ $(document).ready(function() { collapseDependsList("#pkgdepslist"); collapseDependsList("#pkgreqslist"); collapseDependsList("#pkgsrcslist"); + + function update_checked_count() { + var one_pkg = '<?= __("1 package selected") ?>'; + var pkgs = '<?= __("%d packages selected") ?>'; + + var count = $('.package-checkbox:checked').length; + if (count === 1) { + var res = one_pkg; + } else { + var res = pkgs; + } + $('#pkglist-checked-count').text(res.replace('%s', count.toString())); + } + update_checked_count(); // Set initial string + + $('.package-checkbox').change(update_checked_count); }); </script> |