responsive.semanticui.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*! Bootstrap integration for DataTables' Responsive
  2. * ©2015-2016 SpryMedia Ltd - datatables.net/license
  3. */
  4. (function( factory ){
  5. if ( typeof define === 'function' && define.amd ) {
  6. // AMD
  7. define( ['jquery', 'datatables.net-se', 'datatables.net-responsive'], function ( $ ) {
  8. return factory( $, window, document );
  9. } );
  10. }
  11. else if ( typeof exports === 'object' ) {
  12. // CommonJS
  13. module.exports = function (root, $) {
  14. if ( ! root ) {
  15. root = window;
  16. }
  17. if ( ! $ || ! $.fn.dataTable ) {
  18. $ = require('datatables.net-se')(root, $).$;
  19. }
  20. if ( ! $.fn.dataTable.Responsive ) {
  21. require('datatables.net-responsive')(root, $);
  22. }
  23. return factory( $, root, root.document );
  24. };
  25. }
  26. else {
  27. // Browser
  28. factory( jQuery, window, document );
  29. }
  30. }(function( $, window, document, undefined ) {
  31. 'use strict';
  32. var DataTable = $.fn.dataTable;
  33. var _display = DataTable.Responsive.display;
  34. var _original = _display.modal;
  35. var _modal = $(
  36. '<div class="ui modal" role="dialog">'+
  37. '<div class="header">'+
  38. '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
  39. '</div>'+
  40. '<div class="content"/>'+
  41. '</div>'
  42. );
  43. _display.modal = function ( options ) {
  44. return function ( row, update, render ) {
  45. if ( ! $.fn.modal ) {
  46. _original( row, update, render );
  47. }
  48. else {
  49. if ( ! update ) {
  50. if ( options && options.header ) {
  51. _modal.find('div.header')
  52. .empty()
  53. .append( '<h4 class="title">'+options.header( row )+'</h4>' );
  54. }
  55. _modal.find( 'div.content' )
  56. .empty()
  57. .append( render() );
  58. _modal
  59. .appendTo( 'body' )
  60. .modal('show');
  61. }
  62. }
  63. };
  64. };
  65. return DataTable.Responsive;
  66. }));