1
0
Fork 0
mirror of https://github.com/qurator-spk/dinglehopper.git synced 2025-07-02 06:59:59 +02:00
dinglehopper/src/dinglehopper/templates/report.html.js
Mike Gerber 325e5af5f5 🐛 Move source into src/ to fix install
Installing was broken since moving to pyproject.toml, which we didn't notice because of
leftover files in build/. Fix this by using the convention of having the source files
in src/ and adjusting pyproject.toml accordingly.

Fixes gh-86. 🤞
2023-08-03 17:29:30 +02:00

39 lines
1.3 KiB
JavaScript

function find_diff_class(classes) {
return $('.' + classes.split(/\s+/).find(x => x.match(/.diff\d.*/)));
}
$(document).ready(function() {
/* Enable Bootstrap tooltips */
$('[data-toggle="tooltip"]').tooltip();
$('.diff').mouseover(function() {
find_diff_class($(this).attr('class')).addClass('diff-highlight');
});
$('.diff').mouseout(function() {
find_diff_class($(this).attr('class')).removeClass('diff-highlight');
});
/* Sort this column of the table */
$('th').click(function () {
var table = $(this).closest('table');
var rows = table.find('tbody > tr').toArray().sort(compareRows($(this).index()));
this.asc = !this.asc;
if (!this.asc) {
rows = rows.reverse();
}
for (var i = 0; i < rows.length; i++) {
table.children('tbody').append(rows[i]);
}
});
function compareRows(index) {
return function (row1, row2) {
var cell1 = $(row1).children('td').eq(index).text().toLowerCase();
var cell2 = $(row2).children('td').eq(index).text().toLowerCase();
return cell1.localeCompare(cell2, undefined, {
numeric: true,
sensitivity: 'base'
});
}
}
});