Browse Source

Module loaded without dependency of window.jQuery and one build Gulp
script.

João Bolila 11 years ago
parent
commit
e6de59003e

+ 1 - 0
.eslintignore

@@ -0,0 +1 @@
+node_modules/**

+ 24 - 0
.eslintrc

@@ -0,0 +1,24 @@
+{
+    "env": {
+        "node": true
+    },
+
+    "rules": {
+        "brace-style": [2, "1tbs"],
+        "default-case": 2,
+        "func-style": [2, "declaration"],
+        "guard-for-in": 2,
+        "no-floating-decimal": 2,
+        "no-nested-ternary": 2,
+        "radix": 2,
+        "space-unary-word-ops": 2,
+        "space-after-keywords": [2, "always"],
+        "valid-jsdoc": [2, {
+            "prefer": {
+                "return": "returns"
+             }
+        }],
+        "quotes": [1, "single", "allow-avoiding-escaped-quotes"],
+        "wrap-iife": 2
+    }
+}

+ 16 - 1
README.md

@@ -13,10 +13,25 @@ Thanks for [akinoniku](https://github.com/akinoniku)'s suggestions on dialog app
 
 ## Use Guidances from contributors
 
-<a href="https://gist.github.com/Genkilabs/bdcc5f62c5b46a8e0904">How to use bootstrap-dialog as Rails 4 confirm</a> - @[Genkilabs](https://github.com/Genkilabs) 
+<a href="https://gist.github.com/Genkilabs/bdcc5f62c5b46a8e0904">How to use bootstrap-dialog as Rails 4 confirm</a> - @[Genkilabs](https://github.com/Genkilabs)
 
 
 ================
 
+## Build instructions:
+
+Prepare:
+
+```
+npm install
+```
+
+Build:
+
+```
+gulp dist
+```
+
+================
 
 Licensed under The MIT License.

+ 76 - 76
dist/css/bootstrap-dialog.css

@@ -1,120 +1,120 @@
 .bootstrap-dialog {
-
+  /* dialog types */
+  /* dialog sizes */
+  /**
+     * Icon animation
+     * Copied from font-awesome: http://fontawesome.io/
+     **/
+  /** End of icon animation **/
 }
 .bootstrap-dialog .modal-header {
-    border-top-left-radius: 4px;
-    border-top-right-radius: 4px;
+  border-top-left-radius: 4px;
+  border-top-right-radius: 4px;
 }
 .bootstrap-dialog .bootstrap-dialog-title {
-    color: #fff;
-    display: inline-block;
+  color: #fff;
+  display: inline-block;
 }
