1/** 2* NG Responsive Tables v1.0 3* Inspiration: http://css-tricks.com/examples/ResponsiveTables/responsive.php 4* Author: Tomislav MatijeviÄ 5* List of functions: 6* - targetTable: Searches for each table row , find td and take its current index. 7* Apply to that index same index of table head or td in first table row ( in case there are no table header applied ) 8* - checkForTableHead: If there is no table head defined, use td in first table row as table head (prevention mode) 9* Config: 10* - Adjust paddings 11* - On each td there is class named "tdno[index]", so you can modify each td if you need custom padding 12*/ 13 14;(function ( $ ) { 15 $.fn.ngResponsiveTables = function(options) { 16 var defaults = { 17 smallPaddingCharNo: 5, 18 mediumPaddingCharNo: 10, 19 largePaddingCharNo: 15 20 }, 21 $selElement = this, 22 ngResponsiveTables = { 23 opt: '', 24 dataContent: '', 25 globalWidth: 0, 26 init: function(){ 27 this.opt = $.extend( defaults, options ); 28 ngResponsiveTables.targetTable(); 29 }, 30 targetTable: function(){ 31 var that = this; 32 $selElement.find('tr').each(function(){ 33 $(this).find('td').each(function(i, v){ 34 that.checkForTableHead( $(this), i ); 35 $(this).addClass('tdno' + i); 36 }); 37 }); 38 }, 39 checkForTableHead: function(element, index){ 40 if( $selElement.find('th').length ){ 41 this.dataContent = $selElement.find('th')[index].textContent; 42 }else{ 43 this.dataContent = $selElement.find('tr:first td')[index].textContent; 44 } 45 // This padding is for large texts inside header of table 46 // Use small, medium and large paddingMax values from defaults to set-up offsets for each class 47 if( this.opt.smallPaddingCharNo > $.trim(this.dataContent).length ){ 48 element.addClass('small-padding'); 49 }else if( this.opt.mediumPaddingCharNo > $.trim(this.dataContent).length ){ 50 element.addClass('medium-padding'); 51 }else{ 52 element.addClass('large-padding'); 53 } 54 element.attr('data-content', this.dataContent); 55 } 56 }; 57 58 $(function(){ 59 ngResponsiveTables.init(); 60 }); 61 return this; 62 }; 63 64}( 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.