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 // Local modifications to this file are described in the README.chromium | 5 // Local modifications to this file are described in the README.chromium |
6 // file. | 6 // file. |
7 | 7 |
8 var dbg = (typeof console !== 'undefined') ? function(s) { | 8 var dbg = (typeof console !== 'undefined') ? function(s) { |
9 console.log("Readability: " + s); | 9 console.log("Readability: " + s); |
10 } : function() {}; | 10 } : function() {}; |
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 // Returns the distilled article HTML from the page(s). | 1729 // Returns the distilled article HTML from the page(s). |
1730 getDistilledArticleHTML : function() { | 1730 getDistilledArticleHTML : function() { |
1731 return readability.distilledHTML; | 1731 return readability.distilledHTML; |
1732 }, | 1732 }, |
1733 | 1733 |
1734 // Returns the next page of this article. | 1734 // Returns the next page of this article. |
1735 getNextPageLink : function() { | 1735 getNextPageLink : function() { |
1736 return readability.nextPageLink; | 1736 return readability.nextPageLink; |
1737 } | 1737 } |
1738 }; | 1738 }; |
1739 | |
1740 // Extracts long-form content from a page and returns and array where the first | |
1741 // element is the article title, the second element is HTML containing the | |
1742 // long-form content, and remaining elements are URLs for images referenced by | |
1743 // that HTML. Each <img> tag in the HTML has an id field set to k - 2, which | |
1744 // corresponds to a URL listed at index k in the array returned. | |
1745 (function () { | |
1746 readability.init(); | |
1747 var result = new Array(4); | |
1748 result[0] = readability.getArticleTitle(); | |
1749 result[1] = readability.getDistilledArticleHTML(); | |
1750 result[2] = readability.getNextPageLink(); | |
1751 // TODO(shashishekhar): Add actual previous page link here. | |
1752 result[3] = ''; | |
1753 return result.concat(readability.getImages()); | |
1754 }()) | |
1755 | |
OLD | NEW |