summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:47:17 +0000
committerarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:47:17 +0000
commit668dd15b25cf7fd94fede92dd140b59c62009390 (patch)
tree31c294230518ca5cbc8d6bc9b50f9cd97fd59595
parentcac0aa87fa5eaac91f10791258d302695c288805 (diff)
downloadchromium_src-668dd15b25cf7fd94fede92dd140b59c62009390.zip
chromium_src-668dd15b25cf7fd94fede92dd140b59c62009390.tar.gz
chromium_src-668dd15b25cf7fd94fede92dd140b59c62009390.tar.bz2
NNTP cleanup
- Fix bookmark sync background color - Make hidden elements not take up space at the bottom of the NNTP - Simplify sync and set as home page - Fix issue where middle clicking on the sync link opened a new tab BUG=19538 TEST=None Review URL: http://codereview.chromium.org/178065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25107 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/new_new_tab.css30
-rw-r--r--chrome/browser/resources/new_new_tab.html27
-rw-r--r--chrome/browser/resources/new_new_tab.js74
3 files changed, 50 insertions, 81 deletions
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index dc653cf..39d1f67 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -187,6 +187,9 @@ html[anim='false'] *,
cursor: pointer;
text-decoration: underline;
color: hsl(213, 90%, 24%);
+ -webkit-appearance: none;
+ border: 0;
+ background: none;
}
.thumbnail-container {
@@ -491,14 +494,11 @@ html[dir='rtl'] .item {
}
#sync-status {
- -webkit-transition: height .15s, opacity .15s;
- background-color: hsla(213, 60%, 92%, .4);
- border: 1px solid hsl(213, 60%, 92%);
+ display: none;
-webkit-border-radius: 6px;
padding: 5px 0;
margin: 10px 0;
white-space: nowrap;
- opacity: 0;
overflow-x: hidden;
}
@@ -512,26 +512,9 @@ html[dir='rtl'] .item {
margin: 0 10px;
}
-/* TODO(rahulk): The following two classes control the looks of Make this my
-homepage link and need to be refined. */
#set-as-homepage {
- -webkit-transition: height .15s, opacity .15s;
- padding: 5px 0;
+ display: none;
margin: 10px 0;
- white-space: nowrap;
- opacity: 0;
- overflow-x: hidden;
- text-align: center;
-}
-
-#set-as-homepage > * {
- display: inline-block;
- max-width: none;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- font-size: 100%;
- margin: 0 10px;
text-align: center;
}
@@ -707,8 +690,7 @@ html[dir='rtl'] #t4 {
/* tip line */
#tip-line {
- margin-top: 40px;
- margin-bottom: 10px;
+ margin: 10px 0;
text-align: center;
}
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html
index f11bf04..54e136f 100644
--- a/chrome/browser/resources/new_new_tab.html
+++ b/chrome/browser/resources/new_new_tab.html
@@ -1,5 +1,12 @@
-<!DOCTYPE html>
-<html i18n-values="dir:textdirection;firstview:firstview;bookmarkbarattached:bookmarkbarattached;hasattribution:hasattribution;anim:anim;syncispresent:syncispresent;showsetashomepage:showsetashomepage">
+.<!DOCTYPE html>
+<html i18n-values="
+ dir:textdirection;
+ firstview:firstview;
+ bookmarkbarattached:bookmarkbarattached;
+ hasattribution:hasattribution;
+ anim:anim;
+ syncispresent:syncispresent;
+ showsetashomepage:showsetashomepage">
<meta charset="utf-8">
<title i18n-content="title"></title>
@@ -220,22 +227,19 @@ document.write('<link id="themecss" rel="stylesheet" ' +
</div>
<div id="sync-status">
- <h2>&nbsp;</h2>
- <span>&nbsp;</span>
- <span><a href="">&nbsp;</a></span>
+ <h2></h2>
+ <span></span>
</div>
<div id="set-as-homepage">
- <span>
- </span>
+ <button class="link" i18n-content="makethishomepage"></button>
</div>
- <div id="tip-line">
- </div>
+ <div id="tip-line"></div>
<div id="attribution" class="attribution">
- <span i18n-content="attributionintro"></span><br />
- <img id="attribution-img" />
+ <div i18n-content="attributionintro"></div>
+ <img id="attribution-img">
</div>
</div> <!-- main -->
@@ -245,5 +249,4 @@ document.write('<link id="themecss" rel="stylesheet" ' +
</body>
<script src="local_strings.js"></script>
<script src="new_new_tab.js"></script>
-<script>updateAttribution();</script>
</html>
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 184b776..448063d 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -730,19 +730,15 @@ function syncMessageChanged(newMessage) {
// Hide the section if the message is emtpy.
if (!newMessage.syncsectionisvisible) {
- style.opacity = style.height = 0;
return;
}
- style.height = '';
- style.opacity = 1;
+ style.display = 'block';
// Set the sync section background color based on the state.
- if (newMessage.msgtype == "error") {
- style.backgroundColor = "tomato";
- } else if (newMessage.msgtype == "presynced") {
- style.backgroundColor = "greenyellow";
+ if (newMessage.msgtype == 'error') {
+ style.backgroundColor = 'tomato';
} else {
- style.backgroundColor = "#CAFF70";
+ style.backgroundColor = '';
}
// Set the text for the header and sync message.
@@ -751,30 +747,24 @@ function syncMessageChanged(newMessage) {
var messageElement = titleElement.nextElementSibling;
messageElement.textContent = newMessage.msg;
- // Set up the link if we should show one or hide it otherwise.
- var linkContainer = messageElement.nextElementSibling;
- var containerStyle = linkContainer.style;
- var linkElement = linkContainer.firstElementChild;
- linkElement.removeEventListener('click', syncSectionLinkClicked);
-
- // TODO(idana): when we don't have an URL to set, using an href is not a good
- // idea because the user will still be able to right click on the link and
- // open the empty href in a new tab/window.
- //
- // See http://code.google.com/p/chromium/issues/detail?id=19538 for more info
- // about how to fix this.
- linkElement.href = '';
- containerStyle.display = 'none';
+ // Remove what comes after the message
+ while (messageElement.nextSibling) {
+ syncStatusElement.removeChild(messageElement.nextSibling);
+ }
+
if (newMessage.linkisvisible) {
- containerStyle.display = '';
- linkElement.textContent = newMessage.linktext;
- // We don't listen to click events if the backend specified a target URL
- // for the link.
+ var el;
if (newMessage.linkurlisset) {
- linkElement.href = newMessage.linkurl;
+ // Use a link
+ el = document.createElement('a');
+ el.href = newMessage.linkurl;
} else {
- linkElement.addEventListener('click', syncSectionLinkClicked);
+ el = document.createElement('button');
+ el.className = 'link';
+ el.addEventListener('click', syncSectionLinkClicked);
}
+ el.textContent = newMessage.linktext;
+ syncStatusElement.appendChild(el);
}
}
@@ -826,11 +816,11 @@ function updateAttribution() {
}
function bookmarkBarAttached() {
- document.documentElement.setAttribute("bookmarkbarattached", "true");
+ document.documentElement.setAttribute('bookmarkbarattached', 'true');
}
function bookmarkBarDetached() {
- document.documentElement.setAttribute("bookmarkbarattached", "false");
+ document.documentElement.setAttribute('bookmarkbarattached', 'false');
}
function viewLog() {
@@ -1356,35 +1346,27 @@ document.addEventListener('DOMContentLoaded', showSetAsHomepageLink);
* backend told us that the sync code is present.
*/
function callGetSyncMessageIfSyncIsPresent() {
- if (document.documentElement.getAttribute("syncispresent") == "true") {
+ if (document.documentElement.getAttribute('syncispresent') == 'true') {
chrome.send('GetSyncMessage');
}
}
-function setAsHomePageLinkClicked() {
+function setAsHomePageLinkClicked(e) {
chrome.send('SetHomepageLinkClicked');
+ e.preventDefault();
}
function showSetAsHomepageLink() {
var setAsHomepageElement = $('set-as-homepage');
var style = setAsHomepageElement.style;
- if (document.documentElement.getAttribute("showsetashomepage") != "true") {
+ if (document.documentElement.getAttribute('showsetashomepage') != 'true') {
// Hide the section (if new tab page is already homepage).
- style.opacity = style.height = 0;
return;
}
- style.height = '';
- style.opacity = 1;
- var spanElement = setAsHomepageElement.firstElementChild;
- var linkElement = spanElement.firstElementChild;
- if (!linkElement) {
- linkElement = document.createElement('a');
- linkElement.href = '';
- linkElement.textContent = localStrings.getString('makethishomepage');
- linkElement.addEventListener('click', setAsHomePageLinkClicked);
- spanElement.appendChild(linkElement);
- }
+ style.display = 'block';
+ var buttonElement = setAsHomepageElement.firstElementChild;
+ buttonElement.addEventListener('click', setAsHomePageLinkClicked);
}
function hideAllMenus() {
@@ -1675,3 +1657,5 @@ function parseHtmlSubset(s) {
});
return df;
}
+
+updateAttribution();