PageSourceSearch

https://www.bcccreditoconsumo.it/Rebranding/js/tables_utilities.js

js bcccreditoconsumo.it collected 2026-10-06 09:29:40 UTC 2,028 bytes, 80 lines download raw bytes

1function Table_SortingSet(table) {
2    const tableheaders = $("#" + table + " th");
3
4    tableheaders.on("click", function () {
5        var order = "DESC";
6        if (!$(this).hasClass("OrderASC") || $(this).hasClass("OrderDESC"))
7            order = "ASC";
8
9        $(this).removeClass("OrderASC");
10        $(this).removeClass("OrderDESC");
11
12        var image = $(this).find("img");
13        if ($(image).length > 0) {
14            $($(image)[0]).removeClass("image-no-order");
15            $($(image)[0]).removeClass("image-order-ASC");
16            $($(image)[0]).removeClass("image-order-DESC");
17            $($(image)[0]).addClass("image-order-" + order);
18        }
19
20        $(this).addClass("Order" + order);
21        if (order == "ASC") {
22            sortOrder = 1;
23        }
24        else {
25            sortOrder = -1;
26        }
27        const rows = sortRows(table, this);
28        rebuildTbody(table, rows);
29    })
30
31
32}
33
34function sortRows(table, th) {
35    const rows = $.makeArray($("#" + table + " tbody tr"));
36    const col = th.cellIndex;
37    const type = th.dataset.type;
38    rows.sort(function (a, b) {
39        return compare(a, b, col, type) * sortOrder;
40    });
41    return rows;
42}
43
44function compare(a, b, col, type) {
45    let _a = "";
46    let _b = "";
47    if (a.children[col] != undefined)
48        _a = a.children[col].textContent;
49    if (b.children[col] != undefined)
50        _b = b.children[col].textContent;
51    if (type === "number") {
52        _a *= 1;
53        _b *= 1;
54    } else if (type === "string") {
55        _a = _a.toLowerCase();
56        _b = _b.toLowerCase();
57    }
58
59    if (_a < _b) {
60        return -1;
61    }
62    if (_a > _b) {
63        return 1;
64    }
65    return 0;
66}
67
68function rebuildTbody(table, rows) {
69    const tbody = $("#" + table + " tbody");
70    while (tbody.firstChild) {
71        tbody.remove(tbody.firstChild);
72    }
73
74    let j;
75    for (j = 0; j < rows.length; j++) {
76        tbody.append(rows[j]);
77    }
78}
79
80

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.