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

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

Issue 160152: When there are no images to replace a blacklisted page, putting filler... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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 | « AUTHORS ('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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // Find new item. 449 // Find new item.
450 var newItem; 450 var newItem;
451 for (var i = 0; i < data.length; i++) { 451 for (var i = 0; i < data.length; i++) {
452 if (!(data[i].url in oldUrls)) { 452 if (!(data[i].url in oldUrls)) {
453 newItem = data[i]; 453 newItem = data[i];
454 break; 454 break;
455 } 455 }
456 } 456 }
457 457
458 if (!newItem) { 458 if (!newItem) {
459 newItem = {filler: true}; 459 // If no other page is available to replace the blacklisted item,
460 // we need to reorder items s.t. all filler items are in the rightmost
461 // indices.
462 mostVisitedPages(data);
460 } 463 }
461
462 // Replace old item with new item in the mostVisitedData array. 464 // Replace old item with new item in the mostVisitedData array.
463 if (oldIndex != -1) { 465 else if (oldIndex != -1) {
464 mostVisitedData.splice(oldIndex, 1, newItem); 466 mostVisitedData.splice(oldIndex, 1, newItem);
465 mostVisitedPages(mostVisitedData); 467 mostVisitedPages(mostVisitedData);
466 addClass(el, 'fade-in'); 468 addClass(el, 'fade-in');
467 } 469 }
468 470
469 var text = localStrings.formatString('thumbnailremovednotification', 471 var text = localStrings.formatString('thumbnailremovednotification',
470 oldItem.title); 472 oldItem.title);
471 var actionText = localStrings.getString('undothumbnailremove'); 473 var actionText = localStrings.getString('undothumbnailremove');
472 474
473 // Show notification and add undo callback function. 475 // Show notification and add undo callback function.
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 el.addEventListener('dragover', bind(this.handleDragOver, this)); 1396 el.addEventListener('dragover', bind(this.handleDragOver, this));
1395 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); 1397 el.addEventListener('dragleave', bind(this.handleDragLeave, this));
1396 el.addEventListener('drop', bind(this.handleDrop, this)); 1398 el.addEventListener('drop', bind(this.handleDrop, this));
1397 el.addEventListener('dragend', bind(this.handleDragEnd, this)); 1399 el.addEventListener('dragend', bind(this.handleDragEnd, this));
1398 el.addEventListener('drag', bind(this.handleDrag, this)); 1400 el.addEventListener('drag', bind(this.handleDrag, this));
1399 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); 1401 el.addEventListener('mousedown', bind(this.handleMouseDown, this));
1400 } 1402 }
1401 }; 1403 };
1402 1404
1403 dnd.init(); 1405 dnd.init();
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698