From 2bd1bf50d16e3651d725c9168572eae3c6660780 Mon Sep 17 00:00:00 2001 From: dmacias72 Date: Fri, 11 Mar 2016 13:59:07 -0700 Subject: [PATCH] add css, move switches to js --- .../emhttp/plugins/NerdPack/NerdPack.page | 3 - .../emhttp/plugins/NerdPack/css/NerdPack.css | 7 + .../plugins/NerdPack/js/jquery.NerdPack.js | 142 +++++++++--------- .../plugins/NerdPack/scripts/packagemanager | 0 4 files changed, 79 insertions(+), 73 deletions(-) mode change 100644 => 100755 source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page index 503b4a68..96e75573 100644 --- a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/NerdPack.page @@ -7,9 +7,6 @@ Title="Nerd Pack" - - -
diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/css/NerdPack.css b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/css/NerdPack.css index 819d98a7..6612b767 100644 --- a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/css/NerdPack.css +++ b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/css/NerdPack.css @@ -7,3 +7,10 @@ .switch-button-label.off { color: inherit; } +.uptodate { + color:#44B012; + white-space:nowrap; +} +.updateready { + white-space:nowrap; +} \ No newline at end of file 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 3e51481f..ce87fe9c 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,75 +1,76 @@ $(function(){ + // add switches to title bar + $('#title') + .append("") + .append(""); + // tablesorter options - $("#tblPackages").tablesorter({ + $('#tblPackages').tablesorter({ sortList: [[0,0]], - widgets: ["saveSort", "filter", "stickyHeaders"], + widgets: ['saveSort', 'filter', 'stickyHeaders'], widgetOptions: { stickyHeaders_filteredToTop: true, filter_hideEmpty: true, filter_liveSearch: true, filter_saveFilters: true, - filter_reset: ".reset", + filter_reset: '.reset', filter_functions: { - ".filter-version": true, - ".filter-downloaded": true, - ".filter-installed": true + '.filter-version': true, + '.filter-downloaded': true, + '.filter-installed': true } } }); // "uninstall package" switch and cookie - $("#uninstallpkg") + $('#uninstallpkg') .switchButton({ - labels_placement: "left", - on_label: "unInstall On", - off_label: "unInstall Off", - checked: $.cookie("nerdpack_packages_uninstall") == "--uninstall" + labels_placement: 'left', + on_label: 'unInstall On', + off_label: 'unInstall Off', + checked: $.cookie('nerdpack_packages_uninstall') == '--uninstall' }) .change(function () { - $.cookie("nerdpack_packages_uninstall", $(this).prop("checked") ? "--uninstall" : "", { expires: 3650 }); + $.cookie('nerdpack_packages_uninstall', $('#uninstallpkg')[0].checked ? '--uninstall' : '', { expires: 3650 }); }); // "delete package" switch and cookie - $("#deletepkg") + $('#deletepkg') .switchButton({ - labels_placement: "left", - on_label: "delete On", - off_label: "delete Off", - checked: $.cookie("nerdpack_packages_delete") == "--delete" + labels_placement: 'left', + on_label: 'delete On', + off_label: 'delete Off', + checked: $.cookie('nerdpack_packages_delete') == '--delete' }) .change(function () { - $.cookie("nerdpack_packages_delete", $(this).prop("checked") ? "--delete" : "", { expires: 3650 }); + $.cookie('nerdpack_packages_delete', $('#deletepkg')[0].checked ? '--delete' : '', { expires: 3650 }); }); // select all packages switch - $("#checkall") + $('#checkall') .switchButton({ - labels_placement: "right", - on_label: "Select All", - off_label: "Select All", - checked: $.cookie("nerdpack_checkall") == "yes" + 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}); + var myval = $(this)[0].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() { + $('#btnApply').click(function() { checkDepends(); - $.ajax({ - type: "POST", - url: "/update.php", - data: $("#package_form").serializeArray(), - success: function() { - openBox("/plugins/NerdPack/scripts/packagemanager&arg1=--download"+ - "&arg2="+$.cookie("nerdpack_packages_uninstall")+ - "&arg3="+$.cookie("nerdpack_packages_delete"), - "Package Manager", 600, 900, true); + $.post('/update.php', $('#package_form').serializeArray(), function() { + openBox('/plugins/NerdPack/scripts/packagemanager&arg1=--download'+ + '&arg2='+$.cookie('nerdpack_packages_uninstall')+ + '&arg3='+$.cookie('nerdpack_packages_delete'), + 'Package Manager', 600, 900, true); } - }); + ); }); packageQuery(); @@ -77,64 +78,65 @@ $(function(){ //list all available packages in a table function packageQuery(force) { - $("#tblPackages tbody").html(""); - $.getJSON("/plugins/NerdPack/include/PackageQuery.php", {force: force}, function(data) { - $("#tblPackages tbody").empty(); - for (var i in data) { + $('#tblPackages tbody').html(""); + $.getJSON('/plugins/NerdPack/include/PackageQuery.php', {force: force}, function(packages) { + $('#tblPackages tbody').empty(); + var len = packages.length, i = 0; + for (i; i < len; i++) { var Update; - if (data[i].downloadeq == data[i].downloaded && data[i].installeq == data[i].installed) - Update = " up-to-date"; + if (packages[i].downloadeq == packages[i].downloaded && packages[i].installeq == packages[i].installed) + Update = " up-to-date "; else - Update = " update ready"; + Update = " update ready "; - var Downloaded = data[i].downloaded; - if (data[i].downloadeq != data[i].downloaded) + var Downloaded = packages[i].downloaded; + if (packages[i].downloadeq != packages[i].downloaded) Downloaded = 'old'; - var Installed = data[i].installed; - if (data[i].installeq != data[i].installed) + var Installed = packages[i].installed; + if (packages[i].installeq != packages[i].installed) Installed = 'old'; - $("#tblPackages tbody").append(""+ - ""+ // package name + $('#tblPackages tbody').append(""+ + ""+ // package name ""+ // package status - ""+ // package size + ""+ // package size ""+ // package downloaded ""+ // package installed - ""+ // package dependents - ""+ + ""+ // package dependents + ""+ ""); } // attach switch buttons to every package checkbox all at once - $(".pkgcheckbox") + $('.pkgcheckbox') .switchButton({ - labels_placement: "right", - on_label: "On", - off_label: "Off" + labels_placement: 'right', + on_label: 'On', + off_label: 'Off' }) .change(function() { - $(this).parent().parent().find(".pkgvalue").val(this.checked ? "yes": "no"); + $(this).parent().parent().find('.pkgvalue').val(this.checked ? "yes": "no"); if (this.checked) checkDepends(); - $("#btnApply").prop("disabled", false); + $('#btnApply').prop("disabled", false); }); // restore filters - var lastSearch = $("#tblPackages")[0].config.lastSearch; - $("#tblPackages").trigger("update"); - $("#tblPackages").trigger("search", [lastSearch]); + var lastSearch = $('#tblPackages')[0].config.lastSearch; + $('#tblPackages').trigger('update') + .trigger('search', [lastSearch]); }); } function checkDepends() { - if ($("#screen").prop("checked")) { - $("#utempter").switchButton({checked: true}); - $("#utempter", ".pkgvalue").val("yes"); + if ($('#screen')[0].checked) { + $('#utempter').switchButton({checked: true}); + $('#utempter', '.pkgvalue').val('yes'); } - if ($("#iotop").prop("checked")) { - $("#python").switchButton({checked: true}); - $("#python", ".pkgvalue").val("yes"); + if ($('#iotop')[0].checked) { + $('#python').switchButton({checked: true}); + $('#python', '.pkgvalue').val('yes'); } -} \ No newline at end of file +} diff --git a/source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager b/source/NerdPack/usr/local/emhttp/plugins/NerdPack/scripts/packagemanager old mode 100644 new mode 100755

Please wait, retrieving plugin information ...

Please wait, retrieving plugin information ...
"+data[i].name+"
"+packages[i].name+""+Update+""+data[i].size+""+packages[i].size+""+Downloaded+""+Installed+""+data[i].plugins+""+ - ""+packages[i].plugins+""+ + "