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

Side by Side Diff: war/wrapped_domdistiller_template.js

Issue 863863007: Add support for wrapping the standalone JavaScript. (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: Created 5 years, 10 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 | « create_wrapped_standalone_js.py ('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
(Empty)
1 // Copyright 2015 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 // Creates a DomDistiller, applies to to the content of the page, and returns
6 // a DomDistillerResults as a JavaScript object/dictionary.
7 (function(options) {
8 try {
9 // The generated domdistiller.js accesses the window object only explicitly
10 // via the window name. This creates a new object with the normal window
11 // object as its prototype and initialize the domdistiller.js with that new
12 // context so that it does not change the real window object.
13 function initialize(window) {
14 $$DISTILLER_JAVASCRIPT
15 }
16 var context = Object.create(window);
17 context.setTimeout = function() {};
18 context.clearTimeout = function() {};
19 initialize(context);
20
21 var distiller = context.org.chromium.distiller.DomDistiller;
22 var res = distiller.applyWithOptions(options);
23 return res;
24 } catch (e) {
25 window.console.error("Error during distillation: " + e);
26 if (e.stack != undefined) window.console.error(e.stack);
27 }
28 return undefined;
29 // The OPTIONS placeholder will be replaced with the DomDistillerOptions at
30 // runtime.
31 })($$OPTIONS)
OLDNEW
« no previous file with comments | « create_wrapped_standalone_js.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698