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;(function($) { 13 14 $.fn.stacktable = function(options) { 15 var $tables = this, 16 defaults = {id:'stacktable small-only',hideOriginal:true}, 17 settings = $.extend({}, defaults, options); 18 19 return $tables.each(function() { 20 var $stacktable = $('<table class="'+settings.id+'"><tbody></tbody></table>'); 21 if (typeof settings.myClass !== undefined) $stacktable.addClass(settings.myClass); 22 var markup = ''; 23 $table = $(this); 24 $table.addClass('stacktable large-only'); 25 $topRow = $table.find('tr').eq(0); 26 $table.find('tr').each(function(index,value) { 27 if (index===0) { 28 //markup += '<tr><th class="st-head-row st-head-row-main" colspan="2">'+$(this).find('th,td').eq(0).html()+'</th></tr>'; 29 } else { 30 $(this).find('td,th').each(function(index,value) { 31 if (index===0) { 32 markup += '<tr class="st-space"><td></td><td></td></tr><tr class="st-new-item"><td class="st-key"></td><td class="st-val st-head-row">'+$(this).html()+'</td></tr>'; 33 } else { 34 if ($(this).html() !== ''){ 35 markup += '<tr>'; 36 if ($topRow.find('td,th').eq(index).html()){ 37 markup += '<td class="st-key">'+$topRow.find('td,th').eq(index).html()+'</td>'; 38 } else { 39 markup += '<td class="st-key"></td>'; 40 } 41 markup += '<td class="st-val">'+$(this).html()+'</td>'; 42 markup += '</tr>'; 43 } 44 } 45 }); 46 } 47 }); 48 $stacktable.append($(markup)); 49 $table.before($stacktable); 50 if (!settings.hideOriginal) $table.show(); 51 }); 52 }; 53 54 55 56}(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.