bootbox.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define("/Plugin/bootbox", ["exports", "jquery", "Plugin"], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory(exports, require("jquery"), require("Plugin"));
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory(mod.exports, global.jQuery, global.Plugin);
  11. global.PluginBootbox = mod.exports;
  12. }
  13. })(this, function (_exports, _jquery, _Plugin2) {
  14. "use strict";
  15. Object.defineProperty(_exports, "__esModule", {
  16. value: true
  17. });
  18. _exports.default = void 0;
  19. _jquery = babelHelpers.interopRequireDefault(_jquery);
  20. _Plugin2 = babelHelpers.interopRequireDefault(_Plugin2);
  21. var NAME = 'bootbox';
  22. var Bootbox =
  23. /*#__PURE__*/
  24. function (_Plugin) {
  25. babelHelpers.inherits(Bootbox, _Plugin);
  26. function Bootbox() {
  27. babelHelpers.classCallCheck(this, Bootbox);
  28. return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Bootbox).apply(this, arguments));
  29. }
  30. babelHelpers.createClass(Bootbox, [{
  31. key: "getName",
  32. value: function getName() {
  33. return NAME;
  34. }
  35. }, {
  36. key: "render",
  37. value: function render() {
  38. this.$el.data('bootboxWrapApi', this);
  39. }
  40. }, {
  41. key: "show",
  42. value: function show() {
  43. if (typeof bootbox === 'undefined') {
  44. return;
  45. }
  46. var options = this.options;
  47. if (options.classname) {
  48. options.className = options.classname;
  49. }
  50. if (options.className) {
  51. options.className += ' modal-simple';
  52. }
  53. if (typeof options.callback === 'string' && _jquery.default.isFunction(window[options.callback])) {
  54. options.callback = window[options.callback];
  55. }
  56. if (options.type) {
  57. switch (options.type) {
  58. case 'alert':
  59. bootbox.alert(options);
  60. break;
  61. case 'confirm':
  62. bootbox.confirm(options);
  63. break;
  64. case 'prompt':
  65. bootbox.prompt(options);
  66. break;
  67. default:
  68. bootbox.dialog(options);
  69. }
  70. } else {
  71. bootbox.dialog(options);
  72. }
  73. }
  74. }], [{
  75. key: "getDefaults",
  76. value: function getDefaults() {
  77. return {
  78. message: '',
  79. className: 'modal-simple'
  80. };
  81. }
  82. }, {
  83. key: "api",
  84. value: function api() {
  85. return 'click|show';
  86. }
  87. }]);
  88. return Bootbox;
  89. }(_Plugin2.default);
  90. _Plugin2.default.register(NAME, Bootbox);
  91. var _default = Bootbox;
  92. _exports.default = _default;
  93. });