Chromium Code Reviews| Index: chrome/browser/resources/local_ntp/local_ntp.js |
| diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js |
| index 3d7825ecb30befc3eb8256a8e22be04b6f14e7ce..9aed3fedeac59eee3d3b0a2619747561d0c3c17d 100644 |
| --- a/chrome/browser/resources/local_ntp/local_ntp.js |
| +++ b/chrome/browser/resources/local_ntp/local_ntp.js |
| @@ -39,6 +39,7 @@ var CLASSES = { |
| FAKEBOX_FOCUS: 'fakebox-focused', // Applies focus styles to the fakebox |
| FAVICON: 'mv-favicon', |
| GOOGLE_PAGE: 'google-page', // shows the Google logo and fakebox |
| + HIDE_ATTRIBUTION: 'attribution-hide', |
| HIDE_BLACKLIST_BUTTON: 'mv-x-hide', // hides blacklist button during animation |
| HIDE_NOTIFICATION: 'mv-notice-hide', |
| HIDE_NTP: 'hide-ntp', // hides NTP and disables scrollbars |
| @@ -66,14 +67,17 @@ var CLASSES = { |
| var IDS = { |
| ACTIVE_SUGGESTIONS_CONTAINER: 'active-suggestions-container', |
| ATTRIBUTION: 'attribution', |
| + ATTRIBUTION_TEXT: 'attribution-text', |
| CURSOR: 'cursor', |
| FAKEBOX: 'fakebox', |
| + FOOTER: 'footer', |
| LOGO: 'logo', |
| NOTIFICATION: 'mv-notice', |
| NOTIFICATION_CLOSE_BUTTON: 'mv-notice-x', |
| NOTIFICATION_MESSAGE: 'mv-msg', |
| NTP_CONTENTS: 'ntp-contents', |
| PENDING_SUGGESTIONS_CONTAINER: 'pending-suggestions-container', |
| + RECENT_TABS: 'recent-tabs', |
| RESTORE_ALL_LINK: 'mv-restore', |
| SUGGESTION_LOADER: 'suggestion-loader', |
| SUGGESTION_STYLE: 'suggestion-style', |
| @@ -326,7 +330,7 @@ function onThemeChange() { |
| */ |
| function updateAttribution(url) { |
| if (!url) { |
| - attribution.hidden = true; |
| + attribution.classList.add(CLASSES.HIDE_ATTRIBUTION); |
| return; |
| } |
| var attributionImage = new Image(); |
| @@ -335,10 +339,10 @@ function updateAttribution(url) { |
| if (oldAttributionImage) |
| removeNode(oldAttributionImage); |
| attribution.appendChild(attributionImage); |
| - attribution.hidden = false; |
| + attribution.classList.remove(CLASSES.HIDE_ATTRIBUTION); |
| }; |
| attributionImage.onerror = function() { |
| - attribution.hidden = true; |
| + attribution.classList.add(CLASSES.HIDE_ATTRIBUTION); |
| }; |
| attributionImage.src = url; |
| } |
| @@ -1609,6 +1613,17 @@ function init() { |
| ntpContents.insertBefore(logo, ntpContents.firstChild); |
| } |
| + var recentTabsText = templateData.recentTabs; |
| + if (recentTabsText) { |
| + var recentTabsLink = document.createElement('span'); |
|
samarth
2013/05/15 16:49:17
Can this just be an <a href="chrome://history">? O
jeremycho
2013/05/16 20:06:47
It would add a non-functioning "Open link in new t
|
| + recentTabsLink.id = IDS.RECENT_TABS; |
| + recentTabsLink.addEventListener('click', function() { |
|
samarth
2013/05/15 16:49:17
Can you also add logic to look for a modifier and
jeremycho
2013/05/16 20:06:47
Done.
|
| + ntpApiHandle.navigateContentWindow('chrome://history'); |
| + }); |
| + recentTabsLink.textContent = recentTabsText; |
| + var footer = $(IDS.FOOTER); |
| + footer.insertBefore(recentTabsLink, footer.firstChild); |
| + } |
| var notificationMessage = $(IDS.NOTIFICATION_MESSAGE); |
| notificationMessage.textContent = templateData.thumbnailRemovedNotification; |
| @@ -1618,7 +1633,7 @@ function init() { |
| var restoreAllLink = $(IDS.RESTORE_ALL_LINK); |
| restoreAllLink.addEventListener('click', onRestoreAll); |
| restoreAllLink.textContent = templateData.restoreThumbnailsShort; |
| - attribution.textContent = templateData.attributionIntro; |
| + $(IDS.ATTRIBUTION_TEXT).textContent = templateData.attributionIntro; |
| var notificationCloseButton = $(IDS.NOTIFICATION_CLOSE_BUTTON); |
| notificationCloseButton.addEventListener('click', hideNotification); |