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

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

Issue 144022: Removes some duplicated code to use LocalStrings formatString instead... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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/app/generated_resources.grd ('k') | chrome/browser/resources/new_tab.html » ('j') | 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 553 }
554 554
555 /** 555 /**
556 * Returns the text used for a recently closed window. 556 * Returns the text used for a recently closed window.
557 * @param {number} numTabs Number of tabs in the window. 557 * @param {number} numTabs Number of tabs in the window.
558 * @return {string} The text to use. 558 * @return {string} The text to use.
559 */ 559 */
560 function formatTabsText(numTabs) { 560 function formatTabsText(numTabs) {
561 if (numTabs == 1) 561 if (numTabs == 1)
562 return localStrings.getString('closedwindowsingle'); 562 return localStrings.getString('closedwindowsingle');
563 // TODO(arv): Update grd file to use %s so we can use formatString 563 return localStrings.formatString('closedwindowmultiple', numTabs);
564 // http://crbug.com/14878
565 // return localStrings.formatString('closedwindowmultiple', numTabs);
566 return localStrings.getString('closedwindowmultiple').replace(/%/, numTabs);
567 } 564 }
568 565
569 /** 566 /**
570 * We need both most visited and the shown sections to be considered loaded. 567 * We need both most visited and the shown sections to be considered loaded.
571 * @return {boolean} 568 * @return {boolean}
572 */ 569 */
573 function onDataLoaded() { 570 function onDataLoaded() {
574 if (gotMostVisited && gotShownSections) { 571 if (gotMostVisited && gotShownSections) {
575 // Remove class name in a timeout so that changes done in this JS thread are 572 // Remove class name in a timeout so that changes done in this JS thread are
576 // not animated. 573 // not animated.
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 el.addEventListener('dragover', bind(this.handleDragOver, this)); 879 el.addEventListener('dragover', bind(this.handleDragOver, this));
883 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); 880 el.addEventListener('dragleave', bind(this.handleDragLeave, this));
884 el.addEventListener('drop', bind(this.handleDrop, this)); 881 el.addEventListener('drop', bind(this.handleDrop, this));
885 el.addEventListener('dragend', bind(this.handleDragEnd, this)); 882 el.addEventListener('dragend', bind(this.handleDragEnd, this));
886 el.addEventListener('drag', bind(this.handleDrag, this)); 883 el.addEventListener('drag', bind(this.handleDrag, this));
887 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); 884 el.addEventListener('mousedown', bind(this.handleMouseDown, this));
888 } 885 }
889 }; 886 };
890 887
891 dnd.init(); 888 dnd.init();
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/new_tab.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698