1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// This include is processed by grit at build time. 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)<include src="../../../../third_party/readability/js/readability.js"/> 7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Extracts long-form content from a page and returns and array where the first 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// element is the article title, the second element is HTML containing the 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// long-form content, and remaining elements are URLs for images referenced by 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// that HTML. Each <img> tag in the HTML has an id field set to k - 2, which 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// corresponds to a URL listed at index k in the array returned. 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)(function () { 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) readability.init(); 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) var result = new Array(4); 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) result[0] = readability.getArticleTitle(); 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) result[1] = readability.getDistilledArticleHTML(); 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) result[2] = readability.getNextPageLink(); 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // TODO(shashishekhar): Add actual previous page link here. 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) result[3] = ''; 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) return result.concat(readability.getImages()); 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}()) 23