Browse Source

Add option 'animate' for fading effect control.

Note: Sorry guys, the new files are compressed by YUI compressor because I don't have gulp installed on this computer.
Dante 11 years ago
parent
commit
c3fddaa5f5

+ 42 - 19
assets/bootstrap-dialog/js/bootstrap-dialog.js

@@ -1,3 +1,5 @@
+/* global define */
+
 /* ================================================
 /* ================================================
  * Make use of Bootstrap's modal more monkey-friendly.
  * Make use of Bootstrap's modal more monkey-friendly.
  * 
  * 
@@ -9,7 +11,25 @@
  * 
  * 
  * Licensed under The MIT License.
  * Licensed under The MIT License.
  * ================================================ */
  * ================================================ */
-(function($) {
+(function(root, factory) {
+
+    "use strict";
+
+    // CommonJS module is defined
+    if (typeof module !== 'undefined' && module.exports) {
+        module.exports = factory(require('jquery')(root));
+    }
+    // AMD module is defined
+    else if (typeof define === "function" && define.amd) {
+        define("bootstrap-dialog", ["jquery"], function($) {
+            return factory($);
+        });
+    } else {
+        // planted over the root!
+        root.BootstrapDialog = factory(root.jQuery);
+    }
+
+}(this, function($) {
 
 
     "use strict";
     "use strict";
 
 
@@ -82,7 +102,8 @@
         closeByKeyboard: true,
         closeByKeyboard: true,
         spinicon: BootstrapDialog.ICON_SPINNER,
         spinicon: BootstrapDialog.ICON_SPINNER,
         autodestroy: true,
         autodestroy: true,
-        draggable: false
+        draggable: false,
+        animate: true
     };
     };
 
 
     /**
     /**
@@ -137,7 +158,7 @@
             return this;
             return this;
         },
         },
         createModal: function() {
         createModal: function() {
-            var $modal = $('<div class="modal fade" tabindex="-1"></div>');
+            var $modal = $('<div class="modal" tabindex="-1"></div>');
             $modal.prop('id', this.getId());
             $modal.prop('id', this.getId());
 
 
             return $modal;
             return $modal;
@@ -324,6 +345,21 @@
         canCloseByKeyboard: function() {
         canCloseByKeyboard: function() {
             return this.options.closeByKeyboard;
             return this.options.closeByKeyboard;
         },
         },
+        isAnimate: function() {
+            return this.options.animate;
+        },
+        setAnimate: function(animate) {
+            this.options.animate = animate;
+
+            return this;
+        },
+        updateAnimate: function() {
+            if (this.isRealized()) {
+                this.getModal().toggleClass('fade', this.isAnimate());
+            }
+
+            return this;
+        },
         getSpinicon: function() {
         getSpinicon: function() {
             return this.options.spinicon;
             return this.options.spinicon;
         },
         },
@@ -769,6 +805,7 @@
             this.updateTitle();
             this.updateTitle();
             this.updateMessage();
             this.updateMessage();
             this.updateClosable();
             this.updateClosable();
+            this.updateAnimate();
 
 
             return this;
             return this;
         },
         },
@@ -900,20 +937,6 @@
         }).open();
         }).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;
-    };
-    BootstrapDialog.init();
+    return BootstrapDialog;
 
 
-})(window.jQuery);
+}));

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


+ 24 - 0
index.html

@@ -483,6 +483,30 @@
         -->
         -->
     </div>
     </div>
     
     
+    <a name="dialog-animate"></a>
+    <h3>Disabling Animation</h3>
+    <p>
+        Setting option 'animate' to false to disable animation for the opening dialog. <br />
+        If you want to disable animation globally, try to do this: <br />
+        BootstrapDialog.configDefaultOptions({
+            animate: false
+        });
+    </p>
+    <div class="source-code runnable">
+        <!--
+        BootstrapDialog.show({
+            message: 'There is no fading effects on this dialog.',
+            animate: false,
+            buttons: [{
+                label: 'Close the dialog',
+                action: function(dialogRef){
+                    dialogRef.close();
+                }
+            }]
+        });
+        -->
+    </div>
+    
     <h3>Auto spinning icon</h3>
     <h3>Auto spinning icon</h3>
     <p>
     <p>
         Lazy guys must love this.
         Lazy guys must love this.