Skip to content
Browse files

Updating to 0.5

  • Loading branch information...
1 parent db96bd8 commit 4f84a6dd33c7809e280349c1cb0673e3c9bd8146 @darkwing committed Dec 24, 2009
Showing with 79 additions and 5 deletions.
  1. +20 −0 Docs/jQueryEvents.md
  2. +20 −0 README.md
  3. +1 −0 Source/jQueryEvents-yui-compressed.js
  4. +33 −0 Source/jQueryEvents.js
  5. +5 −5 package.yml
View
20 Docs/jQueryEvents.md
@@ -0,0 +1,20 @@
+jQueryEvents
+=========
+
+This MooTools code snippet allows you to use shorthand, jQuery-style Event syntax.
+
+How to Use
+----------
+
+All you need to do is add the jQueryEvents.js file into the page. A few sample usages are:
+
+### Javascript
+ $('myElement').click(function() {
+ //do stuff
+ });
+
+ window.scroll(function() {
+ //do stuff
+ });
+
+For specific usage and options, please read the documentation or visit [http://davidwalsh.name/js/jqueryevents](http://davidwalsh.name/js/jqueryevents)
View
20 README.md
@@ -0,0 +1,20 @@
+jQueryEvents
+=========
+
+This MooTools code snippet allows you to use shorthand, jQuery-style Event syntax.
+
+How to Use
+----------
+
+All you need to do is add the jQueryEvents.js file into the page. A few sample usages are:
+
+### Javascript
+ $('myElement').click(function() {
+ //do stuff
+ });
+
+ window.scroll(function() {
+ //do stuff
+ });
+
+For specific usage and options, please read the documentation or visit [http://davidwalsh.name/js/jqueryevents](http://davidwalsh.name/js/jqueryevents)
View
1 Source/jQueryEvents-yui-compressed.js
@@ -0,0 +1 @@
+var hash=new Hash(Element.NativeEvents);hash.erase("mouseover").erase("mouseout").erase("DOMMouseScroll");hash.include("mouseenter",1).include("mouseleave",1);var eventHash=new Hash({});hash.getKeys().each(function(a){eventHash[a]=function(b){this.addEvent(a,b);return this;};});Element.implement(eventHash);
View
33 Source/jQueryEvents.js
@@ -0,0 +1,33 @@
+/*
+---
+description: jQueryEvents
+
+authors:
+ - David Walsh (http://davidwalsh.name)
+
+license:
+ - MIT-style license
+
+requires:
+ core/1.2.1: '*'
+
+provides:
+ - Element.click (etc.)
+...
+*/
+//hash the element.natives so we can do stuff with it
+var hash = new Hash(Element.NativeEvents);
+//remove items that need to be replaced, add their replacements
+hash.erase('mouseover').erase('mouseout').erase('DOMMouseScroll');
+hash.include('mouseenter',1).include('mouseleave',1);
+//initialize this
+var eventHash = new Hash({});
+//for every event type, add to our hash
+hash.getKeys().each(function(event){
+ eventHash[event] = function(fn) {
+ this.addEvent(event,fn);
+ return this;
+ };
+});
+//make it happen
+Element.implement(eventHash);
View
10 package.yml
@@ -1,7 +1,7 @@
name: jQueryEvents
author: davidwalsh
-current:
-category:
-tags: []
-docs:
-demo:
+current: 0.5
+category: Utilities
+tags: [events]
+docs: http://davidwalsh.name/js/jqueryevents
+demo: http://davidwalsh.name/js/jqueryevents

0 comments on commit 4f84a6d

Please sign in to comment.
Something went wrong with that request. Please try again.