-.bootstrap-dialog.type-default .bootstrap-dialog-title {
-    color: #333;
-}
-.bootstrap-dialog.size-normal .bootstrap-dialog-title {
-    font-size: 16px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-title {
-    font-size: 24px;
+.bootstrap-dialog .bootstrap-dialog-button-icon {
+  margin-right: 3px;
 }
 .bootstrap-dialog .bootstrap-dialog-close-button {
-    float: right;
-    filter:alpha(opacity=90);
-    -moz-opacity:0.9;
-    -khtml-opacity: 0.9;
-    opacity: 0.9;
-}
-.bootstrap-dialog.size-normal .bootstrap-dialog-close-button {
-    font-size: 20px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
-    font-size: 30px;
+  float: right;
+  filter: alpha(opacity=90);
+  -moz-opacity: 0.9;
+  -khtml-opacity: 0.9;
+  opacity: 0.9;
 }
 .bootstrap-dialog .bootstrap-dialog-close-button:hover {
-    cursor: pointer;
-    filter: alpha(opacity=100);
-    -moz-opacity: 1;
-    -khtml-opacity: 1;
-    opacity: 1;
-}
-.bootstrap-dialog.size-normal .bootstrap-dialog-message {
-    font-size: 14px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-message {
-    font-size: 18px;
+  cursor: pointer;
+  filter: alpha(opacity=100);
+  -moz-opacity: 1;
+  -khtml-opacity: 1;
+  opacity: 1;
 }
 .bootstrap-dialog.type-default .modal-header {
-    background-color: #fff;
+  background-color: #fff;
+}
+.bootstrap-dialog.type-default .bootstrap-dialog-title {
+  color: #333;
 }
 .bootstrap-dialog.type-info .modal-header {
-    background-color: #5bc0de;
+  background-color: #5bc0de;
 }
 .bootstrap-dialog.type-primary .modal-header {
-    background-color: #428bca;
+  background-color: #428bca;
 }
 .bootstrap-dialog.type-success .modal-header {
-    background-color: #5cb85c;
+  background-color: #5cb85c;
 }
 .bootstrap-dialog.type-warning .modal-header {
-    background-color: #f0ad4e;
+  background-color: #f0ad4e;
 }
 .bootstrap-dialog.type-danger .modal-header {
-    background-color: #d9534f;
+  background-color: #d9534f;
 }
-.bootstrap-dialog .bootstrap-dialog-button-icon {
-    margin-right: 3px;
-}
-
-/**
- * Icon animation
- * Copied from font-awesome: http://fontawesome.io/
- **/
-.icon-spin {
-    display: inline-block;
-    -moz-animation: spin 2s infinite linear;
-    -o-animation: spin 2s infinite linear;
-    -webkit-animation: spin 2s infinite linear;
-    animation: spin 2s infinite linear;
+.bootstrap-dialog.size-normal .bootstrap-dialog-title {
+  font-size: 16px;
+}
+.bootstrap-dialog.size-normal .bootstrap-dialog-close-button {
+  font-size: 20px;
+}
+.bootstrap-dialog.size-normal .bootstrap-dialog-message {
+  font-size: 14px;
+}
+.bootstrap-dialog.size-large .bootstrap-dialog-title {
+  font-size: 24px;
+}
+.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
+  font-size: 30px;
+}
+.bootstrap-dialog.size-large .bootstrap-dialog-message {
+  font-size: 18px;
+}
+.bootstrap-dialog .icon-spin {
+  display: inline-block;
+  -moz-animation: spin 2s infinite linear;
+  -o-animation: spin 2s infinite linear;
+  -webkit-animation: spin 2s infinite linear;
+  animation: spin 2s infinite linear;
 }
 @-moz-keyframes spin {
-    0% {
+  0% {
     -moz-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -moz-transform: rotate(359deg);
-}
+  }
 }
 @-webkit-keyframes spin {
-    0% {
+  0% {
     -webkit-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -webkit-transform: rotate(359deg);
-}
+  }
 }
 @-o-keyframes spin {
-    0% {
+  0% {
     -o-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -o-transform: rotate(359deg);
-}
+  }
 }
 @-ms-keyframes spin {
-    0% {
+  0% {
     -ms-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -ms-transform: rotate(359deg);
-}
+  }
 }
 @keyframes spin {
-    0% {
+  0% {
     transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     transform: rotate(359deg);
+  }
 }
-}
-/** End of icon animation **/

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


+ 22 - 16
dist/js/bootstrap-dialog.js

@@ -1,3 +1,5 @@
+/* global define */
+
 /* ================================================
  * Make use of Bootstrap's modal more monkey-friendly.
  * 
@@ -9,7 +11,25 @@
  * 
  * 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";
 
@@ -900,20 +920,6 @@
         }).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();
 
-})(window.jQuery);
+}));

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


+ 76 - 76
examples/assets/bootstrap-dialog/css/bootstrap-dialog.css

@@ -1,120 +1,120 @@
 .bootstrap-dialog {
-
+  /* dialog types */
+  /* dialog sizes */
+  /**
+     * Icon animation
+     * Copied from font-awesome: http://fontawesome.io/
+     **/
+  /** End of icon animation **/
 }
 .bootstrap-dialog .modal-header {
-    border-top-left-radius: 4px;
-    border-top-right-radius: 4px;
+  border-top-left-radius: 4px;
+  border-top-right-radius: 4px;
 }
 .bootstrap-dialog .bootstrap-dialog-title {
-    color: #fff;
-    display: inline-block;
+  color: #fff;
+  display: inline-block;
 }
-.bootstrap-dialog.type-default .bootstrap-dialog-title {
-    color: #333;
-}
-.bootstrap-dialog.size-normal .bootstrap-dialog-title {
-    font-size: 16px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-title {
-    font-size: 24px;
+.bootstrap-dialog .bootstrap-dialog-button-icon {
+  margin-right: 3px;
 }
 .bootstrap-dialog .bootstrap-dialog-close-button {
-    float: right;
-    filter:alpha(opacity=90);
-    -moz-opacity:0.9;
-    -khtml-opacity: 0.9;
-    opacity: 0.9;
-}
-.bootstrap-dialog.size-normal .bootstrap-dialog-close-button {
-    font-size: 20px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
-    font-size: 30px;
+  float: right;
+  filter: alpha(opacity=90);
+  -moz-opacity: 0.9;
+  -khtml-opacity: 0.9;
+  opacity: 0.9;
 }
 .bootstrap-dialog .bootstrap-dialog-close-button:hover {
-    cursor: pointer;
-    filter: alpha(opacity=100);
-    -moz-opacity: 1;
-    -khtml-opacity: 1;
-    opacity: 1;
-}
-.bootstrap-dialog.size-normal .bootstrap-dialog-message {
-    font-size: 14px;
-}
-.bootstrap-dialog.size-large .bootstrap-dialog-message {
-    font-size: 18px;
+  cursor: pointer;
+  filter: alpha(opacity=100);
+  -moz-opacity: 1;
+  -khtml-opacity: 1;
+  opacity: 1;
 }
 .bootstrap-dialog.type-default .modal-header {
-    background-color: #fff;
+  background-color: #fff;
+}
+.bootstrap-dialog.type-default .bootstrap-dialog-title {
+  color: #333;
 }
 .bootstrap-dialog.type-info .modal-header {
-    background-color: #5bc0de;
+  background-color: #5bc0de;
 }
 .bootstrap-dialog.type-primary .modal-header {
-    background-color: #428bca;
+  background-color: #428bca;
 }
 .bootstrap-dialog.type-success .modal-header {
-    background-color: #5cb85c;
+  background-color: #5cb85c;
 }
 .bootstrap-dialog.type-warning .modal-header {
-    background-color: #f0ad4e;
+  background-color: #f0ad4e;
 }
 .bootstrap-dialog.type-danger .modal-header {
-    background-color: #d9534f;
+  background-color: #d9534f;
 }
-.bootstrap-dialog .bootstrap-dialog-button-icon {
-    margin-right: 3px;
-}
-
-/**
- * Icon animation
- * Copied from font-awesome: http://fontawesome.io/
- **/
-.icon-spin {
-    display: inline-block;
-    -moz-animation: spin 2s infinite linear;
-    -o-animation: spin 2s infinite linear;
-    -webkit-animation: spin 2s infinite linear;
-    animation: spin 2s infinite linear;
+.bootstrap-dialog.size-normal .bootstrap-dialog-title {
+  font-size: 16px;
+}
+.bootstrap-dialog.size-normal .bootstrap-dialog-close-button {
+  font-size: 20px;
+}
+.bootstrap-dialog.size-normal .bootstrap-dialog-message {
+  font-size: 14px;
+}
+.bootstrap-dialog.size-large .bootstrap-dialog-title {
+  font-size: 24px;
+}
+.bootstrap-dialog.size-large .bootstrap-dialog-close-button {
+  font-size: 30px;
+}
+.bootstrap-dialog.size-large .bootstrap-dialog-message {
+  font-size: 18px;
+}
+.bootstrap-dialog .icon-spin {
+  display: inline-block;
+  -moz-animation: spin 2s infinite linear;
+  -o-animation: spin 2s infinite linear;
+  -webkit-animation: spin 2s infinite linear;
+  animation: spin 2s infinite linear;
 }
 @-moz-keyframes spin {
-    0% {
+  0% {
     -moz-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -moz-transform: rotate(359deg);
-}
+  }
 }
 @-webkit-keyframes spin {
-    0% {
+  0% {
     -webkit-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -webkit-transform: rotate(359deg);
-}
+  }
 }
 @-o-keyframes spin {
-    0% {
+  0% {
     -o-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -o-transform: rotate(359deg);
-}
+  }
 }
 @-ms-keyframes spin {
-    0% {
+  0% {
     -ms-transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     -ms-transform: rotate(359deg);
-}
+  }
 }
 @keyframes spin {
-    0% {
+  0% {
     transform: rotate(0deg);
-}
-100% {
+  }
+  100% {
     transform: rotate(359deg);
+  }
 }
-}
-/** End of icon animation **/

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


+ 22 - 16
examples/assets/bootstrap-dialog/js/bootstrap-dialog.js

@@ -1,3 +1,5 @@
+/* global define */
+
 /* ================================================
  * Make use of Bootstrap's modal more monkey-friendly.
  * 
@@ -9,7 +11,25 @@
  * 
  * 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";
 
@@ -900,20 +920,6 @@
         }).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();
 
-})(window.jQuery);
+}));

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


+ 58 - 0
gulpfile.js

@@ -0,0 +1,58 @@
+// Gulpfile.js
+
+"use strict";
+
+var gulp = require("gulp"),
+  eslint = require("gulp-eslint"),
+  less = require("gulp-less"),
+  minifyCSS = require("gulp-minify-css"),
+  path = require("path"),
+  notify = require("gulp-notify"),
+  clean = require("gulp-clean"),
+  rename = require("gulp-rename"),
+  uglify = require("gulp-uglify");
+
+
+gulp.task("less", function() {
+  gulp.src("less/bootstrap-dialog.less")
+    .pipe(gulp.dest("dist/less"))
+    .pipe(less({
+      paths: [path.join(__dirname, "less", "includes")]
+    }))
+    .pipe(gulp.dest("dist/css"))
+    .pipe(gulp.dest("examples/assets/bootstrap-dialog/css"))
+    .pipe(rename("bootstrap-dialog.min.css"))
+    .pipe(minifyCSS())
+    .pipe(gulp.dest("dist/css"))
+    .pipe(gulp.dest("examples/assets/bootstrap-dialog/css"));
+});
+
+gulp.task("lint", function() {
+  gulp.src(["js/bootstrap-dialog.js"])
+    .pipe(eslint())
+    .pipe(eslint.format());
+});
+
+gulp.task("dist", ["clean", "less"], function() {
+  gulp.src(["js/bootstrap-dialog.js"])
+    .pipe(gulp.dest("dist/js"))
+    .pipe(gulp.dest("examples/assets/bootstrap-dialog/js"))
+    .pipe(rename("bootstrap-dialog.min.js"))
+    .pipe(uglify())
+    .pipe(gulp.dest("dist/js"))
+    .pipe(gulp.dest("examples/assets/bootstrap-dialog/js"))
+    .pipe(notify({
+      message: "Build task completed."
+    }));
+});
+
+gulp.task("clean", function() {
+  return gulp.src(["dist/"], {
+    read: false
+  })
+    .pipe(clean());
+});
+
+gulp.task("default", ["clean"], function() {
+  gulp.start("dist");
+});

+ 22 - 16
js/bootstrap-dialog.js

@@ -1,3 +1,5 @@
+/* global define */
+
 /* ================================================
  * Make use of Bootstrap's modal more monkey-friendly.
  * 
@@ -9,7 +11,25 @@
  * 
  * 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";
 
@@ -900,20 +920,6 @@
         }).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();
 
-})(window.jQuery);
+}));

+ 39 - 0
package.json

@@ -0,0 +1,39 @@
+{
+  "name": "bootstrap3-dialog",
+  "version": "1.30.0",
+  "description": "Make use of Twitter Bootstrap's modal more monkey-friendly.",
+  "private": true,
+  "directories": {
+    "example": "examples"
+  },
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/nakupanda/bootstrap3-dialog.git"
+  },
+  "keywords": [
+    "bootstrap",
+    "dialog"
+  ],
+  "author": "nakupanda",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/nakupanda/bootstrap3-dialog/issues"
+  },
+  "homepage": "http://nakupanda.github.io/bootstrap3-dialog",
+  "devDependencies": {
+    "eslint": ">=0.6.2",
+    "gulp": ">=3.8.1",
+    "gulp-clean": ">=0.3.0",
+    "gulp-eslint": ">=0.1.7",
+    "gulp-less": ">=1.2.3",
+    "gulp-minify-css": "^0.3.4",
+    "gulp-notify": ">=1.3.1",
+    "gulp-rename": ">=1.2.0",
+    "gulp-streamify": "0.0.5",
+    "gulp-uglify": ">=0.3.0",
+    "vinyl-source-stream": "^0.1.1"
+  }
+}