summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2013-05-18 16:53:24 -0400
committerRob Loach <robloach@gmail.com>2013-05-18 16:53:24 -0400
commitae58c4e0e6833c784706a2b6b46825fef9d85452 (patch)
treeb8b238d8e9cf03f6321ec163f66f33c15039bb6a
parente7e38de3eb78a612c876bb909f208856f401f21f (diff)
downloadjquery-once-ae58c4e0e6833c784706a2b6b46825fef9d85452.zip
jquery-once-ae58c4e0e6833c784706a2b6b46825fef9d85452.tar.gz
jquery-once-ae58c4e0e6833c784706a2b6b46825fef9d85452.tar.bz2
Add UMD, Bower support, tag 1.2.11.2.1
-rw-r--r--README.md3
-rw-r--r--bower.json2
-rw-r--r--component.json2
-rw-r--r--example/index.html16
-rw-r--r--jquery.once.js18
-rw-r--r--once.jquery.json3
-rw-r--r--package.json2
7 files changed, 36 insertions, 10 deletions
diff --git a/README.md b/README.md
index fdbbce1..8caae8c 100644
--- a/README.md
+++ b/README.md
@@ -39,4 +39,5 @@ Dual licensed under the MIT and GPL licenses.
Credits
-------
-Written by Konstantin Käfer.
+* [Konstantin Käfer](http://kkaefer.com)
+* [Rob Loach](http://robloach.net)
diff --git a/bower.json b/bower.json
index 04b7ba6..abdd608 100644
--- a/bower.json
+++ b/bower.json
@@ -1,7 +1,7 @@
{
"name": "jquery-once",
"description": "jQuery Once Plugin",
- "version": "1.2.0",
+ "version": "1.2.1",
"keywords": [
"jquery"
],
diff --git a/component.json b/component.json
index 70c16ed..ba3319d 100644
--- a/component.json
+++ b/component.json
@@ -1,7 +1,7 @@
{
"name": "jquery-once",
"description": "jQuery Once Plugin",
- "version": "1.2.0",
+ "version": "1.2.1",
"keywords": [
"jquery"
],
diff --git a/example/index.html b/example/index.html
new file mode 100644
index 0000000..0afff9b
--- /dev/null
+++ b/example/index.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
+ <script src="../jquery.once.js"></script>
+ </head>
+ <body>
+ <h1>jQuery Once</h1>
+ <p>This is some text, which is turned green only once.</p>
+ <script>
+ $('p').once('greenify', function() {
+ $(this).css('color', 'green');
+ });
+ </script>
+ </body>
+</html>
diff --git a/jquery.once.js b/jquery.once.js
index 21c82c2..75a074c 100644
--- a/jquery.once.js
+++ b/jquery.once.js
@@ -1,5 +1,5 @@
/**
- * jQuery Once Plugin v1.2
+ * jQuery Once Plugin v1.2.1
* http://plugins.jquery.com/project/once
*
* Dual licensed under the MIT and GPL licenses:
@@ -7,7 +7,17 @@
* http://www.gnu.org/licenses/gpl.html
*/
-(function ($) {
+(function (factory) {
+ 'use strict';
+ if (typeof exports === 'object') {
+ factory(require('jquery'));
+ } else if (typeof define === 'function' && define.amd) {
+ define(['jquery'], factory);
+ } else {
+ factory(jQuery);
+ }
+}(function ($) {
+ 'use strict';
var cache = {}, uuid = 0;
/**
@@ -36,7 +46,7 @@
* iteration.
*/
$.fn.once = function (id, fn) {
- if (typeof id != 'string') {
+ if (typeof id !== 'string') {
// Generate a numeric ID if the id passed can't be used as a CSS class.
if (!(id in cache)) {
cache[id] = ++uuid;
@@ -75,4 +85,4 @@
return $.isFunction(fn) ? elements.each(fn) : elements;
};
-})(jQuery);
+}));
diff --git a/once.jquery.json b/once.jquery.json
index 333601c..a28c74f 100644
--- a/once.jquery.json
+++ b/once.jquery.json
@@ -6,7 +6,7 @@
"jquery",
"once"
],
- "version": "1.2.0",
+ "version": "1.2.1",
"author": {
"name": "Konstantin Kafer",
"url": "http://kkaefer.com"
@@ -14,7 +14,6 @@
"maintainers": [
{
"name": "Rob Loach",
- "email": "robloach@gmail.com",
"url": "http://robloach.net"
}
],
diff --git a/package.json b/package.json
index a11b576..4895b9c 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "jquery-once",
"description": "jQuery Once Plugin.",
- "version": "1.2.0",
+ "version": "1.2.1",
"keywords": [
"jquery"
],