[aur-dev] [PATCH] Show number of selected packages on search page
Johannes Löthberg
johannes at kyriasis.com
Tue Jun 30 14:21:58 UTC 2015
On 30/06, carstene1ns wrote:
>Am 28.06.2015 um 21:22 schrieb Johannes Löthberg:
>> +function checkboxes() {
>> + document.getElementById("pkglist-checked-count").innerHTML = document.querySelectorAll('input[type="checkbox"]:checked').length;
>> +}
>> +
>> $(document).ready(function() {
>> collapseDependsList("#pkgdepslist");
>> collapseDependsList("#pkgreqslist");
>> collapseDependsList("#pkgsrcslist");
>> + checkboxes(); // Set initial value
>> +
>> + var elements = document.getElementsByClassName('package-checkbox');
>> +
>> + for (var i = 0, len = elements.length; i < len; i++) {
>> + elements[i].onchange = checkboxes;
>> + }
>
>It should be easier to just use the already active jQuery. See the first
>example here: https://api.jquery.com/checked-selector/
>
>That said, $(".package-checkbox:checked").length should do it.
>
Yeah, I wrote the thing before I notice that the AUR already used
jquery, then didn't feel like switching right away, so wanted some
comments first. But I'll switch.
--
Sincerely,
Johannes Löthberg
PGP Key ID: 0x50FB9B273A9D0BB5
https://theos.kyriasis.com/~kyrias/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1495 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/aur-dev/attachments/20150630/11602080/attachment.asc>
More information about the aur-dev
mailing list