OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 5 |
6 /** | 6 /** |
7 * @fileoverview The local InstantExtended NTP and suggestions dropdown. | 7 * @fileoverview The local InstantExtended NTP and suggestions dropdown. |
8 */ | 8 */ |
9 | 9 |
10 (function() { | 10 (function() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 PAGE: 'mv-page', // page tiles | 48 PAGE: 'mv-page', // page tiles |
49 PAGE_READY: 'mv-page-ready', // page tile when ready | 49 PAGE_READY: 'mv-page-ready', // page tile when ready |
50 ROW: 'mv-row', // tile row | 50 ROW: 'mv-row', // tile row |
51 RTL: 'rtl', // sets element alignments for an RTL language | 51 RTL: 'rtl', // sets element alignments for an RTL language |
52 SEARCH: 'search', | 52 SEARCH: 'search', |
53 SELECTED: 'selected', // a selected suggestion (if any) | 53 SELECTED: 'selected', // a selected suggestion (if any) |
54 SUGGESTION: 'suggestion', | 54 SUGGESTION: 'suggestion', |
55 SUGGESTION_CONTENTS: 'suggestion-contents', | 55 SUGGESTION_CONTENTS: 'suggestion-contents', |
56 SUGGESTIONS_BOX: 'suggestions-box', | 56 SUGGESTIONS_BOX: 'suggestions-box', |
57 THUMBNAIL: 'mv-thumb', | 57 THUMBNAIL: 'mv-thumb', |
| 58 THUMBNAIL_MASK: 'mv-mask', |
58 // Applied when user types. Makes fakebox non-interactive and hides | 59 // Applied when user types. Makes fakebox non-interactive and hides |
59 // scrollbars. Removed on ESC. | 60 // scrollbars. Removed on ESC. |
60 USER_TYPED: 'user-typed', | 61 USER_TYPED: 'user-typed', |
61 TILE: 'mv-tile', | 62 TILE: 'mv-tile', |
62 TITLE: 'mv-title' | 63 TITLE: 'mv-title' |
63 }; | 64 }; |
64 | 65 |
65 | 66 |
66 /** | 67 /** |
67 * Enum for HTML element ids. | 68 * Enum for HTML element ids. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 MOST_VISITED_THUMBNAIL_IFRAME, rid, MOST_VISITED_COLOR, | 460 MOST_VISITED_THUMBNAIL_IFRAME, rid, MOST_VISITED_COLOR, |
460 MOST_VISITED_FONT_FAMILY, MOST_VISITED_FONT_SIZE, false, position); | 461 MOST_VISITED_FONT_FAMILY, MOST_VISITED_FONT_SIZE, false, position); |
461 thumbnailElement.hidden = true; | 462 thumbnailElement.hidden = true; |
462 thumbnailElement.onload = function() { | 463 thumbnailElement.onload = function() { |
463 thumbnailElement.hidden = false; | 464 thumbnailElement.hidden = false; |
464 tileElement.classList.add(CLASSES.PAGE_READY); | 465 tileElement.classList.add(CLASSES.PAGE_READY); |
465 }; | 466 }; |
466 thumbnailElement.className = CLASSES.THUMBNAIL; | 467 thumbnailElement.className = CLASSES.THUMBNAIL; |
467 tileElement.appendChild(thumbnailElement); | 468 tileElement.appendChild(thumbnailElement); |
468 | 469 |
| 470 // A mask to darken the thumbnail on focus. |
| 471 var maskElement = createAndAppendElement( |
| 472 tileElement, 'div', CLASSES.THUMBNAIL_MASK); |
| 473 |
469 // The button used to blacklist this page. | 474 // The button used to blacklist this page. |
470 var blacklistButton = createAndAppendElement( | 475 var blacklistButton = createAndAppendElement( |
471 tileElement, 'div', CLASSES.BLACKLIST_BUTTON); | 476 tileElement, 'div', CLASSES.BLACKLIST_BUTTON); |
472 var blacklistFunction = generateBlacklistFunction(rid); | 477 var blacklistFunction = generateBlacklistFunction(rid); |
473 blacklistButton.addEventListener('click', blacklistFunction); | 478 blacklistButton.addEventListener('click', blacklistFunction); |
474 blacklistButton.title = templateData.removeThumbnailTooltip; | 479 blacklistButton.title = templateData.removeThumbnailTooltip; |
475 | 480 |
476 // When a tile is focused, have delete also blacklist the page. | 481 // When a tile is focused, have delete also blacklist the page. |
477 registerKeyHandler(tileElement, KEYCODE.DELETE, blacklistFunction); | 482 registerKeyHandler(tileElement, KEYCODE.DELETE, blacklistFunction); |
478 | 483 |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 } | 1739 } |
1735 } | 1740 } |
1736 | 1741 |
1737 document.addEventListener('DOMContentLoaded', init); | 1742 document.addEventListener('DOMContentLoaded', init); |
1738 window.addEventListener('message', handleMessage, false); | 1743 window.addEventListener('message', handleMessage, false); |
1739 window.addEventListener('blur', function() { | 1744 window.addEventListener('blur', function() { |
1740 if (activeBox) | 1745 if (activeBox) |
1741 activeBox.clearHover(); | 1746 activeBox.clearHover(); |
1742 }, false); | 1747 }, false); |
1743 })(); | 1748 })(); |
OLD | NEW |