From ca86b8d339ff3b8e74ac6d2ccf8a14458a690cf5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 5 Jul 2012 17:36:22 -0500 Subject: Collapse the dependencies and required by lists when they are long For now, this happens when the lists are over 20 items. Using JS, hide the 21st and following packages listed in the list and replace them with a 'Show More...' link that users can click to get the full list. For a package such as glibc with 444 'Required By' entries, this can make quite a visual difference. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 248be7a6..12b7c702 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -126,9 +126,9 @@ if (typeof $.tablesorter !== 'undefined') { (function($) { $.fn.enableCheckboxRangeSelection = function() { var lastCheckbox = null; - var lastElement = null; + var lastElement = null; - var spec = this; + var spec = this; spec.unbind("click.checkboxrange"); spec.bind("click.checkboxrange", function(e) { if (lastCheckbox != null && e.shiftKey) { @@ -170,6 +170,28 @@ function ajaxifyFiles() { }); } +function collapseDependsList(list) { + var limit = 20; + // hide everything past a given limit, but don't do anything if we don't + // enough items that it is worth adding the link + list = $(list); + var items = list.find('li').slice(limit); + if (items.length == 0) { + return; + } + items.hide(); + var linkid = list.attr('id') + 'link'; + list.after('

Show More…

'); + + // add links and wire them up to show the hidden items + $('#' + linkid).click(function(event) { + event.preventDefault(); + list.find('li').show(); + // remove the full

node from the DOM + $(this).parent().remove(); + }); +} + /* packages/differences.html */ function filter_packages() { /* start with all rows, and then remove ones we shouldn't show */ -- cgit v1.2.3-2-g168b From ef8fb7c7f242fc0f081f86d283e2fac22504a6b5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 8 Jul 2012 21:24:36 -0500 Subject: Make collapseDependsList() a bit smarter Signed-off-by: Dan McGee --- sitestatic/archweb.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 12b7c702..01d5b269 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -172,18 +172,18 @@ function ajaxifyFiles() { function collapseDependsList(list) { var limit = 20; - // hide everything past a given limit, but don't do anything if we don't - // enough items that it is worth adding the link list = $(list); + // Hide everything past a given limit. Don't do anything if we don't have + // enough items, or the link already exists. + var linkid = list.attr('id') + 'link'; var items = list.find('li').slice(limit); - if (items.length == 0) { + if (items.length == 0 || $('#' + linkid).length > 0) { return; } items.hide(); - var linkid = list.attr('id') + 'link'; list.after('

Show More…

'); - // add links and wire them up to show the hidden items + // add link and wire it up to show the hidden items $('#' + linkid).click(function(event) { event.preventDefault(); list.find('li').show(); -- cgit v1.2.3-2-g168b From c589f7d930ee7642524ecc33ee41bae79d4edd9b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 8 Jul 2012 23:24:35 -0500 Subject: Don't remove approval CSS class when updating signoff list Signed-off-by: Dan McGee --- sitestatic/archweb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 01d5b269..c0fb3a60 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -288,7 +288,7 @@ function signoff_package() { } /* update the approved column to reflect reality */ var approved = link.closest('tr').children('.approval'); - approved.attr('class', ''); + approved.attr('class', 'approval'); if (data.known_bad) { approved.text('Bad').addClass('signoff-bad'); } else if (!data.enabled) { -- cgit v1.2.3-2-g168b From f81323ff6fe3416f7d50395658006223ae25c87c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 23 Jul 2012 21:13:30 -0500 Subject: Generate package filelist in JavaScript via AJAX This is a super-simple template to follow to make the filelists work, so we can do all the "hard" work client-side. This also removes the need for a header-dependent '/files/' URL, as we are now just using the JSON representation instead. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index c0fb3a60..d17cc68f 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -164,8 +164,13 @@ function enablePreview() { function ajaxifyFiles() { $('#filelink').click(function(event) { event.preventDefault(); - $.get(this.href, function(data) { - $('#pkgfilelist').html(data); + $.getJSON(this.href + 'json/', function(data) { + // Map each file item into an
  • with the correct class + var list_items = $.map(data.files, function(value, i) { + var cls = value.match(/\/$/) ? 'd' : 'f'; + return ['
  • ', value, '
  • ']; + }); + $('#pkgfilelist').html('
      ' + list_items.join('') + '
    '); }); }); } @@ -173,8 +178,8 @@ function ajaxifyFiles() { function collapseDependsList(list) { var limit = 20; list = $(list); - // Hide everything past a given limit. Don't do anything if we don't have - // enough items, or the link already exists. + // Hide everything past a given limit. Don't do anything if we don't have + // enough items, or the link already exists. var linkid = list.attr('id') + 'link'; var items = list.find('li').slice(limit); if (items.length == 0 || $('#' + linkid).length > 0) { -- cgit v1.2.3-2-g168b From 211340c8bd6ccd6b16f3115a71fce4abedcc4c06 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 23 Jul 2012 21:31:17 -0500 Subject: Ensure package files JS can support corner cases We should handle the cases dealing with no filelist available, outdated filelist, or a package without files, just as the HTML server-side page does. Add a bit more info to the JSON returned so we can do so. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index d17cc68f..b04b1d01 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -170,7 +170,17 @@ function ajaxifyFiles() { var cls = value.match(/\/$/) ? 'd' : 'f'; return ['
  • ', value, '
  • ']; }); - $('#pkgfilelist').html('
      ' + list_items.join('') + '
    '); + $('#pkgfilelist').empty(); + if (data.pkg_last_update > data.files_last_update) { + $('#pkgfilelist').append('

    Note: This file list was generated from a previous version of the package; it may be out of date.

    '); + } + if (list_items.length > 0) { + $('#pkgfilelist').append('
      ' + list_items.join('') + '
    '); + } else if (data.files_last_update == null) { + $('#pkgfilelist').append('

    No file list available.

    '); + } else { + $('#pkgfilelist').append('

    Package has no files.

    '); + } }); }); } -- cgit v1.2.3-2-g168b From b1206a4109d3b13b06c3116ef3a2dd6c9e125a1f Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 23 Jul 2012 22:22:49 -0500 Subject: Enable filtering of todolist packages This matches the filtering options we have on the signoffs and package differences pages. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index b04b1d01..e6d73414 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -279,6 +279,29 @@ function todolist_flag() { return false; } +function filter_todolist() { + /* start with all rows, and then remove ones we shouldn't show */ + var rows = $('#dev-todo-pkglist tbody').children(); + var all_rows = rows; + /* apply the filters, cheaper ones first */ + if ($('#id_mine_only').is(':checked')) { + rows = rows.filter('.mine'); + } + if ($('#id_incomplete').is(':checked')) { + rows = rows.has('.incomplete'); + } + /* hide all rows, then show the set we care about */ + all_rows.hide(); + rows.show(); + /* make sure we update the odd/even styling from sorting */ + $('.results').trigger('applyWidgets'); +} +function filter_todolist_reset() { + $('#id_incomplete').removeAttr('checked'); + $('#id_mine_only').removeAttr('checked'); + filter_todolist(); +} + /* signoffs.html */ function signoff_package() { var link = this; -- cgit v1.2.3-2-g168b From c1a6a87e23864ea044cb15f76b9dbb16734f08d8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 25 Jul 2012 00:45:36 -0500 Subject: Add arch and repo filter to todolist packages This matches what we do on signoffs. Also beef up the styling a bit and add the dynamically updated package count info. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index e6d73414..6586d312 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -287,12 +287,21 @@ function filter_todolist() { if ($('#id_mine_only').is(':checked')) { rows = rows.filter('.mine'); } + /* apply arch and repo filters */ + $('#todolist_filter .arch_filter').add( + '#todolist_filter .repo_filter').each(function() { + if (!$(this).is(':checked')) { + rows = rows.not('.' + $(this).val()); + } + }); + /* more expensive filter because of 'has' call */ if ($('#id_incomplete').is(':checked')) { rows = rows.has('.incomplete'); } /* hide all rows, then show the set we care about */ all_rows.hide(); rows.show(); + $('#filter-count').text(rows.length); /* make sure we update the odd/even styling from sorting */ $('.results').trigger('applyWidgets'); } -- cgit v1.2.3-2-g168b From 2a221fa72fd8491ca1a0633ba62b6a846267b4fc Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 9 Jul 2012 00:40:17 -0500 Subject: Upgrade to jQuery 1.7.2 and a maintained tablesorter This touches a wide variety of files as well as makes updates to some of our own code to be fully compatible. We also use some of the newer locale/accent sorting features of tablesorter to make tables with developer names sort in a more sane fashion. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 6586d312..9e9bddf6 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -26,11 +26,11 @@ if (typeof $.tablesorter !== 'undefined') { var c = table.config; return ($.inArray(s, this.special) > -1) || $.tablesorter.isDigit(s, c); }, - format: function(s) { + format: function(s, t) { if ($.inArray(s, this.special) > -1) { return Number.MAX_VALUE; } - return $.tablesorter.formatFloat(s); + return $.tablesorter.formatFloat(s, t); }, type: 'numeric' }); @@ -73,7 +73,7 @@ if (typeof $.tablesorter !== 'undefined') { is: function(s) { return this.re.test(s); }, - format: function(s) { + format: function(s, t) { var matches = this.re.exec(s); if (!matches) { return 0; @@ -86,7 +86,7 @@ if (typeof $.tablesorter !== 'undefined') { * between 0-11, because things have to be difficult. */ var date = new Date(matches[1], matches[2] - 1, matches[3], matches[4], matches[5], matches[7]); - return $.tablesorter.formatFloat(date.getTime()); + return $.tablesorter.formatFloat(date.getTime(), t); }, type: 'numeric' }); @@ -253,7 +253,7 @@ function filter_packages() { all_rows.hide(); rows.show(); /* make sure we update the odd/even styling from sorting */ - $('.results').trigger('applyWidgets'); + $('.results').trigger('applyWidgets', [false]); } function filter_packages_reset() { $('#id_archonly').val('both'); @@ -274,7 +274,7 @@ function todolist_flag() { 'incomplete').removeClass('complete'); } /* let tablesorter know the cell value has changed */ - $('.results').trigger('updateCell', $(link).closest('td')); + $('.results').trigger('updateCell', [$(link).closest('td')[0], false, null]); }); return false; } @@ -303,7 +303,7 @@ function filter_todolist() { rows.show(); $('#filter-count').text(rows.length); /* make sure we update the odd/even styling from sorting */ - $('.results').trigger('applyWidgets'); + $('.results').trigger('applyWidgets', [false]); } function filter_todolist_reset() { $('#id_incomplete').removeAttr('checked'); @@ -360,7 +360,8 @@ function signoff_package() { link.text('Revoke Signoff'); link.attr('href', base_href + '/signoff/revoke/'); } - $('.results').trigger('updateCell', approved); + /* let tablesorter know the cell value has changed */ + $('.results').trigger('updateCell', [approved[0], false, null]); }); return false; } @@ -385,7 +386,7 @@ function filter_signoffs() { rows.show(); $('#filter-count').text(rows.length); /* make sure we update the odd/even styling from sorting */ - $('.results').trigger('applyWidgets'); + $('.results').trigger('applyWidgets', [false]); } function filter_signoffs_reset() { $('#signoffs_filter .arch_filter').attr('checked', 'checked'); -- cgit v1.2.3-2-g168b From c130414a478080519219872ebd842d139d1f139e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 4 Aug 2012 14:43:21 -0500 Subject: Make tablesorter filesize sorter more flexible Accept a few more prefixes, and also handle both 'MB' and 'MiB' style sizes. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 9e9bddf6..1ddf4ebf 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -92,7 +92,7 @@ if (typeof $.tablesorter !== 'undefined') { }); $.tablesorter.addParser({ id: 'filesize', - re: /^(\d+(?:\.\d+)?) (bytes?|KB|MB|GB|TB|PB)$/, + re: /^(\d+(?:\.\d+)?) (bytes?|[KMGTPEZY]i?B)$/, is: function(s) { return this.re.test(s); }, @@ -106,15 +106,29 @@ if (typeof $.tablesorter !== 'undefined') { switch(suffix) { /* intentional fall-through at each level */ + case 'YB': + case 'YiB': + size *= 1024; + case 'ZB': + case 'ZiB': + size *= 1024; + case 'EB': + case 'EiB': + size *= 1024; case 'PB': + case 'PiB': size *= 1024; case 'TB': + case 'TiB': size *= 1024; case 'GB': + case 'GiB': size *= 1024; case 'MB': + case 'MiB': size *= 1024; case 'KB': + case 'KiB': size *= 1024; } return size; -- cgit v1.2.3-2-g168b From acf252f7f3c0af95b3e90f07d0e4d878e4d0d776 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 5 Sep 2012 09:29:38 -0500 Subject: Add some HTML5-ization in JS of various input attributes On the login page, give focus to the username box when the page loads as well as turning autocorrection and auto-capitalization off on the username box. For the developer profile page, we can add some minor validation and typing of certain form fields that allow things like iPhone and Android to customize the presented keyboard to the user, as well as allowing browsers to do some client-side validation. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 1ddf4ebf..c274a675 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -425,3 +425,13 @@ function format_filesize(size, decimals) { return size.toFixed(decimals) + ' ' + labels[label]; } + +/* HTML5 input type and attribute enhancements */ +function modify_attributes(to_change) { + /* jQuery doesn't let us change the 'type' attribute directly due to IE + woes, so instead we can clone and replace, setting the type. */ + $.each(to_change, function(id, attrs) { + var obj = $(id); + obj.replaceWith(obj.clone().attr(attrs)); + }); +} -- cgit v1.2.3-2-g168b From dfbf7cdd4c273f2b1f3c1c79b97149d37e63e028 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 15 Sep 2012 09:13:58 -0500 Subject: Make todolist filtering functions more generic This will allow us to use them elsewhere in a future commit. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index c274a675..783f75c6 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -293,17 +293,17 @@ function todolist_flag() { return false; } -function filter_todolist() { +function filter_pkgs_list(filter_ele, tbody_ele) { /* start with all rows, and then remove ones we shouldn't show */ - var rows = $('#dev-todo-pkglist tbody').children(); + var rows = $(tbody_ele).children(); var all_rows = rows; /* apply the filters, cheaper ones first */ if ($('#id_mine_only').is(':checked')) { rows = rows.filter('.mine'); } /* apply arch and repo filters */ - $('#todolist_filter .arch_filter').add( - '#todolist_filter .repo_filter').each(function() { + $(filter_ele + ' .arch_filter').add( + filter_ele + ' .repo_filter').each(function() { if (!$(this).is(':checked')) { rows = rows.not('.' + $(this).val()); } @@ -319,10 +319,12 @@ function filter_todolist() { /* make sure we update the odd/even styling from sorting */ $('.results').trigger('applyWidgets', [false]); } -function filter_todolist_reset() { +function filter_pkgs_reset(callback) { $('#id_incomplete').removeAttr('checked'); $('#id_mine_only').removeAttr('checked'); - filter_todolist(); + $('.arch_filter').attr('checked', 'checked'); + $('.repo_filter').attr('checked', 'checked'); + callback(); } /* signoffs.html */ -- cgit v1.2.3-2-g168b From febf5e92233738198107a69f66c9f3443b4306c7 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 30 Sep 2012 18:18:19 -0500 Subject: Collapse long lists of related packages Just like we did with the rows of depends and required by, collapse down conflicts, provides, etc. comma-separated lists if they grow too large. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 783f75c6..a42e0208 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -206,7 +206,7 @@ function collapseDependsList(list) { // enough items, or the link already exists. var linkid = list.attr('id') + 'link'; var items = list.find('li').slice(limit); - if (items.length == 0 || $('#' + linkid).length > 0) { + if (items.length <= 1 || $('#' + linkid).length > 0) { return; } items.hide(); @@ -221,6 +221,28 @@ function collapseDependsList(list) { }); } +function collapseRelatedTo(elements) { + var limit = 5; + $(elements).each(function(idx, ele) { + ele = $(ele); + // Hide everything past a given limit. Don't do anything if we don't + // have enough items, or the link already exists. + var items = ele.find('span.related').slice(limit); + if (items.length <= 1 || ele.find('a.morelink').length > 0) { + return; + } + items.hide(); + ele.append('More…'); + + // add link and wire it up to show the hidden items + ele.find('a.morelink').click(function(event) { + event.preventDefault(); + ele.find('span.related').show(); + $(this).remove(); + }); + }); +} + /* packages/differences.html */ function filter_packages() { /* start with all rows, and then remove ones we shouldn't show */ -- cgit v1.2.3-2-g168b From 1decbc079ff8ab9798cef0ca02310357f8f4ba0c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 2 Oct 2012 08:48:54 -0500 Subject: JSLint suggested script cleanups Signed-off-by: Dan McGee --- sitestatic/archweb.js | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index a42e0208..d49665a4 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -1,6 +1,7 @@ +/*'use strict';*/ /* tablesorter custom parsers for various pages: * devel/index.html, mirrors/status.html, todolists/view.html */ -if (typeof $.tablesorter !== 'undefined') { +if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { $.tablesorter.addParser({ id: 'pkgcount', is: function(s) { return false; }, @@ -60,7 +61,7 @@ if (typeof $.tablesorter !== 'undefined') { format: function(s, t, c) { /* TODO: this assumes our magic class is the only one */ var epoch = $(c).attr('class'); - if (!epoch.indexOf('epoch-') == 0) { + if (epoch.indexOf('epoch-') !== 0) { return 0; } return epoch.slice(6); @@ -101,8 +102,8 @@ if (typeof $.tablesorter !== 'undefined') { if (!matches) { return 0; } - var size = parseFloat(matches[1]); - var suffix = matches[2]; + var size = parseFloat(matches[1]), + suffix = matches[2]; switch(suffix) { /* intentional fall-through at each level */ @@ -139,13 +140,13 @@ if (typeof $.tablesorter !== 'undefined') { (function($) { $.fn.enableCheckboxRangeSelection = function() { - var lastCheckbox = null; - var lastElement = null; + var lastCheckbox = null, + lastElement = null, + spec = this; - var spec = this; spec.unbind("click.checkboxrange"); spec.bind("click.checkboxrange", function(e) { - if (lastCheckbox != null && e.shiftKey) { + if (lastCheckbox !== null && e.shiftKey) { spec.slice( Math.min(spec.index(lastCheckbox), spec.index(e.target)), Math.max(spec.index(lastCheckbox), spec.index(e.target)) + 1 @@ -190,7 +191,7 @@ function ajaxifyFiles() { } if (list_items.length > 0) { $('#pkgfilelist').append('
      ' + list_items.join('') + '
    '); - } else if (data.files_last_update == null) { + } else if (data.files_last_update === null) { $('#pkgfilelist').append('

    No file list available.

    '); } else { $('#pkgfilelist').append('

    Package has no files.

    '); @@ -200,12 +201,12 @@ function ajaxifyFiles() { } function collapseDependsList(list) { - var limit = 20; list = $(list); // Hide everything past a given limit. Don't do anything if we don't have // enough items, or the link already exists. - var linkid = list.attr('id') + 'link'; - var items = list.find('li').slice(limit); + var limit = 20, + linkid = list.attr('id') + 'link', + items = list.find('li').slice(limit); if (items.length <= 1 || $('#' + linkid).length > 0) { return; } @@ -246,8 +247,8 @@ function collapseRelatedTo(elements) { /* packages/differences.html */ function filter_packages() { /* start with all rows, and then remove ones we shouldn't show */ - var rows = $('#tbody_differences').children(); - var all_rows = rows; + var rows = $('#tbody_differences').children(), + all_rows = rows; if (!$('#id_multilib').is(':checked')) { rows = rows.not('.multilib').not('.multilib-testing'); } @@ -300,6 +301,7 @@ function filter_packages_reset() { /* todolists/view.html */ function todolist_flag() { + // TODO: fix usage of this var link = this; $.getJSON(link.href, function(data) { if (data.complete) { @@ -317,8 +319,8 @@ function todolist_flag() { function filter_pkgs_list(filter_ele, tbody_ele) { /* start with all rows, and then remove ones we shouldn't show */ - var rows = $(tbody_ele).children(); - var all_rows = rows; + var rows = $(tbody_ele).children(), + all_rows = rows; /* apply the filters, cheaper ones first */ if ($('#id_mine_only').is(':checked')) { rows = rows.filter('.mine'); @@ -351,15 +353,16 @@ function filter_pkgs_reset(callback) { /* signoffs.html */ function signoff_package() { + // TODO: fix usage of this var link = this; $.getJSON(link.href, function(data) { link = $(link); - var signoff = null; - var cell = link.closest('td'); + var signoff = null, + cell = link.closest('td'); if (data.created) { signoff = $('
  • ').addClass('signed-username').text(data.user); var list = cell.children('ul.signoff-list'); - if (list.size() == 0) { + if (list.size() === 0) { list = $('
      ').prependTo(cell); } list.append(signoff); @@ -406,16 +409,14 @@ function signoff_package() { function filter_signoffs() { /* start with all rows, and then remove ones we shouldn't show */ - var rows = $('#tbody_signoffs').children(); - var all_rows = rows; + var rows = $('#tbody_signoffs').children(), + all_rows = rows; /* apply arch and repo filters */ $('#signoffs_filter .arch_filter').add( '#signoffs_filter .repo_filter').each(function() { if (!$(this).is(':checked')) { rows = rows.not('.' + $(this).val()); } - }); - /* and then the slightly more expensive pending check */ if ($('#id_pending').is(':checked')) { rows = rows.has('td.signoff-no'); } @@ -436,8 +437,8 @@ function filter_signoffs_reset() { /* visualizations */ function format_filesize(size, decimals) { /*var labels = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];*/ - var labels = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - var label = 0; + var labels = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], + label = 0; while (size > 2048.0 && label < labels.length - 1) { label++; -- cgit v1.2.3-2-g168b From ddb7f4825f8bf70142735a5ba2f7729ffe5d27c1 Mon Sep 17 00:00:00 2001 From: Evangelos Foutras Date: Sat, 6 Oct 2012 23:11:15 +0300 Subject: archweb.js: Fix syntax error in filter_signoffs() Commit 1decbc079ff8ab9798cef0ca02310357f8f4ba0c "JSLint suggested script cleanups" mistakenly removed the closing brace and parenthesis of a jQuery .each() call, along with a following comment. This commit brings back the two removed lines. Signed-off-by: Evangelos Foutras Signed-off-by: Dan McGee --- sitestatic/archweb.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index d49665a4..a0c5713a 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -417,6 +417,8 @@ function filter_signoffs() { if (!$(this).is(':checked')) { rows = rows.not('.' + $(this).val()); } + }); + /* and then the slightly more expensive pending check */ if ($('#id_pending').is(':checked')) { rows = rows.has('td.signoff-no'); } -- cgit v1.2.3-2-g168b From 040e0ddea591702856ce7d737bf4ea31f60a89e5 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 11 Dec 2012 20:53:50 -0600 Subject: Collapse really long signoff specifications using JS Signed-off-by: Dan McGee --- sitestatic/archweb.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index a0c5713a..42efb3fa 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -301,7 +301,7 @@ function filter_packages_reset() { /* todolists/view.html */ function todolist_flag() { - // TODO: fix usage of this + // TODO: fix usage of this var link = this; $.getJSON(link.href, function(data) { if (data.complete) { @@ -353,7 +353,7 @@ function filter_pkgs_reset(callback) { /* signoffs.html */ function signoff_package() { - // TODO: fix usage of this + // TODO: fix usage of this var link = this; $.getJSON(link.href, function(data) { link = $(link); @@ -436,6 +436,33 @@ function filter_signoffs_reset() { filter_signoffs(); } +function collapseNotes(elements) { + // Remove any trailing
      tags from the note contents + $(elements).children('br').filter(':last-child').filter(function(i, e) { return !e.nextSibling; }).remove(); + + var maxElements = 8; + $(elements).each(function(idx, ele) { + ele = $(ele); + // Hide everything past a given limit. Don't do anything if we don't + // have enough items, or the link already exists. + var contents = ele.contents(); + if (contents.length <= maxElements || ele.find('a.morelink').length > 0) { + return; + } + contents.slice(maxElements).wrapAll('
      '); + ele.append('
      Show More…'); + + // add link and wire it up to show the hidden items + ele.find('a.morelink').click(function(event) { + event.preventDefault(); + ele.find('div.hide').show(); + $(this).remove(); + // remove trailing line break between text and our link + $(this).contents().last().filter('br').remove(); + }); + }); +} + /* visualizations */ function format_filesize(size, decimals) { /*var labels = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];*/ -- cgit v1.2.3-2-g168b From c8ece67cec9c421ac0c711554edd34f022623b45 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 28 Dec 2012 00:27:20 -0600 Subject: Convert to using new todolist models everywhere This is a rather widespread set of changes converting usage to the new todo list and todo list package model recently introduced. The data migration is not included in this commit. After this commit, the old model should no longer be referenced anywhere. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 42efb3fa..4a02fb63 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -15,7 +15,12 @@ if (typeof $ !== 'undefined' && typeof $.tablesorter !== 'undefined') { id: 'todostatus', is: function(s) { return false; }, format: function(s) { - return s.match(/incomplete/i) ? 1 : 0; + if (s.match(/incomplete/i)) { + return 1; + } else if (s.match(/in-progress/i)) { + return 0.5; + } + return 0; }, type: 'numeric' }); @@ -304,13 +309,9 @@ function todolist_flag() { // TODO: fix usage of this var link = this; $.getJSON(link.href, function(data) { - if (data.complete) { - $(link).text('Complete').addClass( - 'complete').removeClass('incomplete'); - } else { - $(link).text('Incomplete').addClass( - 'incomplete').removeClass('complete'); - } + $(link).text(data.status).removeClass( + 'complete inprogress incomplete').addClass( + data.css_class.toLowerCase()); /* let tablesorter know the cell value has changed */ $('.results').trigger('updateCell', [$(link).closest('td')[0], false, null]); }); -- cgit v1.2.3-2-g168b From 26d6fba089f525505be4ee751fd8a4d37961cad0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 3 Feb 2013 13:29:13 -0600 Subject: Fix spacing issues in signoffs 'Show More' links When we had a simple multi-line message here, we would end up with too much spacing wherever the link had planted itself due to the div adding visual whitespace. Remove the div completely when the link is clicked to remedy this. Signed-off-by: Dan McGee --- sitestatic/archweb.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sitestatic/archweb.js') diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js index 4a02fb63..dda22d9e 100644 --- a/sitestatic/archweb.js +++ b/sitestatic/archweb.js @@ -451,15 +451,17 @@ function collapseNotes(elements) { return; } contents.slice(maxElements).wrapAll('
      '); - ele.append('
      Show More…'); + ele.append('Show More…'); // add link and wire it up to show the hidden items ele.find('a.morelink').click(function(event) { event.preventDefault(); - ele.find('div.hide').show(); $(this).remove(); - // remove trailing line break between text and our link - $(this).contents().last().filter('br').remove(); + ele.find('br.morelink-spacer').remove(); + // move the div contents back and delete the empty div + var hidden = ele.find('div.hide'); + hidden.contents().appendTo(ele); + hidden.remove(); }); }); } -- cgit v1.2.3-2-g168b