PageSourceSearch

https://streator.org/_assets_/js/DT_bootstrap2.js?v=P36kBnZeQ3kkWmuO

js streator.org collected 2026-09-26 11:21:18 UTC 11,594 bytes, 313 lines download raw bytes

1			/* Default class modification */
2			$.extend( $.fn.dataTableExt.oStdClasses, {
3				"sSortAsc": "header headerSortDown",
4				"sSortDesc": "header headerSortUp",
5				"sSortable": "header"
6			} );
7
8			/* API method to get paging information */
9			$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
10			{
11				return {
12					"iStart":         oSettings._iDisplayStart,
13					"iEnd":           oSettings.fnDisplayEnd(),
14					"iLength":        oSettings._iDisplayLength,
15					"iTotal":         oSettings.fnRecordsTotal(),
16					"iFilteredTotal": oSettings.fnRecordsDisplay(),
17					"iPage":          Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
18					"iTotalPages":    Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
19				};
20			}
21
22			/* Bootstrap style pagination control */
23			$.extend( $.fn.dataTableExt.oPagination, {
24				"bootstrap": {
25					"fnInit": function( oSettings, nPaging, fnDraw ) {
26						var oLang = oSettings.oLanguage.oPaginate;
27						var fnClickHandler = function ( e ) {
28							e.preventDefault();
29							if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
30								fnDraw( oSettings );
31							}
32						};
33			
34						$(nPaging).addClass('pagination').append(
35							'<ul>'+
36								'<li class="prev disabled"><a href="#example_wrapper">&larr; '+oLang.sPrevious+'</a></li>'+
37								'<li class="next disabled"><a href="#example_wrapper">'+oLang.sNext+' &rarr; </a></li>'+
38							'</ul>'
39						);
40						var els = $('a', nPaging);
41						$(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
42						$(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
43					},
44			
45					"fnUpdate": function ( oSettings, fnDraw ) {
46						var iListLength = 5;
47						var oPaging = oSettings.oInstance.fnPagingInfo();
48						var an = oSettings.aanFeatures.p;
49						var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
50			
51						if ( oPaging.iTotalPages < iListLength) {
52							iStart = 1;
53							iEnd = oPaging.iTotalPages;
54						}
55						else if ( oPaging.iPage <= iHalf ) {
56							iStart = 1;
57							iEnd = iListLength;
58						} else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
59							iStart = oPaging.iTotalPages - iListLength + 1;
60							iEnd = oPaging.iTotalPages;
61						} else {
62							iStart = oPaging.iPage - iHalf + 1;
63							iEnd = iStart + iListLength - 1;
64						}
65			
66						for ( i=0, ien=an.length ; i<ien ; i++ ) {
67							// Remove the middle elements
68							$('li:gt(0)', an[i]).filter(':not(:last)').remove();
69			
70							// Add the new list items and their event handlers
71							for ( j=iStart ; j<=iEnd ; j++ ) {
72								sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
73								$('<li '+sClass+'><a href="#">'+j+'</a></li>')
74									.insertBefore( $('li:last', an[i])[0] )
75									.bind('click', function (e) {
76										e.preventDefault();
77										oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
78										fnDraw( oSettings );
79										$(".stacktable.small-only").remove();
80										$("#example").stacktable();
81									} );
82							}
83			
84							// Add / remove disabled classes from the static elements
85							if ( oPaging.iPage === 0 ) {
86								$('li:first', an[i]).addClass('disabled');
87							} else {
88								$('li:first', an[i]).removeClass('disabled');
89							}
90			
91							if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
92								$('li:last', an[i]).addClass('disabled');
93							} else {
94								$('li:last', an[i]).removeClass('disabled');
95							}
96						}
97					}
98				}
99			} );
100
101			/* Table initialisation */
102			$(document).ready(function() {
103				$('#example').dataTable( {
104					"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
105					"sPaginationType": "bootstrap",
106					"aaSorting": [[0,'asc']],
107					"iDisplayLength":50
108				} );
109			} );
110
111/**
112 * stacktable.js
113 * Author & copyright (c) 2012: John Polacek
114 * CardTable by: Justin McNally (2015)
115 * Dual MIT & GPL license
116 *
117 * Page: http://johnpolacek.github.com/stacktable.js
118 * Repo: https://github.com/johnpolacek/stacktable.js/
119 *
120 * jQuery plugin for stacking tables on small screens
121 * Requires jQuery version 1.7 or above
122 *
123 */
124;(function($) {
125  $.fn.cardtable = function(options) {
126    var $tables = this,
127        defaults = {headIndex:0},
128        settings = $.extend({}, defaults, options),
129        headIndex;
130
131    // checking the "headIndex" option presence... or defaults it to 0
132    if(options && options.headIndex)
133      headIndex = options.headIndex;
134    else
135      headIndex = 0;
136
137    return $tables.each(function() {
138      var $table = $(this);
139      if ($table.hasClass('stacktable')) {
140        return;
141      }
142      var table_css = $(this).prop('class');
143      var $stacktable = $('<div></div>');
144      if (typeof settings.myClass !== 'undefined') $stacktable.addClass(settings.myClass);
145      var markup = '';
146      var $caption, $topRow, headMarkup, bodyMarkup, tr_class;
147
148      $table.addClass('stacktable large-only');
149      $caption = $table.find("caption").clone();
150      $topRow = $table.find('tr').eq(0);
151
152      // using rowIndex and cellIndex in order to reduce ambiguity
153      $table.find('tbody tr').each(function() {
154
155        // declaring headMarkup and bodyMarkup, to be used for separately head and body of single records
156        headMarkup = '';
157        bodyMarkup = '';
158        tr_class = $(this).prop('class');
159        // for the first row, "headIndex" cell is the head of the table
160        // for the other rows, put the "headIndex" cell as the head for that row
161        // then iterate through the key/values
162        $(this).find('td,th').each(function(cellIndex) {
163          if ($(this).html() !== ''){
164            bodyMarkup += '<tr class="' + tr_class +'">';
165            if ($topRow.find('td,th').eq(cellIndex).html()){
166              bodyMarkup += '<td class="st-key">
vendor: 4,697 bytes, lines 166-278
166'+$topRow.find('td,th').eq(cellIndex).html()+'</td>';
167            } else {
168              bodyMarkup += '<td class="st-key"></td>';
169            }
170            bodyMarkup += '<td class="st-val '+$(this).prop('class')  +'">'+$(this).html()+'</td>';
171            bodyMarkup += '</tr>';
172          }
173        });
174
175        markup += '<table class=" '+ table_css +' stacktable small-only"><tbody>' + headMarkup + bodyMarkup + '</tbody></table>';
176      });
177
178      $table.find('tfoot tr td').each(function(rowIndex,value) {
179        if ($.trim($(value).text()) !== '') {
180          markup += '<table class="'+ table_css + ' stacktable small-only"><tbody><tr><td>' + $(value).html() + '</td></tr></tbody></table>';
181        }
182      });
183
184      $stacktable.prepend($caption);
185      $stacktable.append($(markup));
186      $table.before($stacktable);
187    });
188  };
189
190  $.fn.stacktable = function(options) {
191    var $tables = this,
192        defaults = {headIndex:0},
193        settings = $.extend({}, defaults, options),
194        headIndex;
195
196    // checking the "headIndex" option presence... or defaults it to 0
197    if(options && options.headIndex)
198      headIndex = options.headIndex;
199    else
200      headIndex = 0;
201
202    return $tables.each(function() {
203      var table_css = $(this).prop('class');
204      var $stacktable = $('<table class="'+ table_css +' stacktable small-only"><tbody></tbody></table>');
205      if (typeof settings.myClass !== 'undefined') $stacktable.addClass(settings.myClass);
206      var markup = '';
207      var $table, $caption, $topRow, headMarkup, bodyMarkup, tr_class;
208
209      $table = $(this);
210      $table.addClass('stacktable large-only');
211      $caption = $table.find("caption").clone();
212      $topRow = $table.find('tr').eq(0);
213
214      // using rowIndex and cellIndex in order to reduce ambiguity
215      $table.find('tr').each(function(rowIndex) {
216
217        // declaring headMarkup and bodyMarkup, to be used for separately head and body of single records
218        headMarkup = '';
219        bodyMarkup = '';
220        tr_class = $(this).prop('class');
221        // for the first row, "headIndex" cell is the head of the table
222        if (rowIndex === 0) {
223          // the main heading goes into the markup variable
224          markup += '<tr class=" '+tr_class +' "><th class="st-head-row st-head-row-main" colspan="2">'+$(this).find('th,td').eq(headIndex).html()+'</th></tr>';
225        }
226        else {
227          // for the other rows, put the "headIndex" cell as the head for that row
228          // then iterate through the key/values
229          $(this).find('td,th').each(function(cellIndex) {
230            if (cellIndex === headIndex) {
231              headMarkup = '<tr class="'+ tr_class+'"><th class="st-head-row" colspan="2">'+$(this).html()+'</th></tr>';
232            } else {
233              if ($(this).html() !== ''){
234                bodyMarkup += '<tr class="' + tr_class +'">';
235                if ($topRow.find('td,th').eq(cellIndex).html()){
236                  bodyMarkup += '<td class="st-key">'+$topRow.find('td,th').eq(cellIndex).html()+'</td>';
237                } else {
238                  bodyMarkup += '<td class="st-key"></td>';
239                }
240                bodyMarkup += '<td class="st-val '+$(this).prop('class')  +'">'+$(this).html()+'</td>';
241                bodyMarkup += '</tr>';
242              }
243            }
244          });
245
246          markup += headMarkup + bodyMarkup;
247        }
248      });
249
250      $stacktable.prepend($caption);
251      $stacktable.append($(markup));
252      $table.before($stacktable);
253    });
254  };
255
256 $.fn.stackcolumns = function(options) {
257    var $tables = this,
258        defaults = {},
259        settings = $.extend({}, defaults, options);
260
261    return $tables.each(function() {
262      var $table = $(this);
263      var num_cols = $table.find('tr').eq(0).find('td,th').length; //first table <tr> must not contain colspans, or add sum(colspan-1) here.
264      if(num_cols<3) //stackcolumns has no effect on tables with less than 3 columns
265        return;
266
267      var $stackcolumns = $('<table class="stacktable small-only"></table>');
268      if (typeof settings.myClass !== 'undefined') $stackcolumns.addClass(settings.myClass);
269      $table.addClass('stacktable large-only');
270      var tb = $('<tbody></tbody>');
271      var col_i = 1; //col index starts at 0 -> start copy at second column.
272
273      while (col_i < num_cols) {
274        $table.find('tr').each(function(index) {
275          var tem = $('<tr></tr>'); // todo opt. copy styles of $this; todo check if parent is thead or tfoot to handle accordingly
276          if(index === 0) tem.addClass("st-head-row st-head-row-main");
277          var first = $(this).find('td,th').eq(0).clone().addClass("st-key");
278          var target = col_i;
279          // if colspan apply, recompute target for second cell.
280          if ($(this).find("*[colspan]").length) {
281            var i =0;
282            $(this).find('td,th').each(function() {
283                var cs = $(this).attr("colspan");
284                if (cs) {
285                  cs = parseInt(cs, 10);
286                  target -= cs-1;
287                  if ((i+cs) > (col_i)) //out of current bounds
288                    target += i + cs - col_i -1;
289                  i += cs;
290                }
291                else
292                  i++;
293
294                if (i > col_i)
295                  return false; //target is set; break.
296            });
297          }
298          var second = $(this).find('td,th').eq(target).clone().addClass("st-val").removeAttr("colspan");
299          tem.append(first, second);
300          tb.append(tem);
301        });
302        ++col_i;
303      }
304
305      $stackcolumns.append($(tb));
306      $table.before($stackcolumns);
307    });
308  };
309
310}(jQuery));
311
312			
313$('#simple-example-table').stacktable();

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.