1/** 2 * Inline Google Spreadsheet Viewer's DataTables integrations. 3 * 4 * @file Loads and applies DataTables to any tables on the page. 5 * @license GPL-3.0 6 * @author Meitar Moscovitz <[email protected]> 7 * @copyright Copyright 2017 by Meitar "maymay" Moscovitz 8 */ 9 10(function () { // start immediately-invoked function expresion (IIFE) 11 12// DataTables 13jQuery(document).ready(function () { 14 // Set/load defaults. 15 if (igsv_plugin_vars.datatables_defaults_object) { 16 jQuery.extend(jQuery.fn.dataTable.defaults, igsv_plugin_vars.datatables_defaults_object); 17 } else { 18 igsv_plugin_vars.datatables_defaults_object = {}; 19 } 20 // Initialize tables. 21 jQuery(igsv_plugin_vars.datatables_classes).each(function () { 22 var table = jQuery(this); 23 var dt_opts = {}; 24 if (jQuery.fn.dataTable.defaults.buttons) { // apply defaults for Buttons 25 dt_opts.buttons = jQuery.fn.dataTable.defaults.buttons 26 } 27 if (false === table.hasClass('no-responsive')) { 28 dt_opts.responsive = true; 29 } 30 if (table.attr('lang')) { 31 dt_opts.language = { 32 'url': igsv_plugin_vars.lang_dir + '/datatables-' + table.attr('lang') + '.json' 33 } 34 } 35 table.DataTable(dt_opts); 36 37 var x; 38 if (table.is('.FixedHeader')) { 39 new jQuery.fn.dataTable.FixedHeader(table); 40 } else if (x = this.className.match(/FixedHeader-(top|right|footer|left)/g)) { 41 for (var i = 0; i < x.length; i++) { 42 var side = x[i].split('-')[1]; 43 var fheader_opts = {}; 44 fheader_opts[side] = true; 45 } 46 new jQuery.fn.dataTable.FixedHeader(table, fheader_opts); 47 } else if (table.is('.FixedColumns')) { 48 new jQuery.fn.dataTable.FixedColumns(table); 49 } else if (x = this.className.match(/FixedColumns-(left|right)-([0-9])*/g)) { 50 var l_n = 0; 51 var r_n = 0; 52 for (var i = 0; i < x.length; i++) { 53 var z = x[i].split('-'); 54 if ('left' === z[1]) { 55 l_n = z[2]; 56 } else { 57 r_n = z[2]; 58 } 59 } 60 new jQuery.fn.dataTable.FixedColumns(table, { 61 'leftColumns': l_n, 62 'rightColumns': r_n 63 }); 64 } 65 }); 66}); 67 68})(); // end IIFE
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.