PageSourceSearch

https://www.intox.com/wp-content/plugins/product-enquiry-pro/js/public/responsive-table.js?ver=1790280880

js intox.com collected 2026-09-24 20:15:27 UTC 3,794 bytes, 106 lines download raw bytes

1// generate mobile version for each table
2// Responsive script for approval-rejection view.
3// Responsive script for enquiry cart product table
4jQuery('.generated_for_desktop').each(function () {
5        var table = jQuery(this); // cache table object
6        var tableClass = table.attr('class');
7        //Remove Generated for Desktop class
8        tableClass = tableClass.replace("generated_for_desktop", "");
9        var head = table.find('thead th');
10        var rows = table.find('tbody tr').clone(); // appending afterwards does not break original table
11
12        // create new table
13        var newtable = jQuery(
14            '<table class="generated_for_mobile ' + tableClass + '">' +
15            '<colgroup>' +
16            '<col span="1" style="width: 40%">' +
17            '<col span="1" style="width: 60%;">' +
18            '</colgroup>' +
19            '  <tbody>' +
20            '  </tbody>' +
21            '</table>'
22        );
23
24        // cache tbody where we'll be adding data
25        var newtable_tbody = newtable.find('tbody');
26
27        rows.each(function (i) {
28            var cols = jQuery(this).find('td');
29            var classname = i % 2 ? 'even' : 'odd';
30            cols.each(function (k) {
31                var new_tr = jQuery('<tr class="' + classname + '"></tr>').appendTo(newtable_tbody);
32                new_tr.append(head.clone().get(k));
33                new_tr.append(jQuery(this));
34            });
35        });
36
37        /**
38        *   If it is a Approval Rejection Table, then show Total Row at the end
39        */
40    if (tableClass.indexOf('quoteup-quote-table') !== -1) {
41        var lastRow = newtable_tbody.find("tr:last");
42        var secondLastRow = lastRow.prev();
43        var new_tr = jQuery('<tr class="' + lastRow.attr('class') + '"></tr>').appendTo(newtable_tbody);
44        new_tr.append('<th>' + secondLastRow.find('td:last').text() + '</th>');
45        new_tr.append('<td class="' + lastRow.find('td:last').attr('class') + '">' + lastRow.find('td:last').html() + '</td>');
46        //Remove Unwanted Rows
47        secondLastRow.remove();
48        lastRow.remove();
49    }
50
51        jQuery(this).after(newtable);
52
53});
54
55/**
56* Find the desktop table cell location on screen for every table cell on products table in quote cart.
57* @param int index of the table cell row.
58* @param int index of the table cell column.
59*/
60function findDesktopTableCellLocation($mobileTableRowNumber, $totalNoOfColumns)
61{
62    $temp = $mobileTableRowNumber - $totalNoOfColumns;
63    if ($temp < 0) {
64        $data = [];
65        $data[0] = 0;
66        $data[1] = $mobileTableRowNumber;
67        return $data;
68    } else {
69        var $count = 1;
70        while ($temp >= $totalNoOfColumns) {
71            $temp = $temp - $totalNoOfColumns;
72            $count++;
73        }
74        $data = [];
75        $data[0] = $count;
76        $data[1] = $temp;
77        return $data;
78    }
79}
80
81/**
82* Find the mobile table cell location on screen for every table cell on products table in quote cart.
83* @param int index of the table cell row.
84* @param int index of the table cell column.
85*/
86function findMobileTableCellLocation($desktopTableRowNumber, $desktopTableColumnNumber, $totalNoOfColumns)
87{
88    $temp = ($desktopTableRowNumber * $totalNoOfColumns) +$desktopTableColumnNumber;
89    $data = [];
90    $data[0] = $temp;
91    $data[1] = 1;
92    return $data;
93}
94
95/**
96* Returns the cell of the products table in quote cart
97* @param string $selector element
98* @param int $rowNumber row number of cell
99* @param int $columnNumber column number of cell
100*/
101function selectCell($selector, $rowNumber, $columnNumber)
102{
103    var $table = jQuery($selector).find('tbody')[0];
104    var $cell = $table.rows[$rowNumber].cells[$columnNumber]; // This is a DOM "TD" element
105    return jQuery($cell); // Now it's a jQuery object.
106}

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.