diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 22:25:34 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 22:25:34 +0000 |
commit | 76aa2f684a2cdbd8b476001230d4f1e244196a69 (patch) | |
tree | 1cf3b904d5cb4f7e3ecff3ca1ae0580746c35f4a /chrome/browser/resources | |
parent | 2a0fef6f8968901f60e6870731da2e3adf31aabd (diff) | |
download | chromium_src-76aa2f684a2cdbd8b476001230d4f1e244196a69.zip chromium_src-76aa2f684a2cdbd8b476001230d4f1e244196a69.tar.gz chromium_src-76aa2f684a2cdbd8b476001230d4f1e244196a69.tar.bz2 |
Bring back attribution. If there is no custom attribution, fall back to the product logo.
BUG=53970
TEST=
Review URL: http://codereview.chromium.org/3336004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/new_new_tab.css | 31 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.html | 11 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.js | 35 | ||||
-rw-r--r-- | chrome/browser/resources/new_tab_theme.css | 29 |
4 files changed, 78 insertions, 28 deletions
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css index 6ef25c5..2630d79 100644 --- a/chrome/browser/resources/new_new_tab.css +++ b/chrome/browser/resources/new_new_tab.css @@ -261,7 +261,23 @@ html[dir=rtl] #option-menu > [command=hide]:before { } #attribution { - margin: 10px 0; + position: fixed; + right: 5px; + bottom: 5px; + text-align: end; +} + +html[dir=rtl] #attribution { + left: 5px; + right: auto; +} + +#attribution.obscured { + opacity: 0.3; +} + +html[hasattribution=false] #attribution > div { + display: none; } .sync-button { @@ -303,6 +319,12 @@ html[dir=rtl] #option-menu > [command=hide]:before { top: 4px; } +html[dir=rtl] .section > h2 > .disclosure { + left: auto; + right: -15px; + -webkit-transform: rotate(180deg); +} + .section:not(.hidden) > h2 > .disclosure { -webkit-transform:rotate(90deg); } @@ -317,7 +339,7 @@ html[dir=rtl] #option-menu > [command=hide]:before { } .section > h2 span { - padding-right: 5px; + -webkit-padding-end: 5px; position: relative; z-index: 2; } @@ -331,6 +353,11 @@ html[dir=rtl] #option-menu > [command=hide]:before { z-index: 3; } +html[dir=rtl] .section > h2 .settings-wrapper { + left: 0; + right: auto; +} + .section > h2 .settings { position: absolute; left: 5px; diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html index e324d47..2080c71 100644 --- a/chrome/browser/resources/new_new_tab.html +++ b/chrome/browser/resources/new_new_tab.html @@ -117,8 +117,12 @@ if ('mode' in hashParams) { <body class="loading" i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> -<div id="main"> +<div id="attribution" class="attribution"> + <div i18n-content="attributionintro"></div> + <img id="attribution-img"> +</div> +<div id="main"> <menu id="option-menu"> <div command="clear-all-blacklisted" i18n-content="restorethumbnails"></div> @@ -171,11 +175,6 @@ if ('mode' in hashParams) { </div> </div> </div> - - <div id="attribution" class="attribution"> - <div i18n-content="attributionintro"></div> - <img id="attribution-img"> - </div> </div> <!-- main --> <div class="window-menu" id="window-tooltip"></div> diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index 2637b44..92daf99 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -226,6 +226,8 @@ function layoutSections() { if (section == expandedSection) y += expandedSectionHeight; } + + updateAttributionDisplay(y); } function updateMask(maxiview, visibleHeightPx) { @@ -469,14 +471,36 @@ function formatTabsText(numTabs) { // Theme related -function themeChanged() { +function themeChanged(hasAttribution) { + document.documentElement.setAttribute('hasattribution', hasAttribution); $('themecss').href = 'chrome://theme/css/newtab.css?' + Date.now(); updateAttribution(); } function updateAttribution() { - $('attribution-img').src = 'chrome://theme/IDR_THEME_NTP_ATTRIBUTION?' + - Date.now(); + var imageId = + document.documentElement.getAttribute('hasattribution') == 'true' ? + 'IDR_THEME_NTP_ATTRIBUTION' : 'IDR_PRODUCT_LOGO'; + $('attribution-img').src = 'chrome://theme/' + imageId + '?' + Date.now(); +} + +// If the content overlaps with the attribution, we bump its opacity down. +function updateAttributionDisplay(contentBottom) { + var attribution = $('attribution'); + var main = $('main'); + var rtl = document.documentElement.dir == 'rtl'; + var contentRect = main.getBoundingClientRect(); + var attributionRect = attribution.getBoundingClientRect(); + + if (contentBottom > attribution.offsetTop) { + if ((!rtl && contentRect.right > attributionRect.left) || + (rtl && attributionRect.right > contentRect.left)) { + attribution.classList.add('obscured'); + return; + } + } + + attribution.classList.remove('obscured'); } function bookmarkBarAttached() { @@ -623,7 +647,10 @@ OptionMenu.prototype = { positionMenu_: function() { var rect = this.button.getBoundingClientRect(); this.menu.style.top = rect.bottom + 'px'; - this.menu.style.right = (document.body.clientWidth - rect.right) + 'px' + if (document.documentElement.dir == 'rtl') + this.menu.style.left = rect.left + 'px'; + else + this.menu.style.right = (document.body.clientWidth - rect.right) + 'px' }, hide: function() { diff --git a/chrome/browser/resources/new_tab_theme.css b/chrome/browser/resources/new_tab_theme.css index 0a911f6..237274e 100644 --- a/chrome/browser/resources/new_tab_theme.css +++ b/chrome/browser/resources/new_tab_theme.css @@ -28,7 +28,7 @@ body { } #notification.first-run .link { - color: $$6; /* COLOR_NTP_LINK_UNDERLINE */ + color: $$5; /* COLOR_NTP_LINK_UNDERLINE */ } #notification.first-run .link-color { @@ -75,7 +75,7 @@ body { } .miniview > span { - color: $$6; /* COLOR_NTP_LINK_UNDERLINE */ + color: $$5; /* COLOR_NTP_LINK_UNDERLINE */ text-decoration: underline; } @@ -85,9 +85,7 @@ body { } #attribution { - display: $$5; color: $9; /* COLOR_NTP_LINK */ - text-align: end; } #tip-line { @@ -101,36 +99,35 @@ body { :link, :visited, .link { - color: $$6; /* COLOR_NTP_LINK_UNDERLINE */ + color: $$5; /* COLOR_NTP_LINK_UNDERLINE */ +} + +.section > h2 { + color: $$7; /* COLOR_NTP_SECTION_HEADER_TEXT */ } .section:not(.hidden) > h2 { - color: $$9; + color: $$8; /* COLOR_NTP_SECTION_HEADER_TEXT_HOVER */ } .section.hidden:not([noexpand]) > h2:hover { - color: $$9; + color: $$8; /* COLOR_NTP_SECTION_HEADER_TEXT_HOVER */ } .section > h2 .back { background-image: -webkit-gradient(radial, 50% -1753, 1750, 50% -1753, 1770, - from($$$1), to($$$3)); - border-top: 1px solid $$$1; /* COLOR_NTP_SECTION_HEADER_RULE */ + from($$9), to($$$2)); + border-top: 1px solid $$9; /* COLOR_NTP_SECTION_HEADER_RULE */ } .section.hidden > h2 .back { background: none; - border-color-top: $$$2; /* COLOR_NTP_SECTION_HEADER_RULE_LIGHT */ + border-color-top: $$$1; /* COLOR_NTP_SECTION_HEADER_RULE_LIGHT */ } .section.hidden:hover > h2 .back { - border-color-top: $$$1; /* COLOR_NTP_SECTION_HEADER_RULE */ -} - -.section > h2 > .settings { - background-color: $2; /* COLOR_NTP_BACKGROUND */ - border-color: $2; /* COLOR_NTP_BACKGROUND */ + border-color-top: $$9; /* COLOR_NTP_SECTION_HEADER_RULE */ } .app a { |