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

Side by Side Diff: chrome/browser/resources/local_ntp/most_visited_single.js

Issue 1134513005: Adds support for DELETE,BACKSPACE,ENTER,SPACE keys on single iframe ntp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | 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 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */ 3 * found in the LICENSE file. */
4 4
5 // Single iframe for NTP tiles. 5 // Single iframe for NTP tiles.
6 (function() { 6 (function() {
7 'use strict'; 7 'use strict';
8 8
9 9
10 /** 10 /**
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 var html = []; 331 var html = [];
332 if (!USE_ICONS) { 332 if (!USE_ICONS) {
333 html.push('<div class="mv-favicon"></div>'); 333 html.push('<div class="mv-favicon"></div>');
334 } 334 }
335 html.push('<div class="mv-title"></div><div class="mv-thumb"></div>'); 335 html.push('<div class="mv-title"></div><div class="mv-thumb"></div>');
336 html.push('<div title="' + tooltip + '" class="mv-x"></div>'); 336 html.push('<div title="' + tooltip + '" class="mv-x"></div>');
337 tile.innerHTML = html.join(''); 337 tile.innerHTML = html.join('');
338 338
339 tile.href = data.url; 339 tile.href = data.url;
340 tile.title = data.title; 340 tile.title = data.title;
341 tile.addEventListener('keypress', function(ev) { 341 tile.addEventListener('keydown', function(event) {
342 if (ev.keyCode == 127) { // DELETE 342 if (event.keyCode == 46 /* DELETE */ ||
343 event.keyCode == 8 /* BACKSPACE */) {
344 event.preventDefault();
345 event.stopPropagation();
343 blacklistTile(tile); 346 blacklistTile(tile);
344 ev.stopPropagation(); 347 } else if (event.keyCode == 13 /* ENTER */ ||
345 return false; 348 event.keyCode == 32 /* SPACE */) {
349 event.preventDefault();
350 tile.click();
346 } 351 }
347 }); 352 });
348 // TODO(fserb): remove this or at least change to mouseenter. 353 // TODO(fserb): remove this or at least change to mouseenter.
349 tile.addEventListener('mouseover', function() { 354 tile.addEventListener('mouseover', function() {
350 logEvent(LOG_TYPE.NTP_MOUSEOVER); 355 logEvent(LOG_TYPE.NTP_MOUSEOVER);
351 }); 356 });
352 357
353 var title = tile.querySelector('.mv-title'); 358 var title = tile.querySelector('.mv-title');
354 title.innerText = data.title; 359 title.innerText = data.title;
355 title.style.direction = data.direction || 'ltr'; 360 title.style.direction = data.direction || 'ltr';
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 var html = document.querySelector('html'); 524 var html = document.querySelector('html');
520 html.dir = 'rtl'; 525 html.dir = 'rtl';
521 } 526 }
522 527
523 window.addEventListener('message', handlePostMessage); 528 window.addEventListener('message', handlePostMessage);
524 }; 529 };
525 530
526 531
527 window.addEventListener('DOMContentLoaded', init); 532 window.addEventListener('DOMContentLoaded', init);
528 })(); 533 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698