Click event is not prevented from being fired after mouseup when selecting "Mouse Click - Image - Open" option

This commit is contained in:
attosoft committed 2012-08-15 04:19:47 +00:00
1 parent 52922ce978
commit f9da9be826
2 files changed
+12 -12

No files matched your search

+9 -9
View File
@@ -957,19 +957,19 @@ function tb_drag(event, source, action) {
var events = target.data("events");
if (events && events.click) {
var handlers = [];
// XXX: Event handlers are stored within array in v1.4.2 or later, and stored as object property in earlier
// XXX: Event handlers are stored as object property, or stored within array since v1.4.2
jQuery.each(events.click, function(index, value) {
handlers[handlers.length] = value.handler || value;
});
if (handlers.length > 0) {
target.unbind("click").one("click", function (e) { // prevent anchor jump
e.stopImmediatePropagation();
for (var i = 0; i < handlers.length; i++)
target.click(handlers[i]); // rebind
return false;
});
}
}
target.unbind("click").one("click", function (e) { // prevent anchor jump
e.stopImmediatePropagation();
if (handlers) {
for (var i = 0; i < handlers.length; i++)
target.click(handlers[i]); // rebind
}
return false;
});
return false;
});
+3 -3
View File
@@ -52,9 +52,9 @@ function tb_drag(a,c,b){if(1!=a.which)return!0;TB_THRESHOLD=5;MIN_WIDTH=MIN_HEIG
c?"#TB_window a":"#TB_closeWindowButton")),v="move"==b||"w-resize"==b||"nw-resize"==b||"sw-resize"==b,w="move"==b||"n-resize"==b||"ne-resize"==b||"nw-resize"==b,x="move"!=b&&"n-resize"!=b&&"s-resize"!=b,A="move"!=b&&"e-resize"!=b&&"w-resize"!=b,y="ne-resize"==b||"nw-resize"==b||"se-resize"==b||"sw-resize"==b;if(y)var k=jQuery("#TB_window").width()/jQuery("#TB_window").height();if("move"!=b){var m=jQuery("#TB_window").width(),z=jQuery("#TB_window").height(),t=jQuery("image"==c?"#TB_Image":"iframe"==
c?"#TB_iframeContent":"#TB_ajaxContent"),s=t.width(),B=t.height(),o="e-resize"==b||"ne-resize"==b||"se-resize"==b?1:-1,r="s-resize"==b||"se-resize"==b||"sw-resize"==b?1:-1;if("undefined"==typeof document.body.style.maxHeight)var l=jQuery("#TB_window").css("marginTop")}jQuery(document).bind("mousemove.thickbox",function(a,f,h){var f=f?f:a.clientX,h=h?h:a.clientY,a=f-j,g=h-u;if(!i){a=a>TB_THRESHOLD?a-TB_THRESHOLD:a<-TB_THRESHOLD?a+TB_THRESHOLD:0;g=g>TB_THRESHOLD?g-TB_THRESHOLD:g<-TB_THRESHOLD?g+TB_THRESHOLD:
0;if(Math.abs(a)>0||Math.abs(g)>0){i=true;j=f;u=h;q.css("cursor",b)}}if(i){if(y){f=m+a*o;h=z+g*r;f=f/h;k>f?g=Math.round(a/k)*o*r:k<f&&(a=Math.round(g*k)*o*r)}var p=skipMoveY=false;if(x){f=m+a*o;if(f<MIN_WIDTH)p=true;else{jQuery("#TB_window").width(f);t.width(s+a*o)}}if(A){h=z+g*r;if(h<MIN_HEIGHT)skipMoveY=true;else{jQuery("#TB_window").height(h);t.height(B+g*r);c=="image"&&jQuery("#TB_ImageClick > a").height(jQuery("#TB_Image").outerHeight(true));typeof document.body.style.maxHeight=="undefined"&&
jQuery("#TB_window").css("marginTop",l)}}v&&!p&&jQuery("#TB_window").css("left",d+a);w&&!skipMoveY&&jQuery("#TB_window").css("top",e+g)}return false});jQuery(document).bind("mouseup.thickbox",function(a){jQuery(document).unbind("mousemove.thickbox mouseup.thickbox");c=="iframe"&&jQuery("#TB_iframeContent").contents().unbind("mousemove.thickbox mouseup.thickbox");if(!i)return true;q.css("cursor","");var b=jQuery(a.target);if(b.is("html"))return false;b.is(".TB_ImageLeft, .TB_ImageRight")||(b=b.parent());
if((a=b.data("events"))&&a.click){var d=[];jQuery.each(a.click,function(a,b){d[d.length]=b.handler||b});if(d.length>0)b.unbind("click").one("click",function(a){a.preventDefault();a.stopImmediatePropagation?a.stopImmediatePropagation():a.stopPropagation();for(a=0;a<d.length;a++)b.click(d[a]);return false})}});"iframe"==c&&jQuery("#TB_iframeContent").contents().bind("mousemove.thickbox",function(a){a.clientX=a.clientX+(jQuery("#TB_iframeContent").offset().left-jQuery(document).scrollLeft());a.clientY=
a.clientY+(jQuery("#TB_iframeContent").offset().top-jQuery(document).scrollTop());jQuery(document).trigger("mousemove.thickbox",[a.clientX,a.clientY])}).bind("mouseup.thickbox",function(){jQuery(document).trigger("mouseup.thickbox")});return!1}
jQuery("#TB_window").css("marginTop",l)}}v&&!p&&jQuery("#TB_window").css("left",d+a);w&&!skipMoveY&&jQuery("#TB_window").css("top",e+g)}return false});jQuery(document).bind("mouseup.thickbox",function(a){jQuery(document).unbind("mousemove.thickbox mouseup.thickbox");c=="iframe"&&jQuery("#TB_iframeContent").contents().unbind("mousemove.thickbox mouseup.thickbox");if(!i)return true;q.css("cursor","");if(jQuery.browser.opera)return false;var b=jQuery(a.target);if(b.is("html"))return false;b.is(".TB_ImageLeft, .TB_ImageRight")||
(b=b.parent());if((a=b.data("events"))&&a.click){var d=[];jQuery.each(a.click,function(a,b){d[d.length]=b.handler||b})}b.unbind("click").one("click",function(a){a.stopImmediatePropagation();if(d)for(a=0;a<d.length;a++)b.click(d[a]);return false});return false});"iframe"==c&&jQuery("#TB_iframeContent").contents().bind("mousemove.thickbox",function(a){a.clientX=a.clientX+(jQuery("#TB_iframeContent").offset().left-jQuery(document).scrollLeft());a.clientY=a.clientY+(jQuery("#TB_iframeContent").offset().top-
jQuery(document).scrollTop());jQuery(document).trigger("mousemove.thickbox",[a.clientX,a.clientY])}).bind("mouseup.thickbox",function(){jQuery(document).trigger("mouseup.thickbox")});return!1}
function tb_getSize(a,c){var b,d,e=function(){switch(c){case "padding":b=a.innerWidth();d=a.innerHeight();break;case "border":b=a.outerWidth();d=a.outerHeight();break;case "margin":b=a.outerWidth(!0);d=a.outerHeight(!0);break;default:b=a.width(),d=a.height()}};"none"==jQuery("#TB_window").css("display")&&(0<tb_versionCompare("1.4.4")||0<tb_versionCompare("1.6.2")&&c)?jQuery.swap(jQuery("#TB_window")[0],{position:"absolute",visibility:"hidden",display:"block"},e):e();return[b,d]}
function tb_versionCompare(a,c){c=c||jQuery.fn.jquery;if(a!=c)for(var b=a.split("."),d=c.split("."),e=0;e<b.length||e<d.length;e++){if(b[e]&&!d[e]||b[e]>d[e])return 1;if(!b[e]&&d[e]||b[e]<d[e])return-1}return 0}
function tb_hover(a,c,b){!b&&"visible"!=a.css("visibility")&&a.css({visibility:"visible",display:"none"});switch(c){case "zoom":b?a.hide(tb_options.effect_speed):a.show(tb_options.effect_speed);break;case "slide":b?a.slideUp(tb_options.effect_speed):a.slideDown(tb_options.effect_speed);break;case "fade":b?a.fadeOut(tb_options.effect_speed):a.fadeIn(tb_options.effect_speed)}};