OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 ///////////////////////////////////////////////////////////////////////////// | 6 ///////////////////////////////////////////////////////////////////////////// |
7 // OptionsPage class: | 7 // OptionsPage class: |
8 | 8 |
9 /** | 9 /** |
10 * Base class for options page. | 10 * Base class for options page. |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 /** | 474 /** |
475 * Reverses the child elements of a button strip. This is necessary because | 475 * Reverses the child elements of a button strip. This is necessary because |
476 * WebKit does not alter the tab order for elements that are visually reversed | 476 * WebKit does not alter the tab order for elements that are visually reversed |
477 * using -webkit-box-direction: reverse, and the button order is reversed for | 477 * using -webkit-box-direction: reverse, and the button order is reversed for |
478 * views. See https://bugs.webkit.org/show_bug.cgi?id=62664 for more | 478 * views. See https://bugs.webkit.org/show_bug.cgi?id=62664 for more |
479 * information. | 479 * information. |
480 * @param {Object} overlay The overlay containing the button strip to reverse. | 480 * @param {Object} overlay The overlay containing the button strip to reverse. |
481 * @private | 481 * @private |
482 */ | 482 */ |
483 OptionsPage.reverseButtonStrip_ = function(overlay) { | 483 OptionsPage.reverseButtonStrip_ = function(overlay) { |
484 var buttonStrip = overlay.pageDiv.querySelector('.button-strip'); | 484 var buttonStrips = overlay.pageDiv.querySelectorAll('.button-strip'); |
485 | 485 |
486 // Not all overlays have button strips. | 486 // Reverse all button-strips in the overlay. |
487 if (!buttonStrip) | 487 for (var j = 0; j < buttonStrips.length; j++) { |
488 return; | 488 var buttonStrip = buttonStrips[j]; |
489 | 489 |
490 var childNodes = buttonStrip.childNodes; | 490 var childNodes = buttonStrip.childNodes; |
491 for (var i = childNodes.length - 1; i >= 0; i--) | 491 for (var i = childNodes.length - 1; i >= 0; i--) |
492 buttonStrip.appendChild(childNodes[i]); | 492 buttonStrip.appendChild(childNodes[i]); |
| 493 } |
493 }; | 494 }; |
494 | 495 |
495 /** | 496 /** |
496 * Callback for window.onpopstate. | 497 * Callback for window.onpopstate. |
497 * @param {Object} data State data pushed into history. | 498 * @param {Object} data State data pushed into history. |
498 */ | 499 */ |
499 OptionsPage.setState = function(data) { | 500 OptionsPage.setState = function(data) { |
500 if (data && data.pageName) { | 501 if (data && data.pageName) { |
501 // It's possible an overlay may be the last top-level page shown. | 502 // It's possible an overlay may be the last top-level page shown. |
502 if (this.isOverlayVisible_() && | 503 if (this.isOverlayVisible_() && |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 canShowPage: function() { | 1057 canShowPage: function() { |
1057 return true; | 1058 return true; |
1058 }, | 1059 }, |
1059 }; | 1060 }; |
1060 | 1061 |
1061 // Export | 1062 // Export |
1062 return { | 1063 return { |
1063 OptionsPage: OptionsPage | 1064 OptionsPage: OptionsPage |
1064 }; | 1065 }; |
1065 }); | 1066 }); |
OLD | NEW |