| Index: components/dom_distiller/core/javascript/domdistiller.js
|
| diff --git a/components/dom_distiller/core/javascript/domdistiller.js b/components/dom_distiller/core/javascript/domdistiller.js
|
| index 9a0201775c3fa66696e58fc27d6b126f146707f9..b8d860b0f0218718423ba5349a2ea1e83417326b 100644
|
| --- a/components/dom_distiller/core/javascript/domdistiller.js
|
| +++ b/components/dom_distiller/core/javascript/domdistiller.js
|
| @@ -5,64 +5,17 @@
|
| // These includes will be processed at build time by grit.
|
| <include src="../../../../third_party/dom_distiller_js/package/js/domdistiller.js"/>
|
|
|
| -// Extracts long-form content from a page and returns an array where the first
|
| -// element is the article title, the second element is HTML containing the
|
| -// long-form content, the third element is the next page link, and the fourth
|
| -// element is the previous page link.
|
| +// Applies DomDistillerJs to the content of the page and returns a
|
| +// DomDistillerResults (as a javascript object/dict).
|
| (function() {
|
| - var result = new Array(4);
|
| try {
|
| - result[0] = com.dom_distiller.DocumentTitleGetter.getDocumentTitle(
|
| - document.title, document.documentElement);
|
| - result[1] = com.dom_distiller.ContentExtractor.extractContent();
|
| - result[2] = com.dom_distiller.PagingLinksFinder.findNext(
|
| - document.documentElement);
|
| - // TODO(shashishekhar): Add actual previous page link here.
|
| - result[3] = '';
|
| -
|
| - /**
|
| - * // Properties from markup tags.
|
| - *
|
| - * var parser = new com.dom_distiller.MarkupParser(document.documentElement);
|
| - * if (!parser.optOut()) {
|
| - * // Basic properties.
|
| - * var title = parser.getTitle(); // String type.
|
| - * var pageType = parser.getType(); // String type.
|
| - * var pageUrl = parser.getUrl(); // String type.
|
| - * var author = parser.getAuthor(); // String type.
|
| - * var description = parser.getDescription(); // String type.
|
| - * var publisher = parser.getPublisher(); // String type.
|
| - * var copyright = parser.getCopyright(); // String type.
|
| - *
|
| - * // Structured Image's.
|
| - * var images = parser.getImages();
|
| - * for (var i = 0; i < images.length; i++) {
|
| - * var image = images[i];
|
| - * var url = image.getUrl(); // String type.
|
| - * var secureUrl = image.getSecureUrl(); // String type.
|
| - * var type = image.getType(); // String type.
|
| - * var caption = image.getCaption(); // String type.
|
| - * var width = image.getWidth(); // int type.
|
| - * var height = image.getHeight(); // int type.
|
| - * }
|
| - *
|
| - * // Structured Article.
|
| - * var article = parser.getArticle();
|
| - * if (article != null) {
|
| - * var publishedTime = article.getPublishedTime(); // String type.
|
| - * var modifiedTime = article.getModifiedTime(); // String type.
|
| - * var expirationTime = article.getExpirationTime(); // String type.
|
| - * var sectionName = article.getSection(); // String type.
|
| - * var authors = article.getAuthors();
|
| - * for (var i = 0; i < authors.length; i++) {
|
| - * var author = authors[i]; // String type.
|
| - * }
|
| - * }
|
| - * }
|
| - */
|
| -
|
| + // The OPTIONS placeholder will be replaced with the DomDistillerOptions at
|
| + // runtime.
|
| + res = com.dom_distiller.DomDistiller.applyWithOptions($$OPTIONS);
|
| + return res;
|
| } catch (e) {
|
| - window.console.log("Error during distillation: " + e);
|
| + window.console.error("Error during distillation: " + e);
|
| + if (e.stack != undefined) window.console.error(e.stack);
|
| }
|
| - return result;
|
| + return undefined;
|
| })()
|
|
|