From 0f2a52ffe58a0cc188714f6e743a4ee31a8450d1 Mon Sep 17 00:00:00 2001 From: dtbuild Date: Wed, 10 Apr 2024 13:05:17 +0000 Subject: [PATCH] d2ee4b9bdcce1d96b9f9dfd8a1a6fcb5e4616466 Fix: Improve HTML stripping regular expressions Fix: Use `DataTable.stripHtml()` to allow an external parser to be used 8cbe11b44ca3b6f722d836f3949d0da6e3a28a93 Merge branch 'master' of github.com:DataTables/Buttons Sync to source repo @8cbe11b44ca3b6f722d836f3949d0da6e3a28a93 --- datatables.json | 2 +- js/buttons.colVis.js | 9 +++++---- js/buttons.colVis.min.js | 2 +- js/buttons.colVis.min.mjs | 2 +- js/buttons.colVis.mjs | 9 +++++---- js/dataTables.buttons.js | 10 +++++----- js/dataTables.buttons.min.js | 2 +- js/dataTables.buttons.min.mjs | 2 +- js/dataTables.buttons.mjs | 10 +++++----- 9 files changed, 25 insertions(+), 23 deletions(-) diff --git a/datatables.json b/datatables.json index b94a1df..04bd2a3 100644 --- a/datatables.json +++ b/datatables.json @@ -25,5 +25,5 @@ ], "src-repo": "http://github.com/DataTables/Buttons", "last-tag": "3.0.1", - "last-sync": "be5df003b0760bc55d98b96575a78b253c904f4d" + "last-sync": "8cbe11b44ca3b6f722d836f3949d0da6e3a28a93" } \ No newline at end of file diff --git a/js/buttons.colVis.js b/js/buttons.colVis.js index e38e6de..9edf67f 100755 --- a/js/buttons.colVis.js +++ b/js/buttons.colVis.js @@ -203,10 +203,11 @@ $.extend(DataTable.ext.buttons, { title = title .replace(/\n/g, ' ') // remove new lines .replace(//gi, ' ') // replace line breaks with spaces - .replace(//g, '') // remove select tags, including options text - .replace(//g, '') // strip HTML comments - .replace(/<.*?>/g, '') // strip HTML - .replace(/^\s+|\s+$/g, ''); // trim + .replace(//g, '') // remove select tags, including options text + .replace(//g, ''); // strip HTML comments + + // Use whatever HTML stripper DataTables is configured for + title = DataTable.stripHtml(title).trim(); return conf.columnText ? conf.columnText(dt, idx, title) : title; } diff --git a/js/buttons.colVis.min.js b/js/buttons.colVis.min.js index ae10c9d..fbd2583 100644 --- a/js/buttons.colVis.min.js +++ b/js/buttons.colVis.min.js @@ -2,4 +2,4 @@ * Column visibility buttons for Buttons and DataTables. * © SpryMedia Ltd - datatables.net/license */ -!function(e){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(n){return e(n,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(n,t){t.fn.dataTable||require("datatables.net")(n,t),t.fn.dataTable.Buttons||require("datatables.net-buttons")(n,t)},"undefined"==typeof window?module.exports=function(n,t){return n=n||window,t=t||o(n),i(n,t),e(t,0,n.document)}:(i(window,o),module.exports=e(o,window,window.document))):e(jQuery,window,document)}(function(n,t,e){"use strict";var o=n.fn.dataTable;return n.extend(o.ext.buttons,{colvis:function(n,t){var e=null,o={extend:"collection",init:function(n,t){e=t},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]};return n.on("column-reorder.dt"+t.namespace,function(){n.button(null,n.button(null,e).node()).collectionRebuild([{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}])}),o},columnsToggle:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray()},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,t,e){return e._columnText(n,e)},className:"buttons-columnVisibility",action:function(n,t,e,o){var t=t.columns(o.columns),i=t.visible();t.visible(void 0!==o.visibility?o.visibility:!(i.length&&i[0]))},init:function(e,n,o){var i=this;n.attr("data-cv-idx",o.columns),e.on("column-visibility.dt"+o.namespace,function(n,t){t.bDestroying||t.nTable!=e.settings()[0].nTable||i.active(e.column(o.columns).visible())}).on("column-reorder.dt"+o.namespace,function(){o.destroying||1===e.columns(o.columns).count()&&(i.text(o._columnText(e,o)),i.active(e.column(o.columns).visible()))}),this.active(e.column(o.columns).visible())},destroy:function(n,t,e){n.off("column-visibility.dt"+e.namespace).off("column-reorder.dt"+e.namespace)},_columnText:function(n,t){var e,o;return"string"==typeof t.text?t.text:(e=n.column(t.columns).index(),o=(o=(o=n.settings()[0].aoColumns[e].sTitle)||n.column(e).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),t.columnText?t.columnText(n,e,o):o)}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,e){n.columns().every(function(){var n=this.init();void 0===n.__visOriginal&&(n.__visOriginal=this.visible())})},action:function(n,t,e,o){t.columns().every(function(n){var t=this.init();this.visible(t.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,e,o){t.columns(o.show).visible(!0,!1),t.columns(o.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}}),o}); \ No newline at end of file +!function(e){var i,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(n){return e(n,window,document)}):"object"==typeof exports?(i=require("jquery"),o=function(n,t){t.fn.dataTable||require("datatables.net")(n,t),t.fn.dataTable.Buttons||require("datatables.net-buttons")(n,t)},"undefined"==typeof window?module.exports=function(n,t){return n=n||window,t=t||i(n),o(n,t),e(t,0,n.document)}:(o(window,i),module.exports=e(i,window,window.document))):e(jQuery,window,document)}(function(n,t,e){"use strict";var o=n.fn.dataTable;return n.extend(o.ext.buttons,{colvis:function(n,t){var e=null,i={extend:"collection",init:function(n,t){e=t},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]};return n.on("column-reorder.dt"+t.namespace,function(){n.button(null,n.button(null,e).node()).collectionRebuild([{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}])}),i},columnsToggle:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray()},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,t,e){return e._columnText(n,e)},className:"buttons-columnVisibility",action:function(n,t,e,i){var t=t.columns(i.columns),o=t.visible();t.visible(void 0!==i.visibility?i.visibility:!(o.length&&o[0]))},init:function(e,n,i){var o=this;n.attr("data-cv-idx",i.columns),e.on("column-visibility.dt"+i.namespace,function(n,t){t.bDestroying||t.nTable!=e.settings()[0].nTable||o.active(e.column(i.columns).visible())}).on("column-reorder.dt"+i.namespace,function(){i.destroying||1===e.columns(i.columns).count()&&(o.text(i._columnText(e,i)),o.active(e.column(i.columns).visible()))}),this.active(e.column(i.columns).visible())},destroy:function(n,t,e){n.off("column-visibility.dt"+e.namespace).off("column-reorder.dt"+e.namespace)},_columnText:function(n,t){var e,i;return"string"==typeof t.text?t.text:(e=n.column(t.columns).index(),i=(i=(i=n.settings()[0].aoColumns[e].sTitle)||n.column(e).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,""),i=o.stripHtml(i).trim(),t.columnText?t.columnText(n,e,i):i)}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,e){n.columns().every(function(){var n=this.init();void 0===n.__visOriginal&&(n.__visOriginal=this.visible())})},action:function(n,t,e,i){t.columns().every(function(n){var t=this.init();this.visible(t.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,e,i){t.columns(i.show).visible(!0,!1),t.columns(i.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}}),o}); \ No newline at end of file diff --git a/js/buttons.colVis.min.mjs b/js/buttons.colVis.min.mjs index 317b7c3..4a6aa6a 100644 --- a/js/buttons.colVis.min.mjs +++ b/js/buttons.colVis.min.mjs @@ -2,4 +2,4 @@ * Column visibility buttons for Buttons and DataTables. * © SpryMedia Ltd - datatables.net/license */ -import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;$.extend(DataTable.ext.buttons,{colvis:function(n,t){var i=null,o={extend:"collection",init:function(n,t){i=t},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]};return n.on("column-reorder.dt"+t.namespace,function(){n.button(null,n.button(null,i).node()).collectionRebuild([{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}])}),o},columnsToggle:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray()},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,t,i){return i._columnText(n,i)},className:"buttons-columnVisibility",action:function(n,t,i,o){var t=t.columns(o.columns),e=t.visible();t.visible(void 0!==o.visibility?o.visibility:!(e.length&&e[0]))},init:function(i,n,o){var e=this;n.attr("data-cv-idx",o.columns),i.on("column-visibility.dt"+o.namespace,function(n,t){t.bDestroying||t.nTable!=i.settings()[0].nTable||e.active(i.column(o.columns).visible())}).on("column-reorder.dt"+o.namespace,function(){o.destroying||1===i.columns(o.columns).count()&&(e.text(o._columnText(i,o)),e.active(i.column(o.columns).visible()))}),this.active(i.column(o.columns).visible())},destroy:function(n,t,i){n.off("column-visibility.dt"+i.namespace).off("column-reorder.dt"+i.namespace)},_columnText:function(n,t){var i,o;return"string"==typeof t.text?t.text:(i=n.column(t.columns).index(),o=(o=(o=n.settings()[0].aoColumns[i].sTitle)||n.column(i).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),t.columnText?t.columnText(n,i,o):o)}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,i){n.columns().every(function(){var n=this.init();void 0===n.__visOriginal&&(n.__visOriginal=this.visible())})},action:function(n,t,i,o){t.columns().every(function(n){var t=this.init();this.visible(t.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,i,o){t.columns(o.show).visible(!0,!1),t.columns(o.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}});export default DataTable; \ No newline at end of file +import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;$.extend(DataTable.ext.buttons,{colvis:function(n,t){var i=null,o={extend:"collection",init:function(n,t){i=t},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]};return n.on("column-reorder.dt"+t.namespace,function(){n.button(null,n.button(null,i).node()).collectionRebuild([{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}])}),o},columnsToggle:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray()},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,t,i){return i._columnText(n,i)},className:"buttons-columnVisibility",action:function(n,t,i,o){var t=t.columns(o.columns),e=t.visible();t.visible(void 0!==o.visibility?o.visibility:!(e.length&&e[0]))},init:function(i,n,o){var e=this;n.attr("data-cv-idx",o.columns),i.on("column-visibility.dt"+o.namespace,function(n,t){t.bDestroying||t.nTable!=i.settings()[0].nTable||e.active(i.column(o.columns).visible())}).on("column-reorder.dt"+o.namespace,function(){o.destroying||1===i.columns(o.columns).count()&&(e.text(o._columnText(i,o)),e.active(i.column(o.columns).visible()))}),this.active(i.column(o.columns).visible())},destroy:function(n,t,i){n.off("column-visibility.dt"+i.namespace).off("column-reorder.dt"+i.namespace)},_columnText:function(n,t){var i,o;return"string"==typeof t.text?t.text:(i=n.column(t.columns).index(),o=(o=(o=n.settings()[0].aoColumns[i].sTitle)||n.column(i).header().innerHTML).replace(/\n/g," ").replace(//gi," ").replace(//g,"").replace(//g,""),o=DataTable.stripHtml(o).trim(),t.columnText?t.columnText(n,i,o):o)}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,i){n.columns().every(function(){var n=this.init();void 0===n.__visOriginal&&(n.__visOriginal=this.visible())})},action:function(n,t,i,o){t.columns().every(function(n){var t=this.init();this.visible(t.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,i,o){t.columns(o.show).visible(!0,!1),t.columns(o.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}});export default DataTable; \ No newline at end of file diff --git a/js/buttons.colVis.mjs b/js/buttons.colVis.mjs index f76fcaf..98e5506 100644 --- a/js/buttons.colVis.mjs +++ b/js/buttons.colVis.mjs @@ -160,10 +160,11 @@ $.extend(DataTable.ext.buttons, { title = title .replace(/\n/g, ' ') // remove new lines .replace(//gi, ' ') // replace line breaks with spaces - .replace(//g, '') // remove select tags, including options text - .replace(//g, '') // strip HTML comments - .replace(/<.*?>/g, '') // strip HTML - .replace(/^\s+|\s+$/g, ''); // trim + .replace(//g, '') // remove select tags, including options text + .replace(//g, ''); // strip HTML comments + + // Use whatever HTML stripper DataTables is configured for + title = DataTable.stripHtml(title).trim(); return conf.columnText ? conf.columnText(dt, idx, title) : title; } diff --git a/js/dataTables.buttons.js b/js/dataTables.buttons.js index 556b171..a8aaad2 100644 --- a/js/dataTables.buttons.js +++ b/js/dataTables.buttons.js @@ -1880,15 +1880,15 @@ Buttons.stripData = function (str, config) { // Always remove script tags str = str.replace( - /)<[^<]*)*<\/script>/gi, + /)<[^<]*)*<\/script\s*>/gi, '' ); // Always remove comments - str = str.replace(//g, ''); + str = str.replace(//g, ''); if (!config || config.stripHtml) { - str = str.replace(/<[^>]*>/g, ''); + str = DataTable.stripHtml(str); } if (!config || config.trim) { @@ -2519,7 +2519,7 @@ var _filename = function (config, dt) { } if (filename.indexOf('*') !== -1) { - filename = filename.replace('*', $('head > title').text()).trim(); + filename = filename.replace(/\*/g, $('head > title').text()).trim(); } // Strip characters which the OS will object to @@ -2560,7 +2560,7 @@ var _title = function (config, dt) { return title === null ? null : title.indexOf('*') !== -1 - ? title.replace('*', $('head > title').text() || 'Exported data') + ? title.replace(/\*/g, $('head > title').text() || 'Exported data') : title; }; diff --git a/js/dataTables.buttons.min.js b/js/dataTables.buttons.min.js index 421da48..205e720 100644 --- a/js/dataTables.buttons.min.js +++ b/js/dataTables.buttons.min.js @@ -1,4 +1,4 @@ /*! Buttons for DataTables 3.0.1 * © SpryMedia Ltd - datatables.net/license */ -!function(e){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(t,n){n.fn.dataTable||require("datatables.net")(t,n)},"undefined"==typeof window?module.exports=function(t,n){return t=t||window,n=n||o(t),i(t,n),e(n,t,t.document)}:(i(window,o),module.exports=e(o,window,window.document))):e(jQuery,window,document)}(function(x,g,m){"use strict";var e=x.fn.dataTable,o=0,C=0,w=e.ext.buttons,i=null;function v(t,n,e){x.fn.animate?t.stop().fadeIn(n,e):(t.css("display","block"),e&&e.call(t))}function y(t,n,e){x.fn.animate?t.stop().fadeOut(n,e):(t.css("display","none"),e&&e.call(t))}function _(n,t){if(!e.versionCheck("2"))throw"Warning: Buttons requires DataTables 2 or newer";if(!(this instanceof _))return function(t){return new _(t,n).container()};!0===(t=void 0===t?{}:t)&&(t={}),Array.isArray(t)&&(t={buttons:t}),this.c=x.extend(!0,{},_.defaults,t),t.buttons&&(this.c.buttons=t.buttons),this.s={dt:new e.Api(n),buttons:[],listenKeys:"",namespace:"dtb"+o++},this.dom={container:x("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)},this._constructor()}x.extend(_.prototype,{action:function(t,n){t=this._nodeToButton(t);return void 0===n?t.conf.action:(t.conf.action=n,this)},active:function(t,n){var t=this._nodeToButton(t),e=this.c.dom.button.active,o=x(t.node);return t.inCollection&&this.c.dom.collection.button&&void 0!==this.c.dom.collection.button.active&&(e=this.c.dom.collection.button.active),void 0===n?o.hasClass(e):(o.toggleClass(e,void 0===n||n),this)},add:function(t,n,e){var o=this.s.buttons;if("string"==typeof n){for(var i=n.split("-"),s=this.s,r=0,a=i.length-1;r"),h.conf._collection=h.collection,x(h.node).append(c.action.dropHtml),this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!a,a,s,h.conf)),h.conf.split){h.collection=x("<"+c.container.tag+"/>"),h.conf._collection=h.collection;for(var b=0;b").addClass("dt-button-spacer "+n.style+" "+p.spacer.className).html(i(n.text)),{conf:n,node:d,inserter:d,buttons:[],inCollection:t,isSplit:e,collection:null,textNode:d};if(n.available&&!n.available(f,n)&&!n.html)return!1;n.html?c=x(n.html):(r=function(t,n,e,o,i){o.action.call(n.button(e),t,n,e,o,i),x(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o])},a=function(t,n,e,o){o.async?(u.processing(e[0],!0),setTimeout(function(){r(t,n,e,o,function(){u.processing(e[0],!1)})},o.async)):r(t,n,e,o,function(){})},d=n.tag||p.tag,l=void 0===n.clickBlurs||n.clickBlurs,c=x("<"+d+"/>").addClass(p.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(t){t.preventDefault(),!c.hasClass(p.disabled)&&n.action&&a(t,f,c,n),l&&c.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),!c.hasClass(p.disabled))&&n.action&&a(t,f,c,n)}),"a"===d.toLowerCase()&&c.attr("href","#"),"button"===d.toLowerCase()&&c.attr("type","button"),s=p.liner.tag?(d=x("<"+p.liner.tag+"/>").html(i(n.text)).addClass(p.liner.className),"a"===p.liner.tag.toLowerCase()&&d.attr("href","#"),c.append(d),d):(c.html(i(n.text)),c),!1===n.enabled&&c.addClass(p.disabled),n.className&&c.addClass(n.className),n.titleAttr&&c.attr("title",i(n.titleAttr)),n.attr&&c.attr(n.attr),n.namespace||(n.namespace=".dt-button-"+C++),void 0!==n.config&&n.config.split&&(n.split=n.config.split));var h,b,g,m,v,y,d=this.c.dom.buttonContainer,d=d&&d.tag?x("<"+d.tag+"/>").addClass(d.className).append(c):c;return this._addKey(n),this.c.buttonCreated&&(d=this.c.buttonCreated(n,d)),e&&(b=(h=t?x.extend(!0,this.c.dom.split,this.c.dom.collection.split):this.c.dom.split).wrapper,g=x("<"+b.tag+"/>").addClass(b.className).append(c),m=x.extend(n,{align:h.dropdown.align,attr:{"aria-haspopup":"dialog","aria-expanded":!1},className:h.dropdown.className,closeButton:!1,splitAlignClass:h.dropdown.splitAlignClass,text:h.dropdown.text}),this._addKey(m),v=function(t,n,e,o){w.split.action.call(n.button(g),t,n,e,o),x(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o]),e.attr("aria-expanded",!0)},y=x('').html(h.dropdown.dropHtml).on("click.dtb",function(t){t.preventDefault(),t.stopPropagation(),y.hasClass(p.disabled)||v(t,f,y,m),l&&y.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),y.hasClass(p.disabled)||v(t,f,y,m))}),0===n.split.length&&y.addClass("dtb-hide-drop"),g.append(y).attr(m.attr)),{conf:n,node:(e?g:c).get(0),inserter:e?g:d,buttons:[],inCollection:t,isSplit:e,inSplit:o,collection:null,textNode:s}},_nodeToButton:function(t,n){for(var e=0,o=(n=n||this.s.buttons).length;e").addClass(p.containerClassName).addClass(p.collectionLayout).addClass(p.splitAlignClass).addClass(d).css("display","none").attr({"aria-modal":!0,role:"dialog"}),o=x(o).addClass(p.contentClassName).attr("role","menu").appendTo(e),b.attr("aria-expanded","true"),b.parents("body")[0]!==m.body&&(b=m.body.lastChild),p.popoverTitle?e.prepend('
'+p.popoverTitle+"
"):p.collectionTitle&&e.prepend('
'+p.collectionTitle+"
"),p.closeButton&&e.prepend('
×
').addClass("dtb-collection-closeable"),v(e.insertAfter(b),p.fade),n=x(t.table().container()),d=e.css("position"),"container"!==p.span&&"dt-container"!==p.align||(b=b.parent(),e.css("width",n.width())),"absolute"===d?(t=x(b[0].offsetParent),n=b.position(),d=b.offset(),a=t.offset(),s=t.position(),r=g.getComputedStyle(t[0]),a.height=t.outerHeight(),a.width=t.width()+parseFloat(r.paddingLeft),a.right=a.left+a.width,a.bottom=a.top+a.height,t=n.top+b.outerHeight(),a=n.left,e.css({top:t,left:a}),r=g.getComputedStyle(e[0]),(l=e.offset()).height=e.outerHeight(),l.width=e.outerWidth(),l.right=l.left+l.width,l.bottom=l.top+l.height,l.marginTop=parseFloat(r.marginTop),l.marginBottom=parseFloat(r.marginBottom),p.dropup&&(t=n.top-l.height-l.marginTop-l.marginBottom),"button-right"!==p.align&&!e.hasClass(p.rightAlignClassName)||(a=n.left-l.width+b.outerWidth()),"dt-container"!==p.align&&"container"!==p.align||ax(g).width()&&(a=x(g).width()-l.width-s.left),d.left+a<0&&(a=-d.left),s.top+t+l.height>x(g).height()+x(g).scrollTop()&&(t=n.top-l.height-l.marginTop-l.marginBottom),s.top+t").addClass(n).css("display","none").insertAfter(o),e):y(x("div."+n),e,function(){x(this).removeClass(n).remove()})},_.instanceSelector=function(t,i){var s,r,a;return null==t?x.map(i,function(t){return t.inst}):(s=[],r=x.map(i,function(t){return t.name}),(a=function(t){var n;if(Array.isArray(t))for(var e=0,o=t.length;e)<[^<]*)*<\/script>/gi,"")).replace(//g,""),n&&!n.stripHtml||(t=t.replace(/<[^>]*>/g,"")),n&&!n.trim||(t=t.replace(/^\s+|\s+$/g,"")),n&&!n.stripNewlines||(t=t.replace(/\n/g," ")),!n||n.decodeEntities)?i?i(t):(c.innerHTML=t,c.value):t},_.entityDecoder=function(t){i=t},_.defaults={buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{container:{tag:"div",className:"dt-buttons"},collection:{action:{dropHtml:''},container:{className:"dt-button-collection",content:{className:"",tag:"div"},tag:"div"}},button:{tag:"button",className:"dt-button",active:"dt-button-active",disabled:"disabled",spacer:{className:"dt-button-spacer",tag:"span"},liner:{tag:"span",className:""}},split:{action:{className:"dt-button-split-drop-button dt-button",tag:"button"},dropdown:{align:"split-right",className:"dt-button-split-drop",dropHtml:'',splitAlignClass:"dt-button-split-left",tag:"button"},wrapper:{className:"dt-button-split",tag:"div"}}}},x.extend(w,{collection:{text:function(t){return t.i18n("buttons.collection","Collection")},className:"buttons-collection",closeButton:!(_.version="3.0.1"),init:function(t,n){n.attr("aria-expanded",!1)},action:function(t,n,e,o){o._collection.parents("body").length?this.popover(!1,o):this.popover(o._collection,o),"keypress"===t.type&&x("a, button",o._collection).eq(0).focus()},attr:{"aria-haspopup":"dialog"}},split:{text:function(t){return t.i18n("buttons.split","Split")},className:"buttons-split",closeButton:!1,init:function(t,n){return n.attr("aria-expanded",!1)},action:function(t,n,e,o){this.popover(o._collection,o)},attr:{"aria-haspopup":"dialog"}},copy:function(){if(w.copyHtml5)return"copyHtml5"},csv:function(t,n){if(w.csvHtml5&&w.csvHtml5.available(t,n))return"csvHtml5"},excel:function(t,n){if(w.excelHtml5&&w.excelHtml5.available(t,n))return"excelHtml5"},pdf:function(t,n){if(w.pdfHtml5&&w.pdfHtml5.available(t,n))return"pdfHtml5"},pageLength:function(t){var n=t.settings()[0].aLengthMenu,e=[],o=[];if(Array.isArray(n[0]))e=n[0],o=n[1];else for(var i=0;i"+t+"":"",v(x('
').html(t).append(x("
")["string"==typeof n?"html":"append"](n)).css("display","none").appendTo("body")),void 0!==e&&0!==e&&(s=setTimeout(function(){o.buttons.info(!1)},e)),this.on("destroy.btn-info",function(){o.buttons.info(!1)})),this}),e.Api.register("buttons.exportData()",function(t){if(this.context.length)return u(new e.Api(this.context[0]),t)}),e.Api.register("buttons.exportInfo()",function(t){return{filename:n(t=t||{},this),title:a(t,this),messageTop:l(this,t,t.message||t.messageTop,"top"),messageBottom:l(this,t,t.messageBottom,"bottom")}});var s,n=function(t,n){var e;return null==(e="function"==typeof(e="*"===t.filename&&"*"!==t.title&&void 0!==t.title&&null!==t.title&&""!==t.title?t.title:t.filename)?e(t,n):e)?null:(e=(e=-1!==e.indexOf("*")?e.replace("*",x("head > title").text()).trim():e).replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""))+(r(t.extension,t,n)||"")},r=function(t,n,e){return null==t?null:"function"==typeof t?t(n,e):t},a=function(t,n){t=r(t.title,t,n);return null===t?null:-1!==t.indexOf("*")?t.replace("*",x("head > title").text()||"Exported data"):t},l=function(t,n,e,o){e=r(e,n,t);return null===e?null:(n=x("caption",t.table().container()).eq(0),"*"===e?n.css("caption-side")!==o?null:n.length?n.text():"":e)},c=x("