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

Side by Side Diff: chrome/browser/resources/contextual_search/promo.js

Issue 982643002: [Contextual Search] Update promo look. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually adding SVG ;) Created 5 years, 9 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 | « chrome/browser/resources/contextual_search/promo.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 /* Copyright 2014 The Chromium Authors. All rights reserved. 1 /* Copyright 2014 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 <include src="../../../../ui/webui/resources/js/util.js"> 6 <include src="../../../../ui/webui/resources/js/util.js">
7 <include src="../../../../ui/webui/resources/js/load_time_data.js"> 7 <include src="../../../../ui/webui/resources/js/load_time_data.js">
8 8
9 /** 9 /**
10 * The amount of delay to use in the opt-in action in order to give time for 10 * The amount of delay to use in the opt-in action in order to give time for
11 * the fade-out animation to execute, before navigating to the opt-in URL, 11 * the fade-out animation to execute, before navigating to the opt-in URL,
12 * in milliseconds. 12 * in milliseconds.
13 * @const 13 * @const
14 */ 14 */
15 var OPT_IN_DELAY_MS = 65; 15 var OPT_IN_DELAY_MS = 65;
16 16
17 /** 17 /**
18 * Once the DOM is loaded, determine if the header image is to be kept and 18 * Once the DOM is loaded, determine if the header image is to be kept and
19 * register a handler to add the 'hide' class to the container element in order 19 * register a handler to add the 'hide' class to the container element in order
20 * to hide it. 20 * to hide it.
21 */ 21 */
22 document.addEventListener('DOMContentLoaded', function(event) { 22 document.addEventListener('DOMContentLoaded', function(event) {
23 if (config['hideHeader']) { 23 if (config['hideHeader']) {
24 $('container').removeChild($('header-image')); 24 removeHeaderImages();
25 } 25 }
26 $('optin-button').addEventListener('click', function() { 26 $('optin-button').addEventListener('click', function() {
27 $('container').classList.add('hide'); 27 $('container').classList.add('hide');
28 setTimeout(function() { 28 setTimeout(function() {
29 location.hash = 'optin'; 29 location.hash = 'optin';
30 }, OPT_IN_DELAY_MS); 30 }, OPT_IN_DELAY_MS);
31 }); 31 });
32 $('optout-button').addEventListener('click', function() { 32 $('optout-button').addEventListener('click', function() {
33 location.hash = 'optout'; 33 location.hash = 'optout';
34 }); 34 });
35 }); 35 });
36 36
37 /** 37 /**
38 * Returns the height of the content. Method called from Chrome to properly size 38 * Returns the height of the content. Method called from Chrome to properly size
39 * the view embedding it. 39 * the view embedding it.
40 * @return {number} The height of the content, in pixels. 40 * @return {number} The height of the content, in pixels.
41 */ 41 */
42 function getContentHeight() { 42 function getContentHeight() {
43 return $('container').clientHeight; 43 return $('container').clientHeight;
44 } 44 }
45
46 /**
47 * Removes all header images from the promo.
48 */
49 function removeHeaderImages() {
50 var images = document.querySelectorAll('.header-image');
51 for (var i = 0, length = images.length; i < length; i++) {
52 var image = images[i];
53 var parent = image.parentElement;
54 if (parent) {
55 parent.removeChild(image);
56 }
57 }
58 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/contextual_search/promo.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698