diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/js/jquery.NerdPack.js b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/js/jquery.NerdPack.js
index 189e4597..a2a72caa 100644
--- a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/js/jquery.NerdPack.js
+++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/js/jquery.NerdPack.js
@@ -1,4 +1,22 @@
$(function(){
+ // tablesorter options
+ $("#tblPackages").tablesorter({
+ sortList: [[0,1]],
+ widgets: ["saveSort", "filter", "stickyHeaders"],
+ widgetOptions: {
+ stickyHeaders_filteredToTop: true,
+ filter_hideEmpty: true,
+ filter_liveSearch: true,
+ filter_saveFilters: true,
+ filter_reset: "button.reset",
+ filter_functions: {
+ ".filter-version": true,
+ ".filter-downloaded": true,
+ ".filter-installed": true
+ }
+ }
+ });
+
// "uninstall package" switch and cookie
$("#uninstallpkg")
.switchButton({
@@ -23,6 +41,20 @@ $(function(){
$.cookie("nerdpack_packages_delete", $(this).prop("checked") ? "--delete" : "", { expires: 3650 });
});
+ // select all packages switch
+ $("#checkall")
+ .switchButton({
+ labels_placement: "right",
+ on_label: "Select All",
+ off_label: "Select All",
+ checked: $.cookie("nerdpack_checkall") == "yes"
+ })
+ .change(function () {
+ var myval = $(this).prop("checked");
+ $.cookie("nerdpack_checkall", myval ? "yes" : "no", { expires: 3650 });
+ $("#tblPackages tbody td:visible .pkgcheckbox").switchButton({checked: myval});
+ });
+
// set cookie on apply button press
$("#btnApply").click(function() {
checkDepends();
@@ -70,62 +102,29 @@ function packageQuery(force) {
"
"+data[i].size+" | "+ // package size
""+Downloaded+" | "+ // package installed
""+Installed+" | "+ // package installed
- ""+
+ " | "+
" | "+
"");
-
- $("#"+data[i].pkgname)
- .switchButton({
- labels_placement: "right",
- on_label: "On",
- off_label: "Off",
- checked: data[i].config == "yes"
- })
- .change(function() {
- $(this).parent().parent().find(".pkgvalue").val(this.checked ? "yes": "no");
- if (this.checked)
- checkDepends();
- $("#btnApply").prop("disabled", false);
- });
}
- $("#tblPackages").trigger("update");
-
- // tablesorter options
- $("#tblPackages").tablesorter({
- sortList: [[0,0]],
- widgets: ["saveSort", "filter", "stickyHeaders"],
- widgetOptions: {
- stickyHeaders_filteredToTop: true,
- filter_hideEmpty: true,
- filter_liveSearch: true,
- filter_saveFilters: true,
- filter_reset: ".reset",
- filter_functions: {
- ".filter-version": true,
- ".filter-downloaded": true,
- ".filter-installed": true
- }
- }
- });
- // select all packages switch
- $("#checkall")
+ // attach switch buttons to every package checkbox all at once
+ $(".pkgcheckbox")
.switchButton({
labels_placement: "right",
- on_label: "Select All",
- off_label: "Select All",
- checked: $.cookie("nerdpack_checkall") == "yes"
+ on_label: "On",
+ off_label: "Off"
})
- .change(function () {
- var myval = $(this).prop("checked");
- $.cookie("nerdpack_checkall", myval ? "yes" : "no", { expires: 3650 });
- $(".pkgcheckbox").each(function() { // loop through each checkbox
- $(this).switchButton({checked: myval});
- });
- $(".pkgvalue").each(function() { // loop through each value
- $(this).val(myval ? "yes": "no");
- });
+ .change(function() {
+ $(this).parent().parent().find(".pkgvalue").val(this.checked ? "yes": "no");
+ if (this.checked)
+ checkDepends();
+ $("#btnApply").prop("disabled", false);
});
+
+ // restore filters
+ var lastSearch = $("#tblPackages")[0].config.lastSearch;
+ $("#tblPackages").trigger("update");
+ $("#tblPackages").trigger("search", [lastSearch]);
});
}