/*! Widget: output - updated 7/28/2015 (v2.22.4) */ /* * Requires tablesorter v2.8+ and jQuery 1.7+ * Modified from: * HTML Table to CSV: http://www.kunalbabre.com/projects/table2CSV.php (License unknown?) * Download-File-JS: https://github.com/PixelsCommander/Download-File-JS (http://www.apache.org/licenses/LICENSE-2.0) */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery:false, alert:false */ !function(a){"use strict";var b=a.tablesorter,c=b.output={event:"outputTable", // wrap line breaks & tabs in quotes regexQuote:/([\n\t\x09\x0d\x0a]|<[^<]+>)/,// test if cell needs wrapping quotes regexBR:/(|\n)/g,// replace regexIMG:/]+alt\s*=\s*['"]([^'"]+)['"][^>]*>/i,// match regexHTML:/<[^<]+>/g,// replace replaceCR:"\r\n",replaceTab:" ",popupTitle:"Output",popupStyle:"width:100%;height:100%;",// for textarea message:"Your device does not support downloading. Please try again in desktop browser.",init:function(a){a.$table.off(c.event).on(c.event,function(b){b.stopPropagation(), // explicitly use table.config.widgetOptions because we want // the most up-to-date values; not the 'wo' from initialization c.process(a,a.widgetOptions)})},processRow:function(d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r=d.widgetOptions,s=[],t=r.output_duplicateSpans,u=f&&g&&r.output_headerRows&&a.isFunction(r.output_callbackJSON),v=0,w=e.length;for(k=0;w>k;k++)for(s[k]||(s[k]=[]),v=0,i=e.eq(k).children(),j=i.length,n=0;j>n;n++){ // process rowspans if(h=i.eq(n),h.filter("[rowspan]").length)for(o=parseInt(h.attr("rowspan"),10)-1,q=c.formatData(d,r,h,f),l=1;o>=l;l++)s[k+l]||(s[k+l]=[]),s[k+l][v]=f?q:t?q:""; // process colspans if(h.filter("[colspan]").length)for(p=parseInt(h.attr("colspan"),10)-1,q=c.formatData(d,r,h,f),m=1;p>=m;m++) // if we're processing the header & making JSON, the header names need to be unique if(h.filter("[rowspan]").length)for(o=parseInt(h.attr("rowspan"),10),l=0;o>l;l++)s[k+l]||(s[k+l]=[]),s[k+l][v+m]=u?r.output_callbackJSON(h,q,v+m)||q+"("+(v+m)+")":f?q:t?q:"";else s[k][v+m]=u?r.output_callbackJSON(h,q,v+m)||q+"("+(v+m)+")":f?q:t?q:""; // skip column if already defined for(;"undefined"!=typeof s[k][v];)v++;s[k][v]=s[k][v]||c.formatData(d,r,h,f),v++}return b.output.removeColumns(d,r,s)}, // remove hidden/ignored columns removeColumns:function(a,b,c){var d,e,f,g=[],h=c.length;for(d=0;h>d;d++)for(e=c[d],g[d]=[],f=0;f