Chromium Code Reviews| Index: chrome/browser/resources/shared/js/cr/ui/overlay.js |
| diff --git a/chrome/browser/resources/shared/js/cr/ui/overlay.js b/chrome/browser/resources/shared/js/cr/ui/overlay.js |
| index c2b2fffe955439f70914e9170982a481ce5784b7..8950e0b0fa4a8efd491f63b96cb2ca1be55973db 100644 |
| --- a/chrome/browser/resources/shared/js/cr/ui/overlay.js |
| +++ b/chrome/browser/resources/shared/js/cr/ui/overlay.js |
| @@ -51,10 +51,18 @@ cr.define('cr.ui.overlay', function() { |
| * @param {HTMLElement} overlay The .overlay. |
| */ |
| function setupOverlay(overlay) { |
| - /* Remove the 'shake' animation any time the overlay is hidden or shown. |
| + /* Close the overlay on clicking any of the pages' close buttons. */ |
|
James Hawkins
2012/03/12 20:26:01
nit: Use c++ style comment, //.
flackr
2012/03/12 20:32:13
Done.
|
| + var closeButtons = overlay.querySelectorAll('.page .close-button'); |
| + for (var i = 0; i < closeButtons.length; i++) { |
| + closeButtons[i].addEventListener('click', function(e) { |
| + cr.dispatchSimpleEvent(overlay, 'cancelOverlay'); |
| + }); |
| + } |
| + |
| + /* Remove the 'pulse' animation any time the overlay is hidden or shown. |
| */ |
| overlay.__defineSetter__('hidden', function(value) { |
| - this.classList.remove('shake'); |
| + this.classList.remove('pulse'); |
| if (value) |
| this.setAttribute('hidden', true); |
| else |
| @@ -66,17 +74,17 @@ cr.define('cr.ui.overlay', function() { |
| /* Shake when the user clicks away. */ |
| overlay.addEventListener('click', function(e) { |
| - // Only shake if the overlay was the target of the click. |
| + // Only pulse if the overlay was the target of the click. |
| if (this != e.target) |
| return; |
| // This may be null while the overlay is closing. |
| var overlayPage = this.querySelector('.page:not([hidden])'); |
| if (overlayPage) |
| - overlayPage.classList.add('shake'); |
| + overlayPage.classList.add('pulse'); |
| }); |
| overlay.addEventListener('webkitAnimationEnd', function(e) { |
| - e.target.classList.remove('shake'); |
| + e.target.classList.remove('pulse'); |
| }); |
| } |