Permalink
Browse files

v1.0.15

  • Loading branch information...
1 parent 95264b1 commit df5185c087b056d4c5e6ae9ce614c8b9f991d49d codecomputerlove committed Jul 2, 2011
Showing with 17 additions and 8 deletions.
  1. +2 −2 src/examples/debug.html
  2. +3 −2 src/photoswipe.js
  3. +12 −4 src/util-events.js
View
@@ -12,17 +12,17 @@
<script type="text/javascript" src="../util.js"></script>
- <!--
<script type="text/javascript" src="../util-dom.js"></script>
<script type="text/javascript" src="../util-events.js"></script>
<script type="text/javascript" src="../util-animation.js"></script>
- -->
+ <!--
<script type="text/javascript" src="../lib/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="../lib/jquery.animate-enhanced.min.js"></script>
<script type="text/javascript" src="../util-dom-jQuery.js"></script>
<script type="text/javascript" src="../util-events-jQuery.js"></script>
<script type="text/javascript" src="../util-animation-jQuery.js"></script>
+ -->
<script type="text/javascript" src="../element-class.js"></script>
<script type="text/javascript" src="../full-size-image-class.js"></script>
View
@@ -453,7 +453,7 @@
* Function: onKeyDown
*/
onKeyDown: function(e){
-
+
this.stopSlideshow();
if (e.keyCode === 37) { // Left
@@ -1477,7 +1477,8 @@
Code.PhotoSwipe.Current.setOptions(opts);
Code.PhotoSwipe.Current.setImages(thumbEls);
- $(thumbEls).live('click', function(e){
+ $(thumbEls).die('click.photoswipe');
+ $(thumbEls).live('click.photoswipe', function(e){
e.preventDefault();
View
@@ -24,7 +24,7 @@
obj.__eventHandlers[type].push(handler);
// DOM element
- if (this._isElement(obj)){
+ if (this._isBrowserObject(obj)){
obj.addEventListener(type, handler, false);
}
@@ -48,7 +48,7 @@
// Removing all handlers for a type
if (Util.isNothing(handler)){
- if (this._isElement(obj)){
+ if (this._isBrowserObject(obj)){
for (var i=0; i<handlers.length; i++){
obj.removeEventListener(type, handlers[i], false);
}
@@ -67,7 +67,7 @@
}
// DOM element
- if (this._isElement(obj)){
+ if (this._isBrowserObject(obj)){
obj.removeEventListener(type, handler, false);
return;
}
@@ -90,7 +90,7 @@
// DOM element
- if (this._isElement(obj)){
+ if (this._isBrowserObject(obj)){
if (typeof type !== "string"){
throw 'type must be a string for DOM elements';
@@ -184,6 +184,14 @@
},
+ _isBrowserObject: function(obj){
+ if (obj === window || obj === window.document){
+ return true;
+ }
+ return this._isElement(obj) || this._isNode(obj);
+ },
+
+
_isElement: function(obj){
return (
typeof HTMLElement === "object" ? obj instanceof HTMLElement : //DOM2

0 comments on commit df5185c

Please sign in to comment.