OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more | 5 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more |
6 // than this many items in the miniview. | 6 // than this many items in the miniview. |
7 var MAX_MINIVIEW_ITEMS = 15; | 7 var MAX_MINIVIEW_ITEMS = 15; |
8 | 8 |
9 // Extra spacing at the top of the layout. | 9 // Extra spacing at the top of the layout. |
10 var LAYOUT_SPACING_TOP = 25; | 10 var LAYOUT_SPACING_TOP = 25; |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 /** | 1020 /** |
1021 * Hides the notifier. | 1021 * Hides the notifier. |
1022 */ | 1022 */ |
1023 function hideNotification() { | 1023 function hideNotification() { |
1024 var notificationElement = $('notification'); | 1024 var notificationElement = $('notification'); |
1025 notificationElement.classList.remove('show'); | 1025 notificationElement.classList.remove('show'); |
1026 document.body.classList.remove('notification-shown'); | 1026 document.body.classList.remove('notification-shown'); |
1027 var actionLink = notificationElement.querySelector('#actionlink'); | 1027 var actionLink = notificationElement.querySelector('#actionlink'); |
1028 var closeButton = notificationElement.querySelector('#notification-close'); | 1028 var closeButton = notificationElement.querySelector('#notification-close'); |
1029 // Prevent tabbing to the hidden link. | 1029 // Prevent tabbing to the hidden link. |
1030 actionLink.tabIndex = -1; | |
1031 closeButton.tabIndex = -1; | |
1032 // Setting tabIndex to -1 only prevents future tabbing to it. If, however, the | 1030 // Setting tabIndex to -1 only prevents future tabbing to it. If, however, the |
1033 // user switches window or a tab and then moves back to this tab the element | 1031 // user switches window or a tab and then moves back to this tab the element |
1034 // may gain focus. We therefore make sure that we blur the element so that the | 1032 // may gain focus. We therefore make sure that we blur the element so that the |
1035 // element focus is not restored when coming back to this window. | 1033 // element focus is not restored when coming back to this window. |
1036 actionLink.blur(); | 1034 if (actionLink) { |
1037 closeButton.blur(); | 1035 actionLink.tabIndex = -1; |
| 1036 actionLink.blur(); |
| 1037 } |
| 1038 if (closeButton) { |
| 1039 closeButton.tabIndex = -1; |
| 1040 closeButton.blur(); |
| 1041 } |
1038 } | 1042 } |
1039 | 1043 |
1040 function showFirstRunNotification() { | 1044 function showFirstRunNotification() { |
1041 showNotification(localStrings.getString('firstrunnotification'), | 1045 showNotification(localStrings.getString('firstrunnotification'), |
1042 null, null, 30000); | 1046 null, null, 30000); |
1043 var notificationElement = $('notification'); | 1047 var notificationElement = $('notification'); |
1044 notification.classList.add('first-run'); | 1048 notification.classList.add('first-run'); |
1045 } | 1049 } |
1046 | 1050 |
1047 function showPromoNotification() { | 1051 function showPromoNotification() { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 var promoLink = document.querySelector('#apps-promo-text1 a'); | 1437 var promoLink = document.querySelector('#apps-promo-text1 a'); |
1434 promoLink.id = 'apps-promo-link'; | 1438 promoLink.id = 'apps-promo-link'; |
1435 promoLink.href = localStrings.getString('web_store_url'); | 1439 promoLink.href = localStrings.getString('web_store_url'); |
1436 | 1440 |
1437 $('apps-promo-hide').addEventListener('click', function() { | 1441 $('apps-promo-hide').addEventListener('click', function() { |
1438 chrome.send('hideAppsPromo', []); | 1442 chrome.send('hideAppsPromo', []); |
1439 document.documentElement.classList.remove('apps-promo-visible'); | 1443 document.documentElement.classList.remove('apps-promo-visible'); |
1440 layoutSections(); | 1444 layoutSections(); |
1441 }); | 1445 }); |
1442 }); | 1446 }); |
OLD | NEW |