Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "outclick", | ||
"version": "0.0.3", | ||
"description": "A library to detect whether a click was detected outside an element", | ||
"version": "0.0.4", | ||
"description": "A library used to detect DOM clicks outside specific elements, useful for closing menus", | ||
"main": "src/index.js", | ||
@@ -11,3 +11,3 @@ "scripts": { | ||
"type": "git", | ||
"url": "git+https://github.com/joe-tom/outclick.js.git" | ||
"url": "git+https://github.com/joe-tom/outclick.git" | ||
}, | ||
@@ -14,0 +14,0 @@ "keywords": [ |
@@ -13,3 +13,3 @@ # outclick 👉 | ||
## Installation | ||
You can download the latest release or install it as an npm package | ||
You can download the latest [release](https://raw.githubusercontent.com/joe-tom/outclick/master/release/outclick.min.js) or install it as an npm package | ||
```javascript | ||
@@ -41,4 +41,2 @@ npm install --save outclick | ||
<div outclick="someFunc()"></div> | ||
``` | ||
## Methods | ||
``` |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
(function(d){var e=[{listener:null,exceptions:[]}],f=Node.prototype.addEventListener;Object.defineProperty(Node.prototype,"onoutclick",{set:function(a){e[0]={exceptions:[this],listener:a};return a}});d.Node.prototype.addEventListener=function(a,c,b){"outclick"==a?(b=b||[],b.push(this),e.push({exceptions:b,listener:c})):f.apply(this,arguments)};d.document.addEventListener("click",function(a){for(var c=e.length;c--;)for(var b=e[c],d=b.exceptions.length;d--&&!b.exceptions[d].contains(a.target);)b.listener&& | ||
b.listener(a)});d=document.querySelectorAll("[outclick]");[].forEach.call(d,function(a){var c=a.getAttribute("outclick"),c=Function(c);e.push({listener:c,exceptions:[a]})})})(window); | ||
(function(d){var e=[{listener:null,exceptions:[]}],g=Node.prototype.addEventListener;Object.defineProperty(Node.prototype,"onoutclick",{set:function(a){e[0]={exceptions:[this],listener:a};return a}});d.Node.prototype.addEventListener=function(a,c,b){"outclick"==a?(b=b||[],b.push(this),e.push({exceptions:b,listener:c})):g.apply(this,arguments)};d.document.addEventListener("click",function(a){for(var c=e.length;c--;){for(var b=e[c],d=!1,f=b.exceptions.length;f--;)if(b.exceptions[f].contains(a.target)){d= | ||
!0;break}d||b.listener&&b.listener(a)}});d=document.querySelectorAll("[outclick]");[].forEach.call(d,function(a){var c=a.getAttribute("outclick"),c=Function(c);e.push({listener:c,exceptions:[a]})})})(window); |
@@ -0,1 +1,5 @@ | ||
/** | ||
* Version: 0.0.1 | ||
* Author: Joseph Thomas | ||
*/ | ||
(function(window){ | ||
@@ -2,0 +6,0 @@ |
120667
116
40