summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/new_new_tab.js
diff options
context:
space:
mode:
authorarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 18:18:55 +0000
committerarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 18:18:55 +0000
commit1d227c4abd6a727e065eb5232c0494d7622d1eb7 (patch)
tree326ac6f2035e69960a96aad33d14636a1ca945bd /chrome/browser/resources/new_new_tab.js
parentba2a05080653855ad27feaec2bed12146e0e84c6 (diff)
downloadchromium_src-1d227c4abd6a727e065eb5232c0494d7622d1eb7.zip
chromium_src-1d227c4abd6a727e065eb5232c0494d7622d1eb7.tar.gz
chromium_src-1d227c4abd6a727e065eb5232c0494d7622d1eb7.tar.bz2
NNTP: Set the pinned tooltip when we set the pinned state of the DOM.
BUG=16460 TEST=Drag a non pinned thumbnail and drop it on another thumbnail. Then hover over the unpin button and the tooltip should say unpin/don't keep on this page. Review URL: http://codereview.chromium.org/155574 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/new_new_tab.js')
-rw-r--r--chrome/browser/resources/new_new_tab.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index c6e661f..99ebe9c 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -321,17 +321,23 @@ var mostVisited = {
togglePinned: function(el) {
var index = this.getThumbnailIndex(el);
var data = mostVisitedData[index];
+ data.pinned = !data.pinned;
if (data.pinned) {
- removeClass(el, 'pinned');
- chrome.send('removePinnedURL', [data.url]);
- } else {
- addClass(el, 'pinned');
chrome.send('addPinnedURL', [data.url, data.title, String(index)]);
+ } else {
+ chrome.send('removePinnedURL', [data.url]);
}
- data.pinned = !data.pinned;
- // Update tooltip
- el.querySelector('.pin').title = localStrings.getString(data.pinned ?
+ this.updatePinnedDom_(el, data.pinned);
+ },
+
+ updatePinnedDom_: function(el, pinned) {
+ el.querySelector('.pin').title = localStrings.getString(pinned ?
'unpinthumbnailtooltip' : 'pinthumbnailtooltip');
+ if (pinned) {
+ addClass(el, 'pinned');
+ } else {
+ removeClass(el, 'pinned');
+ }
},
getThumbnailIndex: function(el) {
@@ -349,7 +355,8 @@ var mostVisited = {
chrome.send('addPinnedURL', [sourceData.url, sourceData.title,
String(destinationIndex)]);
sourceData.pinned = true;
- addClass(source, 'pinned');
+ this.updatePinnedDom_(source, true);
+
var destinationData = mostVisitedData[destinationIndex];
// Only update the destination if it was pinned before.
if (destinationData.pinned) {