OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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 cr.define('print_preview', function() { | |
6 'use strict'; | |
7 | |
8 /** | |
9 * Creates a HeaderFooterSettings object. This object encapsulates all | |
10 * settings and logic related to the headers and footers checkbox. | |
11 * @constructor | |
12 */ | |
13 function HeaderFooterSettings() { | |
14 this.headerFooterOption_ = $('header-footer-option'); | |
15 this.headerFooterCheckbox_ = $('header-footer'); | |
16 } | |
17 | |
18 cr.addSingletonGetter(HeaderFooterSettings); | |
19 | |
20 HeaderFooterSettings.prototype = { | |
21 /** | |
22 * The checkbox corresponding to the headers and footers option. | |
23 * @type {HTMLInputElement} | |
24 */ | |
25 get headerFooterCheckbox() { | |
26 return this.headerFooterCheckbox_; | |
27 }, | |
28 | |
29 /** | |
30 * Checks whether the Headers and Footers checkbox is checked or not. | |
31 * | |
James Hawkins
2011/08/15 19:39:35
Remove blank comment line.
Aayush Kumar
2011/08/15 21:37:37
Done.
| |
32 * @return {boolean} true if Headers and Footers are checked. | |
33 */ | |
34 hasHeaderFooter: function() { | |
35 return this.headerFooterCheckbox_.checked; | |
36 }, | |
37 | |
38 /** | |
39 * Adding listeners to header footer related controls. | |
40 */ | |
41 addEventListeners: function() { | |
42 this.headerFooterCheckbox_.onclick = | |
43 this.onHeaderFooterChanged_.bind(this); | |
44 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); | |
45 }, | |
46 | |
47 /** | |
48 * Listener executing when the user selects or de-selects the headers | |
49 * and footers option. | |
50 * @private | |
51 */ | |
52 onHeaderFooterChanged_: function() { | |
53 requestPrintPreview(); | |
54 }, | |
55 | |
56 /** | |
57 * Listener executing when a PDFLoaded event occurs. | |
58 * @private | |
59 */ | |
60 onPDFLoaded_: function() { | |
61 if (!previewModifiable) | |
62 fadeOutElement(this.headerFooterOption_); | |
63 }, | |
64 }; | |
65 | |
66 return { | |
67 HeaderFooterSettings: HeaderFooterSettings, | |
68 }; | |
69 }); | |
OLD | NEW |