From 380e31ddb7cbc56d738dd78f176d03e1c94c27a5 Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Fri, 21 Nov 2008 14:52:58 +0000 Subject: [PATCH] Fixed #9642 -- Made the admin calendar/clock popups go away when the users clicks outside them. The previous javascript code did not work on IE. Thanks northtea for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9514 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/media/js/admin/DateTimeShortcuts.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js index f57f97e7ee..e3ebd03fb2 100644 --- a/django/contrib/admin/media/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js @@ -109,11 +109,11 @@ var DateTimeShortcuts = { // Show the clock box clock_box.style.display = 'block'; - addEvent(window, 'click', function() { DateTimeShortcuts.dismissClock(num); return true; }); + addEvent(window.document, 'click', function() { DateTimeShortcuts.dismissClock(num); return true; }); }, dismissClock: function(num) { document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none'; - window.onclick = null; + window.document.onclick = null; }, handleClockQuicklink: function(num, val) { DateTimeShortcuts.clockInputs[num].value = val; @@ -224,10 +224,11 @@ var DateTimeShortcuts = { cal_box.style.top = findPosY(cal_link) - 75 + 'px'; cal_box.style.display = 'block'; - addEvent(window, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; }); + addEvent(window.document, 'click', function() { DateTimeShortcuts.dismissCalendar(num); return true; }); }, dismissCalendar: function(num) { document.getElementById(DateTimeShortcuts.calendarDivName1+num).style.display = 'none'; + window.document.onclick = null; }, drawPrev: function(num) { DateTimeShortcuts.calendars[num].drawPreviousMonth();