/* Widget: print - updated 11/2/2015 (v2.24.1) */ /* * Requires tablesorter v2.8+ and jQuery 1.2.6+ */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ !function(a){"use strict";var b=a.tablesorter,c=b.printTable={event:"printTable",basicStyle:"table, tr, td, th { border : solid 1px black; border-collapse : collapse; } td, th { padding: 2px; }",popupStyle:"width=500,height=300",init:function(a){a.$table.unbind(c.event).bind(c.event,function(){ // explicitly use table.config.widgetOptions because we want // the most up-to-date values; not the 'wo' from initialization c.process(a,a.widgetOptions)})},process:function(d,e){var f,g=a("
").append(d.$table.clone()),h=c.basicStyle+"table { width: 100%; }."+(b.css.filterRow||"tablesorter-filter-row")+ // hide filtered rows ", ."+(e.filter_filteredRow||"filtered")+" { display: none; }."+(b.css.header||"tablesorter-header")+" { background-image: none !important; }"; // replace content with data-attribute content g.find("["+e.print_dataAttrib+"]").each(function(){f=a(this),f.text(f.attr(e.print_dataAttrib))}), // === rows === // Assume 'visible' means rows hidden by the pager (rows set to 'display:none') // or hidden by a class name which is added to the wo.print_extraCSS definition // look for jQuery filter selector in wo.print_rows & use if found /^f/i.test(e.print_rows)?h+="tbody tr:not(."+(e.filter_filteredRow||"filtered")+") { display: table-row !important; }":/^a/i.test(e.print_rows)? // default force show of all rows h+="tbody tr { display: table-row !important; }":/^[.#:\[]/.test(e.print_rows)&&( // look for '.' (class selector), '#' (id selector), // ':' (basic filters, e.g. ':not()') or '[' (attribute selector start) h+="tbody tr"+e.print_rows+" { display: table-row !important; }"), // === columns === // columnSelector -> c.selector.$style // Assume 'visible' means hidden columns have a 'display:none' style, or a class name // add the definition to the wo.print_extraCSS option /s/i.test(e.print_columns)&&d.selector&&d.widgets.indexOf("columnSelector")>=0? // show selected (visible) columns; make a copy of the columnSelector widget css (not media queries) h+=e.columnSelector_mediaquery&&d.selector.auto?"":d.selector.$style.text():/a/i.test(e.print_columns)&&( // force show all cells h+="td, th { display: table-cell !important; }"),h+=e.print_extraCSS,a.isFunction(e.print_callback)?e.print_callback(d,g,h):c.printOutput(d,g.html(),h)},// end process printOutput:function(a,b,d){var e=a.widgetOptions,f=window.open("",e.print_title,c.popupStyle),g=e.print_title||a.$table.find("caption").text()||a.$table[0].id||document.title||"table"; // use timeout to allow browser to build DOM before printing // Print preview in Chrome doesn't work without this code return f.document.write("