From 950f84e173883900ed139b933de120ad0de5617b Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 10 Mar 2023 11:58:37 +0000 Subject: [PATCH] Update: CommonJS loader to support non-execution loading --- api/average().js | 38 +++++++++++-------- api/average().min.js | 2 +- api/average().mjs | 1 - api/column().title().js | 38 +++++++++++-------- api/column().title().min.js | 2 +- api/column().title().mjs | 1 - api/columns().order().js | 38 +++++++++++-------- api/columns().order().min.js | 2 +- api/columns().order().mjs | 1 - api/order.neutral().js | 38 +++++++++++-------- api/order.neutral().min.js | 2 +- api/order.neutral().mjs | 1 - api/page.jumpToData().js | 38 +++++++++++-------- api/page.jumpToData().min.js | 2 +- api/page.jumpToData().mjs | 1 - api/processing().js | 38 +++++++++++-------- api/processing().min.js | 2 +- api/processing().mjs | 1 - api/row().show().js | 38 +++++++++++-------- api/row().show().min.js | 2 +- api/row().show().mjs | 1 - api/rows().generate().js | 38 +++++++++++-------- api/rows().generate().min.js | 2 +- api/rows().generate().mjs | 1 - api/sum().js | 38 +++++++++++-------- api/sum().min.js | 2 +- api/sum().mjs | 1 - buttons/button.download.js | 38 +++++++++++-------- buttons/button.download.min.js | 2 +- buttons/button.download.mjs | 1 - dataRender/anchor.js | 38 +++++++++++-------- dataRender/anchor.min.js | 2 +- dataRender/anchor.mjs | 1 - dataRender/datetime.js | 38 +++++++++++-------- dataRender/datetime.min.js | 2 +- dataRender/datetime.mjs | 1 - dataRender/ellipsis.js | 38 +++++++++++-------- dataRender/ellipsis.min.js | 2 +- dataRender/ellipsis.mjs | 1 - dataRender/hyperLink.js | 38 +++++++++++-------- dataRender/hyperLink.min.js | 2 +- dataRender/hyperLink.mjs | 1 - dataRender/intl.js | 38 +++++++++++-------- dataRender/intl.min.js | 2 +- dataRender/intl.mjs | 1 - dataRender/multi.js | 38 +++++++++++-------- dataRender/multi.min.js | 2 +- dataRender/multi.mjs | 1 - dataRender/numberTo.js | 38 +++++++++++-------- dataRender/numberTo.min.js | 2 +- dataRender/numberTo.mjs | 1 - dataRender/percentageBars.js | 38 +++++++++++-------- dataRender/percentageBars.min.js | 2 +- dataRender/percentageBars.mjs | 1 - .../dataTables.alphabetSearch.js | 38 +++++++++++-------- .../dataTables.alphabetSearch.min.js | 2 +- .../dataTables.alphabetSearch.mjs | 1 - .../dataTables.conditionalPageLength.js | 38 +++++++++++-------- .../dataTables.conditionalPageLength.min.js | 2 +- .../dataTables.conditionalPageLength.mjs | 1 - .../dataTables.conditionalPaging.js | 38 +++++++++++-------- .../dataTables.conditionalPaging.min.js | 2 +- .../dataTables.conditionalPaging.mjs | 1 - features/deepLink/dataTables.deepLink.js | 38 +++++++++++-------- features/deepLink/dataTables.deepLink.min.js | 2 +- features/deepLink/dataTables.deepLink.mjs | 1 - .../excludeSearch/dataTables.excludeSearch.js | 38 +++++++++++-------- .../dataTables.excludeSearch.min.js | 2 +- .../dataTables.excludeSearch.mjs | 1 - .../fuzzySearch/dataTables.fuzzySearch.js | 38 +++++++++++-------- .../fuzzySearch/dataTables.fuzzySearch.min.js | 2 +- .../fuzzySearch/dataTables.fuzzySearch.mjs | 1 - .../lengthLinks/dataTables.lengthLinks.js | 38 +++++++++++-------- .../lengthLinks/dataTables.lengthLinks.min.js | 2 +- .../lengthLinks/dataTables.lengthLinks.mjs | 1 - features/mark.js/datatables.mark.js | 38 +++++++++++-------- features/mark.js/datatables.mark.min.js | 2 +- features/mark.js/datatables.mark.mjs | 1 - features/pageResize/dataTables.pageResize.js | 38 +++++++++++-------- .../pageResize/dataTables.pageResize.min.js | 2 +- features/pageResize/dataTables.pageResize.mjs | 1 - features/rowFill/dataTables.rowFill.js | 38 +++++++++++-------- features/rowFill/dataTables.rowFill.min.js | 2 +- features/rowFill/dataTables.rowFill.mjs | 1 - .../scrollResize/dataTables.scrollResize.js | 38 +++++++++++-------- .../dataTables.scrollResize.min.js | 2 +- .../scrollResize/dataTables.scrollResize.mjs | 1 - .../scrollToTop/dataTables.scrollToTop.js | 38 +++++++++++-------- .../scrollToTop/dataTables.scrollToTop.min.js | 2 +- .../scrollToTop/dataTables.scrollToTop.mjs | 1 - features/searchFade/dataTables.searchFade.js | 38 +++++++++++-------- .../searchFade/dataTables.searchFade.min.js | 2 +- features/searchFade/dataTables.searchFade.mjs | 1 - .../dataTables.searchHighlight.js | 38 +++++++++++-------- .../dataTables.searchHighlight.min.js | 2 +- .../dataTables.searchHighlight.mjs | 1 - .../slidingChild/datatables.slidingChild.js | 38 +++++++++++-------- .../datatables.slidingChild.min.js | 2 +- .../slidingChild/datatables.slidingChild.mjs | 1 - filtering/type-based/accent-neutralise.js | 38 +++++++++++-------- filtering/type-based/accent-neutralise.min.js | 2 +- filtering/type-based/accent-neutralise.mjs | 1 - filtering/type-based/diacritics-neutralise.js | 38 +++++++++++-------- .../type-based/diacritics-neutralise.min.js | 2 +- .../type-based/diacritics-neutralise.mjs | 1 - filtering/type-based/html.js | 38 +++++++++++-------- filtering/type-based/html.min.js | 2 +- filtering/type-based/html.mjs | 1 - filtering/type-based/phoneNumber.js | 38 +++++++++++-------- filtering/type-based/phoneNumber.min.js | 2 +- filtering/type-based/phoneNumber.mjs | 1 - make.sh | 18 ++++----- sorting/Case-Sensitive.js | 38 +++++++++++-------- sorting/Case-Sensitive.min.js | 2 +- sorting/Case-Sensitive.mjs | 1 - sorting/absolute.js | 38 +++++++++++-------- sorting/absolute.min.js | 2 +- sorting/absolute.mjs | 1 - sorting/alt-string.js | 38 +++++++++++-------- sorting/alt-string.min.js | 2 +- sorting/alt-string.mjs | 1 - sorting/anti-the.js | 38 +++++++++++-------- sorting/anti-the.min.js | 2 +- sorting/anti-the.mjs | 1 - sorting/any-number.js | 38 +++++++++++-------- sorting/any-number.min.js | 2 +- sorting/any-number.mjs | 1 - sorting/brackets-negative.js | 38 +++++++++++-------- sorting/brackets-negative.min.js | 2 +- sorting/brackets-negative.mjs | 1 - sorting/chapter.js | 38 +++++++++++-------- sorting/chapter.min.js | 2 +- sorting/chapter.mjs | 1 - sorting/chinese-string.js | 38 +++++++++++-------- sorting/chinese-string.min.js | 2 +- sorting/chinese-string.mjs | 1 - sorting/czech-string.js | 38 +++++++++++-------- sorting/czech-string.min.js | 2 +- sorting/czech-string.mjs | 1 - sorting/diacritics-sort.js | 38 +++++++++++-------- sorting/diacritics-sort.min.js | 2 +- sorting/diacritics-sort.mjs | 1 - sorting/enum.js | 38 +++++++++++-------- sorting/enum.min.js | 2 +- sorting/enum.mjs | 1 - sorting/farsi-numbers.js | 38 +++++++++++-------- sorting/farsi-numbers.min.js | 2 +- sorting/farsi-numbers.mjs | 1 - sorting/file-size.js | 38 +++++++++++-------- sorting/file-size.min.js | 2 +- sorting/file-size.mjs | 1 - sorting/formatted-numbers.js | 38 +++++++++++-------- sorting/formatted-numbers.min.js | 2 +- sorting/formatted-numbers.mjs | 1 - sorting/intl.js | 38 +++++++++++-------- sorting/intl.min.js | 2 +- sorting/intl.mjs | 1 - sorting/ip-address.js | 38 +++++++++++-------- sorting/ip-address.min.js | 2 +- sorting/ip-address.mjs | 1 - sorting/natural-time-delta.js | 38 +++++++++++-------- sorting/natural-time-delta.min.js | 2 +- sorting/natural-time-delta.mjs | 1 - sorting/natural.js | 38 +++++++++++-------- sorting/natural.min.js | 2 +- sorting/natural.mjs | 1 - sorting/nepali-numbers.js | 38 +++++++++++-------- sorting/nepali-numbers.min.js | 2 +- sorting/nepali-numbers.mjs | 1 - sorting/numString.js | 38 +++++++++++-------- sorting/numString.min.js | 2 +- sorting/numString.mjs | 1 - sorting/persian-number.js | 38 +++++++++++-------- sorting/persian-number.min.js | 2 +- sorting/persian-number.mjs | 1 - sorting/persian.js | 38 +++++++++++-------- sorting/persian.min.js | 2 +- sorting/persian.mjs | 1 - sorting/scientific.js | 38 +++++++++++-------- sorting/scientific.min.js | 2 +- sorting/scientific.mjs | 1 - sorting/signed-num.js | 38 +++++++++++-------- sorting/signed-num.min.js | 2 +- sorting/signed-num.mjs | 1 - sorting/time-elapsed-dhms.js | 38 +++++++++++-------- sorting/time-elapsed-dhms.min.js | 2 +- sorting/time-elapsed-dhms.mjs | 1 - sorting/title-numeric.js | 38 +++++++++++-------- sorting/title-numeric.min.js | 2 +- sorting/title-numeric.mjs | 1 - sorting/title-string.js | 38 +++++++++++-------- sorting/title-string.min.js | 2 +- sorting/title-string.mjs | 1 - sorting/turkish-string.js | 38 +++++++++++-------- sorting/turkish-string.min.js | 2 +- sorting/turkish-string.mjs | 1 - type-detection/file-size.js | 38 +++++++++++-------- type-detection/file-size.min.js | 2 +- type-detection/file-size.mjs | 1 - type-detection/formatted-num.js | 38 +++++++++++-------- type-detection/formatted-num.min.js | 2 +- type-detection/formatted-num.mjs | 1 - type-detection/ip-address.js | 38 +++++++++++-------- type-detection/ip-address.min.js | 2 +- type-detection/ip-address.mjs | 1 - 205 files changed, 1641 insertions(+), 1165 deletions(-) diff --git a/api/average().js b/api/average().js index c410226..e9c8688 100644 --- a/api/average().js +++ b/api/average().js @@ -9,25 +9,33 @@ } else if ( typeof exports === 'object' ) { // CommonJS - module.exports = function (root, $) { - if ( ! root ) { - // CommonJS environments without a window global must pass a - // root. This will give an error otherwise - root = window; - } - - if ( ! $ ) { - $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window - require('jquery') : - require('jquery')( root ); - } - + var jq = require('jquery'); + var cjsRequires = function (root, $) { if ( ! $.fn.dataTable ) { require('datatables.net')(root, $); } - - return factory( $, root, root.document ); }; + + if (typeof window !== 'undefined') { + module.exports = function (root, $) { + if ( ! root ) { + // CommonJS environments without a window global must pass a + // root. This will give an error otherwise + root = window; + } + + if ( ! $ ) { + $ = jq( root ); + } + + cjsRequires( root, $ ); + return factory( $, root, root.document ); + }; + } + else { + cjsRequires( window, jq ); + module.exports = factory( jq, window, window.document ); + } } else { // Browser diff --git a/api/average().min.js b/api/average().min.js index 806a0a8..0ee91f3 100644 --- a/api/average().min.js +++ b/api/average().min.js @@ -1,2 +1,2 @@ /*! © SpryMedia Ltd - datatables.net/license */ -!function(t){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?module.exports=function(e,n){return e=e||window,(n=n||("undefined"!=typeof window?require("jquery"):require("jquery")(e))).fn.dataTable||require("datatables.net")(e,n),t(n,0,e.document)}:t(jQuery,window,document)}(function(e,n,t,r){"use strict";e=e.fn.dataTable;return e.Api.register("average()",function(){var e=this.flatten();return e.reduce(function(e,n){return+e+ +n},0)/e.length}),e}); \ No newline at end of file +!function(t){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),r(e,n),t(n,0,e.document)}:(r(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(e,n,t,o){"use strict";e=e.fn.dataTable;return e.Api.register("average()",function(){var e=this.flatten();return e.reduce(function(e,n){return+e+ +n},0)/e.length}),e}); \ No newline at end of file diff --git a/api/average().mjs b/api/average().mjs index d126146..da6deb1 100644 --- a/api/average().mjs +++ b/api/average().mjs @@ -3,7 +3,6 @@ import $ from 'jquery'; import DataTable from 'datatables.net'; - /** * It can sometimes be useful to get the average of data in an API result set, * be it from a column, or a collection of cells. This method provides exactly diff --git a/api/column().title().js b/api/column().title().js index 3a98c89..e8b78da 100644 --- a/api/column().title().js +++ b/api/column().title().js @@ -9,25 +9,33 @@ } else if ( typeof exports === 'object' ) { // CommonJS - module.exports = function (root, $) { - if ( ! root ) { - // CommonJS environments without a window global must pass a - // root. This will give an error otherwise - root = window; - } - - if ( ! $ ) { - $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window - require('jquery') : - require('jquery')( root ); - } - + var jq = require('jquery'); + var cjsRequires = function (root, $) { if ( ! $.fn.dataTable ) { require('datatables.net')(root, $); } - - return factory( $, root, root.document ); }; + + if (typeof window !== 'undefined') { + module.exports = function (root, $) { + if ( ! root ) { + // CommonJS environments without a window global must pass a + // root. This will give an error otherwise + root = window; + } + + if ( ! $ ) { + $ = jq( root ); + } + + cjsRequires( root, $ ); + return factory( $, root, root.document ); + }; + } + else { + cjsRequires( window, jq ); + module.exports = factory( jq, window, window.document ); + } } else { // Browser diff --git a/api/column().title().min.js b/api/column().title().min.js index 9bda90c..516c12f 100644 --- a/api/column().title().min.js +++ b/api/column().title().min.js @@ -1,2 +1,2 @@ /*! © Alejandro Navarro - datatables.net/license */ -!function(n){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?module.exports=function(e,t){return e=e||window,(t=t||("undefined"!=typeof window?require("jquery"):require("jquery")(e))).fn.dataTable||require("datatables.net")(e,t),n(t,0,e.document)}:n(jQuery,window,document)}(function(t,e,n,r){"use strict";var u=t.fn.dataTable;return u.Api.register("column().title()",function(){var e=this.header();return t(e).text().trim()}),u}); \ No newline at end of file +!function(t){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(e,n){n.fn.dataTable||require("datatables.net")(e,n)},"undefined"!=typeof window?module.exports=function(e,n){return e=e||window,n=n||o(e),i(e,n),t(n,0,e.document)}:(i(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(n,e,t,o){"use strict";var i=n.fn.dataTable;return i.Api.register("column().title()",function(){var e=this.header();return n(e).text().trim()}),i}); \ No newline at end of file diff --git a/api/column().title().mjs b/api/column().title().mjs index 65209b2..ce064c1 100644 --- a/api/column().title().mjs +++ b/api/column().title().mjs @@ -3,7 +3,6 @@ import $ from 'jquery'; import DataTable from 'datatables.net'; - /** * This plug-in will read the text from the header cell of a column, returning * that value. diff --git a/api/columns().order().js b/api/columns().order().js index 5ab8cf0..0b3b012 100644 --- a/api/columns().order().js +++ b/api/columns().order().js @@ -9,25 +9,33 @@ } else if ( typeof exports === 'object' ) { // CommonJS - module.exports = function (root, $) { - if ( ! root ) { - // CommonJS environments without a window global must pass a - // root. This will give an error otherwise - root = window; - } - - if ( ! $ ) { - $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window - require('jquery') : - require('jquery')( root ); - } - + var jq = require('jquery'); + var cjsRequires = function (root, $) { if ( ! $.fn.dataTable ) { require('datatables.net')(root, $); } - - return factory( $, root, root.document ); }; + + if (typeof window !== 'undefined') { + module.exports = function (root, $) { + if ( ! root ) { + // CommonJS environments without a window global must pass a + // root. This will give an error otherwise + root = window; + } + + if ( ! $ ) { + $ = jq( root ); + } + + cjsRequires( root, $ ); + return factory( $, root, root.document ); + }; + } + else { + cjsRequires( window, jq ); + module.exports = factory( jq, window, window.document ); + } } else { // Browser diff --git a/api/columns().order().min.js b/api/columns().order().min.js index afffa5c..a95bede 100644 --- a/api/columns().order().min.js +++ b/api/columns().order().min.js @@ -1,2 +1,2 @@ /*! © SpryMedia Ltd - datatables.net/license */ -!function(r){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return r(e,window,document)}):"object"==typeof exports?module.exports=function(e,n){return e=e||window,(n=n||("undefined"!=typeof window?require("jquery"):require("jquery")(e))).fn.dataTable||require("datatables.net")(e,n),r(n,0,e.document)}:r(jQuery,window,document)}(function(e,n,r,t){"use strict";var i=e.fn.dataTable;return i.Api.register("columns().order()",function(u){return this.iterator("columns",function(e,n){for(var r=[],t=0,o=n.length;t=e.start&&t=e.start&&t").css({border:"none",height:0,width:0}).appendTo(u.body)[0].contentWindow.document,d=(r.open(),r.close(),i("
",r).attr("method",o.type).attr("action",o.url).appendTo(r.body));i.each(e,function(t,e){i("",r).attr("type","text").attr("name",t.toString()).attr("autocomplete","no").val(e).appendTo(d)}),d.submit()},url:"",type:"POST",data:{}},n}); \ No newline at end of file +!function(n){var o,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return n(t,window,document)}):"object"==typeof exports?(o=require("jquery"),a=function(t,e){e.fn.dataTable||require("datatables.net")(t,e)},"undefined"!=typeof window?module.exports=function(t,e){return t=t||window,e=e||o(t),a(t,e),n(e,0,t.document)}:(a(window,o),module.exports=n(o,window,window.document))):n(jQuery,window,document)}(function(i,t,u,e){"use strict";var n=i.fn.dataTable;return n.ext.buttons.download={text:"Download",action:function(t,e,n,o){var a={},e=(e.page.info().serverSide&&i.extend(a,e.ajax.params()),"function"==typeof o.data?o.data(a):"object"==typeof o.data&&i.extend(a,o.data),function n(t,o,a){return a=a||{},o=o||"",i.isPlainObject(t)||Array.isArray(t)?i.each(t,function(t,e){n(e,""===o?t:o+"["+t.toString()+"]",a)}):a[o]=t,a}(a)),d=i("