PageSourceSearch

https://www.claas-nordostbayern.de/blueprint/js/stacktable.js

js claas-nordostbayern.de collected 2026-10-06 13:25:54 UTC 3,106 bytes, 78 lines download raw bytes

1/**
2 * stacktable.js
3 * Author & copyright (c) 2012: John Polacek
4 * Dual MIT & GPL license
5 *
6 * Page: http://johnpolacek.github.com/stacktable.js
7 * Repo: https://github.com/johnpolacek/stacktable.js/
8 *
9 * jQuery plugin for stacking tables on small screens
10 *
11 */
12// mod holl20 for claas
13// mod holl20 settings hatt Bezeichner "class", Fehler im IE darum in cssClass geändert
14// mod holl20  CLAASCOMBL-597
15;(function($) {
16
17  $.fn.stacktable = function(options) {
18    var $tables = this,
19        pName="Stacktable: ",
20        defaults = {id:'stacktable',hideOriginal:false,cssClass:'table'},
21        settings = $.extend({}, defaults, options),
22        stacktable;
23
24    return $tables.each(function() {
25      var $stacktable = $('<table class="'+settings.id+'"><tbody></tbody></table>');
26     if (typeof settings.cssClass !== undefined) $stacktable.addClass(settings.cssClass);
27      var markup = '';
28      $table = $(this);
29      $topRow = $table.find('tr').first();
30      $table.find('tr').each(function(index,value) {
31		//console.log( $(this).find('td.td--table-head').length );
32		//delete headlines inside >> emptry tables
33		if($(this).find('td.td--table-head').length > 0 && index !== 0) {
34			return;
35		}
36        markup += '<tr>'
37       // for the first row, top left table cell is the head of the table
38        if (index===0) {
39          headRowMain=$(this).find('tr:first,td').first().html();
40          //console.log(pName + ", index == 0; headRowMain: " + headRowMain);
41        // no extra Head in Claas CI
42        //  markup += '<tr><th class="st-head-row st-head-row-main" colspan="2">'+ headRowMain +'</th></tr>';
43        }
44        // for the other rows, put the left table cell as the head for that row
45        // then iterate through the key/values
46        else {
47         var tdTotal =  $(this).find('td').length;
48         $(this).find('td').each(function(index,value) {
49            if (index===0) {
50              // Repeat headRowMain as title in every row
51              markup += '<tr class="st-head-row"><th  colspan="2" >' +headRowMain + '&nbsp;' +$(this).html()+'</th></tr>';
52            } else {
53              if ($(this).html() !== ''){
54                  if(index%2!==0){
55                      markup += '<tr class="st-row-odd">';
56
57                  }else{
58                      markup += '<tr class="st-row-even">';
59                  }
60                 stKeyText=$topRow.find('td,tr:first').eq(index).html()?$topRow.find('td,tr:first').eq(index).html():'';
61                markup += '<td class="st-key">'+stKeyText+'</td>';
62                markup += '<td class="st-val">'+$(this).html()+'</td>';
63                markup += '</tr>';
64                // extra markup for last element
65                markup += index == tdTotal - 1?'<tr class="st-index-last"><td colspan="2">&nbsp;</td></tr>':'';
66
67              }
68            }
69          });
70        }
71      });
72      $stacktable.append($(markup));
73      $table.before($stacktable);
74      if (settings.hideOriginal) $table.hide();
75    });
76  };
77
78}(jQuery));

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.