All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.datatables.net-buttons.js.buttons.html5.min.js Maven / Gradle / Ivy

/*!
 * HTML5 export buttons for Buttons and DataTables.
 * 2016 SpryMedia Ltd - datatables.net/license
 *
 * FileSaver.js (1.3.3) - MIT license
 * Copyright © 2016 Eli Grey - http://eligrey.com
 */
(function(a){if(typeof define==="function"&&define.amd){define(["jquery","datatables.net","datatables.net-buttons"],function(b){return a(b,window,document)})}else{if(typeof exports==="object"){module.exports=function(b,d,e,c){if(!b){b=window}if(!d||!d.fn.dataTable){d=require("datatables.net")(b,d).$}if(!d.fn.dataTable.Buttons){require("datatables.net-buttons")(b,d)}return a(d,b,b.document,e,c)}}else{a(jQuery,window,document)}}}(function(b,k,s,j,a,e){var q=b.fn.dataTable;function d(){return j||k.JSZip}function v(){return a||k.pdfMake}var o=(function(I){if(typeof I==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var J=I.document,F=function(){return I.URL||I.webkitURL||I},L=J.createElementNS("http://www.w3.org/1999/xhtml","a"),B="download" in L,M=function(P){var O=new MouseEvent("click");P.dispatchEvent(O)},D=/constructor/i.test(I.HTMLElement)||I.safari,N=/CriOS\/[\d]+/.test(navigator.userAgent),C=function(O){(I.setImmediate||I.setTimeout)(function(){throw O},0)},H="application/octet-stream",A=1000*40,K=function(P){var O=function(){if(typeof P==="string"){F().revokeObjectURL(P)}else{P.remove()}};setTimeout(O,A)},G=function(P,O,S){O=[].concat(O);var R=O.length;while(R--){var T=P["on"+O[R]];if(typeof T==="function"){try{T.call(P,S||P)}catch(Q){C(Q)}}}},z=function(O){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(O.type)){return new Blob([String.fromCharCode(65279),O],{type:O.type})}return O},y=function(O,P,Q){if(!Q){O=z(O)}var S=this,V=O.type,R=V===H,T,U=function(){G(S,"writestart progress write writeend".split(" "))},W=function(){if((N||(R&&D))&&I.FileReader){var X=new FileReader();X.onloadend=function(){var aa=N?X.result:X.result.replace(/^data:[^;]*;/,"data:attachment/file;");var Z=I.open(aa,"_blank");if(!Z){I.location.href=aa}aa=e;S.readyState=S.DONE;U()};X.readAsDataURL(O);S.readyState=S.INIT;return}if(!T){T=F().createObjectURL(O)}if(R){I.location.href=T}else{var Y=I.open(T,"_blank");if(!Y){I.location.href=T}}S.readyState=S.DONE;U();K(T)};S.readyState=S.INIT;if(B){T=F().createObjectURL(O);setTimeout(function(){L.href=T;L.download=P;M(L);U();K(T);S.readyState=S.DONE});return}W()},t=y.prototype,E=function(P,Q,O){return new y(P,Q||P.name||"download",O)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(P,Q,O){Q=Q||P.name||"download";if(!O){P=z(P)}return navigator.msSaveOrOpenBlob(P,Q)}}t.abort=function(){};t.readyState=t.INIT=0;t.WRITING=1;t.DONE=2;t.error=t.onwritestart=t.onprogress=t.onwrite=t.onabort=t.onerror=t.onwriteend=null;return E}(typeof self!=="undefined"&&self||typeof k!=="undefined"&&k||this.content));q.fileSave=o;var n=function(t){var y="Sheet1";if(t.sheetName){y=t.sheetName.replace(/[\[\]\*\/\\\?\:]/g,"")}return y};var i=function(t){return t.newline?t.newline:navigator.userAgent.match(/Windows/)?"\r\n":"\n"};var x=function(z,A){var H=i(A);var D=z.buttons.exportData(A.exportOptions);var y=A.fieldBoundary;var F=A.fieldSeparator;var B=new RegExp(y,"g");var K=A.escapeChar!==e?A.escapeChar:"\\";var t=function(M){var O="";for(var N=0,L=M.length;N0){O+=F}O+=y?y+(""+M[N]).replace(B,K+y)+y:M[N]}return O};var E=A.header?t(D.header)+H:"";var I=A.footer&&D.footer?H+t(D.footer):"";var G=[];for(var C=0,J=D.body.length;C1&&t[1]*1<603.1){return true}return false};function f(B){var A="A".charCodeAt(0);var y="Z".charCodeAt(0);var t=y-A+1;var z="";while(B>=0){z=String.fromCharCode(B%t+A)+z;B=Math.floor(B/t)-1}return z}try{var g=new XMLSerializer();var w}catch(p){}function l(t,y){if(w===e){w=g.serializeToString(b.parseXML(r["xl/worksheets/sheet1.xml"])).indexOf("xmlns:r")===-1}b.each(y,function(z,A){if(b.isPlainObject(A)){var B=t.folder(z);l(B,A)}else{if(w){var H=A.childNodes[0];var C,J;var I=[];for(C=H.attributes.length-1;C>=0;C--){var G=H.attributes[C].nodeName;var D=H.attributes[C].nodeValue;if(G.indexOf(":")!==-1){I.push({name:G,value:D});H.removeAttribute(G)}}for(C=0,J=I.length;C'+F}F=F.replace(/_dt_b_namespace_token_/g,":")}F=F.replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");t.file(z,F)}})}function h(z,A,t){var y=z.createElement(A);if(t){if(t.attr){b(y).attr(t.attr)}if(t.children){b.each(t.children,function(B,C){y.appendChild(C)})}if(t.text!==null&&t.text!==e){y.appendChild(z.createTextNode(t.text))}}return y}function m(z,y){var D=z.header[y].length;var B,t,C;if(z.footer&&z.footer[y].length>D){D=z.footer[y].length}for(var A=0,F=z.body.length;AD){D=B}if(D>40){return 52}}D*=1.3;return D>6?D:6}var r={"_rels/.rels":'',"xl/_rels/workbook.xml.rels":'',"[Content_Types].xml":'',"xl/workbook.xml":'',"xl/worksheets/sheet1.xml":'',"xl/styles.xml":''};var c=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(t){return t/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(t){return t/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(t){return -1*t.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(t){return -1*t.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63},{match:/^\-?[\d,]+\.\d{2}$/,style:64}];q.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(t){return t.i18n("buttons.copy","Copy")},action:function(I,z,F,C){this.processing(true);var H=this;var E=x(z,C);var B=z.buttons.exportInfo(C);var D=i(C);var A=E.str;var J=b("
").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0});if(B.title){A=B.title+D+D+A}if(B.messageTop){A=B.messageTop+D+D+A}if(B.messageBottom){A=A+D+D+B.messageBottom}if(C.customize){A=C.customize(A,C,z)}var K=b("