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

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

/*!
 * Flash export buttons for Buttons and DataTables.
 * 2015-2017 SpryMedia Ltd - datatables.net/license
 *
 * ZeroClipbaord - MIT license
 * Copyright (c) 2012 Joseph Huckaby
 */
(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,c){if(!b){b=window}if(!c||!c.fn.dataTable){c=require("datatables.net")(b,c).$}if(!c.fn.dataTable.Buttons){require("datatables.net-buttons")(b,c)}return a(c,b,b.document)}}else{a(jQuery,window,document)}}}(function(a,i,o,c){var m=a.fn.dataTable;var r={version:"1.0.4-TableTools2",clients:{},moviePath:"",nextId:1,$:function(u){if(typeof(u)=="string"){u=o.getElementById(u)}if(!u.addClass){u.hide=function(){this.style.display="none"};u.show=function(){this.style.display=""};u.addClass=function(v){this.removeClass(v);this.className+=" "+v};u.removeClass=function(v){this.className=this.className.replace(new RegExp("\\s*"+v+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"")};u.hasClass=function(v){return !!this.className.match(new RegExp("\\s*"+v+"\\s*"))}}return u},setMoviePath:function(u){this.moviePath=u},dispatch:function(x,v,w){var u=this.clients[x];if(u){u.receiveEvent(v,w)}},log:function(u){console.log("Flash: "+u)},register:function(v,u){this.clients[v]=u},getDOMObjectPosition:function(v){var u={left:0,top:0,width:v.width?v.width:v.offsetWidth,height:v.height?v.height:v.offsetHeight};if(v.style.width!==""){u.width=v.style.width.replace("px","")}if(v.style.height!==""){u.height=v.style.height.replace("px","")}while(v){u.left+=v.offsetLeft;u.top+=v.offsetTop;v=v.offsetParent}return u},Client:function(u){this.handlers={};this.id=r.nextId++;this.movieId="ZeroClipboard_TableToolsMovie_"+this.id;r.register(this.id,this);if(u){this.glue(u)}}};r.Client.prototype={id:0,ready:false,movie:null,clipText:"",fileName:"",action:"copy",handCursorEnabled:true,cssEffects:true,handlers:null,sized:false,sheetName:"",glue:function(w,x){this.domElement=r.$(w);var y=99;if(this.domElement.style.zIndex){y=parseInt(this.domElement.style.zIndex,10)+1}var v=r.getDOMObjectPosition(this.domElement);this.div=o.createElement("div");var u=this.div.style;u.position="absolute";u.left="0px";u.top="0px";u.width=(v.width)+"px";u.height=v.height+"px";u.zIndex=y;if(typeof x!="undefined"&&x!==""){this.div.title=x}if(v.width!==0&&v.height!==0){this.sized=true}if(this.domElement){this.domElement.appendChild(this.div);this.div.innerHTML=this.getHTML(v.width,v.height).replace(/&/g,"&")}},positionElement:function(){var w=r.getDOMObjectPosition(this.domElement);var v=this.div.style;v.position="absolute";v.width=w.width+"px";v.height=w.height+"px";if(w.width!==0&&w.height!==0){this.sized=true}else{return}var u=this.div.childNodes[0];u.width=w.width;u.height=w.height},getHTML:function(x,u){var w="";var v="id="+this.id+"&width="+x+"&height="+u;if(navigator.userAgent.match(/MSIE/)){var y=location.href.match(/^https/i)?"https://":"http://";w+=''}else{w+=''}return w},hide:function(){if(this.div){this.div.style.left="-2000px"}},show:function(){this.reposition()},destroy:function(){var u=this;if(this.domElement&&this.div){a(this.div).remove();this.domElement=null;this.div=null;a.each(r.clients,function(w,v){if(v===u){delete r.clients[w]}})}},reposition:function(w){if(w){this.domElement=r.$(w);if(!this.domElement){this.hide()}}if(this.domElement&&this.div){var v=r.getDOMObjectPosition(this.domElement);var u=this.div.style;u.left=""+v.left+"px";u.top=""+v.top+"px"}},clearText:function(){this.clipText="";if(this.ready){this.movie.clearText()}},appendText:function(u){this.clipText+=u;if(this.ready){this.movie.appendText(u)}},setText:function(u){this.clipText=u;if(this.ready){this.movie.setText(u)}},setFileName:function(u){this.fileName=u;if(this.ready){this.movie.setFileName(u)}},setSheetData:function(u){if(this.ready){this.movie.setSheetData(JSON.stringify(u))}},setAction:function(u){this.action=u;if(this.ready){this.movie.setAction(u)}},addEventListener:function(u,v){u=u.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[u]){this.handlers[u]=[]}this.handlers[u].push(v)},setHandCursor:function(u){this.handCursorEnabled=u;if(this.ready){this.movie.setHandCursor(u)}},setCSSEffects:function(u){this.cssEffects=!!u},receiveEvent:function(x,y){var w;x=x.toString().toLowerCase().replace(/^on/,"");switch(x){case"load":this.movie=o.getElementById(this.movieId);if(!this.movie){w=this;setTimeout(function(){w.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){w=this;setTimeout(function(){w.receiveEvent("load",null)},100);this.ready=true;return}this.ready=true;this.movie.clearText();this.movie.appendText(this.clipText);this.movie.setFileName(this.fileName);this.movie.setAction(this.action);this.movie.setHandCursor(this.handCursorEnabled);break;case"mouseover":if(this.domElement&&this.cssEffects){if(this.recoverActive){this.domElement.addClass("active")}}break;case"mouseout":if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true}}break;case"mousedown":if(this.domElement&&this.cssEffects){this.domElement.addClass("active")}break;case"mouseup":if(this.domElement&&this.cssEffects){this.domElement.removeClass("active");this.recoverActive=false}break}if(this.handlers[x]){for(var v=0,u=this.handlers[x].length;v0){L+=C}L+=v?v+(""+J[K]).replace(y,H+v)+v:J[K]}return L};var B=x.header?u(A.header)+E:"";var F=x.footer&&A.footer?E+u(A.footer):"";var D=[];for(var z=0,G=A.body.length;z=0){w=String.fromCharCode(y%u+x)+w;y=Math.floor(y/u)-1}return w}function h(w,x,u){var v=w.createElement(x);if(u){if(u.attr){a(v).attr(u.attr)}if(u.children){a.each(u.children,function(y,z){v.appendChild(z)})}if(u.text!==null&&u.text!==c){v.appendChild(w.createTextNode(u.text))}}return v}function k(w,v){var A=w.header[v].length;var y,u,z;if(w.footer&&w.footer[v].length>A){A=w.footer[v].length}for(var x=0,C=w.body.length;xA){A=y}if(A>40){return 52}}A*=1.3;return A>6?A:6}var f="";if(typeof i.XMLSerializer==="undefined"){f=new function(){this.serializeToString=function(u){return u.xml}}}else{f=new XMLSerializer()}var s;function d(u){if(s===c){s=f.serializeToString(a.parseXML(n["xl/worksheets/sheet1.xml"])).indexOf("xmlns:r")===-1}a.each(u,function(v,w){if(a.isPlainObject(w)){d(w)}else{if(s){var C=w.childNodes[0];var x,E;var D=[];for(x=C.attributes.length-1;x>=0;x--){var B=C.attributes[x].nodeName;var y=C.attributes[x].nodeValue;if(B.indexOf(":")!==-1){D.push({name:B,value:y});C.removeAttribute(B)}}for(x=0,E=D.length;x'+A}A=A.replace(/_dt_b_namespace_token_/g,":")}A=A.replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");u[v]=A}})}var n={"_rels/.rels":'',"xl/_rels/workbook.xml.rels":'',"[Content_Types].xml":'',"xl/workbook.xml":'',"xl/worksheets/sheet1.xml":'',"xl/styles.xml":''};var b=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(u){return u/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(u){return u/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\([\d,]+\)$/,style:61,fmt:function(u){return -1*u.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(u){return -1*u.replace(/[\(\)]/g,"")}},{match:/^[\d,]+$/,style:63},{match:/^[\d,]+\.\d{2}$/,style:64}];m.Buttons.swfPath="//cdn.datatables.net/buttons/"+m.Buttons.version+"/swf/flashExport.swf";m.Api.register("buttons.resize()",function(){a.each(r.clients,function(v,u){if(u.domElement!==c&&u.domElement.parentNode){u.positionElement()}})});m.ext.buttons.copyFlash=a.extend({},q,{className:"buttons-copy buttons-flash",text:function(u){return u.i18n("buttons.copy","Copy")},action:function(C,u,A,x){if(!x._fromFlash){return}this.processing(true);var B=x._flash;var z=t(u,x);var w=u.buttons.exportInfo(x);var y=g(x);var v=z.str;if(w.title){v=w.title+y+y+v}if(w.messageTop){v=w.messageTop+y+y+v}if(w.messageBottom){v=v+y+y+w.messageBottom}if(x.customize){v=x.customize(v,x,u)}B.setAction("copy");p(B,v);this.processing(false);u.buttons.info(u.i18n("buttons.copyTitle","Copy to clipboard"),u.i18n("buttons.copySuccess",{_:"Copied %d rows to clipboard",1:"Copied 1 row to clipboard"},data.rows),3000)},fieldSeparator:"\t",fieldBoundary:""});m.ext.buttons.csvFlash=a.extend({},q,{className:"buttons-csv buttons-flash",text:function(u){return u.i18n("buttons.csv","CSV")},action:function(B,y,x,w){var v=w._flash;var z=t(y,w);var A=y.buttons.exportInfo(w);var u=w.customize?w.customize(z.str,w,y):z.str;v.setAction("csv");v.setFileName(A.filename);p(v,u)},escapeChar:'"'});m.ext.buttons.excelFlash=a.extend({},q,{className:"buttons-excel buttons-flash",text:function(u){return u.i18n("buttons.excel","Excel")},action:function(J,C,u,K){this.processing(true);var E=K._flash;var I=0;var y=a.parseXML(n["xl/worksheets/sheet1.xml"]);var A=y.getElementsByTagName("sheetData")[0];var z={_rels:{".rels":a.parseXML(n["_rels/.rels"])},xl:{_rels:{"workbook.xml.rels":a.parseXML(n["xl/_rels/workbook.xml.rels"])},"workbook.xml":a.parseXML(n["xl/workbook.xml"]),"styles.xml":a.parseXML(n["xl/styles.xml"]),worksheets:{"sheet1.xml":y}},"[Content_Types].xml":a.parseXML(n["[Content_Types].xml"])};var N=C.buttons.exportData(K.exportOptions);var M,w;var v=function(X){M=I+1;w=h(y,"row",{attr:{r:M}});for(var S=0,W=X.length;S