Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Explicitly removes dismissClock

Uses the removeEvent function in core.js to remove the function from
the document click event.
Refs #4045.
  • Loading branch information...
commit 4509a1be1f1164164c2b654d1e3e4169ef71b5ae 1 parent 216580e
@andrewjesaitis andrewjesaitis authored claudep committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
View
6 django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
@@ -6,6 +6,7 @@ var DateTimeShortcuts = {
calendars: [],
calendarInputs: [],
clockInputs: [],
+ dismissClockFunc: [],
calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
calendarDivName2: 'calendarin', // name of <div> that contains calendar
calendarLinkName: 'calendarlink',// name of the link that is used to toggle
@@ -39,6 +40,7 @@ var DateTimeShortcuts = {
addClock: function(inp) {
var num = DateTimeShortcuts.clockInputs.length;
DateTimeShortcuts.clockInputs[num] = inp;
+ DateTimeShortcuts.dismissClockFunc[num] = function() { DateTimeShortcuts.dismissClock(num); return true; };
// Shortcut links (clock icon and "Now" link)
var shortcuts_span = document.createElement('span');
@@ -118,11 +120,11 @@ var DateTimeShortcuts = {
// Show the clock box
clock_box.style.display = 'block';
- addEvent(window.document, 'click', function() { DateTimeShortcuts.dismissClock(num); return true; });
+ addEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
},
dismissClock: function(num) {
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
- window.document.onclick = null;
+ removeEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
},
handleClockQuicklink: function(num, val) {
DateTimeShortcuts.clockInputs[num].value = val;
Please sign in to comment.
Something went wrong with that request. Please try again.