summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjelle van der Waa <jelle@vdwaa.nl>2018-11-18 23:03:28 +0100
committerGitHub <noreply@github.com>2018-11-18 23:03:28 +0100
commit598d992cb2b55ce0b6c84b2082b1c40c485f8184 (patch)
tree1fc77a7db085336f8be3bf4dcc2cc2928ca379f5
parente2483bb86c930a0f222b3dd678144ebc07b395b2 (diff)
parent6451de66862b843742d1c712a150ea8aa49aec0d (diff)
downloadarchweb-598d992cb2b55ce0b6c84b2082b1c40c485f8184.tar.gz
archweb-598d992cb2b55ce0b6c84b2082b1c40c485f8184.zip
Merge pull request #156 from jelly/js_deprecated
Js deprecated
-rw-r--r--sitestatic/archweb.js100
-rw-r--r--templates/packages/differences.html8
-rw-r--r--visualize/static/visualize.js16
3 files changed, 30 insertions, 94 deletions
diff --git a/sitestatic/archweb.js b/sitestatic/archweb.js
index 5f6e5e97..b8ad6817 100644
--- a/sitestatic/archweb.js
+++ b/sitestatic/archweb.js
@@ -264,61 +264,6 @@ 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(),
- all_rows = rows;
- if (!$('#id_multilib').is(':checked')) {
- rows = rows.not('.multilib').not('.multilib-testing');
- }
- var arch = $('#id_archonly').val();
- if (arch !== 'all') {
- rows = rows.filter('.' + arch);
- }
- if (!$('#id_minor').is(':checked')) {
- /* this check is done last because it is the most expensive */
- var pat = /(.*)-(.+)/;
- rows = rows.filter(function(index) {
- var cells = $(this).children('td');
-
- /* all this just to get the split version out of the table cell */
- var ver_a = cells.eq(2).text().match(pat);
- if (!ver_a) {
- return true;
- }
-
- var ver_b = cells.eq(3).text().match(pat);
- if (!ver_b) {
- return true;
- }
-
- /* first check pkgver */
- if (ver_a[1] !== ver_b[1]) {
- return true;
- }
- /* pkgver matched, so see if rounded pkgrel matches */
- if (Math.floor(parseFloat(ver_a[2])) ===
- Math.floor(parseFloat(ver_b[2]))) {
- return false;
- }
- /* pkgrel didn't match, so keep the row */
- return true;
- });
- }
- /* 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', [false]);
-}
-function filter_packages_reset() {
- $('#id_archonly').val('both');
- $('#id_multilib').removeAttr('checked');
- $('#id_minor').removeAttr('checked');
- filter_packages();
-}
-
/* todolists/view.html */
function todolist_flag() {
// TODO: fix usage of this
@@ -360,10 +305,10 @@ function filter_pkgs_list(filter_ele, tbody_ele) {
$('.results').trigger('applyWidgets', [false]);
}
function filter_pkgs_reset(callback) {
- $('#id_incomplete').removeAttr('checked');
- $('#id_mine_only').removeAttr('checked');
- $('.arch_filter').attr('checked', 'checked');
- $('.repo_filter').attr('checked', 'checked');
+ $('#id_incomplete').prop('checked', false);
+ $('#id_mine_only').prop('checked', false);
+ $('.arch_filter').prop('checked', true);
+ $('.repo_filter').prop('checked', true);
callback();
}
@@ -376,10 +321,10 @@ function filter_todolist_load(list_id) {
if (!state)
return;
state = JSON.parse(state);
- $('#todolist_filter input[type="checkbox"]').removeAttr('checked');
+ $('#todolist_filter input[type="checkbox"]').prop('checked', false);
$.each(state, function (i, v) {
// this assumes our only filters are checkboxes
- $('#todolist_filter input[name="' + v['name'] + '"]').attr('checked', 'checked');
+ $('#todolist_filter input[name="' + v['name'] + '"]').prop('checked', true);
});
}
@@ -392,10 +337,10 @@ function filter_report_load(report_id) {
if (!state)
return;
state = JSON.parse(state);
- $('#report_filter input[type="checkbox"]').removeAttr('checked');
+ $('#report_filter input[type="checkbox"]').prop('checked', false);
$.each(state, function (i, v) {
// this assumes our only filters are checkboxes
- $('#report_filter input[name="' + v['name'] + '"]').attr('checked', 'checked');
+ $('#report_filter input[name="' + v['name'] + '"]').prop('checked', true);
});
}
@@ -410,7 +355,7 @@ function signoff_package() {
if (data.created) {
signoff = $('<li>').addClass('signed-username').text(data.user);
var list = cell.children('ul.signoff-list');
- if (list.size() === 0) {
+ if (list.length === 0) {
list = $('<ul class="signoff-list">').prependTo(cell);
}
list.append(signoff);
@@ -479,9 +424,9 @@ function filter_signoffs() {
filter_signoffs_save();
}
function filter_signoffs_reset() {
- $('#signoffs_filter .arch_filter').attr('checked', 'checked');
- $('#signoffs_filter .repo_filter').attr('checked', 'checked');
- $('#id_pending').removeAttr('checked');
+ $('#signoffs_filter .arch_filter').prop('checked', true);
+ $('#signoffs_filter .repo_filter').prop('checked', true);
+ $('#id_pending').prop('checked', false);
filter_signoffs();
}
function filter_signoffs_save() {
@@ -493,10 +438,10 @@ function filter_signoffs_load() {
if (!state)
return;
state = JSON.parse(state);
- $('#signoffs_filter input[type="checkbox"]').removeAttr('checked');
+ $('#signoffs_filter input[type="checkbox"]').prop('checked', false);
$.each(state, function (i, v) {
// this assumes our only filters are checkboxes
- $('#signoffs_filter input[name="' + v['name'] + '"]').attr('checked', 'checked');
+ $('#signoffs_filter input[name="' + v['name'] + '"]').prop('checked', true);
});
}
@@ -529,23 +474,6 @@ function collapseNotes(elements) {
});
}
-/* 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'],
- label = 0;
-
- while (size > 2048.0 && label < labels.length - 1) {
- label++;
- size /= 1024.0;
- }
- if (decimals === undefined) {
- decimals = 2;
- }
-
- 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
diff --git a/templates/packages/differences.html b/templates/packages/differences.html
index ac046897..30750798 100644
--- a/templates/packages/differences.html
+++ b/templates/packages/differences.html
@@ -44,15 +44,7 @@
<script type="text/javascript" src="{% static "archweb.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
- $('#table_differences').tablesorter({widgets: ['zebra'], sortList: [[1,0], [0,0]]});
$('#table_multilib_differences').tablesorter({widgets: ['zebra'], sortList: [[5, 0]]});
});
-$(document).ready(function() {
- $('#diff_filter select').change(filter_packages);
- $('#diff_filter input').change(filter_packages);
- $('#criteria_reset').click(filter_packages_reset);
- // fire function on page load to ensure the current form selections take effect
- filter_packages();
-});
</script>
{% endblock %}
diff --git a/visualize/static/visualize.js b/visualize/static/visualize.js
index 5254c26b..47d75f6e 100644
--- a/visualize/static/visualize.js
+++ b/visualize/static/visualize.js
@@ -1,3 +1,19 @@
+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'],
+ label = 0;
+
+ while (size > 2048.0 && label < labels.length - 1) {
+ label++;
+ size /= 1024.0;
+ }
+ if (decimals === undefined) {
+ decimals = 2;
+ }
+
+ return size.toFixed(decimals) + ' ' + labels[label];
+}
+
function packages_treemap(chart_id, orderings, default_order) {
var jq_div = jQuery(chart_id),
color = d3.scale.category20();