OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 <include src="../uber/uber_utils.js"> | 5 <include src="../uber/uber_utils.js"> |
6 <include src="history_focus_manager.js"> | 6 <include src="history_focus_manager.js"> |
7 | 7 |
8 /////////////////////////////////////////////////////////////////////////////// | 8 /////////////////////////////////////////////////////////////////////////////// |
9 // Globals: | 9 // Globals: |
10 /** @const */ var RESULTS_PER_PAGE = 150; | 10 /** @const */ var RESULTS_PER_PAGE = 150; |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 var entry = findAncestorByClass(/** @type {Element} */(e.target), | 1768 var entry = findAncestorByClass(/** @type {Element} */(e.target), |
1769 'site-entry'); | 1769 'site-entry'); |
1770 var innerResultList = entry.querySelector('.site-results'); | 1770 var innerResultList = entry.querySelector('.site-results'); |
1771 | 1771 |
1772 if (entry.classList.contains('expand')) { | 1772 if (entry.classList.contains('expand')) { |
1773 innerResultList.style.height = 0; | 1773 innerResultList.style.height = 0; |
1774 innerResultList.setAttribute('aria-hidden', 'true'); | 1774 innerResultList.setAttribute('aria-hidden', 'true'); |
1775 } else { | 1775 } else { |
1776 innerResultList.setAttribute('aria-hidden', 'false'); | 1776 innerResultList.setAttribute('aria-hidden', 'false'); |
1777 innerResultList.style.height = 'auto'; | 1777 innerResultList.style.height = 'auto'; |
1778 // -webkit-transition does not work on height:auto elements so first set | 1778 // transition does not work on height:auto elements so first set |
1779 // the height to auto so that it is computed and then set it to the | 1779 // the height to auto so that it is computed and then set it to the |
1780 // computed value in pixels so the transition works properly. | 1780 // computed value in pixels so the transition works properly. |
1781 var height = innerResultList.clientHeight; | 1781 var height = innerResultList.clientHeight; |
1782 innerResultList.style.height = 0; | 1782 innerResultList.style.height = 0; |
1783 setTimeout(function() { | 1783 setTimeout(function() { |
1784 innerResultList.style.height = height + 'px'; | 1784 innerResultList.style.height = height + 'px'; |
1785 }, 0); | 1785 }, 0); |
1786 } | 1786 } |
1787 | 1787 |
1788 entry.classList.toggle('expand'); | 1788 entry.classList.toggle('expand'); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 * Triggers a fade-out animation, and then removes |node| from the DOM. | 2327 * Triggers a fade-out animation, and then removes |node| from the DOM. |
2328 * @param {Node} node The node to be removed. | 2328 * @param {Node} node The node to be removed. |
2329 * @param {Function?} onRemove A function to be called after the node | 2329 * @param {Function?} onRemove A function to be called after the node |
2330 * has been removed from the DOM. | 2330 * has been removed from the DOM. |
2331 * @param {*=} opt_scope An optional scope object to call |onRemove| with. | 2331 * @param {*=} opt_scope An optional scope object to call |onRemove| with. |
2332 */ | 2332 */ |
2333 function removeNode(node, onRemove, opt_scope) { | 2333 function removeNode(node, onRemove, opt_scope) { |
2334 node.classList.add('fade-out'); // Trigger CSS fade out animation. | 2334 node.classList.add('fade-out'); // Trigger CSS fade out animation. |
2335 | 2335 |
2336 // Delete the node when the animation is complete. | 2336 // Delete the node when the animation is complete. |
2337 node.addEventListener('webkitTransitionEnd', function(e) { | 2337 node.addEventListener('transitionend', function(e) { |
2338 node.parentNode.removeChild(node); | 2338 node.parentNode.removeChild(node); |
2339 | 2339 |
2340 // In case there is nested deletion happening, prevent this event from | 2340 // In case there is nested deletion happening, prevent this event from |
2341 // being handled by listeners on ancestor nodes. | 2341 // being handled by listeners on ancestor nodes. |
2342 e.stopPropagation(); | 2342 e.stopPropagation(); |
2343 | 2343 |
2344 if (onRemove) | 2344 if (onRemove) |
2345 onRemove.call(opt_scope); | 2345 onRemove.call(opt_scope); |
2346 }); | 2346 }); |
2347 } | 2347 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 historyView.reload(); | 2413 historyView.reload(); |
2414 } | 2414 } |
2415 | 2415 |
2416 // Add handlers to HTML elements. | 2416 // Add handlers to HTML elements. |
2417 document.addEventListener('DOMContentLoaded', load); | 2417 document.addEventListener('DOMContentLoaded', load); |
2418 | 2418 |
2419 // This event lets us enable and disable menu items before the menu is shown. | 2419 // This event lets us enable and disable menu items before the menu is shown. |
2420 document.addEventListener('canExecute', function(e) { | 2420 document.addEventListener('canExecute', function(e) { |
2421 e.canExecute = true; | 2421 e.canExecute = true; |
2422 }); | 2422 }); |
OLD | NEW |