Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: chrome/browser/resources/new_new_tab.js

Issue 149166: Add support for extended tooltips.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 'unpinthumbnailtooltip' : 'pinthumbnailtooltip'); 184 'unpinthumbnailtooltip' : 'pinthumbnailtooltip');
185 t.querySelector('.remove').title = 185 t.querySelector('.remove').title =
186 localStrings.getString('removethumbnailtooltip'); 186 localStrings.getString('removethumbnailtooltip');
187 187
188 // There was some concern that a malformed malicious URL could cause an XSS 188 // There was some concern that a malformed malicious URL could cause an XSS
189 // attack but setting style.backgroundImage = 'url(javascript:...)' does 189 // attack but setting style.backgroundImage = 'url(javascript:...)' does
190 // not execute the JavaScript in WebKit. 190 // not execute the JavaScript in WebKit.
191 t.querySelector('.thumbnail-wrapper').style.backgroundImage = 191 t.querySelector('.thumbnail-wrapper').style.backgroundImage =
192 'url("chrome://thumb/' + d.url + '")'; 192 'url("chrome://thumb/' + d.url + '")';
193 var titleDiv = t.querySelector('.title > div'); 193 var titleDiv = t.querySelector('.title > div');
194 titleDiv.title = titleDiv.textContent = d.title; 194 titleDiv.xtitle = titleDiv.textContent = d.title;
195 titleDiv.style.backgroundImage = 'url("chrome://favicon/' + d.url + '")'; 195 titleDiv.style.backgroundImage = 'url("chrome://favicon/' + d.url + '")';
196 titleDiv.dir = d.direction; 196 titleDiv.dir = d.direction;
197 } 197 }
198 } 198 }
199 199
200 /** 200 /**
201 * Calls chrome.send with a callback and restores the original afterwards. 201 * Calls chrome.send with a callback and restores the original afterwards.
202 */ 202 */
203 function chromeSend(name, params, callbackName, callback) { 203 function chromeSend(name, params, callbackName, callback) {
204 var old = global[callbackName]; 204 var old = global[callbackName];
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 optionMenu.hide(); 1045 optionMenu.hide();
1046 } 1046 }
1047 1047
1048 window.addEventListener('blur', hideAllMenus); 1048 window.addEventListener('blur', hideAllMenus);
1049 window.addEventListener('keydown', function(e) { 1049 window.addEventListener('keydown', function(e) {
1050 if (e.keyIdentifier == 'Alt' || e.keyIdentifier == 'Meta') { 1050 if (e.keyIdentifier == 'Alt' || e.keyIdentifier == 'Meta') {
1051 hideAllMenus(); 1051 hideAllMenus();
1052 } 1052 }
1053 }, true); 1053 }, true);
1054 1054
1055 // Tooltip for elements that have text that overflows.
1056 document.addEventListener('mouseover', function(e) {
1057 var el = findAncestor(e.target, function(el) {
1058 return el.xtitle;
1059 });
1060 if (el && el.xtitle != el.title) {
1061 if (el.scrollWidth > el.clientWidth) {
1062 el.title = el.xtitle;
1063 } else {
1064 el.title = '';
1065 }
1066 }
1067 });
1068
1055 // DnD 1069 // DnD
1056 1070
1057 var dnd = { 1071 var dnd = {
1058 currentOverItem: null, 1072 currentOverItem: null,
1059 dragItem: null, 1073 dragItem: null,
1060 startX: 0, 1074 startX: 0,
1061 startY: 0, 1075 startY: 0,
1062 startScreenX: 0, 1076 startScreenX: 0,
1063 startScreenY: 0, 1077 startScreenY: 0,
1064 dragEndTimer: null, 1078 dragEndTimer: null,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 el.addEventListener('dragover', bind(this.handleDragOver, this)); 1184 el.addEventListener('dragover', bind(this.handleDragOver, this));
1171 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); 1185 el.addEventListener('dragleave', bind(this.handleDragLeave, this));
1172 el.addEventListener('drop', bind(this.handleDrop, this)); 1186 el.addEventListener('drop', bind(this.handleDrop, this));
1173 el.addEventListener('dragend', bind(this.handleDragEnd, this)); 1187 el.addEventListener('dragend', bind(this.handleDragEnd, this));
1174 el.addEventListener('drag', bind(this.handleDrag, this)); 1188 el.addEventListener('drag', bind(this.handleDrag, this));
1175 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); 1189 el.addEventListener('mousedown', bind(this.handleMouseDown, this));
1176 } 1190 }
1177 }; 1191 };
1178 1192
1179 dnd.init(); 1193 dnd.init();
OLDNEW
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698