Files
chrome-extensions-samples/_archive/apps/samples/printing/document.js
Oliver Dunk 5bf419b385 Reorganize directory structure (#825)
* Remove docs folder.

This was a redirect from a GitHub pages site that does not appear
to be in use.

* Rename api folder to api-samples.

* Move examples to functional-samples folder.

* Move cookbook sample to functional-samples.

* Move tutorials to functional-samples folder.

* Move mv2 and apps folders to _archive.

* Rename tools folder to .repo.

* Move reference folder to functional-samples.

* Update README.

Update README with new relative links for reorg.

* Update README.md

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

---------

Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>
2023-02-03 10:58:04 -06:00

50 lines
1.5 KiB
JavaScript

/**
* Copyright (c) 2013 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
**/
"use strict";
var Printest = Printest || {};
Printest.document = A.object.create.call(A.controller, {
// The minimum window size set below allow the print preview panel to be large
// enough to be usable (even before http://crbug.com/307839 is fixed).
url: 'document.html',
frame: 'chrome',
sizes: {minimum: [438, 219], default: [438, 219]},
create: function(properties) {
return A.controller.create.apply(this, arguments).then(function(document) {
document.queryElement('#from').textContent = document.from = 1;
document.queryElement('#to').textContent = document.to = 99;
document.addListener('#print', 'click', document.print);
document.addListener(document, 'windowresized', document.onResize_);
document.onResize_();
return document.createPrintout_();
}).then(function(printout) {
printout.document.printout = printout;
return printout.document;
});
},
print: function() {
this.printout.printNumbers(this.from, this.to);
},
/** @private */
createPrintout_: function() {
return Printest.printout.create({
domWindow: this.domWindow.frames['print'],
document: this
});
},
/** @private */
onResize_: function() {
var height = this.queryElement('#fill-footer').scrollHeight;
this.queryElement('#fill-contents').style.bottom = height + 'px';
}
});