Permalink
Browse files

Generate v3.3.0

  • Loading branch information...
1 parent 5d46756 commit 79d1ac190ab18b7db55d2de3407fc0e4828c6132 @zenorocha zenorocha committed May 1, 2013
Showing with 78 additions and 4 deletions.
  1. +2 −2 README.md
  2. +1 −1 boilerplate.jquery.json
  3. +65 −0 build/jquery.boilerplate.js
  4. +9 −0 build/jquery.boilerplate.min.js
  5. +1 −1 package.json
View
4 README.md
@@ -1,4 +1,4 @@
-# jQuery Boilerplate
+# jQuery Boilerplate [![Build Status](https://secure.travis-ci.org/jquery-boilerplate/boilerplate.png?branch=master)](https://travis-ci.org/jquery-boilerplate/boilerplate)
### A boilerplate for jump-starting jQuery plugins development.
@@ -21,4 +21,4 @@ Also, check our guide on [How to publish a plugin in jQuery Plugin Registry](htt
## Have you created a plugin from our boilerplate?
-[Let us know!](https://github.com/jquery-boilerplate/boilerplate/wiki/Sites) It’s interesting to see what features others have come up with.
+[Let us know!](https://github.com/jquery-boilerplate/boilerplate/wiki/Sites) It’s interesting to see what features others have come up with.
View
2 boilerplate.jquery.json
@@ -7,7 +7,7 @@
"boilerplate",
"plugins"
],
- "version": "3.2.0",
+ "version": "3.3.0",
"author": {
"name": "Zeno Rocha",
"url": "https://github.com/zenorocha"
View
65 build/jquery.boilerplate.js
@@ -0,0 +1,65 @@
+/*
+ * jQuery Boilerplate - v3.3.0
+ * A jump-start for jQuery plugins development.
+ * http://jqueryboilerplate.com
+ *
+ * Made by Zeno Rocha
+ * Under MIT License
+ */
+// the semi-colon before function invocation is a safety net against concatenated
+// scripts and/or other plugins which may not be closed properly.
+;(function ($, window, document, undefined) {
+
+ // undefined is used here as the undefined global variable in ECMAScript 3 is
+ // mutable (ie. it can be changed by someone else). undefined isn't really being
+ // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
+ // can no longer be modified.
+
+ // window and document are passed through as local variable rather than global
+ // as this (slightly) quickens the resolution process and can be more efficiently
+ // minified (especially when both are regularly referenced in your plugin).
+
+ // Create the defaults once
+ var pluginName = "defaultPluginName",
+ defaults = {
+ propertyName: "value"
+ };
+
+ // The actual plugin constructor
+ function Plugin(element, options) {
+ this.element = element;
+ // jQuery has an extend method which merges the contents of two or
+ // more objects, storing the result in the first object. The first object
+ // is generally empty as we don't want to alter the default options for
+ // future instances of the plugin
+ this.options = $.extend({}, defaults, options);
+ this._defaults = defaults;
+ this._name = pluginName;
+ this.init();
+ }
+
+ Plugin.prototype = {
+ init: function () {
+ // Place initialization logic here
+ // You already have access to the DOM element and
+ // the options via the instance, e.g. this.element
+ // and this.options
+ // you can add more functions like the one below and
+ // call them like so: this.yourOtherFunction(this.element, this.options).
+ },
+ yourOtherFunction: function () {
+ // some logic
+ }
+ };
+
+ // A really lightweight plugin wrapper around the constructor,
+ // preventing against multiple instantiations
+ $.fn[pluginName] = function (options) {
+ return this.each(function () {
+ if (!$.data(this, "plugin_" + pluginName)) {
+ $.data(this, "plugin_" + pluginName, new Plugin(this, options));
+ }
+ });
+ };
+
+})(jQuery, window, document);
View
9 build/jquery.boilerplate.min.js
@@ -0,0 +1,9 @@
+/*
+ * jQuery Boilerplate - v3.3.0
+ * A jump-start for jQuery plugins development.
+ * http://jqueryboilerplate.com
+ *
+ * Made by Zeno Rocha
+ * Under MIT License
+ */
+(function(t){function n(n,u){this.element=n,this.options=t.extend({},e,u),this._defaults=e,this._name=i,this.init()}var i="defaultPluginName",e={propertyName:"value"};n.prototype={init:function(){},yourOtherFunction:function(){}},t.fn[i]=function(e){return this.each(function(){t.data(this,"plugin_"+i)||t.data(this,"plugin_"+i,new n(this,e))})}})(jQuery,window,document);
View
2 package.json
@@ -4,7 +4,7 @@
"description": "A jump-start for jQuery plugins development.",
"author": "Zeno Rocha",
"homepage": "https://github.com/jquery-boilerplate/boilerplate/",
- "version": "3.2.0",
+ "version": "3.3.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.7",

0 comments on commit 79d1ac1

Please sign in to comment.