diff options
Diffstat (limited to 'sitestatic/archweb.js')
-rw-r--r-- | sitestatic/archweb.js | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index be6f5256..43816c5b 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -123,7 +123,7 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { $.tablesorter.addParser({ id: 'filesize', - re: /^(\d+(?:\.\d+)?) (bytes?|[KMGTPEZY]i?B)$/, + re: /^(\d+(?:\.\d+)?)[ \u00a0](bytes?|[KMGTPEZY]i?B)$/, is: function(s) { return this.re.test(s); }, @@ -387,6 +387,38 @@ function filter_pkgs_reset(callback) { callback(); } +function filter_todolist_save(list_id) { + var state = $('#todolist_filter').serializeArray(); + localStorage['filter_todolist_' + list_id] = JSON.stringify(state); +} +function filter_todolist_load(list_id) { + var state = localStorage['filter_todolist_' + list_id]; + if (!state) + return; + state = JSON.parse(state); + $('#todolist_filter input[type="checkbox"]').removeAttr('checked'); + $.each(state, function (i, v) { + // this assumes our only filters are checkboxes + $('#todolist_filter input[name="' + v['name'] + '"]').attr('checked', 'checked'); + }); +} + +function filter_report_save(report_id) { + var state = $('#report_filter').serializeArray(); + localStorage['filter_report_' + report_id] = JSON.stringify(state); +} +function filter_report_load(report_id) { + var state = localStorage['filter_report_' + report_id]; + if (!state) + return; + state = JSON.parse(state); + $('#report_filter input[type="checkbox"]').removeAttr('checked'); + $.each(state, function (i, v) { + // this assumes our only filters are checkboxes + $('#report_filter input[name="' + v['name'] + '"]').attr('checked', 'checked'); + }); +} + /* signoffs.html */ function signoff_package() { // TODO: fix usage of this @@ -464,6 +496,7 @@ function filter_signoffs() { $('#filter-count').text(rows.length); /* make sure we update the odd/even styling from sorting */ $('.results').trigger('applyWidgets', [false]); + filter_signoffs_save(); } function filter_signoffs_reset() { $('#signoffs_filter .arch_filter').attr('checked', 'checked'); @@ -471,6 +504,21 @@ function filter_signoffs_reset() { $('#id_pending').removeAttr('checked'); filter_signoffs(); } +function filter_signoffs_save() { + var state = $('#signoffs_filter').serializeArray(); + localStorage['filter_signoffs'] = JSON.stringify(state); +} +function filter_signoffs_load() { + var state = localStorage['filter_signoffs']; + if (!state) + return; + state = JSON.parse(state); + $('#signoffs_filter input[type="checkbox"]').removeAttr('checked'); + $.each(state, function (i, v) { + // this assumes our only filters are checkboxes + $('#signoffs_filter input[name="' + v['name'] + '"]').attr('checked', 'checked'); + }); +} function collapseNotes(elements) { // Remove any trailing <br/> tags from the note contents |