| OLD | NEW |
| 1 | 1 |
| 2 // Helpers | 2 // Helpers |
| 3 | 3 |
| 4 function $(id) { | 4 function $(id) { |
| 5 return document.getElementById(id); | 5 return document.getElementById(id); |
| 6 } | 6 } |
| 7 | 7 |
| 8 // TODO(arv): Remove these when classList is available in HTML5. | 8 // TODO(arv): Remove these when classList is available in HTML5. |
| 9 // https://bugs.webkit.org/show_bug.cgi?id=20709 | 9 // https://bugs.webkit.org/show_bug.cgi?id=20709 |
| 10 function hasClass(el, name) { | 10 function hasClass(el, name) { |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 } | 897 } |
| 898 | 898 |
| 899 function doAction() { | 899 function doAction() { |
| 900 f(); | 900 f(); |
| 901 hideNotification(); | 901 hideNotification(); |
| 902 } | 902 } |
| 903 | 903 |
| 904 // Remove any possible first-run trails. | 904 // Remove any possible first-run trails. |
| 905 removeClass(notification, 'first-run'); | 905 removeClass(notification, 'first-run'); |
| 906 | 906 |
| 907 var actionLink = notificationElement.querySelector('.link'); | 907 var actionLink = notificationElement.querySelector('.link-color'); |
| 908 notificationElement.firstElementChild.textContent = text; | 908 notificationElement.firstElementChild.textContent = text; |
| 909 actionLink.textContent = actionText; | 909 actionLink.textContent = actionText; |
| 910 | 910 |
| 911 actionLink.onclick = doAction; | 911 actionLink.onclick = doAction; |
| 912 actionLink.onkeydown = handleIfEnterKey(doAction); | 912 actionLink.onkeydown = handleIfEnterKey(doAction); |
| 913 notificationElement.onmouseover = show; | 913 notificationElement.onmouseover = show; |
| 914 notificationElement.onmouseout = delayedHide; | 914 notificationElement.onmouseout = delayedHide; |
| 915 actionLink.onfocus = show; | 915 actionLink.onfocus = show; |
| 916 actionLink.onblur = delayedHide; | 916 actionLink.onblur = delayedHide; |
| 917 // Enable tabbing to the link now that it is shown. | 917 // Enable tabbing to the link now that it is shown. |
| 918 actionLink.tabIndex = 0; | 918 actionLink.tabIndex = 0; |
| 919 | 919 |
| 920 show(); | 920 show(); |
| 921 delayedHide(); | 921 delayedHide(); |
| 922 } | 922 } |
| 923 | 923 |
| 924 function hideNotification() { | 924 function hideNotification() { |
| 925 var notificationElement = $('notification'); | 925 var notificationElement = $('notification'); |
| 926 removeClass(notificationElement, 'show'); | 926 removeClass(notificationElement, 'show'); |
| 927 var actionLink = notificationElement.querySelector('.link'); | 927 var actionLink = notificationElement.querySelector('.link-color'); |
| 928 // Prevent tabbing to the hidden link. | 928 // Prevent tabbing to the hidden link. |
| 929 actionLink.tabIndex = -1; | 929 actionLink.tabIndex = -1; |
| 930 } | 930 } |
| 931 | 931 |
| 932 function showFirstRunNotification() { | 932 function showFirstRunNotification() { |
| 933 showNotification(localStrings.getString('firstrunnotification'), | 933 showNotification(localStrings.getString('firstrunnotification'), |
| 934 localStrings.getString('closefirstrunnotification'), | 934 localStrings.getString('closefirstrunnotification'), |
| 935 null, 30000); | 935 null, 30000); |
| 936 var notificationElement = $('notification'); | 936 var notificationElement = $('notification'); |
| 937 addClass(notification, 'first-run'); | 937 addClass(notification, 'first-run'); |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 function fixLinkUnderline(el) { | 1681 function fixLinkUnderline(el) { |
| 1682 var span = document.createElement('span'); | 1682 var span = document.createElement('span'); |
| 1683 span.className = 'link-color'; | 1683 span.className = 'link-color'; |
| 1684 while (el.hasChildNodes()) { | 1684 while (el.hasChildNodes()) { |
| 1685 span.appendChild(el.firstChild); | 1685 span.appendChild(el.firstChild); |
| 1686 } | 1686 } |
| 1687 el.appendChild(span); | 1687 el.appendChild(span); |
| 1688 } | 1688 } |
| 1689 | 1689 |
| 1690 updateAttribution(); | 1690 updateAttribution(); |
| OLD | NEW |