Skip to content

Commit

Permalink
properly reset popups when they are invoked and dismissed (bug 688808)
Browse files Browse the repository at this point in the history
  • Loading branch information
potch committed Sep 28, 2011
1 parent c0f69df commit 48f8006
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions media/js/impala/reviews.js
Expand Up @@ -8,6 +8,8 @@ $(document).ready(function() {
callback: function(obj) {
var ct = $(obj.click_target),
$popup = this;
//reset our event handlers
$popup.hideMe();

function addFlag(flag, note) {
$.ajax({type: 'POST',
Expand Down Expand Up @@ -47,6 +49,7 @@ $(document).ready(function() {
}
});

$popup.removeClass("other");
$popup.html(report);
return { pointTo: ct };
}
Expand Down
14 changes: 10 additions & 4 deletions media/js/zamboni/global.js
Expand Up @@ -146,7 +146,8 @@ $.fn.popup = function(click_target, o) {

var $ct = $(click_target),
$popup = this,
uid = (z.uid++);
uid = (z.uid++),
spawned = 0;

$popup.o = $.extend({
delegate: false,
Expand Down Expand Up @@ -195,12 +196,12 @@ $.fn.popup = function(click_target, o) {
$popup.unbind();
$popup.undelegate();
$(document.body).unbind('click.'+uid, $popup.hider);

return $popup;
};

function handler(e) {
e.preventDefault();
spawned = e.timeStamp;
var resp = o.callback ? (o.callback.call($popup, {
click_target: this,
evt: e
Expand All @@ -212,8 +213,13 @@ $.fn.popup = function(click_target, o) {
}

$popup.render = function() {
var p = $popup.o;
$popup.hider = makeBlurHideCallback($popup);
var p = $popup.o,
hideCallback = makeBlurHideCallback($popup);
$popup.hider = function(e) {
if (e.timeStamp != spawned) {
hideCallback.call(this, e);
}
};
if (p.hideme) {
setTimeout(function(){
$(document.body).bind('click.'+uid, $popup.hider);
Expand Down

0 comments on commit 48f8006

Please sign in to comment.