PageSourceSearch

https://www.brunel.ac.uk/SiteElements/plugins/Responsive-tables/responsive-tables.js

js brunel.ac.uk collected 2026-09-24 08:32:24 UTC 1,745 bytes, 67 lines download raw bytes

1$(document).ready(function() {
2  var switched = false;
3  var updateTables = function() {
4    if (($(window).width() < 767) && !switched ){
5      switched = true;
6      $("table.responsive").each(function(i, element) {
7        splitTable($(element));
8      });
9      return true;
10    }
11    else if (switched && ($(window).width() > 767)) {
12      switched = false;
13      $("table.responsive").each(function(i, element) {
14        unsplitTable($(element));
15      });
16    }
17  };
18   
19  $(window).load(updateTables);
20  $(window).on("redraw",function(){switched=false;updateTables();}); // An event to listen for
21  $(window).on("resize", updateTables);
22   
23	
24	function splitTable(original)
25	{
26		original.wrap("<div class='table-wrapper' />");
27		
28		var copy = original.clone();
29		copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none");
30		copy.removeClass("responsive");
31		
32		original.closest(".table-wrapper").append(copy);
33		copy.wrap("<div class='pinned' />");
34		original.wrap("<div class='scrollable' />");
35
36    setCellHeights(original, copy);
37	}
38	
39	function unsplitTable(original) {
40    original.closest(".table-wrapper").find(".pinned").remove();
41    original.unwrap();
42    original.unwrap();
43	}
44
45  function setCellHeights(original, copy) {
46    var tr = original.find('tr'),
47        tr_copy = copy.find('tr'),
48        heights = [];
49
50    tr.each(function (index) {
51      var self = $(this),
52          tx = self.find('th, td');
53
54      tx.each(function () {
55        var height = $(this).outerHeight(true);
56        heights[index] = heights[index] || 0;
57        if (height > heights[index]) heights[index] = height;
58      });
59
60    });
61
62    tr_copy.each(function (index) {
63      $(this).height(heights[index]);
64    });
65  }
66
67});

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.