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

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

Issue 1103163004: [Contextual Search] Remove opt-in code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Donn's comments 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
OLDNEW
(Empty)
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
3 found in the LICENSE file.
4 */
5
6 <include src="../../../../ui/webui/resources/js/util.js">
7 <include src="../../../../ui/webui/resources/js/load_time_data.js">
8
9 /**
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,
12 * in milliseconds.
13 * @const
14 */
15 var OPT_IN_DELAY_MS = 65;
16
17 /**
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
20 * to hide it.
21 */
22 document.addEventListener('DOMContentLoaded', function(event) {
23 if (config['hideHeader']) {
24 removeHeaderImages();
25 }
26 $('optin-button').addEventListener('click', function() {
27 $('container').classList.add('hide');
28 setTimeout(function() {
29 location.hash = 'optin';
30 }, OPT_IN_DELAY_MS);
31 });
32 $('optout-button').addEventListener('click', function() {
33 location.hash = 'optout';
34 });
35 });
36
37 /**
38 * Returns the height of the content. Method called from Chrome to properly size
39 * the view embedding it.
40 * @return {number} The height of the content, in pixels.
41 */
42 function getContentHeight() {
43 return $('container').clientHeight;
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') | chrome/browser/search/contextual_search_promo_source_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698