Browse Source

Added AMD support.

Dante 11 years ago
parent
commit
b14ce3787b

+ 21 - 4
examples/assets/bootstrap-dialog/js/bootstrap-dialog.js

@@ -9,11 +9,11 @@
  * 
  * Licensed under The MIT License.
  * ================================================ */
-var BootstrapDialog = null;
-!function($) {
+(function($) {
+
     "use strict";
 
-    BootstrapDialog = function(options) {
+    var BootstrapDialog = function(options) {
         this.defaultOptions = {
             id: BootstrapDialog.newGuid(),
             type: BootstrapDialog.TYPE_PRIMARY,
@@ -786,4 +786,21 @@ var BootstrapDialog = null;
                 }]
         }).open();
     };
-}(window.jQuery);
+
+    BootstrapDialog.init = function() {
+        // check for nodeJS
+        var hasModule = (typeof module !== 'undefined' && module.exports);
+
+        // CommonJS module is defined
+        if (hasModule)
+            module.exports = BootstrapDialog;
+        else if (typeof define === "function" && define.amd)
+            define("bootstrap-dialog", function() {
+                return BootstrapDialog;
+            });
+        else
+            window.BootstrapDialog = BootstrapDialog;
+    };
+    BootstrapDialog.init();
+
+})(window.jQuery);

File diff suppressed because it is too large
+ 1 - 1
examples/assets/bootstrap-dialog/js/bootstrap-dialog.min.js


+ 14 - 51
js/bootstrap-dialog.js

@@ -787,57 +787,20 @@
         }).open();
     };
 
-    /**
-     * Warning window
-     * 
-     * @param {type} message
-     * @returns the created dialog instance
-     */
-    BootstrapDialog.warning = function(message, callback) {
-        return new BootstrapDialog({
-            type: BootstrapDialog.TYPE_WARNING,
-            message: message
-        }).open();
-    };
-
-    /**
-     * Danger window
-     * 
-     * @param {type} message
-     * @returns the created dialog instance
-     */
-    BootstrapDialog.danger = function(message, callback) {
-        return new BootstrapDialog({
-            type: BootstrapDialog.TYPE_DANGER,
-            message: message
-        }).open();
-    };
-
-
-    /**
-     * Success window
-     * 
-     * @param {type} message
-     * @returns the created dialog instance
-     */
-    BootstrapDialog.success = function(message, callback) {
-        return new BootstrapDialog({
-            type: BootstrapDialog.TYPE_SUCCESS,
-            message: message
-        }).open();
+    BootstrapDialog.init = function() {
+        // check for nodeJS
+        var hasModule = (typeof module !== 'undefined' && module.exports);
+
+        // CommonJS module is defined
+        if (hasModule)
+            module.exports = BootstrapDialog;
+        else if (typeof define === "function" && define.amd)
+            define("bootstrap-dialog", function() {
+                return BootstrapDialog;
+            });
+        else
+            window.BootstrapDialog = BootstrapDialog;
     };
-
-    // check for nodeJS
-    var hasModule = (typeof module !== 'undefined' && module.exports);
-
-    // CommonJS module is defined
-    if (hasModule)
-        module.exports = BootstrapDialog;
-    else if (typeof define === "function" && define.amd)
-        define("bootstrap-dialog", function () {
-            return BootstrapDialog;
-        });
-    else
-        window.BootstrapDialog = BootstrapDialog;
+    BootstrapDialog.init();
 
 })(window.jQuery);

File diff suppressed because it is too large
+ 1 - 1
js/bootstrap-dialog.min.js