OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // TODO(cjhopman): remove dependency on readability. | |
6 | |
7 // These includes will be processed at build time by grit. | 5 // These includes will be processed at build time by grit. |
8 <include src="../../../../third_party/dom_distiller_js/js/domdistiller.js"/> | 6 <include src="../../../../third_party/dom_distiller_js/js/domdistiller.js"/> |
9 | 7 |
10 // Extracts long-form content from a page and returns an array where the first | 8 // Extracts long-form content from a page and returns an array where the first |
11 // element is the article title, the second element is HTML containing the | 9 // element is the article title, the second element is HTML containing the |
12 // long-form content, the third element is the next page link, and the fourth | 10 // long-form content, the third element is the next page link, and the fourth |
13 // element is the previous page link. | 11 // element is the previous page link. |
14 (function() { | 12 (function() { |
15 var result = new Array(4); | 13 var result = new Array(4); |
16 result[0] = com.dom_distiller.DocumentTitleGetter.getDocumentTitle( | 14 try { |
17 document.title, document.documentElement); | 15 result[0] = com.dom_distiller.DocumentTitleGetter.getDocumentTitle( |
18 result[1] = com.dom_distiller.ContentExtractor.extractContent(); | 16 document.title, document.documentElement); |
19 result[2] = com.dom_distiller.PagingLinksFinder.findNext( | 17 result[1] = com.dom_distiller.ContentExtractor.extractContent(); |
20 document.documentElement); | 18 result[2] = com.dom_distiller.PagingLinksFinder.findNext( |
21 // TODO(shashishekhar): Add actual previous page link here. | 19 document.documentElement); |
22 result[3] = ''; | 20 // TODO(shashishekhar): Add actual previous page link here. |
| 21 result[3] = ''; |
| 22 } catch (e) { |
| 23 window.console.log("Erring during distillation: " + e); |
| 24 } |
23 return result; | 25 return result; |
24 })() | 26 })() |
OLD | NEW |