PageSourceSearch

https://trtfn.com/wp-content/themes/scalia/js/jquery.restable.js?ver=6.0.16

js trtfn.com collected 2026-10-03 21:37:33 UTC 3,625 bytes, 129 lines download raw bytes

1/*! ReStable v0.1.1 by Alessandro Benoit */
2(function ($, window, i) {
3
4    'use strict';
5
6    $.fn.ReStable = function (options) {
7
8        // Settings
9        var s = $.extend({
10            rowHeaders: true,
11            maxWidth: 480
12        }, options);
13
14        // Build the responsive menu container and fill it with build_menu()
15        function create_responsive_table(element, i) {
16
17            var $cols = [],
18                $result = {},
19                $cols_header = $(element).find('tr').first().children('td,th'),
20                $row_number = 0,
21                $list;
22
23            if (s.rowHeaders) {
24                $cols_header = $cols_header.slice(1);
25            }
26
27            // Prende le intestazioni
28            $cols_header.each(function () {
29                $cols.push($(this).text());
30            });
31
32            // Costruisce un array con il contenuto: $result
33            $(element).find('tr').slice(1).each(function () {
34
35                var $row = $(this);
36                $row_number += 1;
37
38                $.each($cols, function (index, value) {
39
40                    index += 1;
41
42                    if (s.rowHeaders) {
43                        if (!$result[value]) { $result[value] = {}; }
44                        $result[value][$row.children('td:nth-child(1)').html()] = $row.children('td:nth-child(' + (index + 1) + ')').html();
45                    } else {
46                        if (!$result[$row_number]) { $result[$row_number] = {}; }
47                        $result[$row_number][value] = $row.children('td:nth-child(' + index + ')').html();
48                    }
49
50                });
51
52            });
53
54            // Crea la lista
55            $list = $('<ul/>', {
56                class: 'tabletolist ' + ((s.rowHeaders) ? 'rh' : 'nrh'),
57                id: 'tabletolist' + i
58            }).insertBefore($(element));
59            $.each($result, function (index, value) {
60
61                var $myrow = $('<li/>', {
62                    html: (s.rowHeaders) ? '<span class="titles">' + index + '</span>' : ''
63                }).appendTo($list),
64                    $myrowul = $('<ul/>').appendTo($myrow);
65
66                $.each(value, function (index, value) {
67
68                    $('<li/>', {
69                        html: '<span class="row_headers">' + index + '</span> <span class="row_data">' + value + '</span>'
70                    }).appendTo($myrowul);
71
72                });
73
74            });
75
76            return $list;
77
78        }
79
80        // Let's do it
81        this.each(function () {
82
83            var element = $(this),
84                responsive_table;
85
86            i += 1;
87
88            // The responsive menu is built if the page size is or goes under maxWidth
89            function handle_table() {
90
91                if ($(window).width() > parseInt(s.maxWidth, 10)) {
92
93                    $(element).show();
94
95                    if (responsive_table) {
96                        $(responsive_table).hide();
97                    }
98
99                } else {
100
101                    $(element).hide();
102
103                    if (responsive_table) {
104                        $(responsive_table).show();
105                    } else {
106                        responsive_table = create_responsive_table(element, i);
107                    }
108
109                }
110
111            }
112
113            // At first
114            handle_table();
115
116            // Then at the resizing of the page
117            $(window).resize(function () {
118                handle_table();
119            });
120
121        });
122
123    };
124
125    $.ReStable = function (options) {
126        $('table').ReStable(options);
127    };
128
129})(jQuery, this, 0);

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.