diff --git a/cli.js b/cli.js
index 79b84f3d..c609af74 100755
--- a/cli.js
+++ b/cli.js
@@ -2,10 +2,14 @@
/* eslint-disable */
const Mercury = require('./dist/mercury');
+const argv = require('yargs-parser')(process.argv.slice(2));
-const [, , url] = process.argv;
-
-(async urlToParse => {
+const {
+ _: [url],
+ format,
+ f,
+} = argv;
+(async (urlToParse, contentType) => {
if (!urlToParse) {
console.log(
'\n\
@@ -13,14 +17,23 @@ mercury-parser\n\n\
The Mercury Parser extracts semantic content from any url\n\n\
Usage:\n\
\n\
- mercury-parser [url-to-parse]\n\
+ $ mercury-parser url-to-parse [--format=html|text|markdown]\n\
\n\
'
);
return;
}
try {
- const result = await Mercury.parse(urlToParse);
+ const contentTypeMap = {
+ html: 'html',
+ markdown: 'markdown',
+ md: 'markdown',
+ text: 'text',
+ txt: 'text',
+ };
+ const result = await Mercury.parse(urlToParse, null, {
+ contentType: contentTypeMap[contentType],
+ });
console.log(JSON.stringify(result, null, 2));
} catch (e) {
if (e.message === 'ETIMEDOUT' && false) {
@@ -38,4 +51,4 @@ Usage:\n\
console.error(`\n${reportBug}\n`);
process.exit(1);
}
-})(url);
+})(url, format || f);
diff --git a/dist/mercury.js b/dist/mercury.js
index 402756bb..f0f498c6 100644
--- a/dist/mercury.js
+++ b/dist/mercury.js
@@ -1,64 +1,35 @@
'use strict';
-function _interopDefault(ex) {
- return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
-}
+function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
-var _regeneratorRuntime = _interopDefault(
- require('@babel/runtime-corejs2/regenerator')
-);
-var _objectSpread = _interopDefault(
- require('@babel/runtime-corejs2/helpers/objectSpread')
-);
-var _asyncToGenerator = _interopDefault(
- require('@babel/runtime-corejs2/helpers/asyncToGenerator')
-);
+var _regeneratorRuntime = _interopDefault(require('@babel/runtime-corejs2/regenerator'));
+var _objectSpread = _interopDefault(require('@babel/runtime-corejs2/helpers/objectSpread'));
+var _asyncToGenerator = _interopDefault(require('@babel/runtime-corejs2/helpers/asyncToGenerator'));
var URL = _interopDefault(require('url'));
var cheerio = _interopDefault(require('cheerio'));
var iconv = _interopDefault(require('iconv-lite'));
-var _parseInt = _interopDefault(
- require('@babel/runtime-corejs2/core-js/parse-int')
-);
-var _slicedToArray = _interopDefault(
- require('@babel/runtime-corejs2/helpers/slicedToArray')
-);
-var _Promise = _interopDefault(
- require('@babel/runtime-corejs2/core-js/promise')
-);
+var _parseInt = _interopDefault(require('@babel/runtime-corejs2/core-js/parse-int'));
+var _slicedToArray = _interopDefault(require('@babel/runtime-corejs2/helpers/slicedToArray'));
+var _Promise = _interopDefault(require('@babel/runtime-corejs2/core-js/promise'));
var request = _interopDefault(require('request'));
-var _Reflect$ownKeys = _interopDefault(
- require('@babel/runtime-corejs2/core-js/reflect/own-keys')
-);
-var _toConsumableArray = _interopDefault(
- require('@babel/runtime-corejs2/helpers/toConsumableArray')
-);
-var _defineProperty = _interopDefault(
- require('@babel/runtime-corejs2/helpers/defineProperty')
-);
-var _parseFloat = _interopDefault(
- require('@babel/runtime-corejs2/core-js/parse-float')
-);
+var _Reflect$ownKeys = _interopDefault(require('@babel/runtime-corejs2/core-js/reflect/own-keys'));
+var _toConsumableArray = _interopDefault(require('@babel/runtime-corejs2/helpers/toConsumableArray'));
+var _defineProperty = _interopDefault(require('@babel/runtime-corejs2/helpers/defineProperty'));
+var _parseFloat = _interopDefault(require('@babel/runtime-corejs2/core-js/parse-float'));
var _Set = _interopDefault(require('@babel/runtime-corejs2/core-js/set'));
var _typeof = _interopDefault(require('@babel/runtime-corejs2/helpers/typeof'));
-var _getIterator = _interopDefault(
- require('@babel/runtime-corejs2/core-js/get-iterator')
-);
-var _Object$keys = _interopDefault(
- require('@babel/runtime-corejs2/core-js/object/keys')
-);
+var _getIterator = _interopDefault(require('@babel/runtime-corejs2/core-js/get-iterator'));
+var _Object$keys = _interopDefault(require('@babel/runtime-corejs2/core-js/object/keys'));
+var TurndownService = _interopDefault(require('turndown'));
var stringDirection = _interopDefault(require('string-direction'));
var validUrl = _interopDefault(require('valid-url'));
var moment = _interopDefault(require('moment-timezone'));
var parseFormat = _interopDefault(require('moment-parseformat'));
var wuzzy = _interopDefault(require('wuzzy'));
var difflib = _interopDefault(require('difflib'));
-var _Array$from = _interopDefault(
- require('@babel/runtime-corejs2/core-js/array/from')
-);
+var _Array$from = _interopDefault(require('@babel/runtime-corejs2/core-js/array/from'));
var ellipsize = _interopDefault(require('ellipsize'));
-var _Array$isArray = _interopDefault(
- require('@babel/runtime-corejs2/core-js/array/is-array')
-);
+var _Array$isArray = _interopDefault(require('@babel/runtime-corejs2/core-js/array/is-array'));
var NORMALIZE_RE = /\s{2,}/g;
function normalizeSpaces(text) {
@@ -71,7 +42,7 @@ function normalizeSpaces(text) {
// string to be cleaned.
// Only used for date_published currently.
function extractFromUrl(url, regexList) {
- var matchRe = regexList.find(function(re) {
+ var matchRe = regexList.find(function (re) {
return re.test(url);
});
@@ -98,10 +69,7 @@ function extractFromUrl(url, regexList) {
// Does not match:
// pg=102
// page:2
-var PAGE_IN_HREF_RE = new RegExp(
- '(page|paging|(p(a|g|ag)?(e|enum|ewanted|ing|ination)))?(=|/)([0-9]{1,3})',
- 'i'
-);
+var PAGE_IN_HREF_RE = new RegExp('(page|paging|(p(a|g|ag)?(e|enum|ewanted|ing|ination)))?(=|/)([0-9]{1,3})', 'i');
var HAS_ALPHA_RE = /[a-z]/i;
var IS_ALPHA_RE = /^[a-z]+$/i;
var IS_DIGIT_RE = /^[0-9]+$/i;
@@ -115,6 +83,7 @@ function pageNumFromUrl(url) {
var pageNum = _parseInt(matches[6], 10); // Return pageNum < 100, otherwise
// return null
+
return pageNum < 100 ? pageNum : null;
}
@@ -131,11 +100,13 @@ function isGoodSegment(segment, index, firstSegmentHasLetters) {
} // If this is the first url_segment and it's just "index",
// remove it
+
if (index === 0 && segment.toLowerCase() === 'index') {
goodSegment = false;
} // If our first or second url_segment is smaller than 3 characters,
// and the first url_segment had no alphas, remove it.
+
if (index < 2 && segment.length < 3 && !firstSegmentHasLetters) {
goodSegment = false;
}
@@ -145,51 +116,49 @@ function isGoodSegment(segment, index, firstSegmentHasLetters) {
// pagination data exists in it. Useful for comparing to other links
// that might have pagination data within them.
+
function articleBaseUrl(url, parsed) {
var parsedUrl = parsed || URL.parse(url);
var protocol = parsedUrl.protocol,
- host = parsedUrl.host,
- path = parsedUrl.path;
+ host = parsedUrl.host,
+ path = parsedUrl.path;
var firstSegmentHasLetters = false;
- var cleanedSegments = path
- .split('/')
- .reverse()
- .reduce(function(acc, rawSegment, index) {
- var segment = rawSegment; // Split off and save anything that looks like a file type.
-
- if (segment.includes('.')) {
- var _segment$split = segment.split('.'),
+ var cleanedSegments = path.split('/').reverse().reduce(function (acc, rawSegment, index) {
+ var segment = rawSegment; // Split off and save anything that looks like a file type.
+
+ if (segment.includes('.')) {
+ var _segment$split = segment.split('.'),
_segment$split2 = _slicedToArray(_segment$split, 2),
possibleSegment = _segment$split2[0],
fileExt = _segment$split2[1];
- if (IS_ALPHA_RE.test(fileExt)) {
- segment = possibleSegment;
- }
- } // If our first or second segment has anything looking like a page
- // number, remove it.
-
- if (PAGE_IN_HREF_RE.test(segment) && index < 2) {
- segment = segment.replace(PAGE_IN_HREF_RE, '');
- } // If we're on the first segment, check to see if we have any
- // characters in it. The first segment is actually the last bit of
- // the URL, and this will be helpful to determine if we're on a URL
- // segment that looks like "/2/" for example.
-
- if (index === 0) {
- firstSegmentHasLetters = HAS_ALPHA_RE.test(segment);
- } // If it's not marked for deletion, push it to cleaned_segments.
-
- if (isGoodSegment(segment, index, firstSegmentHasLetters)) {
- acc.push(segment);
+ if (IS_ALPHA_RE.test(fileExt)) {
+ segment = possibleSegment;
}
+ } // If our first or second segment has anything looking like a page
+ // number, remove it.
- return acc;
- }, []);
- return ''
- .concat(protocol, '//')
- .concat(host)
- .concat(cleanedSegments.reverse().join('/'));
+
+ if (PAGE_IN_HREF_RE.test(segment) && index < 2) {
+ segment = segment.replace(PAGE_IN_HREF_RE, '');
+ } // If we're on the first segment, check to see if we have any
+ // characters in it. The first segment is actually the last bit of
+ // the URL, and this will be helpful to determine if we're on a URL
+ // segment that looks like "/2/" for example.
+
+
+ if (index === 0) {
+ firstSegmentHasLetters = HAS_ALPHA_RE.test(segment);
+ } // If it's not marked for deletion, push it to cleaned_segments.
+
+
+ if (isGoodSegment(segment, index, firstSegmentHasLetters)) {
+ acc.push(segment);
+ }
+
+ return acc;
+ }, []);
+ return "".concat(protocol, "//").concat(host).concat(cleanedSegments.reverse().join('/'));
}
// Given a string, return True if it appears to have an ending sentence
@@ -200,13 +169,8 @@ function hasSentenceEnd(text) {
}
function excerptContent(content) {
- var words =
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
- return content
- .trim()
- .split(/\s+/)
- .slice(0, words)
- .join(' ');
+ var words = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
+ return content.trim().split(/\s+/).slice(0, words).join(' ');
}
// used in our fetchResource function to
@@ -227,43 +191,39 @@ function getEncoding(str) {
}
var _marked =
- /*#__PURE__*/
- _regeneratorRuntime.mark(range);
+/*#__PURE__*/
+_regeneratorRuntime.mark(range);
function range() {
var start,
- end,
- _args = arguments;
- return _regeneratorRuntime.wrap(
- function range$(_context) {
- while (1) {
- switch ((_context.prev = _context.next)) {
- case 0:
- start = _args.length > 0 && _args[0] !== undefined ? _args[0] : 1;
- end = _args.length > 1 && _args[1] !== undefined ? _args[1] : 1;
-
- case 2:
- if (!(start <= end)) {
- _context.next = 7;
- break;
- }
+ end,
+ _args = arguments;
+ return _regeneratorRuntime.wrap(function range$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ start = _args.length > 0 && _args[0] !== undefined ? _args[0] : 1;
+ end = _args.length > 1 && _args[1] !== undefined ? _args[1] : 1;
+
+ case 2:
+ if (!(start <= end)) {
+ _context.next = 7;
+ break;
+ }
- _context.next = 5;
- return (start += 1);
+ _context.next = 5;
+ return start += 1;
- case 5:
- _context.next = 2;
- break;
+ case 5:
+ _context.next = 2;
+ break;
- case 7:
- case 'end':
- return _context.stop();
- }
+ case 7:
+ case "end":
+ return _context.stop();
}
- },
- _marked,
- this
- );
+ }
+ }, _marked, this);
}
// extremely simple url validation as a first step
@@ -276,38 +236,31 @@ function validateUrl(_ref) {
var Errors = {
badUrl: {
error: true,
- messages:
- 'The url parameter passed does not look like a valid URL. Please check your data and try again.',
- },
+ messages: 'The url parameter passed does not look like a valid URL. Please check your data and try again.'
+ }
};
-var REQUEST_HEADERS = cheerio.browser
- ? {}
- : {
- 'User-Agent':
- 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
- }; // The number of milliseconds to attempt to fetch a resource before timing out.
+var REQUEST_HEADERS = cheerio.browser ? {} : {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
+}; // The number of milliseconds to attempt to fetch a resource before timing out.
var FETCH_TIMEOUT = 10000; // Content types that we do not extract content from
var BAD_CONTENT_TYPES = ['audio/mpeg', 'image/gif', 'image/jpeg', 'image/jpg'];
-var BAD_CONTENT_TYPES_RE = new RegExp(
- '^('.concat(BAD_CONTENT_TYPES.join('|'), ')$'),
- 'i'
-); // Use this setting as the maximum size an article can be
+var BAD_CONTENT_TYPES_RE = new RegExp("^(".concat(BAD_CONTENT_TYPES.join('|'), ")$"), 'i'); // Use this setting as the maximum size an article can be
// for us to attempt parsing. Defaults to 5 MB.
var MAX_CONTENT_LENGTH = 5242880; // Turn the global proxy on or off
function get(options) {
- return new _Promise(function(resolve, reject) {
- request(options, function(err, response, body) {
+ return new _Promise(function (resolve, reject) {
+ request(options, function (err, response, body) {
if (err) {
reject(err);
} else {
resolve({
body: body,
- response: response,
+ response: response
});
}
});
@@ -317,9 +270,9 @@ function get(options) {
// not. Validation here means that we haven't found reason to bail from
// further processing of this url.
+
function validateResponse(response) {
- var parseNon2xx =
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ var parseNon2xx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
// Check if we got a valid status code
// This isn't great, but I'm requiring a statusMessage to be set
@@ -327,46 +280,25 @@ function validateResponse(response) {
// statusMessage only not set in nock response, in which case
// I check statusCode, which is currently only 200 for OK responses
// in tests
- if (
- (response.statusMessage && response.statusMessage !== 'OK') ||
- response.statusCode !== 200
- ) {
+ if (response.statusMessage && response.statusMessage !== 'OK' || response.statusCode !== 200) {
if (!response.statusCode) {
- throw new Error(
- 'Unable to fetch content. Original exception was '.concat(
- response.error
- )
- );
+ throw new Error("Unable to fetch content. Original exception was ".concat(response.error));
} else if (!parseNon2xx) {
- throw new Error(
- 'Resource returned a response status code of '.concat(
- response.statusCode,
- ' and resource was instructed to reject non-2xx level status codes.'
- )
- );
+ throw new Error("Resource returned a response status code of ".concat(response.statusCode, " and resource was instructed to reject non-2xx level status codes."));
}
}
var _response$headers = response.headers,
- contentType = _response$headers['content-type'],
- contentLength = _response$headers['content-length']; // Check that the content is not in BAD_CONTENT_TYPES
+ contentType = _response$headers['content-type'],
+ contentLength = _response$headers['content-length']; // Check that the content is not in BAD_CONTENT_TYPES
if (BAD_CONTENT_TYPES_RE.test(contentType)) {
- throw new Error(
- 'Content-type for this resource was '.concat(
- contentType,
- ' and is not allowed.'
- )
- );
+ throw new Error("Content-type for this resource was ".concat(contentType, " and is not allowed."));
} // Check that the content length is below maximum
+
if (contentLength > MAX_CONTENT_LENGTH) {
- throw new Error(
- 'Content for this resource was too large. Maximum content length is '.concat(
- MAX_CONTENT_LENGTH,
- '.'
- )
- );
+ throw new Error("Content for this resource was too large. Maximum content length is ".concat(MAX_CONTENT_LENGTH, "."));
}
return true;
@@ -382,74 +314,63 @@ function fetchResource(_x, _x2) {
function _fetchResource() {
_fetchResource = _asyncToGenerator(
- /*#__PURE__*/
- _regeneratorRuntime.mark(function _callee(url, parsedUrl) {
- var options, _ref2, response, body;
-
- return _regeneratorRuntime.wrap(
- function _callee$(_context) {
- while (1) {
- switch ((_context.prev = _context.next)) {
- case 0:
- parsedUrl = parsedUrl || URL.parse(encodeURI(url));
- options = _objectSpread(
- {
- url: parsedUrl.href,
- headers: _objectSpread({}, REQUEST_HEADERS),
- timeout: FETCH_TIMEOUT,
- // Accept cookies
- jar: true,
- // Set to null so the response returns as binary and body as buffer
- // https://github.com/request/request#requestoptions-callback
- encoding: null,
- // Accept and decode gzip
- gzip: true,
- // Follow any non-GET redirects
- followAllRedirects: true,
- },
- typeof window !== 'undefined'
- ? {}
- : {
- // Follow GET redirects; this option is for Node only
- followRedirect: true,
- }
- );
- _context.next = 4;
- return get(options);
-
- case 4:
- _ref2 = _context.sent;
- response = _ref2.response;
- body = _ref2.body;
- _context.prev = 7;
- validateResponse(response);
- return _context.abrupt('return', {
- body: body,
- response: response,
- });
-
- case 12:
- _context.prev = 12;
- _context.t0 = _context['catch'](7);
- return _context.abrupt('return', Errors.badUrl);
-
- case 15:
- case 'end':
- return _context.stop();
- }
- }
- },
- _callee,
- this,
- [[7, 12]]
- );
- })
- );
+ /*#__PURE__*/
+ _regeneratorRuntime.mark(function _callee(url, parsedUrl) {
+ var options, _ref2, response, body;
+
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ parsedUrl = parsedUrl || URL.parse(encodeURI(url));
+ options = _objectSpread({
+ url: parsedUrl.href,
+ headers: _objectSpread({}, REQUEST_HEADERS),
+ timeout: FETCH_TIMEOUT,
+ // Accept cookies
+ jar: true,
+ // Set to null so the response returns as binary and body as buffer
+ // https://github.com/request/request#requestoptions-callback
+ encoding: null,
+ // Accept and decode gzip
+ gzip: true,
+ // Follow any non-GET redirects
+ followAllRedirects: true
+ }, typeof window !== 'undefined' ? {} : {
+ // Follow GET redirects; this option is for Node only
+ followRedirect: true
+ });
+ _context.next = 4;
+ return get(options);
+
+ case 4:
+ _ref2 = _context.sent;
+ response = _ref2.response;
+ body = _ref2.body;
+ _context.prev = 7;
+ validateResponse(response);
+ return _context.abrupt("return", {
+ body: body,
+ response: response
+ });
+
+ case 12:
+ _context.prev = 12;
+ _context.t0 = _context["catch"](7);
+ return _context.abrupt("return", Errors.badUrl);
+
+ case 15:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, this, [[7, 12]]);
+ }));
return _fetchResource.apply(this, arguments);
}
function convertMetaProp($, from, to) {
- $('meta['.concat(from, ']')).each(function(_, node) {
+ $("meta[".concat(from, "]")).each(function (_, node) {
var $node = $(node);
var value = $node.attr(from);
$node.attr(to, value);
@@ -463,6 +384,7 @@ function convertMetaProp($, from, to) {
// In addition, normalize 'property' attributes to 'name' for ease of
// querying later. See, e.g., og or twitter meta tags.
+
function normalizeMetaTags($) {
$ = convertMetaProp($, 'content', 'value');
$ = convertMetaProp($, 'property', 'name');
@@ -474,49 +396,13 @@ var SPACER_RE = new RegExp('transparent|spacer|blank', 'i'); // The class we wil
// but would normally remove
var KEEP_CLASS = 'mercury-parser-keep';
-var KEEP_SELECTORS = [
- 'iframe[src^="https://www.youtube.com"]',
- 'iframe[src^="https://www.youtube-nocookie.com"]',
- 'iframe[src^="http://www.youtube.com"]',
- 'iframe[src^="https://player.vimeo"]',
- 'iframe[src^="http://player.vimeo"]',
-]; // A list of tags to strip from the output if we encounter them.
-
-var STRIP_OUTPUT_TAGS = [
- 'title',
- 'script',
- 'noscript',
- 'link',
- 'style',
- 'hr',
- 'embed',
- 'iframe',
- 'object',
-]; // cleanAttributes
-var WHITELIST_ATTRS = [
- 'src',
- 'srcset',
- 'href',
- 'class',
- 'id',
- 'alt',
- 'xlink:href',
- 'width',
- 'height',
-];
-var WHITELIST_ATTRS_RE = new RegExp(
- '^('.concat(WHITELIST_ATTRS.join('|'), ')$'),
- 'i'
-); // removeEmpty
-
-var CLEAN_CONDITIONALLY_TAGS = [
- 'ul',
- 'ol',
- 'table',
- 'div',
- 'button',
- 'form',
-].join(','); // cleanHeaders
+var KEEP_SELECTORS = ['iframe[src^="https://www.youtube.com"]', 'iframe[src^="https://www.youtube-nocookie.com"]', 'iframe[src^="http://www.youtube.com"]', 'iframe[src^="https://player.vimeo"]', 'iframe[src^="http://player.vimeo"]']; // A list of tags to strip from the output if we encounter them.
+
+var STRIP_OUTPUT_TAGS = ['title', 'script', 'noscript', 'link', 'style', 'hr', 'embed', 'iframe', 'object']; // cleanAttributes
+var WHITELIST_ATTRS = ['src', 'srcset', 'href', 'class', 'id', 'alt', 'xlink:href', 'width', 'height'];
+var WHITELIST_ATTRS_RE = new RegExp("^(".concat(WHITELIST_ATTRS.join('|'), ")$"), 'i'); // removeEmpty
+
+var CLEAN_CONDITIONALLY_TAGS = ['ul', 'ol', 'table', 'div', 'button', 'form'].join(','); // cleanHeaders
var HEADER_TAGS = ['h2', 'h3', 'h4', 'h5', 'h6'];
var HEADER_TAG_LIST = HEADER_TAGS.join(','); // // CONTENT FETCHING CONSTANTS ////
@@ -525,47 +411,11 @@ var HEADER_TAG_LIST = HEADER_TAGS.join(','); // // CONTENT FETCHING CONSTANTS //
// and then tested for existence using re:test, so may contain simple,
// non-pipe style regular expression queries if necessary.
-var UNLIKELY_CANDIDATES_BLACKLIST = [
- 'ad-break',
- 'adbox',
- 'advert',
- 'addthis',
- 'agegate',
- 'aux',
- 'blogger-labels',
- 'combx',
- 'comment',
- 'conversation',
- 'disqus',
- 'entry-unrelated',
- 'extra',
- 'foot', // 'form', // This is too generic, has too many false positives
- 'header',
- 'hidden',
- 'loader',
- 'login', // Note: This can hit 'blogindex'.
- 'menu',
- 'meta',
- 'nav',
- 'outbrain',
- 'pager',
- 'pagination',
- 'predicta', // readwriteweb inline ad box
- 'presence_control_external', // lifehacker.com container full of false positives
- 'popup',
- 'printfriendly',
- 'related',
- 'remove',
- 'remark',
- 'rss',
- 'share',
- 'shoutbox',
- 'sidebar',
- 'sociable',
- 'sponsor',
- 'taboola',
- 'tools',
-]; // A list of strings that can be considered LIKELY candidates when
+var UNLIKELY_CANDIDATES_BLACKLIST = ['ad-break', 'adbox', 'advert', 'addthis', 'agegate', 'aux', 'blogger-labels', 'combx', 'comment', 'conversation', 'disqus', 'entry-unrelated', 'extra', 'foot', // 'form', // This is too generic, has too many false positives
+'header', 'hidden', 'loader', 'login', // Note: This can hit 'blogindex'.
+'menu', 'meta', 'nav', 'outbrain', 'pager', 'pagination', 'predicta', // readwriteweb inline ad box
+'presence_control_external', // lifehacker.com container full of false positives
+'popup', 'printfriendly', 'related', 'remove', 'remark', 'rss', 'share', 'shoutbox', 'sidebar', 'sociable', 'sponsor', 'taboola', 'tools']; // A list of strings that can be considered LIKELY candidates when
// extracting content from a resource. Essentially, the inverse of the
// blacklist above - if something matches both blacklist and whitelist,
// it is kept. This is useful, for example, if something has a className
@@ -577,124 +427,30 @@ var UNLIKELY_CANDIDATES_BLACKLIST = [
// re:test, so may contain simple, non-pipe style regular expression queries
// if necessary.
-var UNLIKELY_CANDIDATES_WHITELIST = [
- 'and',
- 'article',
- 'body',
- 'blogindex',
- 'column',
- 'content',
- 'entry-content-asset',
- 'format', // misuse of form
- 'hfeed',
- 'hentry',
- 'hatom',
- 'main',
- 'page',
- 'posts',
- 'shadow',
-]; // A list of tags which, if found inside, should cause a
to NOT
+var UNLIKELY_CANDIDATES_WHITELIST = ['and', 'article', 'body', 'blogindex', 'column', 'content', 'entry-content-asset', 'format', // misuse of form
+'hfeed', 'hentry', 'hatom', 'main', 'page', 'posts', 'shadow']; // A list of tags which, if found inside, should cause a to NOT
// be turned into a paragraph tag. Shallow div tags without these elements
// should be turned into tags.
-var DIV_TO_P_BLOCK_TAGS = [
- 'a',
- 'blockquote',
- 'dl',
- 'div',
- 'img',
- 'p',
- 'pre',
- 'table',
-].join(','); // A list of tags that should be ignored when trying to find the top candidate
+var DIV_TO_P_BLOCK_TAGS = ['a', 'blockquote', 'dl', 'div', 'img', 'p', 'pre', 'table'].join(','); // A list of tags that should be ignored when trying to find the top candidate
// an article container. Checked against className and id.
//
// TODO: Perhaps have these scale based on their odds of being quality?
-var POSITIVE_SCORE_HINTS = [
- 'article',
- 'articlecontent',
- 'instapaper_body',
- 'blog',
- 'body',
- 'content',
- 'entry-content-asset',
- 'entry',
- 'hentry',
- 'main',
- 'Normal',
- 'page',
- 'pagination',
- 'permalink',
- 'post',
- 'story',
- 'text',
- '[-_]copy', // usatoday
- '\\Bcopy',
-]; // The above list, joined into a matching regular expression
+var POSITIVE_SCORE_HINTS = ['article', 'articlecontent', 'instapaper_body', 'blog', 'body', 'content', 'entry-content-asset', 'entry', 'hentry', 'main', 'Normal', 'page', 'pagination', 'permalink', 'post', 'story', 'text', '[-_]copy', // usatoday
+'\\Bcopy']; // The above list, joined into a matching regular expression
var POSITIVE_SCORE_RE = new RegExp(POSITIVE_SCORE_HINTS.join('|'), 'i'); // Readability publisher-specific guidelines
// an article container. Checked against className and id.
//
// TODO: Perhaps have these scale based on their odds of being quality?
-var NEGATIVE_SCORE_HINTS = [
- 'adbox',
- 'advert',
- 'author',
- 'bio',
- 'bookmark',
- 'bottom',
- 'byline',
- 'clear',
- 'com-',
- 'combx',
- 'comment',
- 'comment\\B',
- 'contact',
- 'copy',
- 'credit',
- 'crumb',
- 'date',
- 'deck',
- 'excerpt',
- 'featured', // tnr.com has a featured_content which throws us off
- 'foot',
- 'footer',
- 'footnote',
- 'graf',
- 'head',
- 'info',
- 'infotext', // newscientist.com copyright
- 'instapaper_ignore',
- 'jump',
- 'linebreak',
- 'link',
- 'masthead',
- 'media',
- 'meta',
- 'modal',
- 'outbrain', // slate.com junk
- 'promo',
- 'pr_', // autoblog - press release
- 'related',
- 'respond',
- 'roundcontent', // lifehacker restricted content warning
- 'scroll',
- 'secondary',
- 'share',
- 'shopping',
- 'shoutbox',
- 'side',
- 'sidebar',
- 'sponsor',
- 'stamp',
- 'sub',
- 'summary',
- 'tags',
- 'tools',
- 'widget',
-]; // The above list, joined into a matching regular expression
+var NEGATIVE_SCORE_HINTS = ['adbox', 'advert', 'author', 'bio', 'bookmark', 'bottom', 'byline', 'clear', 'com-', 'combx', 'comment', 'comment\\B', 'contact', 'copy', 'credit', 'crumb', 'date', 'deck', 'excerpt', 'featured', // tnr.com has a featured_content which throws us off
+'foot', 'footer', 'footnote', 'graf', 'head', 'info', 'infotext', // newscientist.com copyright
+'instapaper_ignore', 'jump', 'linebreak', 'link', 'masthead', 'media', 'meta', 'modal', 'outbrain', // slate.com junk
+'promo', 'pr_', // autoblog - press release
+'related', 'respond', 'roundcontent', // lifehacker restricted content warning
+'scroll', 'secondary', 'share', 'shopping', 'shoutbox', 'side', 'sidebar', 'sponsor', 'stamp', 'sub', 'summary', 'tags', 'tools', 'widget']; // The above list, joined into a matching regular expression
var NEGATIVE_SCORE_RE = new RegExp(NEGATIVE_SCORE_HINTS.join('|'), 'i'); // XPath to try to determine if a page is wordpress. Not always successful.
@@ -703,59 +459,8 @@ var IS_WP_SELECTOR = 'meta[name=generator][value^=WordPress]'; // Match a digit.
var PAGE_RE = new RegExp('pag(e|ing|inat)', 'i'); // Match any link text/classname/id that looks like it could mean the next
// http://bit.ly/qneNIT
-var BLOCK_LEVEL_TAGS = [
- 'article',
- 'aside',
- 'blockquote',
- 'body',
- 'br',
- 'button',
- 'canvas',
- 'caption',
- 'col',
- 'colgroup',
- 'dd',
- 'div',
- 'dl',
- 'dt',
- 'embed',
- 'fieldset',
- 'figcaption',
- 'figure',
- 'footer',
- 'form',
- 'h1',
- 'h2',
- 'h3',
- 'h4',
- 'h5',
- 'h6',
- 'header',
- 'hgroup',
- 'hr',
- 'li',
- 'map',
- 'object',
- 'ol',
- 'output',
- 'p',
- 'pre',
- 'progress',
- 'section',
- 'table',
- 'tbody',
- 'textarea',
- 'tfoot',
- 'th',
- 'thead',
- 'tr',
- 'ul',
- 'video',
-];
-var BLOCK_LEVEL_TAGS_RE = new RegExp(
- '^('.concat(BLOCK_LEVEL_TAGS.join('|'), ')$'),
- 'i'
-); // The removal is implemented as a blacklist and whitelist, this test finds
+var BLOCK_LEVEL_TAGS = ['article', 'aside', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'col', 'colgroup', 'dd', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'li', 'map', 'object', 'ol', 'output', 'p', 'pre', 'progress', 'section', 'table', 'tbody', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'ul', 'video'];
+var BLOCK_LEVEL_TAGS_RE = new RegExp("^(".concat(BLOCK_LEVEL_TAGS.join('|'), ")$"), 'i'); // The removal is implemented as a blacklist and whitelist, this test finds
// blacklisted elements that aren't whitelisted. We do this all in one
// expression-both because it's only one pass, and because this skips the
// serialization for whitelisted nodes.
@@ -775,23 +480,21 @@ function stripUnlikelyCandidates($) {
//
// :param $: a cheerio object to strip nodes from
// :return $: the cleaned cheerio object
- $('*')
- .not('a')
- .each(function(index, node) {
- var $node = $(node);
- var classes = $node.attr('class');
- var id = $node.attr('id');
- if (!id && !classes) return;
- var classAndId = ''.concat(classes || '', ' ').concat(id || '');
-
- if (CANDIDATES_WHITELIST.test(classAndId)) {
- return;
- }
+ $('*').not('a').each(function (index, node) {
+ var $node = $(node);
+ var classes = $node.attr('class');
+ var id = $node.attr('id');
+ if (!id && !classes) return;
+ var classAndId = "".concat(classes || '', " ").concat(id || '');
- if (CANDIDATES_BLACKLIST.test(classAndId)) {
- $node.remove();
- }
- });
+ if (CANDIDATES_WHITELIST.test(classAndId)) {
+ return;
+ }
+
+ if (CANDIDATES_BLACKLIST.test(classAndId)) {
+ $node.remove();
+ }
+ });
return $;
}
@@ -804,7 +507,7 @@ function stripUnlikelyCandidates($) {
function brsToPs$$1($) {
var collapsing = false;
- $('br').each(function(index, element) {
+ $('br').each(function (index, element) {
var $element = $(element);
var nextElement = $element.next().get(0);
@@ -830,8 +533,7 @@ function brsToPs$$1($) {
// :param br: Whether or not the passed node is a br
function paragraphize(node, $) {
- var br =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
+ var br = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var $node = $(node);
if (br) {
@@ -839,12 +541,9 @@ function paragraphize(node, $) {
var p = $(''); // while the next node is text or not a block level element
// append it to a new p node
- while (
- sibling &&
- !(sibling.tagName && BLOCK_LEVEL_TAGS_RE.test(sibling.tagName))
- ) {
+ while (sibling && !(sibling.tagName && BLOCK_LEVEL_TAGS_RE.test(sibling.tagName))) {
var _sibling = sibling,
- nextSibling = _sibling.nextSibling;
+ nextSibling = _sibling.nextSibling;
$(sibling).appendTo(p);
sibling = nextSibling;
}
@@ -858,7 +557,7 @@ function paragraphize(node, $) {
}
function convertDivs($) {
- $('div').each(function(index, div) {
+ $('div').each(function (index, div) {
var $div = $(div);
var convertable = $div.children(DIV_TO_P_BLOCK_TAGS).length === 0;
@@ -870,7 +569,7 @@ function convertDivs($) {
}
function convertSpans($) {
- $('span').each(function(index, span) {
+ $('span').each(function (index, span) {
var $span = $(span);
var convertable = $span.parents('p, div').length === 0;
@@ -891,6 +590,7 @@ function convertSpans($) {
// :return cheerio object with new p elements
// (By-reference mutation, though. Returned just for convenience.)
+
function convertToParagraphs$$1($) {
$ = brsToPs$$1($);
$ = convertDivs($);
@@ -899,8 +599,7 @@ function convertToParagraphs$$1($) {
}
function convertNodeTo$$1($node, $) {
- var tag =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'p';
+ var tag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'p';
var node = $node.get(0);
if (!node) {
@@ -909,11 +608,9 @@ function convertNodeTo$$1($node, $) {
var attrs = getAttrs(node) || {};
- var attribString = _Reflect$ownKeys(attrs)
- .map(function(key) {
- return ''.concat(key, '=').concat(attrs[key]);
- })
- .join(' ');
+ var attribString = _Reflect$ownKeys(attrs).map(function (key) {
+ return "".concat(key, "=").concat(attrs[key]);
+ }).join(' ');
var html;
@@ -921,19 +618,12 @@ function convertNodeTo$$1($node, $) {
// In the browser, the contents of noscript tags aren't rendered, therefore
// transforms on the noscript tag (commonly used for lazy-loading) don't work
// as expected. This test case handles that
- html =
- node.tagName.toLowerCase() === 'noscript' ? $node.text() : $node.html();
+ html = node.tagName.toLowerCase() === 'noscript' ? $node.text() : $node.html();
} else {
html = $node.contents();
}
- $node.replaceWith(
- '<'
- .concat(tag, ' ')
- .concat(attribString, '>')
- .concat(html, '')
- .concat(tag, '>')
- );
+ $node.replaceWith("<".concat(tag, " ").concat(attribString, ">").concat(html, "").concat(tag, ">"));
return $;
}
@@ -957,6 +647,7 @@ function cleanForHeight($img, $) {
} // Cleans out images where the source string matches transparent/spacer/etc
// TODO This seems very aggressive - AP
+
function removeSpacers($img, $) {
if (SPACER_RE.test($img.attr('src'))) {
$img.remove();
@@ -966,7 +657,7 @@ function removeSpacers($img, $) {
}
function cleanImages($article, $) {
- $article.find('img').each(function(index, img) {
+ $article.find('img').each(function (index, img) {
var $img = $(img);
cleanForHeight($img, $);
removeSpacers($img, $);
@@ -975,8 +666,7 @@ function cleanImages($article, $) {
}
function markToKeep(article, $, url) {
- var tags =
- arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
+ var tags = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
if (tags.length === 0) {
tags = KEEP_SELECTORS;
@@ -984,12 +674,10 @@ function markToKeep(article, $, url) {
if (url) {
var _URL$parse = URL.parse(url),
- protocol = _URL$parse.protocol,
- hostname = _URL$parse.hostname;
+ protocol = _URL$parse.protocol,
+ hostname = _URL$parse.hostname;
- tags = [].concat(_toConsumableArray(tags), [
- 'iframe[src^="'.concat(protocol, '//').concat(hostname, '"]'),
- ]);
+ tags = [].concat(_toConsumableArray(tags), ["iframe[src^=\"".concat(protocol, "//").concat(hostname, "\"]")]);
}
$(tags.join(','), article).addClass(KEEP_CLASS);
@@ -997,17 +685,15 @@ function markToKeep(article, $, url) {
}
function stripJunkTags(article, $) {
- var tags =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
+ var tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
if (tags.length === 0) {
tags = STRIP_OUTPUT_TAGS;
} // Remove matching elements, but ignore
// any element with a class of mercury-parser-keep
- $(tags.join(','), article)
- .not('.'.concat(KEEP_CLASS))
- .remove();
+
+ $(tags.join(','), article).not(".".concat(KEEP_CLASS)).remove();
return $;
}
@@ -1018,11 +704,11 @@ function cleanHOnes$$1(article, $) {
var $hOnes = $('h1', article);
if ($hOnes.length < 3) {
- $hOnes.each(function(index, node) {
+ $hOnes.each(function (index, node) {
return $(node).remove();
});
} else {
- $hOnes.each(function(index, node) {
+ $hOnes.each(function (index, node) {
convertNodeTo$$1($(node), $, 'h2');
});
}
@@ -1031,39 +717,33 @@ function cleanHOnes$$1(article, $) {
}
function removeAllButWhitelist($article, $) {
- $article.find('*').each(function(index, node) {
+ $article.find('*').each(function (index, node) {
var attrs = getAttrs(node);
- setAttrs(
- node,
- _Reflect$ownKeys(attrs).reduce(function(acc, attr) {
- if (WHITELIST_ATTRS_RE.test(attr)) {
- return _objectSpread({}, acc, _defineProperty({}, attr, attrs[attr]));
- }
+ setAttrs(node, _Reflect$ownKeys(attrs).reduce(function (acc, attr) {
+ if (WHITELIST_ATTRS_RE.test(attr)) {
+ return _objectSpread({}, acc, _defineProperty({}, attr, attrs[attr]));
+ }
- return acc;
- }, {})
- );
+ return acc;
+ }, {}));
}); // Remove the mercury-parser-keep class from result
- $('.'.concat(KEEP_CLASS), $article).removeClass(KEEP_CLASS);
+ $(".".concat(KEEP_CLASS), $article).removeClass(KEEP_CLASS);
return $article;
} // Remove attributes like style or align
+
function cleanAttributes$$1($article, $) {
// Grabbing the parent because at this point
// $article will be wrapped in a div which will
// have a score set on it.
- return removeAllButWhitelist(
- $article.parent().length ? $article.parent() : $article,
- $
- );
+ return removeAllButWhitelist($article.parent().length ? $article.parent() : $article, $);
}
function removeEmpty($article, $) {
- $article.find('p').each(function(index, p) {
+ $article.find('p').each(function (index, p) {
var $p = $(p);
- if ($p.find('iframe, img').length === 0 && $p.text().trim() === '')
- $p.remove();
+ if ($p.find('iframe, img').length === 0 && $p.text().trim() === '') $p.remove();
});
return $;
}
@@ -1071,62 +751,20 @@ function removeEmpty($article, $) {
// // CONTENT FETCHING CONSTANTS ////
// for a document.
-var NON_TOP_CANDIDATE_TAGS$1 = [
- 'br',
- 'b',
- 'i',
- 'label',
- 'hr',
- 'area',
- 'base',
- 'basefont',
- 'input',
- 'img',
- 'link',
- 'meta',
-];
-var NON_TOP_CANDIDATE_TAGS_RE$1 = new RegExp(
- '^('.concat(NON_TOP_CANDIDATE_TAGS$1.join('|'), ')$'),
- 'i'
-); // A list of selectors that specify, very clearly, either hNews or other
+var NON_TOP_CANDIDATE_TAGS$1 = ['br', 'b', 'i', 'label', 'hr', 'area', 'base', 'basefont', 'input', 'img', 'link', 'meta'];
+var NON_TOP_CANDIDATE_TAGS_RE$1 = new RegExp("^(".concat(NON_TOP_CANDIDATE_TAGS$1.join('|'), ")$"), 'i'); // A list of selectors that specify, very clearly, either hNews or other
// very content-specific style content, like Blogger templates.
// More examples here: http://microformats.org/wiki/blog-post-formats
-var HNEWS_CONTENT_SELECTORS$1 = [
- ['.hentry', '.entry-content'],
- ['entry', '.entry-content'],
- ['.entry', '.entry_content'],
- ['.post', '.postbody'],
- ['.post', '.post_body'],
- ['.post', '.post-body'],
-];
+var HNEWS_CONTENT_SELECTORS$1 = [['.hentry', '.entry-content'], ['entry', '.entry-content'], ['.entry', '.entry_content'], ['.post', '.postbody'], ['.post', '.post_body'], ['.post', '.post-body']];
var PHOTO_HINTS$1 = ['figure', 'photo', 'image', 'caption'];
var PHOTO_HINTS_RE$1 = new RegExp(PHOTO_HINTS$1.join('|'), 'i'); // A list of strings that denote a positive scoring for this content as being
// an article container. Checked against className and id.
//
// TODO: Perhaps have these scale based on their odds of being quality?
-var POSITIVE_SCORE_HINTS$1 = [
- 'article',
- 'articlecontent',
- 'instapaper_body',
- 'blog',
- 'body',
- 'content',
- 'entry-content-asset',
- 'entry',
- 'hentry',
- 'main',
- 'Normal',
- 'page',
- 'pagination',
- 'permalink',
- 'post',
- 'story',
- 'text',
- '[-_]copy', // usatoday
- '\\Bcopy',
-]; // The above list, joined into a matching regular expression
+var POSITIVE_SCORE_HINTS$1 = ['article', 'articlecontent', 'instapaper_body', 'blog', 'body', 'content', 'entry-content-asset', 'entry', 'hentry', 'main', 'Normal', 'page', 'pagination', 'permalink', 'post', 'story', 'text', '[-_]copy', // usatoday
+'\\Bcopy']; // The above list, joined into a matching regular expression
var POSITIVE_SCORE_RE$1 = new RegExp(POSITIVE_SCORE_HINTS$1.join('|'), 'i'); // Readability publisher-specific guidelines
@@ -1135,63 +773,12 @@ var READABILITY_ASSET$1 = new RegExp('entry-content-asset', 'i'); // A list of s
//
// TODO: Perhaps have these scale based on their odds of being quality?
-var NEGATIVE_SCORE_HINTS$1 = [
- 'adbox',
- 'advert',
- 'author',
- 'bio',
- 'bookmark',
- 'bottom',
- 'byline',
- 'clear',
- 'com-',
- 'combx',
- 'comment',
- 'comment\\B',
- 'contact',
- 'copy',
- 'credit',
- 'crumb',
- 'date',
- 'deck',
- 'excerpt',
- 'featured', // tnr.com has a featured_content which throws us off
- 'foot',
- 'footer',
- 'footnote',
- 'graf',
- 'head',
- 'info',
- 'infotext', // newscientist.com copyright
- 'instapaper_ignore',
- 'jump',
- 'linebreak',
- 'link',
- 'masthead',
- 'media',
- 'meta',
- 'modal',
- 'outbrain', // slate.com junk
- 'promo',
- 'pr_', // autoblog - press release
- 'related',
- 'respond',
- 'roundcontent', // lifehacker restricted content warning
- 'scroll',
- 'secondary',
- 'share',
- 'shopping',
- 'shoutbox',
- 'side',
- 'sidebar',
- 'sponsor',
- 'stamp',
- 'sub',
- 'summary',
- 'tags',
- 'tools',
- 'widget',
-]; // The above list, joined into a matching regular expression
+var NEGATIVE_SCORE_HINTS$1 = ['adbox', 'advert', 'author', 'bio', 'bookmark', 'bottom', 'byline', 'clear', 'com-', 'combx', 'comment', 'comment\\B', 'contact', 'copy', 'credit', 'crumb', 'date', 'deck', 'excerpt', 'featured', // tnr.com has a featured_content which throws us off
+'foot', 'footer', 'footnote', 'graf', 'head', 'info', 'infotext', // newscientist.com copyright
+'instapaper_ignore', 'jump', 'linebreak', 'link', 'masthead', 'media', 'meta', 'modal', 'outbrain', // slate.com junk
+'promo', 'pr_', // autoblog - press release
+'related', 'respond', 'roundcontent', // lifehacker restricted content warning
+'scroll', 'secondary', 'share', 'shopping', 'shoutbox', 'side', 'sidebar', 'sponsor', 'stamp', 'sub', 'summary', 'tags', 'tools', 'widget']; // The above list, joined into a matching regular expression
var NEGATIVE_SCORE_RE$1 = new RegExp(NEGATIVE_SCORE_HINTS$1.join('|'), 'i'); // Match a digit. Pretty clear.
var PARAGRAPH_SCORE_TAGS$1 = new RegExp('^(p|li|span|pre)$', 'i');
@@ -1229,6 +816,7 @@ function getWeight(node) {
// possible photo matches
// "try to keep photos if we can"
+
if (PHOTO_HINTS_RE$1.test(classes)) {
score += 10;
} // add 25 if class matches entry-content-asset,
@@ -1236,6 +824,7 @@ function getWeight(node) {
// Readability publisher guidelines
// https://www.readability.com/developers/guidelines
+
if (READABILITY_ASSET$1.test(classes)) {
score += 25;
}
@@ -1258,8 +847,7 @@ function scoreCommas(text) {
var idkRe = new RegExp('^(p|pre)$', 'i');
function scoreLength(textLength) {
- var tagName =
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'p';
+ var tagName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'p';
var chunks = textLength / 50;
if (chunks > 0) {
@@ -1292,6 +880,7 @@ function scoreParagraph$$1(node) {
return 0;
} // Add points for any commas within this paragraph
+
score += scoreCommas(text); // For every 50 characters in this paragraph, add another point. Up
// to 3 points.
@@ -1316,8 +905,7 @@ function addScore$$1($node, $, amount) {
try {
var score = getOrInitScore$$1($node, $) + amount;
setScore($node, $, score);
- } catch (e) {
- // Ignoring; error occurs in scoreNode
+ } catch (e) {// Ignoring; error occurs in scoreNode
}
return $node;
@@ -1337,8 +925,7 @@ function addToParent$$1(node, $, score) {
// the node's tag type
function getOrInitScore$$1($node, $) {
- var weightNodes =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
+ var weightNodes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var score = getScore($node);
if (score) {
@@ -1359,10 +946,11 @@ function getOrInitScore$$1($node, $) {
function scoreNode$$1($node) {
var _$node$get = $node.get(0),
- tagName = _$node$get.tagName; // TODO: Consider ordering by most likely.
+ tagName = _$node$get.tagName; // TODO: Consider ordering by most likely.
// E.g., if divs are a more common tag on a page,
// Could save doing that regex test on every node – AP
+
if (PARAGRAPH_SCORE_TAGS$1.test(tagName)) {
return scoreParagraph$$1($node);
}
@@ -1389,7 +977,7 @@ function scoreNode$$1($node) {
function convertSpans$1($node, $) {
if ($node.get(0)) {
var _$node$get = $node.get(0),
- tagName = _$node$get.tagName;
+ tagName = _$node$get.tagName;
if (tagName === 'span') {
// convert spans to divs
@@ -1406,41 +994,36 @@ function addScoreTo($node, $, score) {
}
function scorePs($, weightNodes) {
- $('p, pre')
- .not('[score]')
- .each(function(index, node) {
- // The raw score for this paragraph, before we add any parent/child
- // scores.
- var $node = $(node);
- $node = setScore($node, $, getOrInitScore$$1($node, $, weightNodes));
- var $parent = $node.parent();
- var rawScore = scoreNode$$1($node);
- addScoreTo($parent, $, rawScore, weightNodes);
-
- if ($parent) {
- // Add half of the individual content score to the
- // grandparent
- addScoreTo($parent.parent(), $, rawScore / 2, weightNodes);
- }
- });
+ $('p, pre').not('[score]').each(function (index, node) {
+ // The raw score for this paragraph, before we add any parent/child
+ // scores.
+ var $node = $(node);
+ $node = setScore($node, $, getOrInitScore$$1($node, $, weightNodes));
+ var $parent = $node.parent();
+ var rawScore = scoreNode$$1($node);
+ addScoreTo($parent, $, rawScore, weightNodes);
+
+ if ($parent) {
+ // Add half of the individual content score to the
+ // grandparent
+ addScoreTo($parent.parent(), $, rawScore / 2, weightNodes);
+ }
+ });
return $;
} // score content. Parents get the full value of their children's
// content score, grandparents half
+
function scoreContent$$1($) {
- var weightNodes =
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ var weightNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
// First, look for special hNews based selectors and give them a big
// boost, if they exist
- HNEWS_CONTENT_SELECTORS$1.forEach(function(_ref) {
+ HNEWS_CONTENT_SELECTORS$1.forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
- parentSelector = _ref2[0],
- childSelector = _ref2[1];
+ parentSelector = _ref2[0],
+ childSelector = _ref2[1];
- $(''.concat(parentSelector, ' ').concat(childSelector)).each(function(
- index,
- node
- ) {
+ $("".concat(parentSelector, " ").concat(childSelector)).each(function (index, node) {
addScore$$1($(node).parent(parentSelector), $, 80);
});
}); // Doubling this again
@@ -1466,75 +1049,64 @@ function mergeSiblings($candidate, topScore, $) {
var siblingScoreThreshold = Math.max(10, topScore * 0.25);
var wrappingDiv = $('');
- $candidate
- .parent()
- .children()
- .each(function(index, sibling) {
- var $sibling = $(sibling); // Ignore tags like BR, HR, etc
+ $candidate.parent().children().each(function (index, sibling) {
+ var $sibling = $(sibling); // Ignore tags like BR, HR, etc
- if (NON_TOP_CANDIDATE_TAGS_RE$1.test(sibling.tagName)) {
- return null;
- }
+ if (NON_TOP_CANDIDATE_TAGS_RE$1.test(sibling.tagName)) {
+ return null;
+ }
- var siblingScore = getScore($sibling);
+ var siblingScore = getScore($sibling);
- if (siblingScore) {
- if ($sibling.get(0) === $candidate.get(0)) {
- wrappingDiv.append($sibling);
- } else {
- var contentBonus = 0;
- var density = linkDensity($sibling); // If sibling has a very low link density,
- // give it a small bonus
-
- if (density < 0.05) {
- contentBonus += 20;
- } // If sibling has a high link density,
- // give it a penalty
-
- if (density >= 0.5) {
- contentBonus -= 20;
- } // If sibling node has the same class as
- // candidate, give it a bonus
-
- if ($sibling.attr('class') === $candidate.attr('class')) {
- contentBonus += topScore * 0.2;
- }
+ if (siblingScore) {
+ if ($sibling.get(0) === $candidate.get(0)) {
+ wrappingDiv.append($sibling);
+ } else {
+ var contentBonus = 0;
+ var density = linkDensity($sibling); // If sibling has a very low link density,
+ // give it a small bonus
- var newScore = siblingScore + contentBonus;
+ if (density < 0.05) {
+ contentBonus += 20;
+ } // If sibling has a high link density,
+ // give it a penalty
- if (newScore >= siblingScoreThreshold) {
- return wrappingDiv.append($sibling);
- }
- if (sibling.tagName === 'p') {
- var siblingContent = $sibling.text();
- var siblingContentLength = textLength(siblingContent);
+ if (density >= 0.5) {
+ contentBonus -= 20;
+ } // If sibling node has the same class as
+ // candidate, give it a bonus
- if (siblingContentLength > 80 && density < 0.25) {
- return wrappingDiv.append($sibling);
- }
- if (
- siblingContentLength <= 80 &&
- density === 0 &&
- hasSentenceEnd(siblingContent)
- ) {
- return wrappingDiv.append($sibling);
- }
+ if ($sibling.attr('class') === $candidate.attr('class')) {
+ contentBonus += topScore * 0.2;
+ }
+
+ var newScore = siblingScore + contentBonus;
+
+ if (newScore >= siblingScoreThreshold) {
+ return wrappingDiv.append($sibling);
+ }
+
+ if (sibling.tagName === 'p') {
+ var siblingContent = $sibling.text();
+ var siblingContentLength = textLength(siblingContent);
+
+ if (siblingContentLength > 80 && density < 0.25) {
+ return wrappingDiv.append($sibling);
+ }
+
+ if (siblingContentLength <= 80 && density === 0 && hasSentenceEnd(siblingContent)) {
+ return wrappingDiv.append($sibling);
}
}
}
+ }
- return null;
- });
+ return null;
+ });
- if (
- wrappingDiv.children().length === 1 &&
- wrappingDiv
- .children()
- .first()
- .get(0) === $candidate.get(0)
- ) {
+ if (wrappingDiv.children().length === 1 && wrappingDiv.children().first().get(0) === $candidate.get(0)) {
return $candidate;
}
@@ -1546,7 +1118,7 @@ function mergeSiblings($candidate, topScore, $) {
function findTopCandidate$$1($) {
var $candidate;
var topScore = 0;
- $('[score]').each(function(index, node) {
+ $('[score]').each(function (index, node) {
// Ignore tags like BR, HR, etc
if (NON_TOP_CANDIDATE_TAGS_RE$1.test(node.tagName)) {
return;
@@ -1611,6 +1183,7 @@ function removeUnlessContent($node, $, weight) {
} // Too high of a link density, despite the score being
// high.
+
if (weight >= 25 && density > 0.5) {
// Don't remove the node if it's a list and the
// previous sibling starts with a colon though. That
@@ -1621,10 +1194,7 @@ function removeUnlessContent($node, $, weight) {
if (nodeIsList) {
var previousNode = $node.prev();
- if (
- previousNode &&
- normalizeSpaces(previousNode.text()).slice(-1) === ':'
- ) {
+ if (previousNode && normalizeSpaces(previousNode.text()).slice(-1) === ':') {
return;
}
}
@@ -1647,15 +1217,12 @@ function removeUnlessContent($node, $, weight) {
//
// Return this same doc.
+
function cleanTags$$1($article, $) {
- $(CLEAN_CONDITIONALLY_TAGS, $article).each(function(index, node) {
+ $(CLEAN_CONDITIONALLY_TAGS, $article).each(function (index, node) {
var $node = $(node); // If marked to keep, skip it
- if (
- $node.hasClass(KEEP_CLASS) ||
- $node.find('.'.concat(KEEP_CLASS)).length > 0
- )
- return;
+ if ($node.hasClass(KEEP_CLASS) || $node.find(".".concat(KEEP_CLASS)).length > 0) return;
var weight = getScore($node);
if (!weight) {
@@ -1663,6 +1230,7 @@ function cleanTags$$1($article, $) {
setScore($node, $, weight);
} // drop node if its weight is < 0
+
if (weight < 0) {
$node.remove();
} else {
@@ -1674,9 +1242,8 @@ function cleanTags$$1($article, $) {
}
function cleanHeaders($article, $) {
- var title =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
- $(HEADER_TAG_LIST, $article).each(function(index, header) {
+ var title = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+ $(HEADER_TAG_LIST, $article).each(function (index, header) {
var $header = $(header); // Remove any headers that appear before all other p tags in the
// document. This probably means that it was part of the title, a
// subtitle or something else extraneous like a datestamp or byline,
@@ -1686,11 +1253,13 @@ function cleanHeaders($article, $) {
return $header.remove();
} // Remove any headers that match the title exactly.
+
if (normalizeSpaces($(header).text()) === title) {
return $header.remove();
} // If this header has a negative weight, it's probably junk.
// Get rid of it.
+
if (getWeight($(header)) < 0) {
return $header.remove();
}
@@ -1713,7 +1282,7 @@ function rewriteTopLevel$$1(article, $) {
function absolutize($, rootUrl, attr, $content) {
var baseUrl = $('base').attr('href');
- $('['.concat(attr, ']'), $content).each(function(_, node) {
+ $("[".concat(attr, "]"), $content).each(function (_, node) {
var attrs = getAttrs(node);
var url = attrs[attr];
var absoluteUrl = URL.resolve(baseUrl || rootUrl, url);
@@ -1722,7 +1291,7 @@ function absolutize($, rootUrl, attr, $content) {
}
function absolutizeSet($, rootUrl, $content) {
- $('[srcset]', $content).each(function(_, node) {
+ $('[srcset]', $content).each(function (_, node) {
var attrs = getAttrs(node);
var urlSet = attrs.srcset;
@@ -1730,23 +1299,16 @@ function absolutizeSet($, rootUrl, $content) {
// a comma should be considered part of the candidate URL unless preceded by a descriptor
// descriptors can only contain positive numbers followed immediately by either 'w' or 'x'
// space characters inside the URL should be encoded (%20 or +)
- var candidates = urlSet.match(
- /(?:\s*)(\S+(?:\s*[\d.]+[wx])?)(?:\s*,\s*)?/g
- );
- var absoluteCandidates = candidates.map(function(candidate) {
+ var candidates = urlSet.match(/(?:\s*)(\S+(?:\s*[\d.]+[wx])?)(?:\s*,\s*)?/g);
+ var absoluteCandidates = candidates.map(function (candidate) {
// a candidate URL cannot start or end with a comma
// descriptors are separated from the URLs by unescaped whitespace
- var parts = candidate
- .trim()
- .replace(/,$/, '')
- .split(/\s+/);
+ var parts = candidate.trim().replace(/,$/, '').split(/\s+/);
parts[0] = URL.resolve(rootUrl, parts[0]);
return parts.join(' ');
});
- var absoluteUrlSet = _toConsumableArray(
- new _Set(absoluteCandidates)
- ).join(', ');
+ var absoluteUrlSet = _toConsumableArray(new _Set(absoluteCandidates)).join(', ');
setAttr(node, 'srcset', absoluteUrlSet);
}
@@ -1754,7 +1316,7 @@ function absolutizeSet($, rootUrl, $content) {
}
function makeLinksAbsolute$$1($content, $, url) {
- ['href', 'src'].forEach(function(attr) {
+ ['href', 'src'].forEach(function (attr) {
return absolutize($, url, attr, $content);
});
absolutizeSet($, url, $content);
@@ -1786,9 +1348,8 @@ function linkDensity($node) {
// search for, find a meta tag associated.
function extractFromMeta$$1($, metaNames, cachedNames) {
- var cleanTags =
- arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
- var foundNames = metaNames.filter(function(name) {
+ var cleanTags = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var foundNames = metaNames.filter(function (name) {
return cachedNames.indexOf(name) !== -1;
}); // eslint-disable-next-line no-restricted-syntax
@@ -1801,18 +1362,15 @@ function extractFromMeta$$1($, metaNames, cachedNames) {
var name = _step.value;
var type = 'name';
var value = 'value';
- var nodes = $('meta['.concat(type, '="').concat(name, '"]')); // Get the unique value of every matching node, in case there
+ var nodes = $("meta[".concat(type, "=\"").concat(name, "\"]")); // Get the unique value of every matching node, in case there
// are two meta tags with the same name and value.
// Remove empty values.
- var values = nodes
- .map(function(index, node) {
- return $(node).attr(value);
- })
- .toArray()
- .filter(function(text) {
- return text !== '';
- }); // If we have more than one value for the same name, we have a
+ var values = nodes.map(function (index, node) {
+ return $(node).attr(value);
+ }).toArray().filter(function (text) {
+ return text !== '';
+ }); // If we have more than one value for the same name, we have a
// conflict and can't trust any of them. Skip this name. If we have
// zero, that means our meta tags had no values. Skip this name
// also.
@@ -1830,20 +1388,17 @@ function extractFromMeta$$1($, metaNames, cachedNames) {
}
return {
- v: metaValue,
+ v: metaValue
};
}
};
- for (
- var _iterator = _getIterator(foundNames), _step;
- !(_iteratorNormalCompletion = (_step = _iterator.next()).done);
- _iteratorNormalCompletion = true
- ) {
+ for (var _iterator = _getIterator(foundNames), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _ret = _loop();
- if (_typeof(_ret) === 'object') return _ret.v;
+ if (_typeof(_ret) === "object") return _ret.v;
} // If nothing is found, return null
+
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
@@ -1869,6 +1424,7 @@ function isGoodNode($node, maxChildren) {
return false;
} // If it looks to be within a comment, skip it.
+
if (withinComment$$1($node)) {
return false;
}
@@ -1878,22 +1434,17 @@ function isGoodNode($node, maxChildren) {
// be extractable from the document. This is for flat
// meta-information, like author, title, date published, etc.
+
function extractFromSelectors$$1($, selectors) {
- var maxChildren =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
- var textOnly =
- arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
+ var maxChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+ var textOnly = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
// eslint-disable-next-line no-restricted-syntax
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
- for (
- var _iterator = _getIterator(selectors), _step;
- !(_iteratorNormalCompletion = (_step = _iterator.next()).done);
- _iteratorNormalCompletion = true
- ) {
+ for (var _iterator = _getIterator(selectors), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var selector = _step.value;
var nodes = $(selector); // If we didn't get exactly one of this selector, this may be
// a list of articles or comments. Skip it.
@@ -1938,17 +1489,17 @@ function extractFromSelectors$$1($, selectors) {
function stripTags(text, $) {
// Wrapping text in html element prevents errors when text
// has no html
- var cleanText = $(''.concat(text, '')).text();
+ var cleanText = $("".concat(text, "")).text();
return cleanText === '' ? text : cleanText;
}
function withinComment$$1($node) {
var parents = $node.parents().toArray();
- var commentParent = parents.find(function(parent) {
+ var commentParent = parents.find(function (parent) {
var attrs = getAttrs(parent);
var nodeClass = attrs.class,
- id = attrs.id;
- var classAndId = ''.concat(nodeClass, ' ').concat(id);
+ id = attrs.id;
+ var classAndId = "".concat(nodeClass, " ").concat(id);
return classAndId.includes('comment');
});
return commentParent !== undefined;
@@ -1967,10 +1518,10 @@ function isWordpress($) {
function getAttrs(node) {
var attribs = node.attribs,
- attributes = node.attributes;
+ attributes = node.attributes;
if (!attribs && attributes) {
- var attrs = _Reflect$ownKeys(attributes).reduce(function(acc, index) {
+ var attrs = _Reflect$ownKeys(attributes).reduce(function (acc, index) {
var attr = attributes[index];
if (!attr.name || !attr.value) return acc;
acc[attr.name] = attr.value;
@@ -2001,7 +1552,7 @@ function setAttrs(node, attrs) {
node.removeAttribute(node.attributes[0].name);
}
- _Reflect$ownKeys(attrs).forEach(function(key) {
+ _Reflect$ownKeys(attrs).forEach(function (key) {
node.setAttribute(key, attrs[key]);
});
}
@@ -2021,10 +1572,10 @@ var TAGS_TO_REMOVE = ['script', 'style', 'form'].join(',');
// the src attribute so the images are no longer lazy loaded.
function convertLazyLoadedImages($) {
- $('img').each(function(_, img) {
+ $('img').each(function (_, img) {
var attrs = getAttrs(img);
- _Reflect$ownKeys(attrs).forEach(function(attr) {
+ _Reflect$ownKeys(attrs).forEach(function (attr) {
var value = attrs[attr];
if (attr !== 'src' && IS_LINK.test(value) && IS_IMAGE.test(value)) {
@@ -2040,11 +1591,7 @@ function isComment(index, node) {
}
function cleanComments($) {
- $.root()
- .find('*')
- .contents()
- .filter(isComment)
- .remove();
+ $.root().find('*').contents().filter(isComment).remove();
return $;
}
@@ -2061,80 +1608,71 @@ var Resource = {
// :param response: If set, use as the response rather than
// attempting to fetch it ourselves. Expects a
// string.
- create: (function() {
+ create: function () {
var _create = _asyncToGenerator(
- /*#__PURE__*/
- _regeneratorRuntime.mark(function _callee(
- url,
- preparedResponse,
- parsedUrl
- ) {
- var result, validResponse;
- return _regeneratorRuntime.wrap(
- function _callee$(_context) {
- while (1) {
- switch ((_context.prev = _context.next)) {
- case 0:
- if (!preparedResponse) {
- _context.next = 5;
- break;
- }
-
- validResponse = {
- statusMessage: 'OK',
- statusCode: 200,
- headers: {
- 'content-type': 'text/html',
- 'content-length': 500,
- },
- };
- result = {
- body: preparedResponse,
- response: validResponse,
- };
- _context.next = 8;
- break;
-
- case 5:
- _context.next = 7;
- return fetchResource(url, parsedUrl);
-
- case 7:
- result = _context.sent;
-
- case 8:
- if (!result.error) {
- _context.next = 11;
- break;
- }
-
- result.failed = true;
- return _context.abrupt('return', result);
-
- case 11:
- return _context.abrupt('return', this.generateDoc(result));
-
- case 12:
- case 'end':
- return _context.stop();
+ /*#__PURE__*/
+ _regeneratorRuntime.mark(function _callee(url, preparedResponse, parsedUrl) {
+ var result, validResponse;
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ if (!preparedResponse) {
+ _context.next = 5;
+ break;
}
- }
- },
- _callee,
- this
- );
- })
- );
+
+ validResponse = {
+ statusMessage: 'OK',
+ statusCode: 200,
+ headers: {
+ 'content-type': 'text/html',
+ 'content-length': 500
+ }
+ };
+ result = {
+ body: preparedResponse,
+ response: validResponse
+ };
+ _context.next = 8;
+ break;
+
+ case 5:
+ _context.next = 7;
+ return fetchResource(url, parsedUrl);
+
+ case 7:
+ result = _context.sent;
+
+ case 8:
+ if (!result.error) {
+ _context.next = 11;
+ break;
+ }
+
+ result.failed = true;
+ return _context.abrupt("return", result);
+
+ case 11:
+ return _context.abrupt("return", this.generateDoc(result));
+
+ case 12:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, this);
+ }));
function create(_x, _x2, _x3) {
return _create.apply(this, arguments);
}
return create;
- })(),
+ }(),
generateDoc: function generateDoc(_ref) {
var content = _ref.body,
- response = _ref.response;
+ response = _ref.response;
var contentType = response.headers['content-type']; // TODO: Implement is_text function from
// https://github.com/ReadabilityHoldings/readability/blob/8dc89613241d04741ebd42fa9fa7df1b1d746303/readability/utils/text.py#L57
@@ -2144,7 +1682,7 @@ var Resource = {
var $ = this.encodeDoc({
content: content,
- contentType: contentType,
+ contentType: contentType
});
if ($.root().children().length === 0) {
@@ -2158,7 +1696,7 @@ var Resource = {
},
encodeDoc: function encodeDoc(_ref2) {
var content = _ref2.content,
- contentType = _ref2.contentType;
+ contentType = _ref2.contentType;
var encoding = getEncoding(contentType);
var decodedContent = iconv.decode(content, encoding);
var $ = cheerio.load(decodedContent); // after first cheerio.load, check to see if encoding matches
@@ -2172,25 +1710,18 @@ var Resource = {
}
return $;
- },
+ }
};
var merge = function merge(extractor, domains) {
- return domains.reduce(function(acc, domain) {
+ return domains.reduce(function (acc, domain) {
acc[domain] = extractor;
return acc;
}, {});
};
function mergeSupportedDomains(extractor) {
- return extractor.supportedDomains
- ? merge(
- extractor,
- [extractor.domain].concat(
- _toConsumableArray(extractor.supportedDomains)
- )
- )
- : merge(extractor, [extractor.domain]);
+ return extractor.supportedDomains ? merge(extractor, [extractor.domain].concat(_toConsumableArray(extractor.supportedDomains))) : merge(extractor, [extractor.domain]);
}
var BloggerExtractor = {
@@ -2204,18 +1735,18 @@ var BloggerExtractor = {
clean: [],
// Convert the noscript tag to a div
transforms: {
- noscript: 'div',
- },
+ noscript: 'div'
+ }
},
author: {
- selectors: ['.post-author-name'],
+ selectors: ['.post-author-name']
},
title: {
- selectors: ['.post h2.title'],
+ selectors: ['.post h2.title']
},
date_published: {
- selectors: ['span.publishdate'],
- },
+ selectors: ['span.publishdate']
+ }
};
var NYMagExtractor = {
@@ -2238,33 +1769,26 @@ var NYMagExtractor = {
noscript: function noscript($node, $) {
var $children = $.browser ? $($node.text()) : $node.children();
- if (
- $children.length === 1 &&
- $children.get(0) !== undefined &&
- $children.get(0).tagName.toLowerCase() === 'img'
- ) {
+ if ($children.length === 1 && $children.get(0) !== undefined && $children.get(0).tagName.toLowerCase() === 'img') {
return 'figure';
}
return null;
- },
- },
+ }
+ }
},
title: {
- selectors: ['h1.lede-feature-title', 'h1.headline-primary', 'h1'],
+ selectors: ['h1.lede-feature-title', 'h1.headline-primary', 'h1']
},
author: {
- selectors: ['.by-authors', '.lede-feature-author'],
+ selectors: ['.by-authors', '.lede-feature-author']
},
dek: {
- selectors: ['.lede-feature-teaser'],
+ selectors: ['.lede-feature-teaser']
},
date_published: {
- selectors: [
- ['time.article-timestamp[datetime]', 'datetime'],
- 'time.article-timestamp',
- ],
- },
+ selectors: [['time.article-timestamp[datetime]', 'datetime'], 'time.article-timestamp']
+ }
};
var WikipediaExtractor = {
@@ -2282,23 +1806,18 @@ var WikipediaExtractor = {
}
},
'.infobox caption': 'figcaption',
- '.infobox': 'figure',
+ '.infobox': 'figure'
},
// Selectors to remove from the extracted content
- clean: [
- '.mw-editsection',
- 'figure tr, figure td, figure tbody',
- '#toc',
- '.navbox',
- ],
+ clean: ['.mw-editsection', 'figure tr, figure td, figure tbody', '#toc', '.navbox']
},
author: 'Wikipedia Contributors',
title: {
- selectors: ['h2.title'],
+ selectors: ['h2.title']
},
date_published: {
- selectors: ['#footer-info-lastmod'],
- },
+ selectors: ['#footer-info-lastmod']
+ }
};
var TwitterExtractor = {
@@ -2317,27 +1836,27 @@ var TwitterExtractor = {
},
// Twitter wraps @ with s, which
// renders as a strikethrough
- s: 'span',
+ s: 'span'
},
selectors: ['.permalink[role=main]'],
defaultCleaner: false,
- clean: ['.stream-item-footer', 'button', '.tweet-details-fixer'],
+ clean: ['.stream-item-footer', 'button', '.tweet-details-fixer']
},
author: {
- selectors: ['.tweet.permalink-tweet .username'],
+ selectors: ['.tweet.permalink-tweet .username']
},
date_published: {
- selectors: [['.permalink-tweet ._timestamp[data-time-ms]', 'data-time-ms']],
- },
+ selectors: [['.permalink-tweet ._timestamp[data-time-ms]', 'data-time-ms']]
+ }
};
var NYTimesExtractor = {
domain: 'www.nytimes.com',
title: {
- selectors: ['h1.g-headline', 'h1[itemprop="headline"]', 'h1.headline'],
+ selectors: ['h1.g-headline', 'h1[itemprop="headline"]', 'h1.headline']
},
author: {
- selectors: [['meta[name="author"]', 'value'], '.g-byline', '.byline'],
+ selectors: [['meta[name="author"]', 'value'], '.g-byline', '.byline']
},
content: {
selectors: ['div.g-blocks', 'article#story'],
@@ -2347,32 +1866,19 @@ var NYTimesExtractor = {
var width = 640;
src = src.replace('{{size}}', width);
$node.attr('src', src);
- },
+ }
},
- clean: [
- '.ad',
- 'header#story-header',
- '.story-body-1 .lede.video',
- '.visually-hidden',
- '#newsletter-promo',
- '.promo',
- '.comments-button',
- '.hidden',
- '.comments',
- '.supplemental',
- '.nocontent',
- '.story-footer-links',
- ],
+ clean: ['.ad', 'header#story-header', '.story-body-1 .lede.video', '.visually-hidden', '#newsletter-promo', '.promo', '.comments-button', '.hidden', '.comments', '.supplemental', '.nocontent', '.story-footer-links']
},
date_published: {
- selectors: [['meta[name="article:published"]', 'value']],
+ selectors: [['meta[name="article:published"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: null,
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2380,30 +1886,27 @@ var NYTimesExtractor = {
var TheAtlanticExtractor = {
domain: 'www.theatlantic.com',
title: {
- selectors: ['h1.hed'],
+ selectors: ['h1.hed']
},
author: {
- selectors: ['article#article .article-cover-extra .metadata .byline a'],
+ selectors: ['article#article .article-cover-extra .metadata .byline a']
},
content: {
- selectors: [
- ['.article-cover figure.lead-img', '.article-body'],
- '.article-body',
- ],
+ selectors: [['.article-cover figure.lead-img', '.article-body'], '.article-body'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: [],
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.partner-box', '.callout'],
+ clean: ['.partner-box', '.callout']
},
date_published: {
- selectors: [['time[itemProp="datePublished"]', 'datetime']],
+ selectors: [['time[itemProp="datePublished"]', 'datetime']]
},
lead_image_url: null,
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2412,10 +1915,10 @@ var TheAtlanticExtractor = {
var NewYorkerExtractor = {
domain: 'www.newyorker.com',
title: {
- selectors: ['h1.title'],
+ selectors: ['h1.title']
},
author: {
- selectors: ['.contributors'],
+ selectors: ['.contributors']
},
content: {
selectors: ['div#articleBody', 'div.articleBody'],
@@ -2425,23 +1928,20 @@ var NewYorkerExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
+ clean: []
},
date_published: {
- selectors: [
- ['meta[name="article:published_time"]', 'value'],
- ['time[itemProp="datePublished"]', 'content'],
- ],
- timezone: 'America/New_York',
+ selectors: [['meta[name="article:published_time"]', 'value'], ['time[itemProp="datePublished"]', 'content']],
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: ['.dek', 'h2.dek'],
+ selectors: ['.dek', 'h2.dek']
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2450,10 +1950,10 @@ var NewYorkerExtractor = {
var WiredExtractor = {
domain: 'www.wired.com',
title: {
- selectors: ['h1.post-title'],
+ selectors: ['h1.post-title']
},
author: {
- selectors: ['a[rel="author"]'],
+ selectors: ['a[rel="author"]']
},
content: {
selectors: ['article.content'],
@@ -2463,19 +1963,19 @@ var WiredExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.visually-hidden', 'figcaption img.photo'],
+ clean: ['.visually-hidden', 'figcaption img.photo']
},
date_published: {
- selectors: [['meta[itemprop="datePublished"]', 'value']],
+ selectors: [['meta[itemprop="datePublished"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2484,10 +1984,10 @@ var WiredExtractor = {
var MSNExtractor = {
domain: 'www.msn.com',
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: ['span.authorname-txt'],
+ selectors: ['span.authorname-txt']
},
content: {
selectors: ['div.richtext'],
@@ -2497,19 +1997,19 @@ var MSNExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['span.caption'],
+ clean: ['span.caption']
},
date_published: {
- selectors: ['span.time'],
+ selectors: ['span.time']
},
lead_image_url: {
- selectors: [],
+ selectors: []
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2518,37 +2018,34 @@ var MSNExtractor = {
var YahooExtractor = {
domain: 'www.yahoo.com',
title: {
- selectors: ['header.canvas-header'],
+ selectors: ['header.canvas-header']
},
author: {
- selectors: ['span.provider-name'],
+ selectors: ['span.provider-name']
},
content: {
- selectors: [
- // enter content selectors
- '.content-canvas',
- ],
+ selectors: [// enter content selectors
+ '.content-canvas'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: [],
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.figure-caption'],
+ clean: ['.figure-caption']
},
date_published: {
- selectors: [['time.date[datetime]', 'datetime']],
+ selectors: [['time.date[datetime]', 'datetime']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [
- // enter dek selectors
- ],
+ selectors: [// enter dek selectors
+ ]
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2557,54 +2054,43 @@ var YahooExtractor = {
var BuzzfeedExtractor = {
domain: 'www.buzzfeed.com',
title: {
- selectors: ['h1[id="post-title"]'],
+ selectors: ['h1[id="post-title"]']
},
author: {
- selectors: ['a[data-action="user/username"]', 'byline__author'],
+ selectors: ['a[data-action="user/username"]', 'byline__author']
},
content: {
- selectors: [
- ['.longform_custom_header_media', '#buzz_sub_buzz'],
- '#buzz_sub_buzz',
- ],
+ selectors: [['.longform_custom_header_media', '#buzz_sub_buzz'], '#buzz_sub_buzz'],
defaultCleaner: false,
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
h2: 'b',
- 'div.longform_custom_header_media': function divLongform_custom_header_media(
- $node
- ) {
+ 'div.longform_custom_header_media': function divLongform_custom_header_media($node) {
if ($node.has('img') && $node.has('.longform_header_image_source')) {
return 'figure';
}
return null;
},
- 'figure.longform_custom_header_media .longform_header_image_source':
- 'figcaption',
+ 'figure.longform_custom_header_media .longform_header_image_source': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [
- '.instapaper_ignore',
- '.suplist_list_hide .buzz_superlist_item .buzz_superlist_number_inline',
- '.share-box',
- '.print',
- ],
+ clean: ['.instapaper_ignore', '.suplist_list_hide .buzz_superlist_item .buzz_superlist_number_inline', '.share-box', '.print']
},
date_published: {
- selectors: ['.buzz-datetime'],
+ selectors: ['.buzz-datetime']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2613,10 +2099,10 @@ var BuzzfeedExtractor = {
var WikiaExtractor = {
domain: 'fandom.wikia.com',
title: {
- selectors: ['h1.entry-title'],
+ selectors: ['h1.entry-title']
},
author: {
- selectors: ['.author vcard', '.fn'],
+ selectors: ['.author vcard', '.fn']
},
content: {
selectors: ['.grid-content', '.entry-content'],
@@ -2626,19 +2112,19 @@ var WikiaExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
+ clean: []
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2647,30 +2133,27 @@ var WikiaExtractor = {
var LittleThingsExtractor = {
domain: 'www.littlethings.com',
title: {
- selectors: ['h1.post-title'],
+ selectors: ['h1.post-title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
content: {
- selectors: [
- // enter content selectors
- '.mainContentIntro',
- '.content-wrapper',
- ],
+ selectors: [// enter content selectors
+ '.mainContentIntro', '.content-wrapper'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: [],
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
+ clean: []
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
// Rename CustomExtractor
@@ -2679,100 +2162,79 @@ var LittleThingsExtractor = {
var PoliticoExtractor = {
domain: 'www.politico.com',
title: {
- selectors: [
- // enter title selectors
- ['meta[name="og:title"]', 'value'],
- ],
+ selectors: [// enter title selectors
+ ['meta[name="og:title"]', 'value']]
},
author: {
- selectors: ['.story-main-content .byline .vcard'],
+ selectors: ['.story-main-content .byline .vcard']
},
content: {
- selectors: [
- // enter content selectors
- '.story-main-content',
- '.content-group',
- '.story-core',
- '.story-text',
- ],
+ selectors: [// enter content selectors
+ '.story-main-content', '.content-group', '.story-core', '.story-text'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: [],
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['figcaption'],
+ clean: ['figcaption']
},
date_published: {
- selectors: [['.story-main-content .timestamp time[datetime]', 'datetime']],
+ selectors: [['.story-main-content .timestamp time[datetime]', 'datetime']]
},
lead_image_url: {
- selectors: [
- // enter lead_image_url selectors
- ['meta[name="og:image"]', 'value'],
- ],
+ selectors: [// enter lead_image_url selectors
+ ['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: null,
- excerpt: null,
+ excerpt: null
};
var DeadspinExtractor = {
domain: 'deadspin.com',
- supportedDomains: [
- 'jezebel.com',
- 'lifehacker.com',
- 'kotaku.com',
- 'gizmodo.com',
- 'jalopnik.com',
- 'kinja.com',
- ],
+ supportedDomains: ['jezebel.com', 'lifehacker.com', 'kotaku.com', 'gizmodo.com', 'jalopnik.com', 'kinja.com'],
title: {
- selectors: ['h1.headline'],
+ selectors: ['h1.headline']
},
author: {
- selectors: ['.author'],
+ selectors: ['.author']
},
content: {
selectors: ['.post-content', '.entry-content'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- 'iframe.lazyload[data-recommend-id^="youtube://"]': function iframeLazyloadDataRecommendIdYoutube(
- $node
- ) {
+ 'iframe.lazyload[data-recommend-id^="youtube://"]': function iframeLazyloadDataRecommendIdYoutube($node) {
var youtubeId = $node.attr('id').split('youtube-')[1];
- $node.attr('src', 'https://www.youtube.com/embed/'.concat(youtubeId));
- },
+ $node.attr('src', "https://www.youtube.com/embed/".concat(youtubeId));
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.magnifier', '.lightbox'],
+ clean: ['.magnifier', '.lightbox']
},
date_published: {
- selectors: [['time.updated[datetime]', 'datetime']],
+ selectors: [['time.updated[datetime]', 'datetime']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
next_page_url: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
excerpt: {
- selectors: [
- // enter selectors
- ],
- },
+ selectors: [// enter selectors
+ ]
+ }
};
// Rename CustomExtractor
@@ -2781,10 +2243,10 @@ var DeadspinExtractor = {
var BroadwayWorldExtractor = {
domain: 'www.broadwayworld.com',
title: {
- selectors: ['h1.article-title'],
+ selectors: ['h1.article-title']
},
author: {
- selectors: ['span[itemprop=author]'],
+ selectors: ['span[itemprop=author]']
},
content: {
selectors: ['div[itemprop=articlebody]'],
@@ -2794,27 +2256,25 @@ var BroadwayWorldExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
+ clean: []
},
date_published: {
- selectors: [['meta[itemprop=datePublished]', 'value']],
+ selectors: [['meta[itemprop=datePublished]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
excerpt: {
- selectors: [
- // enter selectors
- ],
- },
+ selectors: [// enter selectors
+ ]
+ }
};
// Rename CustomExtractor
@@ -2823,67 +2283,58 @@ var BroadwayWorldExtractor = {
var ApartmentTherapyExtractor = {
domain: 'www.apartmenttherapy.com',
title: {
- selectors: ['h1.headline'],
+ selectors: ['h1.headline']
},
author: {
- selectors: ['.PostByline__name'],
+ selectors: ['.PostByline__name']
},
content: {
selectors: ['div.post__content'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- 'div[data-render-react-id="images/LazyPicture"]': function divDataRenderReactIdImagesLazyPicture(
- $node,
- $
- ) {
+ 'div[data-render-react-id="images/LazyPicture"]': function divDataRenderReactIdImagesLazyPicture($node, $) {
var data = JSON.parse($node.attr('data-props'));
var src = data.sources[0].src;
var $img = $('').attr('src', src);
$node.replaceWith($img);
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
+ clean: []
},
date_published: {
- selectors: [['.PostByline__timestamp[datetime]', 'datetime']],
+ selectors: [['.PostByline__timestamp[datetime]', 'datetime']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
next_page_url: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
excerpt: {
- selectors: [
- // enter selectors
- ],
- },
+ selectors: [// enter selectors
+ ]
+ }
};
var MediumExtractor = {
domain: 'medium.com',
supportedDomains: ['trackchanges.postlight.com'],
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
content: {
- selectors: [
- ['.section-content'],
- '.section-content',
- 'article > div > section',
- ],
+ selectors: [['.section-content'], '.section-content', 'article > div > section'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
@@ -2894,11 +2345,12 @@ var MediumExtractor = {
if (ytRe.test(thumb)) {
var _thumb$match = thumb.match(ytRe),
- _thumb$match2 = _slicedToArray(_thumb$match, 2),
- _ = _thumb$match2[0],
- youtubeId = _thumb$match2[1]; // eslint-disable-line
+ _thumb$match2 = _slicedToArray(_thumb$match, 2),
+ _ = _thumb$match2[0],
+ youtubeId = _thumb$match2[1]; // eslint-disable-line
- $node.attr('src', 'https://www.youtube.com/embed/'.concat(youtubeId));
+
+ $node.attr('src', "https://www.youtube.com/embed/".concat(youtubeId));
var $parent = $node.parents('figure');
var $caption = $parent.find('figcaption');
$parent.empty().append([$node, $caption]);
@@ -2911,53 +2363,49 @@ var MediumExtractor = {
var $img = $node.find('img').slice(-1)[0];
var $caption = $node.find('figcaption');
$node.empty().append([$img, $caption]);
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
+ clean: []
},
date_published: {
- selectors: [['time[datetime]', 'datetime']],
+ selectors: [['time[datetime]', 'datetime']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
next_page_url: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
excerpt: {
- selectors: [
- // enter selectors
- ],
- },
+ selectors: [// enter selectors
+ ]
+ }
};
var WwwTmzComExtractor = {
domain: 'www.tmz.com',
title: {
- selectors: ['.post-title-breadcrumb', 'h1', '.headline'],
+ selectors: ['.post-title-breadcrumb', 'h1', '.headline']
},
author: 'TMZ STAFF',
date_published: {
selectors: ['.article-posted-date'],
- timezone: 'America/Los_Angeles',
+ timezone: 'America/Los_Angeles'
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article-content', '.all-post-body'],
@@ -2967,26 +2415,26 @@ var WwwTmzComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.lightbox-link'],
- },
+ clean: ['.lightbox-link']
+ }
};
var WwwWashingtonpostComExtractor = {
domain: 'www.washingtonpost.com',
title: {
- selectors: ['h1', '#topper-headline-wrapper'],
+ selectors: ['h1', '#topper-headline-wrapper']
},
author: {
- selectors: ['.pb-author-name'],
+ selectors: ['.pb-author-name']
},
date_published: {
- selectors: [['.author-timestamp[itemprop="datePublished"]', 'content']],
+ selectors: [['.author-timestamp[itemprop="datePublished"]', 'content']]
},
dek: {
- selectors: [],
+ selectors: []
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article-body'],
@@ -3001,34 +2449,31 @@ var WwwWashingtonpostComExtractor = {
$node.remove();
return null;
},
- '.pb-caption': 'figcaption',
+ '.pb-caption': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.interstitial-link', '.newsletter-inline-unit'],
- },
+ clean: ['.interstitial-link', '.newsletter-inline-unit']
+ }
};
var WwwHuffingtonpostComExtractor = {
domain: 'www.huffingtonpost.com',
title: {
- selectors: ['h1.headline__title'],
+ selectors: ['h1.headline__title']
},
author: {
- selectors: ['span.author-card__details__name'],
+ selectors: ['span.author-card__details__name']
},
date_published: {
- selectors: [
- ['meta[name="article:modified_time"]', 'value'],
- ['meta[name="article:published_time"]', 'value'],
- ],
+ selectors: [['meta[name="article:modified_time"]', 'value'], ['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['h2.headline__subtitle'],
+ selectors: ['h2.headline__subtitle']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.entry__body'],
@@ -3039,67 +2484,57 @@ var WwwHuffingtonpostComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [
- '.pull-quote',
- '.tag-cloud',
- '.embed-asset',
- '.below-entry',
- '.entry-corrections',
- '#suggested-story',
- ],
- },
+ clean: ['.pull-quote', '.tag-cloud', '.embed-asset', '.below-entry', '.entry-corrections', '#suggested-story']
+ }
};
var NewrepublicComExtractor = {
domain: 'newrepublic.com',
title: {
- selectors: ['h1.article-headline', '.minutes-primary h1.minute-title'],
+ selectors: ['h1.article-headline', '.minutes-primary h1.minute-title']
},
author: {
- selectors: ['div.author-list', '.minutes-primary h3.minute-byline'],
+ selectors: ['div.author-list', '.minutes-primary h3.minute-byline']
},
date_published: {
selectors: [['meta[name="article:published_time"]', 'value']],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: ['h2.article-subhead'],
+ selectors: ['h2.article-subhead']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['.article-cover', 'div.content-body'],
- ['.minute-image', '.minutes-primary div.content-body'],
- ],
+ selectors: [['.article-cover', 'div.content-body'], ['.minute-image', '.minutes-primary div.content-body']],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['aside'],
- },
+ clean: ['aside']
+ }
};
var MoneyCnnComExtractor = {
domain: 'money.cnn.com',
title: {
- selectors: ['.article-title'],
+ selectors: ['.article-title']
},
author: {
- selectors: ['.byline a'],
+ selectors: ['.byline a']
},
date_published: {
selectors: [['meta[name="date"]', 'value']],
- timezone: 'GMT',
+ timezone: 'GMT'
},
dek: {
- selectors: ['#storytext h2'],
+ selectors: ['#storytext h2']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['#storytext'],
@@ -3109,36 +2544,34 @@ var MoneyCnnComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.inStoryHeading'],
- },
+ clean: ['.inStoryHeading']
+ }
};
var WwwThevergeComExtractor = {
domain: 'www.theverge.com',
supportedDomains: ['www.polygon.com'],
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['h2.p-dek'],
+ selectors: ['h2.p-dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- // feature template multi-match
- ['.c-entry-hero .e-image', '.c-entry-intro', '.c-entry-content'], // regular post multi-match
- ['.e-image--hero', '.c-entry-content'], // feature template fallback
- '.l-wrapper .l-feature', // regular post fallback
- 'div.c-entry-content',
- ],
+ selectors: [// feature template multi-match
+ ['.c-entry-hero .e-image', '.c-entry-intro', '.c-entry-content'], // regular post multi-match
+ ['.e-image--hero', '.c-entry-content'], // feature template fallback
+ '.l-wrapper .l-feature', // regular post fallback
+ 'div.c-entry-content'],
// Transform lazy-loaded images
transforms: {
noscript: function noscript($node) {
@@ -3149,42 +2582,37 @@ var WwwThevergeComExtractor = {
}
return null;
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.aside', 'img.c-dynamic-image'],
- },
+ clean: ['.aside', 'img.c-dynamic-image']
+ }
};
var WwwCnnComExtractor = {
domain: 'www.cnn.com',
title: {
- selectors: ['h1.pg-headline', 'h1'],
+ selectors: ['h1.pg-headline', 'h1']
},
author: {
- selectors: ['.metadata__byline__author'],
+ selectors: ['.metadata__byline__author']
},
date_published: {
- selectors: [['meta[name="pubdate"]', 'value']],
+ selectors: [['meta[name="pubdate"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- // a more specific selector to grab the lead image and the body
- ['.media__video--thumbnail', '.zn-body-text'], // a fallback for the above
- '.zn-body-text',
- 'div[itemprop="articleBody"]',
- ],
+ selectors: [// a more specific selector to grab the lead image and the body
+ ['.media__video--thumbnail', '.zn-body-text'], // a fallback for the above
+ '.zn-body-text', 'div[itemprop="articleBody"]'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- '.zn-body__paragraph, .el__leafmedia--sourced-paragraph': function znBody__paragraphEl__leafmediaSourcedParagraph(
- $node
- ) {
+ '.zn-body__paragraph, .el__leafmedia--sourced-paragraph': function znBody__paragraphEl__leafmediaSourcedParagraph($node) {
var $text = $node.html();
if ($text) {
@@ -3197,45 +2625,38 @@ var WwwCnnComExtractor = {
// to related content but not marked as such in any way.
'.zn-body__paragraph': function znBody__paragraph($node) {
if ($node.has('a')) {
- if (
- $node.text().trim() ===
- $node
- .find('a')
- .text()
- .trim()
- ) {
+ if ($node.text().trim() === $node.find('a').text().trim()) {
$node.remove();
}
}
},
- '.media__video--thumbnail': 'figure',
+ '.media__video--thumbnail': 'figure'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwAolComExtractor = {
domain: 'www.aol.com',
title: {
- selectors: ['h1.p-article__title'],
+ selectors: ['h1.p-article__title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
selectors: ['.p-article__byline__date'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article-content'],
@@ -3245,29 +2666,28 @@ var WwwAolComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwYoutubeComExtractor = {
domain: 'www.youtube.com',
title: {
- selectors: ['.watch-title', 'h1.watch-title-container'],
+ selectors: ['.watch-title', 'h1.watch-title-container']
},
author: {
- selectors: ['.yt-user-info'],
+ selectors: ['.yt-user-info']
},
date_published: {
selectors: [['meta[itemProp="datePublished"]', 'value']],
- timezone: 'GMT',
+ timezone: 'GMT'
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
defaultCleaner: false,
@@ -3277,37 +2697,32 @@ var WwwYoutubeComExtractor = {
transforms: {
'#player-api': function playerApi($node, $) {
var videoId = $('meta[itemProp="videoId"]').attr('value');
- $node.html(
- '\n '
- )
- );
- },
+ $node.html("\n "));
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwTheguardianComExtractor = {
domain: 'www.theguardian.com',
title: {
- selectors: ['.content__headline'],
+ selectors: ['.content__headline']
},
author: {
- selectors: ['p.byline'],
+ selectors: ['p.byline']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['.content__standfirst'],
+ selectors: ['.content__standfirst']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.content__article-body'],
@@ -3317,26 +2732,26 @@ var WwwTheguardianComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.hide-on-mobile', '.inline-icon'],
- },
+ clean: ['.hide-on-mobile', '.inline-icon']
+ }
};
var WwwSbnationComExtractor = {
domain: 'www.sbnation.com',
title: {
- selectors: ['h1.c-page-title'],
+ selectors: ['h1.c-page-title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['h2.c-entry-summary.p-dek'],
+ selectors: ['h2.c-entry-summary.p-dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.c-entry-content'],
@@ -3346,71 +2761,59 @@ var WwwSbnationComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwBloombergComExtractor = {
domain: 'www.bloomberg.com',
title: {
- selectors: [
- // normal articles
- '.lede-headline', // /graphics/ template
- 'h1.article-title', // /news/ template
- 'h1.lede-text-only__hed',
- ],
+ selectors: [// normal articles
+ '.lede-headline', // /graphics/ template
+ 'h1.article-title', // /news/ template
+ 'h1.lede-text-only__hed']
},
author: {
- selectors: [
- ['meta[name="parsely-author"]', 'value'],
- '.byline-details__link', // /graphics/ template
- '.bydek', // /news/ template
- '.author',
- ],
+ selectors: [['meta[name="parsely-author"]', 'value'], '.byline-details__link', // /graphics/ template
+ '.bydek', // /news/ template
+ '.author']
},
date_published: {
- selectors: [
- ['time.published-at', 'datetime'],
- ['time[datetime]', 'datetime'],
- ['meta[name="date"]', 'value'],
- ['meta[name="parsely-pub-date"]', 'value'],
- ],
+ selectors: [['time.published-at', 'datetime'], ['time[datetime]', 'datetime'], ['meta[name="date"]', 'value'], ['meta[name="parsely-pub-date"]', 'value']]
},
dek: {
- selectors: [],
+ selectors: []
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- '.article-body__content', // /graphics/ template
- ['section.copy-block'], // /news/ template
- '.body-copy',
- ],
+ selectors: ['.article-body__content', // /graphics/ template
+ ['section.copy-block'], // /news/ template
+ '.body-copy'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.inline-newsletter', '.page-ad'],
- },
+ clean: ['.inline-newsletter', '.page-ad']
+ }
};
var WwwBustleComExtractor = {
domain: 'www.bustle.com',
title: {
- selectors: ['h1.post-page__title'],
+ selectors: ['h1.post-page__title']
},
author: {
- selectors: ['div.content-meta__author'],
+ selectors: ['div.content-meta__author']
},
date_published: {
- selectors: [['time.content-meta__published-date[datetime]', 'datetime']],
+ selectors: [['time.content-meta__published-date[datetime]', 'datetime']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.post-page__body'],
@@ -3420,29 +2823,23 @@ var WwwBustleComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwNprOrgExtractor = {
domain: 'www.npr.org',
title: {
- selectors: ['h1', '.storytitle'],
+ selectors: ['h1', '.storytitle']
},
author: {
- selectors: ['p.byline__name.byline__name--block'],
+ selectors: ['p.byline__name.byline__name--block']
},
date_published: {
- selectors: [
- ['.dateblock time[datetime]', 'datetime'],
- ['meta[name="date"]', 'value'],
- ],
+ selectors: [['.dateblock time[datetime]', 'datetime'], ['meta[name="date"]', 'value']]
},
lead_image_url: {
- selectors: [
- ['meta[name="og:image"]', 'value'],
- ['meta[name="twitter:image:src"]', 'value'],
- ],
+ selectors: [['meta[name="og:image"]', 'value'], ['meta[name="twitter:image:src"]', 'value']]
},
content: {
selectors: ['.storytext'],
@@ -3450,60 +2847,57 @@ var WwwNprOrgExtractor = {
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
'.bucketwrap.image': 'figure',
- '.bucketwrap.image .credit-caption': 'figcaption',
+ '.bucketwrap.image .credit-caption': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['div.enlarge_measure'],
- },
+ clean: ['div.enlarge_measure']
+ }
};
var WwwRecodeNetExtractor = {
domain: 'www.recode.net',
title: {
- selectors: ['h1.c-page-title'],
+ selectors: ['h1.c-page-title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['h2.c-entry-summary.p-dek'],
+ selectors: ['h2.c-entry-summary.p-dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['figure.e-image--hero', '.c-entry-content'],
- '.c-entry-content',
- ],
+ selectors: [['figure.e-image--hero', '.c-entry-content'], '.c-entry-content'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var QzComExtractor = {
domain: 'qz.com',
title: {
- selectors: ['header.item-header.content-width-responsive'],
+ selectors: ['header.item-header.content-width-responsive']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: ['.timestamp'],
+ selectors: ['.timestamp']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['figure.featured-image', '.item-body'], '.item-body'],
@@ -3513,30 +2907,28 @@ var QzComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.article-aside', '.progressive-image-thumbnail'],
- },
+ clean: ['.article-aside', '.progressive-image-thumbnail']
+ }
};
var WwwDmagazineComExtractor = {
domain: 'www.dmagazine.com',
title: {
- selectors: ['h1.story__title'],
+ selectors: ['h1.story__title']
},
author: {
- selectors: ['.story__info .story__info__item:first-child'],
+ selectors: ['.story__info .story__info__item:first-child']
},
date_published: {
- selectors: [
- // enter selectors
- '.story__info',
- ],
- timezone: 'America/Chicago',
+ selectors: [// enter selectors
+ '.story__info'],
+ timezone: 'America/Chicago'
},
dek: {
- selectors: ['.story__subhead'],
+ selectors: ['.story__subhead']
},
lead_image_url: {
- selectors: [['article figure a:first-child', 'href']],
+ selectors: [['article figure a:first-child', 'href']]
},
content: {
selectors: ['.story__content'],
@@ -3546,79 +2938,79 @@ var WwwDmagazineComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwReutersComExtractor = {
domain: 'www.reuters.com',
title: {
- selectors: ['h1.article-headline'],
+ selectors: ['h1.article-headline']
},
author: {
- selectors: ['.author'],
+ selectors: ['.author']
},
date_published: {
- selectors: [['meta[name="og:article:published_time"]', 'value']],
+ selectors: [['meta[name="og:article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['#article-text'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- '.article-subtitle': 'h4',
+ '.article-subtitle': 'h4'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['#article-byline .author'],
- },
+ clean: ['#article-byline .author']
+ }
};
var MashableComExtractor = {
domain: 'mashable.com',
title: {
- selectors: ['h1.title'],
+ selectors: ['h1.title']
},
author: {
- selectors: ['span.author_name a'],
+ selectors: ['span.author_name a']
},
date_published: {
- selectors: [['meta[name="og:article:published_time"]', 'value']],
+ selectors: [['meta[name="og:article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['section.article-content.blueprint'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- '.image-credit': 'figcaption',
+ '.image-credit': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwChicagotribuneComExtractor = {
domain: 'www.chicagotribune.com',
title: {
- selectors: ['h1.trb_ar_hl_t'],
+ selectors: ['h1.trb_ar_hl_t']
},
author: {
- selectors: ['span.trb_ar_by_nm_au'],
+ selectors: ['span.trb_ar_by_nm_au']
},
date_published: {
- selectors: [['meta[itemprop="datePublished"]', 'value']],
+ selectors: [['meta[itemprop="datePublished"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.trb_ar_page'],
@@ -3628,71 +3020,63 @@ var WwwChicagotribuneComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwVoxComExtractor = {
domain: 'www.vox.com',
title: {
- selectors: ['h1.c-page-title'],
+ selectors: ['h1.c-page-title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['.p-dek'],
+ selectors: ['.p-dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['figure.e-image--hero', '.c-entry-content'],
- '.c-entry-content',
- ],
+ selectors: [['figure.e-image--hero', '.c-entry-content'], '.c-entry-content'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- 'figure .e-image__image noscript': function figureEImage__imageNoscript(
- $node
- ) {
+ 'figure .e-image__image noscript': function figureEImage__imageNoscript($node) {
var imgHtml = $node.html();
- $node
- .parents('.e-image__image')
- .find('.c-dynamic-image')
- .replaceWith(imgHtml);
+ $node.parents('.e-image__image').find('.c-dynamic-image').replaceWith(imgHtml);
},
- 'figure .e-image__meta': 'figcaption',
+ 'figure .e-image__meta': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var NewsNationalgeographicComExtractor = {
domain: 'news.nationalgeographic.com',
title: {
- selectors: ['h1', 'h1.main-title'],
+ selectors: ['h1', 'h1.main-title']
},
author: {
- selectors: ['.byline-component__contributors b span'],
+ selectors: ['.byline-component__contributors b span']
},
date_published: {
selectors: [['meta[name="article:published_time"]', 'value']],
format: 'ddd MMM DD HH:mm:ss zz YYYY',
- timezone: 'EST',
+ timezone: 'EST'
},
dek: {
- selectors: ['.article__deck'],
+ selectors: ['.article__deck']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.parsys.content', '.__image-lead__'], '.content'],
@@ -3700,42 +3084,36 @@ var NewsNationalgeographicComExtractor = {
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
'.parsys.content': function parsysContent($node, $) {
- var $imgSrc = $node
- .find('.image.parbase.section')
- .find('.picturefill')
- .first()
- .data('platform-src');
+ var $imgSrc = $node.find('.image.parbase.section').find('.picturefill').first().data('platform-src');
if ($imgSrc) {
- $node.prepend(
- $(''))
- );
+ $node.prepend($("")));
}
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.pull-quote.pull-quote--large'],
- },
+ clean: ['.pull-quote.pull-quote--large']
+ }
};
var WwwNationalgeographicComExtractor = {
domain: 'www.nationalgeographic.com',
title: {
- selectors: ['h1', 'h1.main-title'],
+ selectors: ['h1', 'h1.main-title']
},
author: {
- selectors: ['.byline-component__contributors b span'],
+ selectors: ['.byline-component__contributors b span']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['.article__deck'],
+ selectors: ['.article__deck']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.parsys.content', '.__image-lead__'], '.content'],
@@ -3746,57 +3124,42 @@ var WwwNationalgeographicComExtractor = {
var $imageParent = $node.children().first();
if ($imageParent.hasClass('imageGroup')) {
- var $dataAttrContainer = $imageParent
- .find('.media--medium__container')
- .children()
- .first();
+ var $dataAttrContainer = $imageParent.find('.media--medium__container').children().first();
var imgPath1 = $dataAttrContainer.data('platform-image1-path');
var imgPath2 = $dataAttrContainer.data('platform-image2-path');
if (imgPath2 && imgPath1) {
- $node.prepend(
- $(
- '\n
\n
\n
')
- )
- );
+ $node.prepend($("\n
\n
\n
")));
}
} else {
- var $imgSrc = $node
- .find('.image.parbase.section')
- .find('.picturefill')
- .first()
- .data('platform-src');
+ var $imgSrc = $node.find('.image.parbase.section').find('.picturefill').first().data('platform-src');
if ($imgSrc) {
- $node.prepend(
- $(''))
- );
+ $node.prepend($("")));
}
}
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.pull-quote.pull-quote--small'],
- },
+ clean: ['.pull-quote.pull-quote--small']
+ }
};
var WwwLatimesComExtractor = {
domain: 'www.latimes.com',
title: {
- selectors: ['.trb_ar_hl'],
+ selectors: ['.trb_ar_hl']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[itemprop="datePublished"]', 'value']],
+ selectors: [['meta[itemprop="datePublished"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.trb_ar_main'],
@@ -3806,64 +3169,61 @@ var WwwLatimesComExtractor = {
'.trb_ar_la': function trb_ar_la($node) {
var $figure = $node.find('figure');
$node.replaceWith($figure);
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.trb_ar_by', '.trb_ar_cr'],
- },
+ clean: ['.trb_ar_by', '.trb_ar_cr']
+ }
};
var PagesixComExtractor = {
domain: 'pagesix.com',
supportedDomains: ['nypost.com'],
title: {
- selectors: ['h1 a'],
+ selectors: ['h1 a']
},
author: {
- selectors: ['.byline'],
+ selectors: ['.byline']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: [['meta[name="description"]', 'value']],
+ selectors: [['meta[name="description"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['#featured-image-wrapper', '.entry-content'],
- '.entry-content',
- ],
+ selectors: [['#featured-image-wrapper', '.entry-content'], '.entry-content'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
'#featured-image-wrapper': 'figure',
- '.wp-caption-text': 'figcaption',
+ '.wp-caption-text': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.modal-trigger'],
- },
+ clean: ['.modal-trigger']
+ }
};
var ThefederalistpapersOrgExtractor = {
domain: 'thefederalistpapers.org',
title: {
- selectors: ['h1.entry-title'],
+ selectors: ['h1.entry-title']
},
author: {
- selectors: ['main span.entry-author-name'],
+ selectors: ['main span.entry-author-name']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry-content'],
@@ -3873,27 +3233,27 @@ var ThefederalistpapersOrgExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [['p[style]']],
- },
+ clean: [['p[style]']]
+ }
};
var WwwCbssportsComExtractor = {
domain: 'www.cbssports.com',
title: {
- selectors: ['.article-headline'],
+ selectors: ['.article-headline']
},
author: {
- selectors: ['.author-name'],
+ selectors: ['.author-name']
},
date_published: {
selectors: [['.date-original-reading-time time', 'datetime']],
- timezone: 'UTC',
+ timezone: 'UTC'
},
dek: {
- selectors: ['.article-subline'],
+ selectors: ['.article-subline']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article'],
@@ -3903,26 +3263,26 @@ var WwwCbssportsComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwMsnbcComExtractor = {
domain: 'www.msnbc.com',
title: {
- selectors: ['h1', 'h1.is-title-pane'],
+ selectors: ['h1', 'h1.is-title-pane']
},
author: {
- selectors: ['.author'],
+ selectors: ['.author']
},
date_published: {
- selectors: [['meta[name="DC.date.issued"]', 'value']],
+ selectors: [['meta[name="DC.date.issued"]', 'value']]
},
dek: {
- selectors: [['meta[name="description"]', 'value']],
+ selectors: [['meta[name="description"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.pane-node-body'],
@@ -3930,46 +3290,42 @@ var WwwMsnbcComExtractor = {
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
'.pane-node-body': function paneNodeBody($node, $) {
- var _WwwMsnbcComExtractor = _slicedToArray(
- WwwMsnbcComExtractor.lead_image_url.selectors[0],
- 2
- ),
- selector = _WwwMsnbcComExtractor[0],
- attr = _WwwMsnbcComExtractor[1];
+ var _WwwMsnbcComExtractor = _slicedToArray(WwwMsnbcComExtractor.lead_image_url.selectors[0], 2),
+ selector = _WwwMsnbcComExtractor[0],
+ attr = _WwwMsnbcComExtractor[1];
var src = $(selector).attr(attr);
if (src) {
- $node.prepend(''));
+ $node.prepend(""));
}
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwThepoliticalinsiderComExtractor = {
domain: 'www.thepoliticalinsider.com',
title: {
- selectors: [['meta[name="sailthru.title"]', 'value']],
+ selectors: [['meta[name="sailthru.title"]', 'value']]
},
author: {
- selectors: [['meta[name="sailthru.author"]', 'value']],
+ selectors: [['meta[name="sailthru.author"]', 'value']]
},
date_published: {
selectors: [['meta[name="sailthru.date"]', 'value']],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div#article-body'],
@@ -3979,24 +3335,24 @@ var WwwThepoliticalinsiderComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwMentalflossComExtractor = {
domain: 'www.mentalfloss.com',
title: {
- selectors: ['h1.title', '.title-group', '.inner'],
+ selectors: ['h1.title', '.title-group', '.inner']
},
author: {
- selectors: ['.field-name-field-enhanced-authors'],
+ selectors: ['.field-name-field-enhanced-authors']
},
date_published: {
selectors: ['.date-display-single'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.field.field-name-body'],
@@ -4006,25 +3362,25 @@ var WwwMentalflossComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var AbcnewsGoComExtractor = {
domain: 'abcnews.go.com',
title: {
- selectors: ['.article-header h1'],
+ selectors: ['.article-header h1']
},
author: {
selectors: ['.authors'],
- clean: ['.author-overlay', '.by-text'],
+ clean: ['.author-overlay', '.by-text']
},
date_published: {
selectors: ['.timestamp'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article-copy'],
@@ -4034,23 +3390,23 @@ var AbcnewsGoComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwNydailynewsComExtractor = {
domain: 'www.nydailynews.com',
title: {
- selectors: ['h1#ra-headline'],
+ selectors: ['h1#ra-headline']
},
author: {
- selectors: [['meta[name="parsely-author"]', 'value']],
+ selectors: [['meta[name="parsely-author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="sailthru.date"]', 'value']],
+ selectors: [['meta[name="sailthru.date"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['article#ra-body'],
@@ -4060,23 +3416,23 @@ var WwwNydailynewsComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['dl#ra-tags', '.ra-related', 'a.ra-editor', 'dl#ra-share-bottom'],
- },
+ clean: ['dl#ra-tags', '.ra-related', 'a.ra-editor', 'dl#ra-share-bottom']
+ }
};
var WwwCnbcComExtractor = {
domain: 'www.cnbc.com',
title: {
- selectors: ['h1.title'],
+ selectors: ['h1.title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div#article_body.content', 'div.story'],
@@ -4086,23 +3442,23 @@ var WwwCnbcComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwPopsugarComExtractor = {
domain: 'www.popsugar.com',
title: {
- selectors: ['h2.post-title', 'title-text'],
+ selectors: ['h2.post-title', 'title-text']
},
author: {
- selectors: [['meta[name="article:author"]', 'value']],
+ selectors: [['meta[name="article:author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['#content'],
@@ -4112,26 +3468,26 @@ var WwwPopsugarComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.share-copy-title', '.post-tags', '.reactions'],
- },
+ clean: ['.share-copy-title', '.post-tags', '.reactions']
+ }
};
var ObserverComExtractor = {
domain: 'observer.com',
title: {
- selectors: ['h1.entry-title'],
+ selectors: ['h1.entry-title']
},
author: {
- selectors: ['.author', '.vcard'],
+ selectors: ['.author', '.vcard']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['h2.dek'],
+ selectors: ['h2.dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.entry-content'],
@@ -4141,23 +3497,23 @@ var ObserverComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var PeopleComExtractor = {
domain: 'people.com',
title: {
- selectors: [['meta[name="og:title"]', 'value']],
+ selectors: [['meta[name="og:title"]', 'value']]
},
author: {
- selectors: ['a.author.url.fn'],
+ selectors: ['a.author.url.fn']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.article-body__inner'],
@@ -4167,24 +3523,24 @@ var PeopleComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwUsmagazineComExtractor = {
domain: 'www.usmagazine.com',
title: {
- selectors: ['header h1'],
+ selectors: ['header h1']
},
author: {
- selectors: ['a.article-byline.tracked-offpage'],
+ selectors: ['a.article-byline.tracked-offpage']
},
date_published: {
timezone: 'America/New_York',
- selectors: ['time.article-published-date'],
+ selectors: ['time.article-published-date']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.article-body-inner'],
@@ -4194,27 +3550,27 @@ var WwwUsmagazineComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.module-related'],
- },
+ clean: ['.module-related']
+ }
};
var WwwRollingstoneComExtractor = {
domain: 'www.rollingstone.com',
title: {
- selectors: ['h1.content-title'],
+ selectors: ['h1.content-title']
},
author: {
- selectors: ['a.content-author.tracked-offpage'],
+ selectors: ['a.content-author.tracked-offpage']
},
date_published: {
selectors: ['time.content-published-date'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: ['.content-description'],
+ selectors: ['.content-description']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.lead-container', '.article-content'], '.article-content'],
@@ -4224,23 +3580,23 @@ var WwwRollingstoneComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.module-related'],
- },
+ clean: ['.module-related']
+ }
};
var twofortysevensportsComExtractor = {
domain: '247sports.com',
title: {
- selectors: ['title', 'article header h1'],
+ selectors: ['title', 'article header h1']
},
author: {
- selectors: ['.author'],
+ selectors: ['.author']
},
date_published: {
- selectors: [['time[data-published]', 'data-published']],
+ selectors: [['time[data-published]', 'data-published']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['section.body.article'],
@@ -4250,23 +3606,23 @@ var twofortysevensportsComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var UproxxComExtractor = {
domain: 'uproxx.com',
title: {
- selectors: ['div.post-top h1'],
+ selectors: ['div.post-top h1']
},
author: {
- selectors: ['.post-top .authorname'],
+ selectors: ['.post-top .authorname']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.post-body'],
@@ -4274,57 +3630,55 @@ var UproxxComExtractor = {
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
'div.image': 'figure',
- 'div.image .wp-media-credit': 'figcaption',
+ 'div.image .wp-media-credit': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwEonlineComExtractor = {
domain: 'www.eonline.com',
title: {
- selectors: ['h1.article__title'],
+ selectors: ['h1.article__title']
},
author: {
- selectors: ['.entry-meta__author a'],
+ selectors: ['.entry-meta__author a']
},
date_published: {
- selectors: [['meta[itemprop="datePublished"]', 'value']],
+ selectors: [['meta[itemprop="datePublished"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['.post-content section, .post-content div.post-content__image'],
- ],
+ selectors: [['.post-content section, .post-content div.post-content__image']],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
'div.post-content__image': 'figure',
- 'div.post-content__image .image__credits': 'figcaption',
+ 'div.post-content__image .image__credits': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwMiamiheraldComExtractor = {
domain: 'www.miamiherald.com',
title: {
- selectors: ['h1.title'],
+ selectors: ['h1.title']
},
date_published: {
selectors: ['p.published-date'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.dateline-storybody'],
@@ -4334,31 +3688,27 @@ var WwwMiamiheraldComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwRefinery29ComExtractor = {
domain: 'www.refinery29.com',
title: {
- selectors: ['h1.title'],
+ selectors: ['h1.title']
},
author: {
- selectors: ['.contributor'],
+ selectors: ['.contributor']
},
date_published: {
selectors: [['meta[name="sailthru.date"]', 'value']],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['.full-width-opener', '.article-content'],
- '.article-content',
- '.body',
- ],
+ selectors: [['.full-width-opener', '.article-content'], '.article-content', '.body'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
@@ -4368,34 +3718,34 @@ var WwwRefinery29ComExtractor = {
},
'.section-image': 'figure',
'.section-image .content-caption': 'figcaption',
- '.section-text': 'p',
+ '.section-text': 'p'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.story-share'],
- },
+ clean: ['.story-share']
+ }
};
var WwwMacrumorsComExtractor = {
domain: 'www.macrumors.com',
title: {
- selectors: ['h1', 'h1.title'],
+ selectors: ['h1', 'h1.title']
},
author: {
- selectors: ['.author-url'],
+ selectors: ['.author-url']
},
date_published: {
selectors: ['.article .byline'],
// Wednesday January 18, 2017 11:44 am PST
format: 'dddd MMMM D, YYYY h:mm A zz',
- timezone: 'America/Los_Angeles',
+ timezone: 'America/Los_Angeles'
},
dek: {
- selectors: [['meta[name="description"]', 'value']],
+ selectors: [['meta[name="description"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article'],
@@ -4405,26 +3755,26 @@ var WwwMacrumorsComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwAndroidcentralComExtractor = {
domain: 'www.androidcentral.com',
title: {
- selectors: ['h1', 'h1.main-title'],
+ selectors: ['h1', 'h1.main-title']
},
author: {
- selectors: ['.meta-by'],
+ selectors: ['.meta-by']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: [['meta[name="og:description"]', 'value']],
+ selectors: [['meta[name="og:description"]', 'value']]
},
lead_image_url: {
- selectors: [['.image-large', 'src']],
+ selectors: [['.image-large', 'src']]
},
content: {
selectors: ['.article-body'],
@@ -4434,27 +3784,27 @@ var WwwAndroidcentralComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.intro', 'blockquote'],
- },
+ clean: ['.intro', 'blockquote']
+ }
};
var WwwSiComExtractor = {
domain: 'www.si.com',
title: {
- selectors: ['h1', 'h1.headline'],
+ selectors: ['h1', 'h1.headline']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
selectors: ['.timestamp'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: ['.quick-hit ul'],
+ selectors: ['.quick-hit ul']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['p', '.marquee_large_2x', '.component.image']],
@@ -4469,31 +3819,29 @@ var WwwSiComExtractor = {
}
return null;
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [
- ['.inline-thumb', '.primary-message', '.description', '.instructions'],
- ],
- },
+ clean: [['.inline-thumb', '.primary-message', '.description', '.instructions']]
+ }
};
var WwwRawstoryComExtractor = {
domain: 'www.rawstory.com',
title: {
- selectors: ['.blog-title'],
+ selectors: ['.blog-title']
},
author: {
- selectors: ['.blog-author a:first-of-type'],
+ selectors: ['.blog-author a:first-of-type']
},
date_published: {
selectors: ['.blog-author a:last-of-type'],
- timezone: 'EST',
+ timezone: 'EST'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.blog-content'],
@@ -4503,33 +3851,30 @@ var WwwRawstoryComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwCnetComExtractor = {
domain: 'www.cnet.com',
title: {
- selectors: [['meta[name="og:title"]', 'value']],
+ selectors: [['meta[name="og:title"]', 'value']]
},
author: {
- selectors: ['a.author'],
+ selectors: ['a.author']
},
date_published: {
selectors: ['time'],
- timezone: 'America/Los_Angeles',
+ timezone: 'America/Los_Angeles'
},
dek: {
- selectors: ['.article-dek'],
+ selectors: ['.article-dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['img.__image-lead__', '.article-main-body'],
- '.article-main-body',
- ],
+ selectors: [['img.__image-lead__', '.article-main-body'], '.article-main-body'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
@@ -4539,29 +3884,29 @@ var WwwCnetComExtractor = {
$img.attr('height', '100%');
$img.addClass('__image-lead__');
$node.remove('.imgContainer').prepend($img);
- },
+ }
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwCinemablendComExtractor = {
domain: 'www.cinemablend.com',
title: {
- selectors: ['.story_title'],
+ selectors: ['.story_title']
},
author: {
- selectors: ['.author'],
+ selectors: ['.author']
},
date_published: {
selectors: [['meta[name="article:published_time"]', 'value']],
- timezone: 'EST',
+ timezone: 'EST'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div#wrap_left_content'],
@@ -4571,23 +3916,23 @@ var WwwCinemablendComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwTodayComExtractor = {
domain: 'www.today.com',
title: {
- selectors: ['h1.entry-headline'],
+ selectors: ['h1.entry-headline']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="DC.date.issued"]', 'value']],
+ selectors: [['meta[name="DC.date.issued"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry-container'],
@@ -4597,24 +3942,24 @@ var WwwTodayComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.label-comment'],
- },
+ clean: ['.label-comment']
+ }
};
var WwwHowtogeekComExtractor = {
domain: 'www.howtogeek.com',
title: {
- selectors: ['title'],
+ selectors: ['title']
},
author: {
- selectors: ['#authorinfobox a'],
+ selectors: ['#authorinfobox a']
},
date_published: {
selectors: ['#authorinfobox + div li'],
- timezone: 'GMT',
+ timezone: 'GMT'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.thecontent'],
@@ -4624,24 +3969,24 @@ var WwwHowtogeekComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwAlComExtractor = {
domain: 'www.al.com',
title: {
- selectors: [['meta[name="title"]', 'value']],
+ selectors: [['meta[name="title"]', 'value']]
},
author: {
- selectors: [['meta[name="article_author"]', 'value']],
+ selectors: [['meta[name="article_author"]', 'value']]
},
date_published: {
selectors: [['meta[name="article_date_original"]', 'value']],
- timezone: 'EST',
+ timezone: 'EST'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry-content'],
@@ -4651,23 +3996,23 @@ var WwwAlComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwThepennyhoarderComExtractor = {
domain: 'www.thepennyhoarder.com',
title: {
- selectors: [['meta[name="dcterms.title"]', 'value']],
+ selectors: [['meta[name="dcterms.title"]', 'value']]
},
author: {
- selectors: [['link[rel="author"]', 'title']],
+ selectors: [['link[rel="author"]', 'title']]
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.post-img', '.post-text'], '.post-text'],
@@ -4677,26 +4022,26 @@ var WwwThepennyhoarderComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwWesternjournalismComExtractor = {
domain: 'www.westernjournalism.com',
title: {
- selectors: ['title', 'h1.entry-title'],
+ selectors: ['title', 'h1.entry-title']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="DC.date.issued"]', 'value']],
+ selectors: [['meta[name="DC.date.issued"]', 'value']]
},
dek: {
- selectors: ['.subtitle'],
+ selectors: ['.subtitle']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.article-sharing.top + div'],
@@ -4706,64 +4051,59 @@ var WwwWesternjournalismComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.ad-notice-small'],
- },
+ clean: ['.ad-notice-small']
+ }
};
var FusionNetExtractor = {
domain: 'fusion.net',
title: {
- selectors: ['.post-title', '.single-title', '.headline'],
+ selectors: ['.post-title', '.single-title', '.headline']
},
author: {
- selectors: ['.show-for-medium .byline'],
+ selectors: ['.show-for-medium .byline']
},
date_published: {
- selectors: [['time.local-time', 'datetime']],
+ selectors: [['time.local-time', 'datetime']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- ['.post-featured-media', '.article-content'],
- '.article-content',
- ],
+ selectors: [['.post-featured-media', '.article-content'], '.article-content'],
// Is there anything in the content you selected that needs transformed
// before it's consumable content? E.g., unusual lazy loaded images
transforms: {
- '.fusion-youtube-oembed': 'figure',
+ '.fusion-youtube-oembed': 'figure'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwAmericanowComExtractor = {
domain: 'www.americanow.com',
title: {
- selectors: ['.title', ['meta[name="title"]', 'value']],
+ selectors: ['.title', ['meta[name="title"]', 'value']]
},
author: {
- selectors: ['.byline'],
+ selectors: ['.byline']
},
date_published: {
- selectors: [['meta[name="publish_date"]', 'value']],
+ selectors: [['meta[name="publish_date"]', 'value']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.article-content', '.image', '.body'], '.body'],
@@ -4773,28 +4113,27 @@ var WwwAmericanowComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.article-video-wrapper', '.show-for-small-only'],
- },
+ clean: ['.article-video-wrapper', '.show-for-small-only']
+ }
};
var ScienceflyComExtractor = {
domain: 'sciencefly.com',
title: {
- selectors: ['.entry-title', '.cb-entry-title', '.cb-single-title'],
+ selectors: ['.entry-title', '.cb-entry-title', '.cb-single-title']
},
author: {
- selectors: ['div.cb-author', 'div.cb-author-title'],
+ selectors: ['div.cb-author', 'div.cb-author-title']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['div.theiaPostSlider_slides img', 'src']],
+ selectors: [['div.theiaPostSlider_slides img', 'src']]
},
content: {
selectors: ['div.theiaPostSlider_slides'],
@@ -4804,23 +4143,23 @@ var ScienceflyComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var HellogigglesComExtractor = {
domain: 'hellogiggles.com',
title: {
- selectors: ['.title'],
+ selectors: ['.title']
},
author: {
- selectors: ['.author-link'],
+ selectors: ['.author-link']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry-content'],
@@ -4830,26 +4169,23 @@ var HellogigglesComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var ThoughtcatalogComExtractor = {
domain: 'thoughtcatalog.com',
title: {
- selectors: ['h1.title', ['meta[name="og:title"]', 'value']],
+ selectors: ['h1.title', ['meta[name="og:title"]', 'value']]
},
author: {
- selectors: [
- 'div.col-xs-12.article_header div.writer-container.writer-container-inline.writer-no-avatar h4.writer-name',
- 'h1.writer-name',
- ],
+ selectors: ['div.col-xs-12.article_header div.writer-container.writer-container-inline.writer-no-avatar h4.writer-name', 'h1.writer-name']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry.post'],
@@ -4859,24 +4195,24 @@ var ThoughtcatalogComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.tc_mark'],
- },
+ clean: ['.tc_mark']
+ }
};
var WwwNjComExtractor = {
domain: 'www.nj.com',
title: {
- selectors: [['meta[name="title"]', 'value']],
+ selectors: [['meta[name="title"]', 'value']]
},
author: {
- selectors: [['meta[name="article_author"]', 'value']],
+ selectors: [['meta[name="article_author"]', 'value']]
},
date_published: {
selectors: [['meta[name="article_date_original"]', 'value']],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry-content'],
@@ -4886,23 +4222,23 @@ var WwwNjComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwInquisitrComExtractor = {
domain: 'www.inquisitr.com',
title: {
- selectors: ['h1.entry-title.story--header--title'],
+ selectors: ['h1.entry-title.story--header--title']
},
author: {
- selectors: ['div.story--header--author'],
+ selectors: ['div.story--header--author']
},
date_published: {
- selectors: [['meta[name="datePublished"]', 'value']],
+ selectors: [['meta[name="datePublished"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['article.story', '.entry-content.'],
@@ -4912,31 +4248,24 @@ var WwwInquisitrComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [
- '.post-category',
- '.story--header--socials',
- '.story--header--content',
- ],
- },
+ clean: ['.post-category', '.story--header--socials', '.story--header--content']
+ }
};
var WwwNbcnewsComExtractor = {
domain: 'www.nbcnews.com',
title: {
- selectors: ['div.article-hed h1'],
+ selectors: ['div.article-hed h1']
},
author: {
- selectors: ['span.byline_author'],
+ selectors: ['span.byline_author']
},
date_published: {
- selectors: [
- ['.flag_article-wrapper time.timestamp_article[datetime]', 'datetime'],
- '.flag_article-wrapper time',
- ],
- timezone: 'America/New_York',
+ selectors: [['.flag_article-wrapper time.timestamp_article[datetime]', 'datetime'], '.flag_article-wrapper time'],
+ timezone: 'America/New_York'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['div.article-body'],
@@ -4946,24 +4275,24 @@ var WwwNbcnewsComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var FortuneComExtractor = {
domain: 'fortune.com',
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: [['meta[name="author"]', 'value']],
+ selectors: [['meta[name="author"]', 'value']]
},
date_published: {
selectors: ['.MblGHNMJ'],
- timezone: 'UTC',
+ timezone: 'UTC'
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['picture', 'article.row'], 'article.row'],
@@ -4973,32 +4302,28 @@ var FortuneComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwLinkedinComExtractor = {
domain: 'www.linkedin.com',
title: {
- selectors: ['.article-title', 'h1'],
+ selectors: ['.article-title', 'h1']
},
author: {
- selectors: [
- ['meta[name="article:author"]', 'value'],
- '.entity-name a[rel=author]',
- ],
+ selectors: [['meta[name="article:author"]', 'value'], '.entity-name a[rel=author]']
},
date_published: {
selectors: [['time[itemprop="datePublished"]', 'datetime']],
- timezone: 'America/Los_Angeles',
+ timezone: 'America/Los_Angeles'
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['header figure', '.prose'], '.prose'],
@@ -5008,27 +4333,27 @@ var WwwLinkedinComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.entity-image'],
- },
+ clean: ['.entity-image']
+ }
};
var ObamawhitehouseArchivesGovExtractor = {
domain: 'obamawhitehouse.archives.gov',
supportedDomains: ['whitehouse.gov'],
title: {
- selectors: ['h1', '.pane-node-title'],
+ selectors: ['h1', '.pane-node-title']
},
author: {
- selectors: ['.blog-author-link', '.node-person-name-link'],
+ selectors: ['.blog-author-link', '.node-person-name-link']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['.field-name-field-forall-summary'],
+ selectors: ['.field-name-field-forall-summary']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
defaultCleaner: false,
@@ -5039,28 +4364,27 @@ var ObamawhitehouseArchivesGovExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.pane-node-title', '.pane-custom.pane-1'],
- },
+ clean: ['.pane-node-title', '.pane-custom.pane-1']
+ }
};
var WwwOpposingviewsComExtractor = {
domain: 'www.opposingviews.com',
title: {
- selectors: ['h1.title'],
+ selectors: ['h1.title']
},
author: {
- selectors: ['div.date span span a'],
+ selectors: ['div.date span span a']
},
date_published: {
- selectors: [['meta[name="publish_date"]', 'value']],
+ selectors: [['meta[name="publish_date"]', 'value']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article-content'],
@@ -5070,27 +4394,27 @@ var WwwOpposingviewsComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.show-for-small-only'],
- },
+ clean: ['.show-for-small-only']
+ }
};
var WwwProspectmagazineCoUkExtractor = {
domain: 'www.prospectmagazine.co.uk',
title: {
- selectors: ['.page-title'],
+ selectors: ['.page-title']
},
author: {
- selectors: ['.aside_author .title'],
+ selectors: ['.aside_author .title']
},
date_published: {
selectors: ['.post-info'],
- timezone: 'Europe/London',
+ timezone: 'Europe/London'
},
dek: {
- selectors: ['.page-subtitle'],
+ selectors: ['.page-subtitle']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['article .post_content'],
@@ -5100,28 +4424,27 @@ var WwwProspectmagazineCoUkExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var ForwardComExtractor = {
domain: 'forward.com',
title: {
- selectors: [['meta[name="og:title"]', 'value']],
+ selectors: [['meta[name="og:title"]', 'value']]
},
author: {
- selectors: ['.author-name', ['meta[name="sailthru.author"]', 'value']],
+ selectors: ['.author-name', ['meta[name="sailthru.author"]', 'value']]
},
date_published: {
- selectors: [['meta[name="date"]', 'value']],
+ selectors: [['meta[name="date"]', 'value']]
},
dek: {
- selectors: [
- // enter selectors
- ],
+ selectors: [// enter selectors
+ ]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.post-item-media-wrap', '.post-item p']],
@@ -5131,26 +4454,26 @@ var ForwardComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.donate-box', '.message', '.subtitle'],
- },
+ clean: ['.donate-box', '.message', '.subtitle']
+ }
};
var WwwQdailyComExtractor = {
domain: 'www.qdaily.com',
title: {
- selectors: ['h2', 'h2.title'],
+ selectors: ['h2', 'h2.title']
},
author: {
- selectors: ['.name'],
+ selectors: ['.name']
},
date_published: {
- selectors: [['.date.smart-date', 'data-origindate']],
+ selectors: [['.date.smart-date', 'data-origindate']]
},
dek: {
- selectors: ['.excerpt'],
+ selectors: ['.excerpt']
},
lead_image_url: {
- selectors: [['.article-detail-hd img', 'src']],
+ selectors: [['.article-detail-hd img', 'src']]
},
content: {
selectors: ['.detail'],
@@ -5160,34 +4483,28 @@ var WwwQdailyComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['.lazyload', '.lazylad', '.lazylood'],
- },
+ clean: ['.lazyload', '.lazylad', '.lazylood']
+ }
};
var GothamistComExtractor = {
domain: 'gothamist.com',
- supportedDomains: [
- 'chicagoist.com',
- 'laist.com',
- 'sfist.com',
- 'shanghaiist.com',
- 'dcist.com',
- ],
+ supportedDomains: ['chicagoist.com', 'laist.com', 'sfist.com', 'shanghaiist.com', 'dcist.com'],
title: {
- selectors: ['h1', '.entry-header h1'],
+ selectors: ['h1', '.entry-header h1']
},
author: {
- selectors: ['.author'],
+ selectors: ['.author']
},
date_published: {
selectors: ['abbr', 'abbr.published'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: [null],
+ selectors: [null]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.entry-body'],
@@ -5199,36 +4516,31 @@ var GothamistComExtractor = {
'div.image-left': 'figure',
'.image-left i': 'figcaption',
'div.image-right': 'figure',
- '.image-right i': 'figcaption',
+ '.image-right i': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [
- '.image-none br',
- '.image-left br',
- '.image-right br',
- '.galleryEase',
- ],
- },
+ clean: ['.image-none br', '.image-left br', '.image-right br', '.galleryEase']
+ }
};
var WwwFoolComExtractor = {
domain: 'www.fool.com',
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: ['.author-inline .author-name'],
+ selectors: ['.author-inline .author-name']
},
date_published: {
- selectors: [['meta[name="date"]', 'value']],
+ selectors: [['meta[name="date"]', 'value']]
},
dek: {
- selectors: ['header h2'],
+ selectors: ['header h2']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.article-content'],
@@ -5237,36 +4549,34 @@ var WwwFoolComExtractor = {
transforms: {
'.caption img': function captionImg($node) {
var src = $node.attr('src');
- $node
- .parent()
- .replaceWith(''));
+ $node.parent().replaceWith(""));
},
- '.caption': 'figcaption',
+ '.caption': 'figcaption'
},
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: ['#pitch'],
- },
+ clean: ['#pitch']
+ }
};
var WwwSlateComExtractor = {
domain: 'www.slate.com',
title: {
- selectors: ['.hed', 'h1'],
+ selectors: ['.hed', 'h1']
},
author: {
- selectors: ['a[rel=author]'],
+ selectors: ['a[rel=author]']
},
date_published: {
selectors: ['.pub-date'],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: ['.dek'],
+ selectors: ['.dek']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: ['.body'],
@@ -5276,32 +4586,27 @@ var WwwSlateComExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [
- '.about-the-author',
- '.pullquote',
- '.newsletter-signup-component',
- '.top-comment',
- ],
- },
+ clean: ['.about-the-author', '.pullquote', '.newsletter-signup-component', '.top-comment']
+ }
};
var IciRadioCanadaCaExtractor = {
domain: 'ici.radio-canada.ca',
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: [['meta[name="dc.creator"]', 'value']],
+ selectors: [['meta[name="dc.creator"]', 'value']]
},
date_published: {
selectors: [['meta[name="dc.date.created"]', 'value']],
- timezone: 'America/New_York',
+ timezone: 'America/New_York'
},
dek: {
- selectors: ['.bunker-component.lead'],
+ selectors: ['.bunker-component.lead']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
selectors: [['.main-multimedia-item', '.news-story-content']],
@@ -5311,28 +4616,26 @@ var IciRadioCanadaCaExtractor = {
// Is there anything that is in the result that shouldn't be?
// The clean selectors will remove anything that matches from
// the result
- clean: [],
- },
+ clean: []
+ }
};
var WwwFortinetComExtractor = {
domain: 'www.fortinet.com',
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: ['.b15-blog-meta__author'],
+ selectors: ['.b15-blog-meta__author']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: [
- 'div.responsivegrid.aem-GridColumn.aem-GridColumn--default--12',
- ],
+ selectors: ['div.responsivegrid.aem-GridColumn.aem-GridColumn--default--12'],
transforms: {
noscript: function noscript($node) {
var $children = $node.children();
@@ -5342,34 +4645,36 @@ var WwwFortinetComExtractor = {
}
return null;
- },
- },
- },
+ }
+ }
+ }
};
var WwwFastcompanyComExtractor = {
domain: 'www.fastcompany.com',
title: {
- selectors: ['h1'],
+ selectors: ['h1']
},
author: {
- selectors: ['.post__by'],
+ selectors: ['.post__by']
},
date_published: {
- selectors: [['meta[name="article:published_time"]', 'value']],
+ selectors: [['meta[name="article:published_time"]', 'value']]
},
dek: {
- selectors: ['.post__deck'],
+ selectors: ['.post__deck']
},
lead_image_url: {
- selectors: [['meta[name="og:image"]', 'value']],
+ selectors: [['meta[name="og:image"]', 'value']]
},
content: {
- selectors: ['.post__article'],
- },
+ selectors: ['.post__article']
+ }
};
-var CustomExtractors = /*#__PURE__*/ Object.freeze({
+
+
+var CustomExtractors = /*#__PURE__*/Object.freeze({
BloggerExtractor: BloggerExtractor,
NYMagExtractor: NYMagExtractor,
WikipediaExtractor: WikipediaExtractor,
@@ -5462,10 +4767,10 @@ var CustomExtractors = /*#__PURE__*/ Object.freeze({
WwwSlateComExtractor: WwwSlateComExtractor,
IciRadioCanadaCaExtractor: IciRadioCanadaCaExtractor,
WwwFortinetComExtractor: WwwFortinetComExtractor,
- WwwFastcompanyComExtractor: WwwFastcompanyComExtractor,
+ WwwFastcompanyComExtractor: WwwFastcompanyComExtractor
});
-var Extractors = _Object$keys(CustomExtractors).reduce(function(acc, key) {
+var Extractors = _Object$keys(CustomExtractors).reduce(function (acc, key) {
var extractor = CustomExtractors[key];
return _objectSpread({}, acc, mergeSupportedDomains(extractor));
}, {});
@@ -5480,32 +4785,12 @@ var SEC_DATE_STRING = /^\d{10}$/i;
var CLEAN_DATE_STRING_RE = /^\s*published\s*:?\s*(.*)/i;
var TIME_MERIDIAN_SPACE_RE = /(.*\d)(am|pm)(.*)/i;
var TIME_MERIDIAN_DOTS_RE = /\.m\./i;
-var months = [
- 'jan',
- 'feb',
- 'mar',
- 'apr',
- 'may',
- 'jun',
- 'jul',
- 'aug',
- 'sep',
- 'oct',
- 'nov',
- 'dec',
-];
+var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
var allMonths = months.join('|');
var timestamp1 = '[0-9]{1,2}:[0-9]{2,2}( ?[ap].?m.?)?';
var timestamp2 = '[0-9]{1,2}[/-][0-9]{1,2}[/-][0-9]{2,4}';
var timestamp3 = '-[0-9]{3,4}$';
-var SPLIT_DATE_STRING = new RegExp(
- '('
- .concat(timestamp1, ')|(')
- .concat(timestamp2, ')|(')
- .concat(timestamp3, ')|([0-9]{1,4})|(')
- .concat(allMonths, ')'),
- 'ig'
-); // 2016-11-22T08:57-500
+var SPLIT_DATE_STRING = new RegExp("(".concat(timestamp1, ")|(").concat(timestamp2, ")|(").concat(timestamp3, ")|([0-9]{1,4})|(").concat(allMonths, ")"), 'ig'); // 2016-11-22T08:57-500
// Check if datetime string has an offset at the end
var TIME_WITH_OFFSET_RE = /-\d{3,4}$/; // CLEAN TITLE CONSTANTS
@@ -5535,12 +4820,11 @@ function clean$1(leadImageUrl) {
function cleanDek(dek, _ref) {
var $ = _ref.$,
- excerpt = _ref.excerpt;
+ excerpt = _ref.excerpt;
// Sanity check that we didn't get too short or long of a dek.
if (dek.length > 1000 || dek.length < 5) return null; // Check that dek isn't the same as excerpt
- if (excerpt && excerptContent(excerpt, 10) === excerptContent(dek, 10))
- return null;
+ if (excerpt && excerptContent(excerpt, 10) === excerptContent(dek, 10)) return null;
var dekText = stripTags(dek, $); // Plain text links shouldn't exist in the dek. If we have some, it's
// not a good dek - bail.
@@ -5549,29 +4833,21 @@ function cleanDek(dek, _ref) {
}
function cleanDateString(dateString) {
- return (dateString.match(SPLIT_DATE_STRING) || [])
- .join(' ')
- .replace(TIME_MERIDIAN_DOTS_RE, 'm')
- .replace(TIME_MERIDIAN_SPACE_RE, '$1 $2 $3')
- .replace(CLEAN_DATE_STRING_RE, '$1')
- .trim();
+ return (dateString.match(SPLIT_DATE_STRING) || []).join(' ').replace(TIME_MERIDIAN_DOTS_RE, 'm').replace(TIME_MERIDIAN_SPACE_RE, '$1 $2 $3').replace(CLEAN_DATE_STRING_RE, '$1').trim();
}
function createDate(dateString, timezone, format) {
if (TIME_WITH_OFFSET_RE.test(dateString)) {
return moment(new Date(dateString));
}
- return timezone
- ? moment.tz(dateString, format || parseFormat(dateString), timezone)
- : moment(dateString, format || parseFormat(dateString));
+ return timezone ? moment.tz(dateString, format || parseFormat(dateString), timezone) : moment(dateString, format || parseFormat(dateString));
} // Take a date published string, and hopefully return a date out of
// it. Return none if we fail.
function cleanDatePublished(dateString) {
- var _ref =
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- timezone = _ref.timezone,
- format = _ref.format;
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
+ timezone = _ref.timezone,
+ format = _ref.format;
// If string is in milliseconds or seconds, convert to int and return
if (MS_DATE_STRING.test(dateString) || SEC_DATE_STRING.test(dateString)) {
@@ -5590,16 +4866,14 @@ function cleanDatePublished(dateString) {
function extractCleanNode(article, _ref) {
var $ = _ref.$,
- _ref$cleanConditional = _ref.cleanConditionally,
- cleanConditionally =
- _ref$cleanConditional === void 0 ? true : _ref$cleanConditional,
- _ref$title = _ref.title,
- title = _ref$title === void 0 ? '' : _ref$title,
- _ref$url = _ref.url,
- url = _ref$url === void 0 ? '' : _ref$url,
- _ref$defaultCleaner = _ref.defaultCleaner,
- defaultCleaner =
- _ref$defaultCleaner === void 0 ? true : _ref$defaultCleaner;
+ _ref$cleanConditional = _ref.cleanConditionally,
+ cleanConditionally = _ref$cleanConditional === void 0 ? true : _ref$cleanConditional,
+ _ref$title = _ref.title,
+ title = _ref$title === void 0 ? '' : _ref$title,
+ _ref$url = _ref.url,
+ url = _ref$url === void 0 ? '' : _ref$url,
+ _ref$defaultCleaner = _ref.defaultCleaner,
+ defaultCleaner = _ref$defaultCleaner === void 0 ? true : _ref$defaultCleaner;
// Rewrite the tag name to div if it's a top level node like body or
// html to avoid later complications with multiple body tags.
rewriteTopLevel$$1(article, $); // Drop small images and spacer images
@@ -5636,7 +4910,7 @@ function extractCleanNode(article, _ref) {
function cleanTitle$$1(title, _ref) {
var url = _ref.url,
- $ = _ref.$;
+ $ = _ref.$;
// If title has |, :, or - in it, see if
// we can clean it up.
@@ -5645,6 +4919,7 @@ function cleanTitle$$1(title, _ref) {
} // Final sanity check that we didn't get a crazy title.
// if (title.length > 150 || title.length < 15) {
+
if (title.length > 150) {
// If we did, return h1 from the document if it exists
var h1 = $('h1');
@@ -5654,6 +4929,7 @@ function cleanTitle$$1(title, _ref) {
}
} // strip any html tags in the title text
+
return normalizeSpaces(stripTags(title, $).trim());
}
@@ -5665,34 +4941,32 @@ function extractBreadcrumbTitle(splitTitle, text) {
// Look to see if we can find a breadcrumb splitter that happens
// more than once. If we can, we'll be able to better pull out
// the title.
- var termCounts = splitTitle.reduce(function(acc, titleText) {
+ var termCounts = splitTitle.reduce(function (acc, titleText) {
acc[titleText] = acc[titleText] ? acc[titleText] + 1 : 1;
return acc;
}, {});
- var _Reflect$ownKeys$redu = _Reflect$ownKeys(termCounts).reduce(
- function(acc, key) {
- if (acc[1] < termCounts[key]) {
- return [key, termCounts[key]];
- }
+ var _Reflect$ownKeys$redu = _Reflect$ownKeys(termCounts).reduce(function (acc, key) {
+ if (acc[1] < termCounts[key]) {
+ return [key, termCounts[key]];
+ }
- return acc;
- },
- [0, 0]
- ),
- _Reflect$ownKeys$redu2 = _slicedToArray(_Reflect$ownKeys$redu, 2),
- maxTerm = _Reflect$ownKeys$redu2[0],
- termCount = _Reflect$ownKeys$redu2[1]; // We found a splitter that was used more than once, so it
+ return acc;
+ }, [0, 0]),
+ _Reflect$ownKeys$redu2 = _slicedToArray(_Reflect$ownKeys$redu, 2),
+ maxTerm = _Reflect$ownKeys$redu2[0],
+ termCount = _Reflect$ownKeys$redu2[1]; // We found a splitter that was used more than once, so it
// is probably the breadcrumber. Split our title on that instead.
// Note: max_term should be <= 4 characters, so that " >> "
// will match, but nothing longer than that.
+
if (termCount >= 2 && maxTerm.length <= 4) {
splitTitle = text.split(maxTerm);
}
var splitEnds = [splitTitle[0], splitTitle.slice(-1)];
- var longestEnd = splitEnds.reduce(function(acc, end) {
+ var longestEnd = splitEnds.reduce(function (acc, end) {
return acc.length > end.length ? acc : end;
}, '');
@@ -5714,7 +4988,7 @@ function cleanDomainFromTitle(splitTitle, url) {
// Strip out the big TLDs - it just makes the matching a bit more
// accurate. Not the end of the world if it doesn't strip right.
var _URL$parse = URL.parse(url),
- host = _URL$parse.host;
+ host = _URL$parse.host;
var nakedDomain = host.replace(DOMAIN_ENDINGS_RE, '');
var startSlug = splitTitle[0].toLowerCase().replace(' ', '');
@@ -5724,10 +4998,7 @@ function cleanDomainFromTitle(splitTitle, url) {
return splitTitle.slice(2).join('');
}
- var endSlug = splitTitle
- .slice(-1)[0]
- .toLowerCase()
- .replace(' ', '');
+ var endSlug = splitTitle.slice(-1)[0].toLowerCase().replace(' ', '');
var endSlugRatio = wuzzy.levenshtein(endSlug, nakedDomain);
if (endSlugRatio > 0.4 && endSlug.length >= 5) {
@@ -5738,9 +5009,9 @@ function cleanDomainFromTitle(splitTitle, url) {
} // Given a title with separators in it (colons, dashes, etc),
// resolve whether any of the segments should be removed.
+
function resolveSplitTitle(title) {
- var url =
- arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+ var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
// Splits while preserving splitters, like:
// ['The New New York', ' - ', 'The Washington Post']
var splitTitle = title.split(TITLE_SPLITTERS_RE);
@@ -5764,7 +5035,7 @@ var Cleaners = {
dek: cleanDek,
date_published: cleanDatePublished,
content: extractCleanNode,
- title: cleanTitle$$1,
+ title: cleanTitle$$1
};
// likely to be article text.
@@ -5793,7 +5064,7 @@ var GenericContentExtractor = {
defaultOpts: {
stripUnlikelyCandidates: true,
weightNodes: true,
- cleanConditionally: true,
+ cleanConditionally: true
},
// Extract the content for this resource - initially, pass in our
// most restrictive opts which will return the highest quality
@@ -5816,9 +5087,9 @@ var GenericContentExtractor = {
// superfluous content. Things like forms, ads, etc.
extract: function extract(_ref, opts) {
var $ = _ref.$,
- html = _ref.html,
- title = _ref.title,
- url = _ref.url;
+ html = _ref.html,
+ title = _ref.title,
+ url = _ref.url;
opts = _objectSpread({}, this.defaultOpts, opts);
$ = $ || cheerio.load(html); // Cascade through our extraction-specific opts in an ordered fashion,
// turning them off as we try to extract content.
@@ -5831,21 +5102,15 @@ var GenericContentExtractor = {
// extraction opts and try again.
// eslint-disable-next-line no-restricted-syntax
+
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
- for (
- var _iterator = _getIterator(
- _Reflect$ownKeys(opts).filter(function(k) {
- return opts[k] === true;
- })
- ),
- _step;
- !(_iteratorNormalCompletion = (_step = _iterator.next()).done);
- _iteratorNormalCompletion = true
- ) {
+ for (var _iterator = _getIterator(_Reflect$ownKeys(opts).filter(function (k) {
+ return opts[k] === true;
+ })), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
opts[key] = false;
$ = cheerio.load(html);
@@ -5878,7 +5143,7 @@ var GenericContentExtractor = {
$: $,
cleanConditionally: opts.cleanConditionally,
title: title,
- url: url,
+ url: url
});
},
// Once we got here, either we're at our last-resort node, or
@@ -5890,7 +5155,7 @@ var GenericContentExtractor = {
}
return normalizeSpaces($.html(node));
- },
+ }
};
// TODO: It would be great if we could merge the meta and selector lists into
@@ -5899,13 +5164,7 @@ var GenericContentExtractor = {
// An ordered list of meta tag names that denote likely article titles. All
// attributes should be lowercase for faster case-insensitive matching. From
// most distinct to least distinct.
-var STRONG_TITLE_META_TAGS = [
- 'tweetmeme-title',
- 'dc.title',
- 'rbtitle',
- 'headline',
- 'title',
-]; // og:title is weak because it typically contains context that we don't like,
+var STRONG_TITLE_META_TAGS = ['tweetmeme-title', 'dc.title', 'rbtitle', 'headline', 'title']; // og:title is weak because it typically contains context that we don't like,
// for example the source site's name. Gotta get that brand into facebook!
var WEAK_TITLE_META_TAGS = ['og:title']; // An ordered list of XPath Selectors to find likely article titles. From
@@ -5916,71 +5175,44 @@ var WEAK_TITLE_META_TAGS = ['og:title']; // An ordered list of XPath Selectors t
// splits on spaces/endlines), but for our purposes it's close enough. The
// speed tradeoff is worth the accuracy hit.
-var STRONG_TITLE_SELECTORS = [
- '.hentry .entry-title',
- 'h1#articleHeader',
- 'h1.articleHeader',
- 'h1.article',
- '.instapaper_title',
- '#meebo-title',
-];
-var WEAK_TITLE_SELECTORS = [
- 'article h1',
- '#entry-title',
- '.entry-title',
- '#entryTitle',
- '#entrytitle',
- '.entryTitle',
- '.entrytitle',
- '#articleTitle',
- '.articleTitle',
- 'post post-title',
- 'h1.title',
- 'h2.article',
- 'h1',
- 'html head title',
- 'title',
-];
+var STRONG_TITLE_SELECTORS = ['.hentry .entry-title', 'h1#articleHeader', 'h1.articleHeader', 'h1.article', '.instapaper_title', '#meebo-title'];
+var WEAK_TITLE_SELECTORS = ['article h1', '#entry-title', '.entry-title', '#entryTitle', '#entrytitle', '.entryTitle', '.entrytitle', '#articleTitle', '.articleTitle', 'post post-title', 'h1.title', 'h2.article', 'h1', 'html head title', 'title'];
var GenericTitleExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- url = _ref.url,
- metaCache = _ref.metaCache;
+ url = _ref.url,
+ metaCache = _ref.metaCache;
// First, check to see if we have a matching meta tag that we can make
// use of that is strongly associated with the headline.
var title;
title = extractFromMeta$$1($, STRONG_TITLE_META_TAGS, metaCache);
- if (title)
- return cleanTitle$$1(title, {
- url: url,
- $: $,
- }); // Second, look through our content selectors for the most likely
+ if (title) return cleanTitle$$1(title, {
+ url: url,
+ $: $
+ }); // Second, look through our content selectors for the most likely
// article title that is strongly associated with the headline.
title = extractFromSelectors$$1($, STRONG_TITLE_SELECTORS);
- if (title)
- return cleanTitle$$1(title, {
- url: url,
- $: $,
- }); // Third, check for weaker meta tags that may match.
+ if (title) return cleanTitle$$1(title, {
+ url: url,
+ $: $
+ }); // Third, check for weaker meta tags that may match.
title = extractFromMeta$$1($, WEAK_TITLE_META_TAGS, metaCache);
- if (title)
- return cleanTitle$$1(title, {
- url: url,
- $: $,
- }); // Last, look for weaker selector tags that may match.
+ if (title) return cleanTitle$$1(title, {
+ url: url,
+ $: $
+ }); // Last, look for weaker selector tags that may match.
title = extractFromSelectors$$1($, WEAK_TITLE_SELECTORS);
- if (title)
- return cleanTitle$$1(title, {
- url: url,
- $: $,
- }); // If no matches, return an empty string
+ if (title) return cleanTitle$$1(title, {
+ url: url,
+ $: $
+ }); // If no matches, return an empty string
return '';
- },
+ }
};
// An ordered list of meta tag names that denote likely article authors. All
@@ -5989,15 +5221,7 @@ var GenericTitleExtractor = {
//
// Note: "author" is too often the -developer- of the page, so it is not
// added here.
-var AUTHOR_META_TAGS = [
- 'byl',
- 'clmst',
- 'dc.author',
- 'dcsext.author',
- 'dc.creator',
- 'rbauthors',
- 'authors',
-];
+var AUTHOR_META_TAGS = ['byl', 'clmst', 'dc.author', 'dcsext.author', 'dc.creator', 'rbauthors', 'authors'];
var AUTHOR_MAX_LENGTH = 300; // An ordered list of XPath Selectors to find likely article authors. From
// most explicit to least explicit.
//
@@ -6006,31 +5230,7 @@ var AUTHOR_MAX_LENGTH = 300; // An ordered list of XPath Selectors to find likel
// splits on spaces/endlines), but for our purposes it's close enough. The
// speed tradeoff is worth the accuracy hit.
-var AUTHOR_SELECTORS = [
- '.entry .entry-author',
- '.author.vcard .fn',
- '.author .vcard .fn',
- '.byline.vcard .fn',
- '.byline .vcard .fn',
- '.byline .by .author',
- '.byline .by',
- '.byline .author',
- '.post-author.vcard',
- '.post-author .vcard',
- 'a[rel=author]',
- '#by_author',
- '.by_author',
- '#entryAuthor',
- '.entryAuthor',
- '.byline a[href*=author]',
- '#author .authorname',
- '.author .authorname',
- '#author',
- '.author',
- '.articleauthor',
- '.ArticleAuthor',
- '.byline',
-]; // An ordered list of Selectors to find likely article authors, with
+var AUTHOR_SELECTORS = ['.entry .entry-author', '.author.vcard .fn', '.author .vcard .fn', '.byline.vcard .fn', '.byline .vcard .fn', '.byline .by .author', '.byline .by', '.byline .author', '.post-author.vcard', '.post-author .vcard', 'a[rel=author]', '#by_author', '.by_author', '#entryAuthor', '.entryAuthor', '.byline a[href*=author]', '#author .authorname', '.author .authorname', '#author', '.author', '.articleauthor', '.ArticleAuthor', '.byline']; // An ordered list of Selectors to find likely article authors, with
// regular expression for content.
var bylineRe = /^[\n\s]*By/i;
@@ -6039,7 +5239,7 @@ var BYLINE_SELECTORS_RE = [['#byline', bylineRe], ['.byline', bylineRe]];
var GenericAuthorExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- metaCache = _ref.metaCache;
+ metaCache = _ref.metaCache;
var author; // First, check to see if we have a matching
// meta tag that we can make use of.
@@ -6049,6 +5249,7 @@ var GenericAuthorExtractor = {
return cleanAuthor(author);
} // Second, look through our selectors looking for potential authors.
+
author = extractFromSelectors$$1($, AUTHOR_SELECTORS, 2);
if (author && author.length < AUTHOR_MAX_LENGTH) {
@@ -6057,19 +5258,16 @@ var GenericAuthorExtractor = {
// potential authors.
// eslint-disable-next-line no-restricted-syntax
+
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
- for (
- var _iterator = _getIterator(BYLINE_SELECTORS_RE), _step;
- !(_iteratorNormalCompletion = (_step = _iterator.next()).done);
- _iteratorNormalCompletion = true
- ) {
+ for (var _iterator = _getIterator(BYLINE_SELECTORS_RE), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = _slicedToArray(_step.value, 2),
- selector = _step$value[0],
- regex = _step$value[1];
+ selector = _step$value[0],
+ regex = _step$value[1];
var node = $(selector);
@@ -6097,78 +5295,34 @@ var GenericAuthorExtractor = {
}
return null;
- },
+ }
};
// An ordered list of meta tag names that denote
// likely date published dates. All attributes
// should be lowercase for faster case-insensitive matching.
// From most distinct to least distinct.
-var DATE_PUBLISHED_META_TAGS = [
- 'article:published_time',
- 'displaydate',
- 'dc.date',
- 'dc.date.issued',
- 'rbpubdate',
- 'publish_date',
- 'pub_date',
- 'pagedate',
- 'pubdate',
- 'revision_date',
- 'doc_date',
- 'date_created',
- 'content_create_date',
- 'lastmodified',
- 'created',
- 'date',
-]; // An ordered list of XPath Selectors to find
+var DATE_PUBLISHED_META_TAGS = ['article:published_time', 'displaydate', 'dc.date', 'dc.date.issued', 'rbpubdate', 'publish_date', 'pub_date', 'pagedate', 'pubdate', 'revision_date', 'doc_date', 'date_created', 'content_create_date', 'lastmodified', 'created', 'date']; // An ordered list of XPath Selectors to find
// likely date published dates. From most explicit
// to least explicit.
-var DATE_PUBLISHED_SELECTORS = [
- '.hentry .dtstamp.published',
- '.hentry .published',
- '.hentry .dtstamp.updated',
- '.hentry .updated',
- '.single .published',
- '.meta .published',
- '.meta .postDate',
- '.entry-date',
- '.byline .date',
- '.postmetadata .date',
- '.article_datetime',
- '.date-header',
- '.story-date',
- '.dateStamp',
- '#story .datetime',
- '.dateline',
- '.pubdate',
-]; // An ordered list of compiled regular expressions to find likely date
+var DATE_PUBLISHED_SELECTORS = ['.hentry .dtstamp.published', '.hentry .published', '.hentry .dtstamp.updated', '.hentry .updated', '.single .published', '.meta .published', '.meta .postDate', '.entry-date', '.byline .date', '.postmetadata .date', '.article_datetime', '.date-header', '.story-date', '.dateStamp', '#story .datetime', '.dateline', '.pubdate']; // An ordered list of compiled regular expressions to find likely date
// published dates from the URL. These should always have the first
// reference be a date string that is parseable by dateutil.parser.parse
var abbrevMonthsStr = '(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)';
-var DATE_PUBLISHED_URL_RES = [
- new RegExp('/(20\\d{2}/\\d{2}/\\d{2})/', 'i'),
- new RegExp('(20\\d{2}-[01]\\d-[0-3]\\d)', 'i'),
- new RegExp('/(20\\d{2}/'.concat(abbrevMonthsStr, '/[0-3]\\d)/'), 'i'),
-];
+var DATE_PUBLISHED_URL_RES = [new RegExp('/(20\\d{2}/\\d{2}/\\d{2})/', 'i'), new RegExp('(20\\d{2}-[01]\\d-[0-3]\\d)', 'i'), new RegExp("/(20\\d{2}/".concat(abbrevMonthsStr, "/[0-3]\\d)/"), 'i')];
var GenericDatePublishedExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- url = _ref.url,
- metaCache = _ref.metaCache;
+ url = _ref.url,
+ metaCache = _ref.metaCache;
var datePublished; // First, check to see if we have a matching meta tag
// that we can make use of.
// Don't try cleaning tags from this string
- datePublished = extractFromMeta$$1(
- $,
- DATE_PUBLISHED_META_TAGS,
- metaCache,
- false
- );
+ datePublished = extractFromMeta$$1($, DATE_PUBLISHED_META_TAGS, metaCache, false);
if (datePublished) return cleanDatePublished(datePublished); // Second, look through our selectors looking for potential
// date_published's.
@@ -6178,7 +5332,7 @@ var GenericDatePublishedExtractor = {
datePublished = extractFromUrl(url, DATE_PUBLISHED_URL_RES);
if (datePublished) return cleanDatePublished(datePublished);
return null;
- },
+ }
};
// Currently there is only one selector for
@@ -6188,7 +5342,7 @@ var GenericDatePublishedExtractor = {
var GenericDekExtractor = {
extract: function extract() {
return null;
- },
+ }
};
// An ordered list of meta tag names that denote likely article leading images.
@@ -6196,57 +5350,18 @@ var GenericDekExtractor = {
// From most distinct to least distinct.
var LEAD_IMAGE_URL_META_TAGS = ['og:image', 'twitter:image', 'image_src'];
var LEAD_IMAGE_URL_SELECTORS = ['link[rel=image_src]'];
-var POSITIVE_LEAD_IMAGE_URL_HINTS = [
- 'upload',
- 'wp-content',
- 'large',
- 'photo',
- 'wp-image',
-];
-var POSITIVE_LEAD_IMAGE_URL_HINTS_RE = new RegExp(
- POSITIVE_LEAD_IMAGE_URL_HINTS.join('|'),
- 'i'
-);
-var NEGATIVE_LEAD_IMAGE_URL_HINTS = [
- 'spacer',
- 'sprite',
- 'blank',
- 'throbber',
- 'gradient',
- 'tile',
- 'bg',
- 'background',
- 'icon',
- 'social',
- 'header',
- 'hdr',
- 'advert',
- 'spinner',
- 'loader',
- 'loading',
- 'default',
- 'rating',
- 'share',
- 'facebook',
- 'twitter',
- 'theme',
- 'promo',
- 'ads',
- 'wp-includes',
-];
-var NEGATIVE_LEAD_IMAGE_URL_HINTS_RE = new RegExp(
- NEGATIVE_LEAD_IMAGE_URL_HINTS.join('|'),
- 'i'
-);
+var POSITIVE_LEAD_IMAGE_URL_HINTS = ['upload', 'wp-content', 'large', 'photo', 'wp-image'];
+var POSITIVE_LEAD_IMAGE_URL_HINTS_RE = new RegExp(POSITIVE_LEAD_IMAGE_URL_HINTS.join('|'), 'i');
+var NEGATIVE_LEAD_IMAGE_URL_HINTS = ['spacer', 'sprite', 'blank', 'throbber', 'gradient', 'tile', 'bg', 'background', 'icon', 'social', 'header', 'hdr', 'advert', 'spinner', 'loader', 'loading', 'default', 'rating', 'share', 'facebook', 'twitter', 'theme', 'promo', 'ads', 'wp-includes'];
+var NEGATIVE_LEAD_IMAGE_URL_HINTS_RE = new RegExp(NEGATIVE_LEAD_IMAGE_URL_HINTS.join('|'), 'i');
var GIF_RE = /\.gif(\?.*)?$/i;
var JPG_RE = /\.jpe?g(\?.*)?$/i;
function getSig($node) {
- return ''
- .concat($node.attr('class') || '', ' ')
- .concat($node.attr('id') || '');
+ return "".concat($node.attr('class') || '', " ").concat($node.attr('id') || '');
} // Scores image urls based on a variety of heuristics.
+
function scoreImageUrl(url) {
url = url.trim();
var score = 0;
@@ -6260,6 +5375,7 @@ function scoreImageUrl(url) {
} // TODO: We might want to consider removing this as
// gifs are much more common/popular than they once were
+
if (GIF_RE.test(url)) {
score -= 10;
}
@@ -6268,6 +5384,7 @@ function scoreImageUrl(url) {
score += 10;
} // PNGs are neutral.
+
return score;
} // Alt attribute usually means non-presentational image.
@@ -6295,7 +5412,7 @@ function scoreByParents($img) {
$gParent = $parent.parent();
}
- [$parent, $gParent].forEach(function($node) {
+ [$parent, $gParent].forEach(function ($node) {
if (PHOTO_HINTS_RE$1.test(getSig($node))) {
score += 15;
}
@@ -6332,6 +5449,7 @@ function scoreByDimensions($img) {
score -= 50;
} // Penalty for short images
+
if (height && height <= 50) {
score -= 50;
}
@@ -6364,26 +5482,20 @@ function scoreByPosition($imgs, index) {
var GenericLeadImageUrlExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- content = _ref.content,
- metaCache = _ref.metaCache,
- html = _ref.html;
+ content = _ref.content,
+ metaCache = _ref.metaCache,
+ html = _ref.html;
var cleanUrl;
if (!$.browser && $('head').length === 0) {
- $('*')
- .first()
- .prepend(html);
+ $('*').first().prepend(html);
} // Check to see if we have a matching meta tag that we can make use of.
// Moving this higher because common practice is now to use large
// images on things like Open Graph or Twitter cards.
// images usually have for things like Open Graph.
- var imageUrl = extractFromMeta$$1(
- $,
- LEAD_IMAGE_URL_META_TAGS,
- metaCache,
- false
- );
+
+ var imageUrl = extractFromMeta$$1($, LEAD_IMAGE_URL_META_TAGS, metaCache, false);
if (imageUrl) {
cleanUrl = clean$1(imageUrl);
@@ -6392,10 +5504,11 @@ var GenericLeadImageUrlExtractor = {
// We'd rather not have to fetch each image and check dimensions,
// so try to do some analysis and determine them instead.
+
var $content = $(content);
var imgs = $('img', $content).toArray();
var imgScores = {};
- imgs.forEach(function(img, index) {
+ imgs.forEach(function (img, index) {
var $img = $(img);
var src = $img.attr('src');
if (!src) return;
@@ -6408,15 +5521,12 @@ var GenericLeadImageUrlExtractor = {
imgScores[src] = score;
});
- var _Reflect$ownKeys$redu = _Reflect$ownKeys(imgScores).reduce(
- function(acc, key) {
- return imgScores[key] > acc[1] ? [key, imgScores[key]] : acc;
- },
- [null, 0]
- ),
- _Reflect$ownKeys$redu2 = _slicedToArray(_Reflect$ownKeys$redu, 2),
- topUrl = _Reflect$ownKeys$redu2[0],
- topScore = _Reflect$ownKeys$redu2[1];
+ var _Reflect$ownKeys$redu = _Reflect$ownKeys(imgScores).reduce(function (acc, key) {
+ return imgScores[key] > acc[1] ? [key, imgScores[key]] : acc;
+ }, [null, 0]),
+ _Reflect$ownKeys$redu2 = _slicedToArray(_Reflect$ownKeys$redu, 2),
+ topUrl = _Reflect$ownKeys$redu2[0],
+ topScore = _Reflect$ownKeys$redu2[1];
if (topScore > 0) {
cleanUrl = clean$1(topUrl);
@@ -6425,16 +5535,13 @@ var GenericLeadImageUrlExtractor = {
// probable nodes in the doc, like .
// eslint-disable-next-line no-restricted-syntax
+
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
- for (
- var _iterator = _getIterator(LEAD_IMAGE_URL_SELECTORS), _step;
- !(_iteratorNormalCompletion = (_step = _iterator.next()).done);
- _iteratorNormalCompletion = true
- ) {
+ for (var _iterator = _getIterator(LEAD_IMAGE_URL_SELECTORS), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var selector = _step.value;
var $node = $(selector).first();
var src = $node.attr('src');
@@ -6474,7 +5581,7 @@ var GenericLeadImageUrlExtractor = {
}
return null;
- },
+ }
};
function scoreSimilarity(score, articleUrl, href) {
@@ -6484,11 +5591,7 @@ function scoreSimilarity(score, articleUrl, href) {
// sliding scale, subtract points from this link based on
// similarity.
if (score > 0) {
- var similarity = new difflib.SequenceMatcher(
- null,
- articleUrl,
- href
- ).ratio(); // Subtract .1 from diff_percent when calculating modifier,
+ var similarity = new difflib.SequenceMatcher(null, articleUrl, href).ratio(); // Subtract .1 from diff_percent when calculating modifier,
// which means that if it's less than 10% different, we give a
// bonus instead. Ex:
// 3% different = +17.5 points
@@ -6515,6 +5618,7 @@ function scoreLinkText(linkText, pageNum) {
// Give it a negative score. Otherwise, up to page 10, give a
// small bonus.
+
if (linkTextAsNum < 2) {
score = -30;
} else {
@@ -6523,6 +5627,7 @@ function scoreLinkText(linkText, pageNum) {
// this links page number, it's a very bad sign. Give it a big
// penalty.
+
if (pageNum && pageNum >= linkTextAsNum) {
score -= 50;
}
@@ -6545,33 +5650,12 @@ function scorePageInLink(pageNum, isWp) {
var DIGIT_RE$2 = /\d/; // A list of words that, if found in link text or URLs, likely mean that
// this link is not a next page link.
-var EXTRANEOUS_LINK_HINTS$1 = [
- 'print',
- 'archive',
- 'comment',
- 'discuss',
- 'e-mail',
- 'email',
- 'share',
- 'reply',
- 'all',
- 'login',
- 'sign',
- 'single',
- 'adx',
- 'entry-unrelated',
-];
-var EXTRANEOUS_LINK_HINTS_RE$1 = new RegExp(
- EXTRANEOUS_LINK_HINTS$1.join('|'),
- 'i'
-); // Match any link text/classname/id that looks like it could mean the next
+var EXTRANEOUS_LINK_HINTS$1 = ['print', 'archive', 'comment', 'discuss', 'e-mail', 'email', 'share', 'reply', 'all', 'login', 'sign', 'single', 'adx', 'entry-unrelated'];
+var EXTRANEOUS_LINK_HINTS_RE$1 = new RegExp(EXTRANEOUS_LINK_HINTS$1.join('|'), 'i'); // Match any link text/classname/id that looks like it could mean the next
// page. Things like: next, continue, >, >>, » but not >|, »| as those can
// mean last page.
-var NEXT_LINK_TEXT_RE$1 = new RegExp(
- '(next|weiter|continue|>([^|]|$)|»([^|]|$))',
- 'i'
-); // Match any link text/classname/id that looks like it is an end link: things
+var NEXT_LINK_TEXT_RE$1 = new RegExp('(next|weiter|continue|>([^|]|$)|»([^|]|$))', 'i'); // Match any link text/classname/id that looks like it is an end link: things
// like "first", "last", "end", etc.
var CAP_LINK_TEXT_RE$1 = new RegExp('(first|last|end)', 'i'); // Match any link text/classname/id that looks like it means the previous
@@ -6589,9 +5673,7 @@ function scoreExtraneousLinks(href) {
}
function makeSig($link) {
- return ''
- .concat($link.attr('class') || '', ' ')
- .concat($link.attr('id') || '');
+ return "".concat($link.attr('class') || '', " ").concat($link.attr('id') || '');
}
function scoreByParents$1($link) {
@@ -6603,7 +5685,7 @@ function scoreByParents$1($link) {
var negativeMatch = false;
var score = 0;
- _Array$from(range(0, 4)).forEach(function() {
+ _Array$from(range(0, 4)).forEach(function () {
if ($parent.length === 0) {
return;
}
@@ -6618,11 +5700,8 @@ function scoreByParents$1($link) {
// we don't have something like 'content' as well, that's
// a bad sign. Give a penalty.
- if (
- !negativeMatch &&
- NEGATIVE_SCORE_RE.test(parentData) &&
- EXTRANEOUS_LINK_HINTS_RE$1.test(parentData)
- ) {
+
+ if (!negativeMatch && NEGATIVE_SCORE_RE.test(parentData) && EXTRANEOUS_LINK_HINTS_RE$1.test(parentData)) {
if (!POSITIVE_SCORE_RE.test(parentData)) {
negativeMatch = true;
score -= 25;
@@ -6645,24 +5724,16 @@ function scorePrevLink(linkData) {
return 0;
}
-function shouldScore(
- href,
- articleUrl,
- baseUrl,
- parsedUrl,
- linkText,
- previousUrls
-) {
+function shouldScore(href, articleUrl, baseUrl, parsedUrl, linkText, previousUrls) {
// skip if we've already fetched this url
- if (
- previousUrls.find(function(url) {
- return href === url;
- }) !== undefined
- ) {
+ if (previousUrls.find(function (url) {
+ return href === url;
+ }) !== undefined) {
return false;
} // If we've already parsed this URL, or the URL matches the base
// URL, or is empty, skip it.
+
if (!href || href === articleUrl || href === baseUrl) {
return false;
}
@@ -6670,13 +5741,15 @@ function shouldScore(
var hostname = parsedUrl.hostname;
var _URL$parse = URL.parse(href),
- linkHost = _URL$parse.hostname; // Domain mismatch.
+ linkHost = _URL$parse.hostname; // Domain mismatch.
+
if (linkHost !== hostname) {
return false;
} // If href doesn't contain a digit after removing the base URL,
// it's certainly not the next page.
+
var fragment = href.replace(baseUrl, '');
if (!DIGIT_RE$2.test(fragment)) {
@@ -6684,10 +5757,12 @@ function shouldScore(
} // This link has extraneous content (like "comment") in its link
// text, so we skip it.
+
if (EXTRANEOUS_LINK_HINTS_RE$1.test(linkText)) {
return false;
} // Next page link text is never long, skip if it is too long.
+
if (linkText.length > 25) {
return false;
}
@@ -6732,24 +5807,21 @@ function scoreCapLinks(linkData) {
}
function makeBaseRegex(baseUrl) {
- return new RegExp('^'.concat(baseUrl), 'i');
+ return new RegExp("^".concat(baseUrl), 'i');
}
function makeSig$1($link, linkText) {
- return ''
- .concat(linkText || $link.text(), ' ')
- .concat($link.attr('class') || '', ' ')
- .concat($link.attr('id') || '');
+ return "".concat(linkText || $link.text(), " ").concat($link.attr('class') || '', " ").concat($link.attr('id') || '');
}
function scoreLinks(_ref) {
var links = _ref.links,
- articleUrl = _ref.articleUrl,
- baseUrl = _ref.baseUrl,
- parsedUrl = _ref.parsedUrl,
- $ = _ref.$,
- _ref$previousUrls = _ref.previousUrls,
- previousUrls = _ref$previousUrls === void 0 ? [] : _ref$previousUrls;
+ articleUrl = _ref.articleUrl,
+ baseUrl = _ref.baseUrl,
+ parsedUrl = _ref.parsedUrl,
+ $ = _ref.$,
+ _ref$previousUrls = _ref.previousUrls,
+ previousUrls = _ref$previousUrls === void 0 ? [] : _ref$previousUrls;
parsedUrl = parsedUrl || URL.parse(articleUrl);
var baseRegex = makeBaseRegex(baseUrl);
var isWp = isWordpress($); // Loop through all links, looking for hints that they may be next-page
@@ -6760,7 +5832,7 @@ function scoreLinks(_ref) {
// looks most like the next page link, as long as its score is strong
// enough to have decent confidence.
- var scoredPages = links.reduce(function(possiblePages, link) {
+ var scoredPages = links.reduce(function (possiblePages, link) {
// Remove any anchor data since we don't do a good job
// standardizing URLs (it's hard), we're going to do
// some checking with and without a trailing slash
@@ -6771,22 +5843,19 @@ function scoreLinks(_ref) {
var $link = $(link);
var linkText = $link.text();
- if (
- !shouldScore(href, articleUrl, baseUrl, parsedUrl, linkText, previousUrls)
- ) {
+ if (!shouldScore(href, articleUrl, baseUrl, parsedUrl, linkText, previousUrls)) {
return possiblePages;
} // ## PASSED THE FIRST-PASS TESTS. Start scoring. ##
+
if (!possiblePages[href]) {
possiblePages[href] = {
score: 0,
linkText: linkText,
- href: href,
+ href: href
};
} else {
- possiblePages[href].linkText = ''
- .concat(possiblePages[href].linkText, '|')
- .concat(linkText);
+ possiblePages[href].linkText = "".concat(possiblePages[href].linkText, "|").concat(linkText);
}
var possiblePage = possiblePages[href];
@@ -6812,10 +5881,10 @@ function scoreLinks(_ref) {
var GenericNextPageUrlExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- url = _ref.url,
- parsedUrl = _ref.parsedUrl,
- _ref$previousUrls = _ref.previousUrls,
- previousUrls = _ref$previousUrls === void 0 ? [] : _ref$previousUrls;
+ url = _ref.url,
+ parsedUrl = _ref.parsedUrl,
+ _ref$previousUrls = _ref.previousUrls,
+ previousUrls = _ref$previousUrls === void 0 ? [] : _ref$previousUrls;
parsedUrl = parsedUrl || URL.parse(url);
var articleUrl = removeAnchor(url);
var baseUrl = articleBaseUrl(url, parsedUrl);
@@ -6826,29 +5895,27 @@ var GenericNextPageUrlExtractor = {
baseUrl: baseUrl,
parsedUrl: parsedUrl,
$: $,
- previousUrls: previousUrls,
+ previousUrls: previousUrls
}); // If no links were scored, return null
if (!scoredLinks) return null; // now that we've scored all possible pages,
// find the biggest one.
- var topPage = _Reflect$ownKeys(scoredLinks).reduce(
- function(acc, link) {
- var scoredLink = scoredLinks[link];
- return scoredLink.score > acc.score ? scoredLink : acc;
- },
- {
- score: -100,
- }
- ); // If the score is less than 50, we're not confident enough to use it,
+ var topPage = _Reflect$ownKeys(scoredLinks).reduce(function (acc, link) {
+ var scoredLink = scoredLinks[link];
+ return scoredLink.score > acc.score ? scoredLink : acc;
+ }, {
+ score: -100
+ }); // If the score is less than 50, we're not confident enough to use it,
// so we fail.
+
if (topPage.score >= 50) {
return topPage.href;
}
return null;
- },
+ }
};
var CANONICAL_META_SELECTORS = ['og:url'];
@@ -6862,15 +5929,15 @@ function parseDomain(url) {
function result(url) {
return {
url: url,
- domain: parseDomain(url),
+ domain: parseDomain(url)
};
}
var GenericUrlExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- url = _ref.url,
- metaCache = _ref.metaCache;
+ url = _ref.url,
+ metaCache = _ref.metaCache;
var $canonical = $('link[rel=canonical]');
if ($canonical.length !== 0) {
@@ -6888,34 +5955,34 @@ var GenericUrlExtractor = {
}
return result(url);
- },
+ }
};
var EXCERPT_META_SELECTORS = ['og:description', 'twitter:description'];
function clean$2(content, $) {
- var maxLength =
- arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
+ var maxLength = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
content = content.replace(/[\s\n]+/g, ' ').trim();
return ellipsize(content, maxLength, {
- ellipse: '…',
+ ellipse: '…'
});
}
var GenericExcerptExtractor = {
extract: function extract(_ref) {
var $ = _ref.$,
- content = _ref.content,
- metaCache = _ref.metaCache;
+ content = _ref.content,
+ metaCache = _ref.metaCache;
var excerpt = extractFromMeta$$1($, EXCERPT_META_SELECTORS, metaCache);
if (excerpt) {
return clean$2(stripTags(excerpt, $));
} // Fall back to excerpting from the extracted content
+
var maxLength = 200;
var shortContent = content.slice(0, maxLength * 5);
return clean$2($(shortContent).text(), $, maxLength);
- },
+ }
};
var GenericWordCountExtractor = {
@@ -6925,7 +5992,7 @@ var GenericWordCountExtractor = {
var $content = $('div').first();
var text = normalizeSpaces($content.text());
return text.split(/\s/).length;
- },
+ }
};
var GenericExtractor = {
@@ -6947,7 +6014,9 @@ var GenericExtractor = {
},
extract: function extract(options) {
var html = options.html,
- $ = options.$;
+ $ = options.$,
+ _options$contentType = options.contentType,
+ contentType = _options$contentType === void 0 ? 'html' : _options$contentType;
if (html && !$) {
var loaded = cheerio.load(html);
@@ -6957,39 +6026,40 @@ var GenericExtractor = {
var title = this.title(options);
var date_published = this.date_published(options);
var author = this.author(options);
- var content = this.content(
- _objectSpread({}, options, {
- title: title,
- })
- );
- var lead_image_url = this.lead_image_url(
- _objectSpread({}, options, {
- content: content,
- })
- );
- var dek = this.dek(
- _objectSpread({}, options, {
- content: content,
- })
- );
+ var content = this.content(_objectSpread({}, options, {
+ title: title
+ }));
+ var lead_image_url = this.lead_image_url(_objectSpread({}, options, {
+ content: content
+ }));
+ var dek = this.dek(_objectSpread({}, options, {
+ content: content
+ }));
var next_page_url = this.next_page_url(options);
- var excerpt = this.excerpt(
- _objectSpread({}, options, {
- content: content,
- })
- );
- var word_count = this.word_count(
- _objectSpread({}, options, {
- content: content,
- })
- );
+ var excerpt = this.excerpt(_objectSpread({}, options, {
+ content: content
+ }));
+ var word_count = this.word_count(_objectSpread({}, options, {
+ content: content
+ }));
var direction = this.direction({
- title: title,
+ title: title
});
var _this$url_and_domain = this.url_and_domain(options),
- url = _this$url_and_domain.url,
- domain = _this$url_and_domain.domain;
+ url = _this$url_and_domain.url,
+ domain = _this$url_and_domain.domain;
+
+ var convertedContent;
+
+ if (contentType === 'html') {
+ convertedContent = content;
+ } else if (contentType === 'text') {
+ convertedContent = $.text(cheerio.load(content));
+ } else if (contentType === 'markdown') {
+ var turndownService = new TurndownService();
+ convertedContent = turndownService.turndown(content);
+ }
return {
title: title,
@@ -6997,23 +6067,23 @@ var GenericExtractor = {
date_published: date_published || null,
dek: dek,
lead_image_url: lead_image_url,
- content: content,
+ content: convertedContent,
next_page_url: next_page_url,
url: url,
domain: domain,
excerpt: excerpt,
word_count: word_count,
- direction: direction,
+ direction: direction
};
- },
+ }
};
var Detectors = {
'meta[name="al:ios:app_name"][value="Medium"]': MediumExtractor,
- 'meta[name="generator"][value="blogger"]': BloggerExtractor,
+ 'meta[name="generator"][value="blogger"]': BloggerExtractor
};
function detectByHtml($) {
- var selector = _Reflect$ownKeys(Detectors).find(function(s) {
+ var selector = _Reflect$ownKeys(Detectors).find(function (s) {
return $(s).length > 0;
});
@@ -7023,17 +6093,9 @@ function detectByHtml($) {
function getExtractor(url, parsedUrl, $) {
parsedUrl = parsedUrl || URL.parse(url);
var _parsedUrl = parsedUrl,
- hostname = _parsedUrl.hostname;
- var baseDomain = hostname
- .split('.')
- .slice(-2)
- .join('.');
- return (
- Extractors[hostname] ||
- Extractors[baseDomain] ||
- detectByHtml($) ||
- GenericExtractor
- );
+ hostname = _parsedUrl.hostname;
+ var baseDomain = hostname.split('.').slice(-2).join('.');
+ return Extractors[hostname] || Extractors[baseDomain] || detectByHtml($) || GenericExtractor;
}
function cleanBySelectors($content, $, _ref) {
@@ -7047,17 +6109,17 @@ function transformElements($content, $, _ref2) {
var transforms = _ref2.transforms;
if (!transforms) return $content;
- _Reflect$ownKeys(transforms).forEach(function(key) {
+ _Reflect$ownKeys(transforms).forEach(function (key) {
var $matches = $(key, $content);
var value = transforms[key]; // If value is a string, convert directly
if (typeof value === 'string') {
- $matches.each(function(index, node) {
+ $matches.each(function (index, node) {
convertNodeTo$$1($(node), $, transforms[key]);
});
} else if (typeof value === 'function') {
// If value is function, apply function to node
- $matches.each(function(index, node) {
+ $matches.each(function (index, node) {
var result = value($(node), $); // If function returns a string, convert node to that value
if (typeof result === 'string') {
@@ -7071,51 +6133,41 @@ function transformElements($content, $, _ref2) {
}
function findMatchingSelector($, selectors, extractHtml) {
- return selectors.find(function(selector) {
+ return selectors.find(function (selector) {
if (_Array$isArray(selector)) {
if (extractHtml) {
- return selector.reduce(function(acc, s) {
+ return selector.reduce(function (acc, s) {
return acc && $(s).length > 0;
}, true);
}
var _selector = _slicedToArray(selector, 2),
- s = _selector[0],
- attr = _selector[1];
-
- return (
- $(s).length === 1 &&
- $(s).attr(attr) &&
- $(s)
- .attr(attr)
- .trim() !== ''
- );
+ s = _selector[0],
+ attr = _selector[1];
+
+ return $(s).length === 1 && $(s).attr(attr) && $(s).attr(attr).trim() !== '';
}
- return (
- $(selector).length === 1 &&
- $(selector)
- .text()
- .trim() !== ''
- );
+ return $(selector).length === 1 && $(selector).text().trim() !== '';
});
}
function select(opts) {
var $ = opts.$,
- type = opts.type,
- extractionOpts = opts.extractionOpts,
- _opts$extractHtml = opts.extractHtml,
- extractHtml = _opts$extractHtml === void 0 ? false : _opts$extractHtml; // Skip if there's not extraction for this type
+ type = opts.type,
+ extractionOpts = opts.extractionOpts,
+ _opts$extractHtml = opts.extractHtml,
+ extractHtml = _opts$extractHtml === void 0 ? false : _opts$extractHtml,
+ _opts$contentType = opts.contentType,
+ contentType = _opts$contentType === void 0 ? 'html' : _opts$contentType; // Skip if there's not extraction for this type
if (!extractionOpts) return null; // If a string is hardcoded for a type (e.g., Wikipedia
// contributors), return the string
if (typeof extractionOpts === 'string') return extractionOpts;
var selectors = extractionOpts.selectors,
- _extractionOpts$defau = extractionOpts.defaultCleaner,
- defaultCleaner =
- _extractionOpts$defau === void 0 ? true : _extractionOpts$defau;
+ _extractionOpts$defau = extractionOpts.defaultCleaner,
+ defaultCleaner = _extractionOpts$defau === void 0 ? true : _extractionOpts$defau;
var matchingSelector = findMatchingSelector($, selectors, extractHtml);
if (!matchingSelector) return null; // Declaring result; will contain either
// text or html, which will be cleaned
@@ -7133,7 +6185,7 @@ function select(opts) {
if (_Array$isArray(matchingSelector)) {
$content = $(matchingSelector.join(','));
var $wrapper = $('');
- $content.each(function(index, element) {
+ $content.each(function (index, element) {
$wrapper.append(element);
});
$content = $wrapper;
@@ -7141,17 +6193,27 @@ function select(opts) {
$content = $(matchingSelector);
} // Wrap in div so transformation can take place on root element
+
$content.wrap($(''));
$content = $content.parent();
$content = transformElements($content, $, extractionOpts);
$content = cleanBySelectors($content, $, extractionOpts);
- $content = Cleaners[type](
- $content,
- _objectSpread({}, opts, {
- defaultCleaner: defaultCleaner,
- })
- );
- return $.html($content);
+ $content = Cleaners[type]($content, _objectSpread({}, opts, {
+ defaultCleaner: defaultCleaner
+ }));
+
+ if (contentType === 'html') {
+ return $.html($content);
+ }
+
+ if (contentType === 'text') {
+ return $.text($content);
+ }
+
+ if (contentType === 'markdown') {
+ var turndownService = new TurndownService();
+ return turndownService.turndown($.html($content));
+ }
}
var result; // if selector is an array (e.g., ['img', 'src']),
@@ -7159,12 +6221,10 @@ function select(opts) {
if (_Array$isArray(matchingSelector)) {
var _matchingSelector = _slicedToArray(matchingSelector, 2),
- selector = _matchingSelector[0],
- attr = _matchingSelector[1];
+ selector = _matchingSelector[0],
+ attr = _matchingSelector[1];
- result = $(selector)
- .attr(attr)
- .trim();
+ result = $(selector).attr(attr).trim();
} else {
var $node = $(matchingSelector);
$node = cleanBySelectors($node, $, extractionOpts);
@@ -7173,6 +6233,7 @@ function select(opts) {
} // Allow custom extractor to skip default cleaner
// for this type; defaults to true
+
if (defaultCleaner) {
return Cleaners[type](result, _objectSpread({}, opts, extractionOpts));
}
@@ -7182,123 +6243,98 @@ function select(opts) {
function extractResult(opts) {
var type = opts.type,
- extractor = opts.extractor,
- _opts$fallback = opts.fallback,
- fallback = _opts$fallback === void 0 ? true : _opts$fallback;
- var result = select(
- _objectSpread({}, opts, {
- extractionOpts: extractor[type],
- })
- ); // If custom parser succeeds, return the result
+ extractor = opts.extractor,
+ _opts$fallback = opts.fallback,
+ fallback = _opts$fallback === void 0 ? true : _opts$fallback;
+ var result = select(_objectSpread({}, opts, {
+ extractionOpts: extractor[type]
+ })); // If custom parser succeeds, return the result
if (result) {
return result;
} // If nothing matches the selector, and fallback is enabled,
// run the Generic extraction
+
if (fallback) return GenericExtractor[type](opts);
return null;
}
var RootExtractor = {
extract: function extract() {
- var extractor =
- arguments.length > 0 && arguments[0] !== undefined
- ? arguments[0]
- : GenericExtractor;
+ var extractor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GenericExtractor;
var opts = arguments.length > 1 ? arguments[1] : undefined;
var _opts = opts,
- contentOnly = _opts.contentOnly,
- extractedTitle = _opts.extractedTitle; // This is the generic extractor. Run its extract method
+ contentOnly = _opts.contentOnly,
+ extractedTitle = _opts.extractedTitle,
+ _opts$contentType2 = _opts.contentType,
+ contentType = _opts$contentType2 === void 0 ? 'html' : _opts$contentType2; // This is the generic extractor. Run its extract method
if (extractor.domain === '*') return extractor.extract(opts);
opts = _objectSpread({}, opts, {
- extractor: extractor,
+ extractor: extractor
});
if (contentOnly) {
- var _content = extractResult(
- _objectSpread({}, opts, {
- type: 'content',
- extractHtml: true,
- title: extractedTitle,
- })
- );
+ var _content = extractResult(_objectSpread({}, opts, {
+ type: 'content',
+ extractHtml: true,
+ title: extractedTitle,
+ contentType: contentType
+ }));
return {
- content: _content,
+ content: _content
};
}
- var title = extractResult(
- _objectSpread({}, opts, {
- type: 'title',
- })
- );
- var date_published = extractResult(
- _objectSpread({}, opts, {
- type: 'date_published',
- })
- );
- var author = extractResult(
- _objectSpread({}, opts, {
- type: 'author',
- })
- );
- var next_page_url = extractResult(
- _objectSpread({}, opts, {
- type: 'next_page_url',
- })
- );
- var content = extractResult(
- _objectSpread({}, opts, {
- type: 'content',
- extractHtml: true,
- title: title,
- })
- );
- var lead_image_url = extractResult(
- _objectSpread({}, opts, {
- type: 'lead_image_url',
- content: content,
- })
- );
- var excerpt = extractResult(
- _objectSpread({}, opts, {
- type: 'excerpt',
- content: content,
- })
- );
- var dek = extractResult(
- _objectSpread({}, opts, {
- type: 'dek',
- content: content,
- excerpt: excerpt,
- })
- );
- var word_count = extractResult(
- _objectSpread({}, opts, {
- type: 'word_count',
- content: content,
- })
- );
- var direction = extractResult(
- _objectSpread({}, opts, {
- type: 'direction',
- title: title,
- })
- );
-
- var _ref3 = extractResult(
- _objectSpread({}, opts, {
- type: 'url_and_domain',
- })
- ) || {
- url: null,
- domain: null,
- },
- url = _ref3.url,
- domain = _ref3.domain;
+ var title = extractResult(_objectSpread({}, opts, {
+ type: 'title'
+ }));
+ var date_published = extractResult(_objectSpread({}, opts, {
+ type: 'date_published'
+ }));
+ var author = extractResult(_objectSpread({}, opts, {
+ type: 'author'
+ }));
+ var next_page_url = extractResult(_objectSpread({}, opts, {
+ type: 'next_page_url'
+ }));
+ var content = extractResult(_objectSpread({}, opts, {
+ type: 'content',
+ extractHtml: true,
+ title: title
+ }));
+ var lead_image_url = extractResult(_objectSpread({}, opts, {
+ type: 'lead_image_url',
+ content: content
+ }));
+ var excerpt = extractResult(_objectSpread({}, opts, {
+ type: 'excerpt',
+ content: content
+ }));
+ var dek = extractResult(_objectSpread({}, opts, {
+ type: 'dek',
+ content: content,
+ excerpt: excerpt
+ }));
+ var word_count = extractResult(_objectSpread({}, opts, {
+ type: 'word_count',
+ content: content
+ }));
+ var direction = extractResult(_objectSpread({}, opts, {
+ type: 'direction',
+ title: title
+ }));
+
+ var _ref3 = extractResult(_objectSpread({}, opts, {
+ type: 'url_and_domain'
+ })) || {
+ url: null,
+ domain: null
+ },
+ url = _ref3.url,
+ domain = _ref3.domain;
return {
title: title,
@@ -7312,9 +6348,9 @@ var RootExtractor = {
domain: domain,
excerpt: excerpt,
word_count: word_count,
- direction: direction,
+ direction: direction
};
- },
+ }
};
function collectAllPages(_x) {
@@ -7323,115 +6359,84 @@ function collectAllPages(_x) {
function _collectAllPages() {
_collectAllPages = _asyncToGenerator(
- /*#__PURE__*/
- _regeneratorRuntime.mark(function _callee(_ref) {
- var next_page_url,
- html,
- $,
- metaCache,
- result,
- Extractor,
- title,
- url,
- pages,
- previousUrls,
- extractorOpts,
- nextPageResult,
- word_count;
- return _regeneratorRuntime.wrap(
- function _callee$(_context) {
- while (1) {
- switch ((_context.prev = _context.next)) {
- case 0:
- (next_page_url = _ref.next_page_url),
- (html = _ref.html),
- ($ = _ref.$),
- (metaCache = _ref.metaCache),
- (result = _ref.result),
- (Extractor = _ref.Extractor),
- (title = _ref.title),
- (url = _ref.url);
- // At this point, we've fetched just the first page
- pages = 1;
- previousUrls = [removeAnchor(url)]; // If we've gone over 26 pages, something has
- // likely gone wrong.
-
- case 3:
- if (!(next_page_url && pages < 26)) {
- _context.next = 16;
- break;
- }
+ /*#__PURE__*/
+ _regeneratorRuntime.mark(function _callee(_ref) {
+ var next_page_url, html, $, metaCache, result, Extractor, title, url, pages, previousUrls, extractorOpts, nextPageResult, word_count;
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ next_page_url = _ref.next_page_url, html = _ref.html, $ = _ref.$, metaCache = _ref.metaCache, result = _ref.result, Extractor = _ref.Extractor, title = _ref.title, url = _ref.url;
+ // At this point, we've fetched just the first page
+ pages = 1;
+ previousUrls = [removeAnchor(url)]; // If we've gone over 26 pages, something has
+ // likely gone wrong.
+
+ case 3:
+ if (!(next_page_url && pages < 26)) {
+ _context.next = 16;
+ break;
+ }
- pages += 1; // eslint-disable-next-line no-await-in-loop
+ pages += 1; // eslint-disable-next-line no-await-in-loop
- _context.next = 7;
- return Resource.create(next_page_url);
+ _context.next = 7;
+ return Resource.create(next_page_url);
- case 7:
- $ = _context.sent;
- html = $.html();
- extractorOpts = {
- url: next_page_url,
- html: html,
- $: $,
- metaCache: metaCache,
- contentOnly: true,
- extractedTitle: title,
- previousUrls: previousUrls,
- };
- nextPageResult = RootExtractor.extract(
- Extractor,
- extractorOpts
- );
- previousUrls.push(next_page_url);
- result = _objectSpread({}, result, {
- content: ''
- .concat(result.content, '
Page ')
- .concat(pages, '
')
- .concat(nextPageResult.content),
- }); // eslint-disable-next-line prefer-destructuring
-
- next_page_url = nextPageResult.next_page_url;
- _context.next = 3;
- break;
+ case 7:
+ $ = _context.sent;
+ html = $.html();
+ extractorOpts = {
+ url: next_page_url,
+ html: html,
+ $: $,
+ metaCache: metaCache,
+ contentOnly: true,
+ extractedTitle: title,
+ previousUrls: previousUrls
+ };
+ nextPageResult = RootExtractor.extract(Extractor, extractorOpts);
+ previousUrls.push(next_page_url);
+ result = _objectSpread({}, result, {
+ content: "".concat(result.content, "
Page ").concat(pages, "
").concat(nextPageResult.content)
+ }); // eslint-disable-next-line prefer-destructuring
+
+ next_page_url = nextPageResult.next_page_url;
+ _context.next = 3;
+ break;
- case 16:
- word_count = GenericExtractor.word_count({
- content: ''.concat(result.content, '
'),
- });
- return _context.abrupt(
- 'return',
- _objectSpread({}, result, {
- total_pages: pages,
- pages_rendered: pages,
- word_count: word_count,
- })
- );
-
- case 18:
- case 'end':
- return _context.stop();
- }
- }
- },
- _callee,
- this
- );
- })
- );
+ case 16:
+ word_count = GenericExtractor.word_count({
+ content: "".concat(result.content, "
")
+ });
+ return _context.abrupt("return", _objectSpread({}, result, {
+ total_pages: pages,
+ pages_rendered: pages,
+ word_count: word_count
+ }));
+
+ case 18:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, this);
+ }));
return _collectAllPages.apply(this, arguments);
}
var Mercury = {
- parse: (function() {
+ parse: function () {
var _parse = _asyncToGenerator(
- /*#__PURE__*/
- _regeneratorRuntime.mark(function _callee(url, html) {
- var opts,
+ /*#__PURE__*/
+ _regeneratorRuntime.mark(function _callee(url, html) {
+ var opts,
_opts$fetchAllPages,
fetchAllPages,
_opts$fallback,
fallback,
+ _opts$contentType,
+ contentType,
parsedUrl,
$,
Extractor,
@@ -7442,135 +6447,120 @@ var Mercury = {
next_page_url,
_args = arguments;
- return _regeneratorRuntime.wrap(
- function _callee$(_context) {
- while (1) {
- switch ((_context.prev = _context.next)) {
- case 0:
- opts =
- _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- (_opts$fetchAllPages = opts.fetchAllPages),
- (fetchAllPages =
- _opts$fetchAllPages === void 0
- ? true
- : _opts$fetchAllPages),
- (_opts$fallback = opts.fallback),
- (fallback =
- _opts$fallback === void 0 ? true : _opts$fallback); // if no url was passed and this is the browser version,
- // set url to window.location.href and load the html
- // from the current page
-
- if (!url && cheerio.browser) {
- url = window.location.href; // eslint-disable-line no-undef
-
- html = html || cheerio.html();
- }
-
- parsedUrl = URL.parse(url);
-
- if (validateUrl(parsedUrl)) {
- _context.next = 6;
- break;
- }
-
- return _context.abrupt('return', Errors.badUrl);
-
- case 6:
- _context.next = 8;
- return Resource.create(url, html, parsedUrl);
-
- case 8:
- $ = _context.sent;
- Extractor = getExtractor(url, parsedUrl, $); // console.log(`Using extractor for ${Extractor.domain}`);
- // If we found an error creating the resource, return that error
-
- if (!$.failed) {
- _context.next = 12;
- break;
- }
-
- return _context.abrupt('return', $);
-
- case 12:
- // if html still has not been set (i.e., url passed to Mercury.parse),
- // set html from the response of Resource.create
- if (!html) {
- html = $.html();
- } // Cached value of every meta name in our document.
- // Used when extracting title/author/date_published/dek
-
- metaCache = $('meta')
- .map(function(_, node) {
- return $(node).attr('name');
- })
- .toArray();
- result = RootExtractor.extract(Extractor, {
- url: url,
- html: html,
- $: $,
- metaCache: metaCache,
- parsedUrl: parsedUrl,
- fallback: fallback,
- });
- (_result = result),
- (title = _result.title),
- (next_page_url = _result.next_page_url); // Fetch more pages if next_page_url found
-
- if (!(fetchAllPages && next_page_url)) {
- _context.next = 22;
- break;
- }
-
- _context.next = 19;
- return collectAllPages({
- Extractor: Extractor,
- next_page_url: next_page_url,
- html: html,
- $: $,
- metaCache: metaCache,
- result: result,
- title: title,
- url: url,
- });
-
- case 19:
- result = _context.sent;
- _context.next = 23;
- break;
-
- case 22:
- result = _objectSpread({}, result, {
- total_pages: 1,
- rendered_pages: 1,
- });
-
- case 23:
- return _context.abrupt('return', result);
-
- case 24:
- case 'end':
- return _context.stop();
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ opts = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
+ _opts$fetchAllPages = opts.fetchAllPages, fetchAllPages = _opts$fetchAllPages === void 0 ? true : _opts$fetchAllPages, _opts$fallback = opts.fallback, fallback = _opts$fallback === void 0 ? true : _opts$fallback, _opts$contentType = opts.contentType, contentType = _opts$contentType === void 0 ? 'html' : _opts$contentType; // if no url was passed and this is the browser version,
+ // set url to window.location.href and load the html
+ // from the current page
+
+ if (!url && cheerio.browser) {
+ url = window.location.href; // eslint-disable-line no-undef
+
+ html = html || cheerio.html();
}
- }
- },
- _callee,
- this
- );
- })
- );
+
+ parsedUrl = URL.parse(url);
+
+ if (validateUrl(parsedUrl)) {
+ _context.next = 6;
+ break;
+ }
+
+ return _context.abrupt("return", Errors.badUrl);
+
+ case 6:
+ _context.next = 8;
+ return Resource.create(url, html, parsedUrl);
+
+ case 8:
+ $ = _context.sent;
+ Extractor = getExtractor(url, parsedUrl, $); // console.log(`Using extractor for ${Extractor.domain}`);
+ // If we found an error creating the resource, return that error
+
+ if (!$.failed) {
+ _context.next = 12;
+ break;
+ }
+
+ return _context.abrupt("return", $);
+
+ case 12:
+ // if html still has not been set (i.e., url passed to Mercury.parse),
+ // set html from the response of Resource.create
+ if (!html) {
+ html = $.html();
+ } // Cached value of every meta name in our document.
+ // Used when extracting title/author/date_published/dek
+
+
+ metaCache = $('meta').map(function (_, node) {
+ return $(node).attr('name');
+ }).toArray();
+ result = RootExtractor.extract(Extractor, {
+ url: url,
+ html: html,
+ $: $,
+ metaCache: metaCache,
+ parsedUrl: parsedUrl,
+ fallback: fallback,
+ contentType: contentType
+ });
+ _result = result, title = _result.title, next_page_url = _result.next_page_url; // Fetch more pages if next_page_url found
+
+ if (!(fetchAllPages && next_page_url)) {
+ _context.next = 22;
+ break;
+ }
+
+ _context.next = 19;
+ return collectAllPages({
+ Extractor: Extractor,
+ next_page_url: next_page_url,
+ html: html,
+ $: $,
+ metaCache: metaCache,
+ result: result,
+ title: title,
+ url: url
+ });
+
+ case 19:
+ result = _context.sent;
+ _context.next = 23;
+ break;
+
+ case 22:
+ result = _objectSpread({}, result, {
+ total_pages: 1,
+ rendered_pages: 1
+ });
+
+ case 23:
+ return _context.abrupt("return", result);
+
+ case 24:
+ case "end":
+ return _context.stop();
+ }
+ }
+ }, _callee, this);
+ }));
function parse(_x, _x2) {
return _parse.apply(this, arguments);
}
return parse;
- })(),
+ }(),
browser: !!cheerio.browser,
// A convenience method for getting a resource
// to work with, e.g., for custom extractor generator
fetchResource: function fetchResource(url) {
return Resource.create(url);
- },
+ }
};
module.exports = Mercury;
diff --git a/dist/mercury.web.js b/dist/mercury.web.js
index 2a0ced15..39c0b72e 100644
--- a/dist/mercury.web.js
+++ b/dist/mercury.web.js
@@ -1,20972 +1 @@
-var Mercury = (function() {
- 'use strict';
- function $n() {
- throw new Error(
- 'Dynamic requires are not currently supported by rollup-plugin-commonjs'
- );
- }
- function e(e, t) {
- return e((t = { exports: {} }), t.exports), t.exports;
- }
- var t = e(function(O) {
- !(function(e) {
- var c,
- t = Object.prototype,
- l = t.hasOwnProperty,
- n = 'function' == typeof Symbol ? Symbol : {},
- a = n.iterator || '@@iterator',
- r = n.asyncIterator || '@@asyncIterator',
- i = n.toStringTag || '@@toStringTag',
- o = e.regeneratorRuntime;
- if (o) O.exports = o;
- else {
- (o = e.regeneratorRuntime = O.exports).wrap = y;
- var f = 'suspendedStart',
- h = 'suspendedYield',
- d = 'executing',
- p = 'completed',
- m = {},
- s = {};
- s[a] = function() {
- return this;
- };
- var u = Object.getPrototypeOf,
- g = u && u(u(C([])));
- g && g !== t && l.call(g, a) && (s = g);
- var v = (A.prototype = _.prototype = Object.create(s));
- (w.prototype = v.constructor = A),
- (A.constructor = w),
- (A[i] = w.displayName = 'GeneratorFunction'),
- (o.isGeneratorFunction = function(e) {
- var t = 'function' == typeof e && e.constructor;
- return (
- !!t &&
- (t === w || 'GeneratorFunction' === (t.displayName || t.name))
- );
- }),
- (o.mark = function(e) {
- return (
- Object.setPrototypeOf
- ? Object.setPrototypeOf(e, A)
- : ((e.__proto__ = A), i in e || (e[i] = 'GeneratorFunction')),
- (e.prototype = Object.create(v)),
- e
- );
- }),
- (o.awrap = function(e) {
- return { __await: e };
- }),
- x(k.prototype),
- (k.prototype[r] = function() {
- return this;
- }),
- (o.AsyncIterator = k),
- (o.async = function(e, t, n, r) {
- var a = new k(y(e, t, n, r));
- return o.isGeneratorFunction(t)
- ? a
- : a.next().then(function(e) {
- return e.done ? e.value : a.next();
- });
- }),
- x(v),
- (v[i] = 'Generator'),
- (v[a] = function() {
- return this;
- }),
- (v.toString = function() {
- return '[object Generator]';
- }),
- (o.keys = function(n) {
- var r = [];
- for (var e in n) r.push(e);
- return (
- r.reverse(),
- function e() {
- for (; r.length; ) {
- var t = r.pop();
- if (t in n) return (e.value = t), (e.done = !1), e;
- }
- return (e.done = !0), e;
- }
- );
- }),
- (o.values = C),
- (T.prototype = {
- constructor: T,
- reset: function(e) {
- if (
- ((this.prev = 0),
- (this.next = 0),
- (this.sent = this._sent = c),
- (this.done = !1),
- (this.delegate = null),
- (this.method = 'next'),
- (this.arg = c),
- this.tryEntries.forEach(E),
- !e)
- )
- for (var t in this)
- 't' === t.charAt(0) &&
- l.call(this, t) &&
- !isNaN(+t.slice(1)) &&
- (this[t] = c);
- },
- stop: function() {
- this.done = !0;
- var e = this.tryEntries[0].completion;
- if ('throw' === e.type) throw e.arg;
- return this.rval;
- },
- dispatchException: function(n) {
- if (this.done) throw n;
- var r = this;
- function e(e, t) {
- return (
- (i.type = 'throw'),
- (i.arg = n),
- (r.next = e),
- t && ((r.method = 'next'), (r.arg = c)),
- !!t
- );
- }
- for (var t = this.tryEntries.length - 1; 0 <= t; --t) {
- var a = this.tryEntries[t],
- i = a.completion;
- if ('root' === a.tryLoc) return e('end');
- if (a.tryLoc <= this.prev) {
- var o = l.call(a, 'catchLoc'),
- s = l.call(a, 'finallyLoc');
- if (o && s) {
- if (this.prev < a.catchLoc) return e(a.catchLoc, !0);
- if (this.prev < a.finallyLoc) return e(a.finallyLoc);
- } else if (o) {
- if (this.prev < a.catchLoc) return e(a.catchLoc, !0);
- } else {
- if (!s)
- throw new Error(
- 'try statement without catch or finally'
- );
- if (this.prev < a.finallyLoc) return e(a.finallyLoc);
- }
- }
- }
- },
- abrupt: function(e, t) {
- for (var n = this.tryEntries.length - 1; 0 <= n; --n) {
- var r = this.tryEntries[n];
- if (
- r.tryLoc <= this.prev &&
- l.call(r, 'finallyLoc') &&
- this.prev < r.finallyLoc
- ) {
- var a = r;
- break;
- }
- }
- a &&
- ('break' === e || 'continue' === e) &&
- a.tryLoc <= t &&
- t <= a.finallyLoc &&
- (a = null);
- var i = a ? a.completion : {};
- return (
- (i.type = e),
- (i.arg = t),
- a
- ? ((this.method = 'next'), (this.next = a.finallyLoc), m)
- : this.complete(i)
- );
- },
- complete: function(e, t) {
- if ('throw' === e.type) throw e.arg;
- return (
- 'break' === e.type || 'continue' === e.type
- ? (this.next = e.arg)
- : 'return' === e.type
- ? ((this.rval = this.arg = e.arg),
- (this.method = 'return'),
- (this.next = 'end'))
- : 'normal' === e.type && t && (this.next = t),
- m
- );
- },
- finish: function(e) {
- for (var t = this.tryEntries.length - 1; 0 <= t; --t) {
- var n = this.tryEntries[t];
- if (n.finallyLoc === e)
- return this.complete(n.completion, n.afterLoc), E(n), m;
- }
- },
- catch: function(e) {
- for (var t = this.tryEntries.length - 1; 0 <= t; --t) {
- var n = this.tryEntries[t];
- if (n.tryLoc === e) {
- var r = n.completion;
- if ('throw' === r.type) {
- var a = r.arg;
- E(n);
- }
- return a;
- }
- }
- throw new Error('illegal catch attempt');
- },
- delegateYield: function(e, t, n) {
- return (
- (this.delegate = {
- iterator: C(e),
- resultName: t,
- nextLoc: n,
- }),
- 'next' === this.method && (this.arg = c),
- m
- );
- },
- });
- }
- function y(e, t, n, r) {
- var i,
- o,
- s,
- c,
- a = t && t.prototype instanceof _ ? t : _,
- l = Object.create(a.prototype),
- u = new T(r || []);
- return (
- (l._invoke = ((i = e),
- (o = n),
- (s = u),
- (c = f),
- function(e, t) {
- if (c === d) throw new Error('Generator is already running');
- if (c === p) {
- if ('throw' === e) throw t;
- return D();
- }
- for (s.method = e, s.arg = t; ; ) {
- var n = s.delegate;
- if (n) {
- var r = M(n, s);
- if (r) {
- if (r === m) continue;
- return r;
- }
- }
- if ('next' === s.method) s.sent = s._sent = s.arg;
- else if ('throw' === s.method) {
- if (c === f) throw ((c = p), s.arg);
- s.dispatchException(s.arg);
- } else 'return' === s.method && s.abrupt('return', s.arg);
- c = d;
- var a = b(i, o, s);
- if ('normal' === a.type) {
- if (((c = s.done ? p : h), a.arg === m)) continue;
- return { value: a.arg, done: s.done };
- }
- 'throw' === a.type &&
- ((c = p), (s.method = 'throw'), (s.arg = a.arg));
- }
- })),
- l
- );
- }
- function b(e, t, n) {
- try {
- return { type: 'normal', arg: e.call(t, n) };
- } catch (e) {
- return { type: 'throw', arg: e };
- }
- }
- function _() {}
- function w() {}
- function A() {}
- function x(e) {
- ['next', 'throw', 'return'].forEach(function(t) {
- e[t] = function(e) {
- return this._invoke(t, e);
- };
- });
- }
- function k(c) {
- var t;
- this._invoke = function(n, r) {
- function e() {
- return new Promise(function(e, t) {
- !(function t(e, n, r, a) {
- var i = b(c[e], c, n);
- if ('throw' !== i.type) {
- var o = i.arg,
- s = o.value;
- return s && 'object' == typeof s && l.call(s, '__await')
- ? Promise.resolve(s.__await).then(
- function(e) {
- t('next', e, r, a);
- },
- function(e) {
- t('throw', e, r, a);
- }
- )
- : Promise.resolve(s).then(
- function(e) {
- (o.value = e), r(o);
- },
- function(e) {
- return t('throw', e, r, a);
- }
- );
- }
- a(i.arg);
- })(n, r, e, t);
- });
- }
- return (t = t ? t.then(e, e) : e());
- };
- }
- function M(e, t) {
- var n = e.iterator[t.method];
- if (n === c) {
- if (((t.delegate = null), 'throw' === t.method)) {
- if (
- e.iterator.return &&
- ((t.method = 'return'),
- (t.arg = c),
- M(e, t),
- 'throw' === t.method)
- )
- return m;
- (t.method = 'throw'),
- (t.arg = new TypeError(
- "The iterator does not provide a 'throw' method"
- ));
- }
- return m;
- }
- var r = b(n, e.iterator, t.arg);
- if ('throw' === r.type)
- return (
- (t.method = 'throw'), (t.arg = r.arg), (t.delegate = null), m
- );
- var a = r.arg;
- return a
- ? a.done
- ? ((t[e.resultName] = a.value),
- (t.next = e.nextLoc),
- 'return' !== t.method && ((t.method = 'next'), (t.arg = c)),
- (t.delegate = null),
- m)
- : a
- : ((t.method = 'throw'),
- (t.arg = new TypeError('iterator result is not an object')),
- (t.delegate = null),
- m);
- }
- function S(e) {
- var t = { tryLoc: e[0] };
- 1 in e && (t.catchLoc = e[1]),
- 2 in e && ((t.finallyLoc = e[2]), (t.afterLoc = e[3])),
- this.tryEntries.push(t);
- }
- function E(e) {
- var t = e.completion || {};
- (t.type = 'normal'), delete t.arg, (e.completion = t);
- }
- function T(e) {
- (this.tryEntries = [{ tryLoc: 'root' }]),
- e.forEach(S, this),
- this.reset(!0);
- }
- function C(t) {
- if (t) {
- var e = t[a];
- if (e) return e.call(t);
- if ('function' == typeof t.next) return t;
- if (!isNaN(t.length)) {
- var n = -1,
- r = function e() {
- for (; ++n < t.length; )
- if (l.call(t, n)) return (e.value = t[n]), (e.done = !1), e;
- return (e.value = c), (e.done = !0), e;
- };
- return (r.next = r);
- }
- }
- return { next: D };
- }
- function D() {
- return { value: c, done: !0 };
- }
- })(
- (function() {
- return this || ('object' == typeof self && self);
- })() || Function('return this')()
- );
- }),
- n =
- (function() {
- return this || ('object' == typeof self && self);
- })() || Function('return this')(),
- r =
- n.regeneratorRuntime &&
- 0 <= Object.getOwnPropertyNames(n).indexOf('regeneratorRuntime'),
- a = r && n.regeneratorRuntime;
- n.regeneratorRuntime = void 0;
- var i = t;
- if (r) n.regeneratorRuntime = a;
- else
- try {
- delete n.regeneratorRuntime;
- } catch (e) {
- n.regeneratorRuntime = void 0;
- }
- var v = i,
- o = {}.toString,
- s = function(e) {
- return o.call(e).slice(8, -1);
- },
- f = Object('z').propertyIsEnumerable(0)
- ? Object
- : function(e) {
- return 'String' == s(e) ? e.split('') : Object(e);
- },
- c = function(e) {
- if (null == e) throw TypeError("Can't call method on " + e);
- return e;
- },
- l = function(e) {
- return f(c(e));
- },
- u = { f: {}.propertyIsEnumerable },
- A = function(e, t) {
- return {
- enumerable: !(1 & e),
- configurable: !(2 & e),
- writable: !(4 & e),
- value: t,
- };
- },
- h = function(e) {
- return 'object' == typeof e ? null !== e : 'function' == typeof e;
- },
- d = function(e, t) {
- if (!h(e)) return e;
- var n, r;
- if (t && 'function' == typeof (n = e.toString) && !h((r = n.call(e))))
- return r;
- if ('function' == typeof (n = e.valueOf) && !h((r = n.call(e)))) return r;
- if (!t && 'function' == typeof (n = e.toString) && !h((r = n.call(e))))
- return r;
- throw TypeError("Can't convert object to primitive value");
- },
- p = {}.hasOwnProperty,
- m = function(e, t) {
- return p.call(e, t);
- },
- g = function(e) {
- try {
- return !!e();
- } catch (e) {
- return !0;
- }
- },
- y = !g(function() {
- return (
- 7 !=
- Object.defineProperty({}, 'a', {
- get: function() {
- return 7;
- },
- }).a
- );
- }),
- b = e(function(e) {
- var t = (e.exports =
- 'undefined' != typeof window && window.Math == Math
- ? window
- : 'undefined' != typeof self && self.Math == Math
- ? self
- : Function('return this')());
- 'number' == typeof __g && (__g = t);
- }),
- _ = b.document,
- w = h(_) && h(_.createElement),
- x = function(e) {
- return w ? _.createElement(e) : {};
- },
- k =
- !y &&
- !g(function() {
- return (
- 7 !=
- Object.defineProperty(x('div'), 'a', {
- get: function() {
- return 7;
- },
- }).a
- );
- }),
- M = Object.getOwnPropertyDescriptor,
- S = {
- f: y
- ? M
- : function(e, t) {
- if (((e = l(e)), (t = d(t, !0)), k))
- try {
- return M(e, t);
- } catch (e) {}
- if (m(e, t)) return A(!u.f.call(e, t), e[t]);
- },
- },
- E = e(function(e) {
- var t = (e.exports = { version: '2.6.2' });
- 'number' == typeof __e && (__e = t);
- }),
- T = (E.version,
- function(e) {
- if ('function' != typeof e) throw TypeError(e + ' is not a function!');
- return e;
- }),
- C = function(r, a, e) {
- if ((T(r), void 0 === a)) return r;
- switch (e) {
- case 1:
- return function(e) {
- return r.call(a, e);
- };
- case 2:
- return function(e, t) {
- return r.call(a, e, t);
- };
- case 3:
- return function(e, t, n) {
- return r.call(a, e, t, n);
- };
- }
- return function() {
- return r.apply(a, arguments);
- };
- },
- D = function(e) {
- if (!h(e)) throw TypeError(e + ' is not an object!');
- return e;
- },
- O = Object.defineProperty,
- j = {
- f: y
- ? Object.defineProperty
- : function(e, t, n) {
- if ((D(e), (t = d(t, !0)), D(n), k))
- try {
- return O(e, t, n);
- } catch (e) {}
- if ('get' in n || 'set' in n)
- throw TypeError('Accessors not supported!');
- return 'value' in n && (e[t] = n.value), e;
- },
- },
- N = y
- ? function(e, t, n) {
- return j.f(e, t, A(1, n));
- }
- : function(e, t, n) {
- return (e[t] = n), e;
- },
- P = 'prototype',
- z = function(e, t, n) {
- var r,
- a,
- i,
- o = e & z.F,
- s = e & z.G,
- c = e & z.S,
- l = e & z.P,
- u = e & z.B,
- f = e & z.W,
- h = s ? E : E[t] || (E[t] = {}),
- d = h[P],
- p = s ? b : c ? b[t] : (b[t] || {})[P];
- for (r in (s && (n = t), n))
- ((a = !o && p && void 0 !== p[r]) && m(h, r)) ||
- ((i = a ? p[r] : n[r]),
- (h[r] =
- s && 'function' != typeof p[r]
- ? n[r]
- : u && a
- ? C(i, b)
- : f && p[r] == i
- ? (function(r) {
- var e = function(e, t, n) {
- if (this instanceof r) {
- switch (arguments.length) {
- case 0:
- return new r();
- case 1:
- return new r(e);
- case 2:
- return new r(e, t);
- }
- return new r(e, t, n);
- }
- return r.apply(this, arguments);
- };
- return (e[P] = r[P]), e;
- })(i)
- : l && 'function' == typeof i
- ? C(Function.call, i)
- : i),
- l &&
- (((h.virtual || (h.virtual = {}))[r] = i),
- e & z.R && d && !d[r] && N(d, r, i)));
- };
- (z.F = 1),
- (z.G = 2),
- (z.S = 4),
- (z.P = 8),
- (z.B = 16),
- (z.W = 32),
- (z.U = 64),
- (z.R = 128);
- var L = z,
- R = function(e, t) {
- var n = (E.Object || {})[e] || Object[e],
- r = {};
- (r[e] = t(n)),
- L(
- L.S +
- L.F *
- g(function() {
- n(1);
- }),
- 'Object',
- r
- );
- },
- Y = S.f;
- R('getOwnPropertyDescriptor', function() {
- return function(e, t) {
- return Y(l(e), t);
- };
- });
- var W,
- q = E.Object,
- H = function(e, t) {
- return q.getOwnPropertyDescriptor(e, t);
- },
- I = N,
- F = 0,
- G = Math.random(),
- B = function(e) {
- return 'Symbol('.concat(
- void 0 === e ? '' : e,
- ')_',
- (++F + G).toString(36)
- );
- },
- U = e(function(e) {
- var n = B('meta'),
- t = j.f,
- r = 0,
- a =
- Object.isExtensible ||
- function() {
- return !0;
- },
- i = !g(function() {
- return a(Object.preventExtensions({}));
- }),
- o = function(e) {
- t(e, n, { value: { i: 'O' + ++r, w: {} } });
- },
- s = (e.exports = {
- KEY: n,
- NEED: !1,
- fastKey: function(e, t) {
- if (!h(e))
- return 'symbol' == typeof e
- ? e
- : ('string' == typeof e ? 'S' : 'P') + e;
- if (!m(e, n)) {
- if (!a(e)) return 'F';
- if (!t) return 'E';
- o(e);
- }
- return e[n].i;
- },
- getWeak: function(e, t) {
- if (!m(e, n)) {
- if (!a(e)) return !0;
- if (!t) return !1;
- o(e);
- }
- return e[n].w;
- },
- onFreeze: function(e) {
- return i && s.NEED && a(e) && !m(e, n) && o(e), e;
- },
- });
- }),
- $ = (U.KEY,
- U.NEED,
- U.fastKey,
- U.getWeak,
- U.onFreeze,
- e(function(e) {
- var t = '__core-js_shared__',
- n = b[t] || (b[t] = {});
- (e.exports = function(e, t) {
- return n[e] || (n[e] = void 0 !== t ? t : {});
- })('versions', []).push({
- version: E.version,
- mode: 'pure',
- copyright: '© 2019 Denis Pushkarev (zloirock.ru)',
- });
- })),
- V = e(function(e) {
- var t = $('wks'),
- n = b.Symbol,
- r = 'function' == typeof n;
- (e.exports = function(e) {
- return t[e] || (t[e] = (r && n[e]) || (r ? n : B)('Symbol.' + e));
- }).store = t;
- }),
- K = j.f,
- J = V('toStringTag'),
- X = function(e, t, n) {
- e &&
- !m((e = n ? e : e.prototype), J) &&
- K(e, J, { configurable: !0, value: t });
- },
- Z = { f: V },
- Q = j.f,
- ee = function(e) {
- var t = E.Symbol || (E.Symbol = {});
- '_' == e.charAt(0) || e in t || Q(t, e, { value: Z.f(e) });
- },
- te = Math.ceil,
- ne = Math.floor,
- re = function(e) {
- return isNaN((e = +e)) ? 0 : (0 < e ? ne : te)(e);
- },
- ae = Math.min,
- ie = function(e) {
- return 0 < e ? ae(re(e), 9007199254740991) : 0;
- },
- oe = Math.max,
- se = Math.min,
- ce = $('keys'),
- le = function(e) {
- return ce[e] || (ce[e] = B(e));
- },
- ue = ((W = !1),
- function(e, t, n) {
- var r,
- a,
- i,
- o = l(e),
- s = ie(o.length),
- c = ((a = s), (r = re((r = n))) < 0 ? oe(r + a, 0) : se(r, a));
- if (W && t != t) {
- for (; c < s; ) if ((i = o[c++]) != i) return !0;
- } else
- for (; c < s; c++) if ((W || c in o) && o[c] === t) return W || c || 0;
- return !W && -1;
- }),
- fe = le('IE_PROTO'),
- he = function(e, t) {
- var n,
- r = l(e),
- a = 0,
- i = [];
- for (n in r) n != fe && m(r, n) && i.push(n);
- for (; t.length > a; ) m(r, (n = t[a++])) && (~ue(i, n) || i.push(n));
- return i;
- },
- de = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(
- ','
- ),
- pe =
- Object.keys ||
- function(e) {
- return he(e, de);
- },
- me = { f: Object.getOwnPropertySymbols },
- ge =
- Array.isArray ||
- function(e) {
- return 'Array' == s(e);
- },
- ve = y
- ? Object.defineProperties
- : function(e, t) {
- D(e);
- for (var n, r = pe(t), a = r.length, i = 0; i < a; )
- j.f(e, (n = r[i++]), t[n]);
- return e;
- },
- ye = b.document,
- be = ye && ye.documentElement,
- _e = le('IE_PROTO'),
- we = function() {},
- Ae = 'prototype',
- xe = function() {
- var e,
- t = x('iframe'),
- n = de.length;
- for (
- t.style.display = 'none',
- be.appendChild(t),
- t.src = 'javascript:',
- (e = t.contentWindow.document).open(),
- e.write(''),
- e.close(),
- xe = e.F;
- n--;
-
- )
- delete xe[Ae][de[n]];
- return xe();
- },
- ke =
- Object.create ||
- function(e, t) {
- var n;
- return (
- null !== e
- ? ((we[Ae] = D(e)), (n = new we()), (we[Ae] = null), (n[_e] = e))
- : (n = xe()),
- void 0 === t ? n : ve(n, t)
- );
- },
- Me = de.concat('length', 'prototype'),
- Se = {
- f:
- Object.getOwnPropertyNames ||
- function(e) {
- return he(e, Me);
- },
- },
- Ee = Se.f,
- Te = {}.toString,
- Ce =
- 'object' == typeof window && window && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window)
- : [],
- De = {
- f: function(e) {
- return Ce && '[object Window]' == Te.call(e)
- ? (function(e) {
- try {
- return Ee(e);
- } catch (e) {
- return Ce.slice();
- }
- })(e)
- : Ee(l(e));
- },
- },
- Oe = U.KEY,
- je = S.f,
- Ne = j.f,
- Pe = De.f,
- ze = b.Symbol,
- Le = b.JSON,
- Re = Le && Le.stringify,
- Ye = 'prototype',
- We = V('_hidden'),
- qe = V('toPrimitive'),
- He = {}.propertyIsEnumerable,
- Ie = $('symbol-registry'),
- Fe = $('symbols'),
- Ge = $('op-symbols'),
- Be = Object[Ye],
- Ue = 'function' == typeof ze,
- $e = b.QObject,
- Ve = !$e || !$e[Ye] || !$e[Ye].findChild,
- Ke =
- y &&
- g(function() {
- return (
- 7 !=
- ke(
- Ne({}, 'a', {
- get: function() {
- return Ne(this, 'a', { value: 7 }).a;
- },
- })
- ).a
- );
- })
- ? function(e, t, n) {
- var r = je(Be, t);
- r && delete Be[t], Ne(e, t, n), r && e !== Be && Ne(Be, t, r);
- }
- : Ne,
- Je = function(e) {
- var t = (Fe[e] = ke(ze[Ye]));
- return (t._k = e), t;
- },
- Xe =
- Ue && 'symbol' == typeof ze.iterator
- ? function(e) {
- return 'symbol' == typeof e;
- }
- : function(e) {
- return e instanceof ze;
- },
- Ze = function(e, t, n) {
- return (
- e === Be && Ze(Ge, t, n),
- D(e),
- (t = d(t, !0)),
- D(n),
- m(Fe, t)
- ? (n.enumerable
- ? (m(e, We) && e[We][t] && (e[We][t] = !1),
- (n = ke(n, { enumerable: A(0, !1) })))
- : (m(e, We) || Ne(e, We, A(1, {})), (e[We][t] = !0)),
- Ke(e, t, n))
- : Ne(e, t, n)
- );
- },
- Qe = function(e, t) {
- D(e);
- for (
- var n,
- r = (function(e) {
- var t = pe(e),
- n = me.f;
- if (n)
- for (var r, a = n(e), i = u.f, o = 0; a.length > o; )
- i.call(e, (r = a[o++])) && t.push(r);
- return t;
- })((t = l(t))),
- a = 0,
- i = r.length;
- a < i;
-
- )
- Ze(e, (n = r[a++]), t[n]);
- return e;
- },
- et = function(e) {
- var t = He.call(this, (e = d(e, !0)));
- return (
- !(this === Be && m(Fe, e) && !m(Ge, e)) &&
- (!(t || !m(this, e) || !m(Fe, e) || (m(this, We) && this[We][e])) || t)
- );
- },
- tt = function(e, t) {
- if (((e = l(e)), (t = d(t, !0)), e !== Be || !m(Fe, t) || m(Ge, t))) {
- var n = je(e, t);
- return (
- !n || !m(Fe, t) || (m(e, We) && e[We][t]) || (n.enumerable = !0), n
- );
- }
- },
- nt = function(e) {
- for (var t, n = Pe(l(e)), r = [], a = 0; n.length > a; )
- m(Fe, (t = n[a++])) || t == We || t == Oe || r.push(t);
- return r;
- },
- rt = function(e) {
- for (
- var t, n = e === Be, r = Pe(n ? Ge : l(e)), a = [], i = 0;
- r.length > i;
-
- )
- !m(Fe, (t = r[i++])) || (n && !m(Be, t)) || a.push(Fe[t]);
- return a;
- };
- Ue ||
- (I(
- (ze = function() {
- if (this instanceof ze) throw TypeError('Symbol is not a constructor!');
- var t = B(0 < arguments.length ? arguments[0] : void 0),
- n = function(e) {
- this === Be && n.call(Ge, e),
- m(this, We) && m(this[We], t) && (this[We][t] = !1),
- Ke(this, t, A(1, e));
- };
- return y && Ve && Ke(Be, t, { configurable: !0, set: n }), Je(t);
- })[Ye],
- 'toString',
- function() {
- return this._k;
- }
- ),
- (S.f = tt),
- (j.f = Ze),
- (Se.f = De.f = nt),
- (u.f = et),
- (me.f = rt),
- (Z.f = function(e) {
- return Je(V(e));
- })),
- L(L.G + L.W + L.F * !Ue, { Symbol: ze });
- for (
- var at = 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(
- ','
- ),
- it = 0;
- at.length > it;
-
- )
- V(at[it++]);
- for (var ot = pe(V.store), st = 0; ot.length > st; ) ee(ot[st++]);
- L(L.S + L.F * !Ue, 'Symbol', {
- for: function(e) {
- return m(Ie, (e += '')) ? Ie[e] : (Ie[e] = ze(e));
- },
- keyFor: function(e) {
- if (!Xe(e)) throw TypeError(e + ' is not a symbol!');
- for (var t in Ie) if (Ie[t] === e) return t;
- },
- useSetter: function() {
- Ve = !0;
- },
- useSimple: function() {
- Ve = !1;
- },
- }),
- L(L.S + L.F * !Ue, 'Object', {
- create: function(e, t) {
- return void 0 === t ? ke(e) : Qe(ke(e), t);
- },
- defineProperty: Ze,
- defineProperties: Qe,
- getOwnPropertyDescriptor: tt,
- getOwnPropertyNames: nt,
- getOwnPropertySymbols: rt,
- }),
- Le &&
- L(
- L.S +
- L.F *
- (!Ue ||
- g(function() {
- var e = ze();
- return (
- '[null]' != Re([e]) ||
- '{}' != Re({ a: e }) ||
- '{}' != Re(Object(e))
- );
- })),
- 'JSON',
- {
- stringify: function(e) {
- for (var t, n, r = [e], a = 1; arguments.length > a; )
- r.push(arguments[a++]);
- if (((n = t = r[1]), (h(t) || void 0 !== e) && !Xe(e)))
- return (
- ge(t) ||
- (t = function(e, t) {
- if (
- ('function' == typeof n && (t = n.call(this, e, t)),
- !Xe(t))
- )
- return t;
- }),
- (r[1] = t),
- Re.apply(Le, r)
- );
- },
- }
- ),
- ze[Ye][qe] || N(ze[Ye], qe, ze[Ye].valueOf),
- X(ze, 'Symbol'),
- X(Math, 'Math', !0),
- X(b.JSON, 'JSON', !0);
- var ct = E.Object.getOwnPropertySymbols,
- lt = function(e) {
- return Object(c(e));
- };
- R('keys', function() {
- return function(e) {
- return pe(lt(e));
- };
- });
- var ut = E.Object.keys;
- L(L.S + L.F * !y, 'Object', { defineProperty: j.f });
- var ft = E.Object,
- ht = function(e, t, n) {
- return ft.defineProperty(e, t, n);
- };
- var dt = function(e, t, n) {
- return (
- t in e
- ? ht(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 })
- : (e[t] = n),
- e
- );
- };
- var pt = function(t) {
- for (var e = 1; e < arguments.length; e++) {
- var n = null != arguments[e] ? arguments[e] : {},
- r = ut(n);
- 'function' == typeof ct &&
- (r = r.concat(
- ct(n).filter(function(e) {
- return H(n, e).enumerable;
- })
- )),
- r.forEach(function(e) {
- dt(t, e, n[e]);
- });
- }
- return t;
- },
- mt = {},
- gt = {};
- N(gt, V('iterator'), function() {
- return this;
- });
- var vt,
- yt = le('IE_PROTO'),
- bt = Object.prototype,
- _t =
- Object.getPrototypeOf ||
- function(e) {
- return (
- (e = lt(e)),
- m(e, yt)
- ? e[yt]
- : 'function' == typeof e.constructor && e instanceof e.constructor
- ? e.constructor.prototype
- : e instanceof Object
- ? bt
- : null
- );
- },
- wt = V('iterator'),
- At = !([].keys && 'next' in [].keys()),
- xt = 'values',
- kt = function() {
- return this;
- },
- Mt = function(e, t, n, r, a, i, o) {
- var s, c, l;
- (c = t),
- (l = r),
- ((s = n).prototype = ke(gt, { next: A(1, l) })),
- X(s, c + ' Iterator');
- var u,
- f,
- h,
- d = function(e) {
- if (!At && e in v) return v[e];
- switch (e) {
- case 'keys':
- case xt:
- return function() {
- return new n(this, e);
- };
- }
- return function() {
- return new n(this, e);
- };
- },
- p = t + ' Iterator',
- m = a == xt,
- g = !1,
- v = e.prototype,
- y = v[wt] || v['@@iterator'] || (a && v[a]),
- b = y || d(a),
- _ = a ? (m ? d('entries') : b) : void 0,
- w = ('Array' == t && v.entries) || y;
- if (
- (w &&
- (h = _t(w.call(new e()))) !== Object.prototype &&
- h.next &&
- X(h, p, !0),
- m &&
- y &&
- y.name !== xt &&
- ((g = !0),
- (b = function() {
- return y.call(this);
- })),
- o && (At || g || !v[wt]) && N(v, wt, b),
- (mt[t] = b),
- (mt[p] = kt),
- a)
- )
- if (
- ((u = { values: m ? b : d(xt), keys: i ? b : d('keys'), entries: _ }),
- o)
- )
- for (f in u) f in v || I(v, f, u[f]);
- else L(L.P + L.F * (At || g), t, u);
- return u;
- },
- St = ((vt = !0),
- function(e, t) {
- var n,
- r,
- a = String(c(e)),
- i = re(t),
- o = a.length;
- return i < 0 || o <= i
- ? vt
- ? ''
- : void 0
- : (n = a.charCodeAt(i)) < 55296 ||
- 56319 < n ||
- i + 1 === o ||
- (r = a.charCodeAt(i + 1)) < 56320 ||
- 57343 < r
- ? vt
- ? a.charAt(i)
- : n
- : vt
- ? a.slice(i, i + 2)
- : r - 56320 + ((n - 55296) << 10) + 65536;
- });
- Mt(
- String,
- 'String',
- function(e) {
- (this._t = String(e)), (this._i = 0);
- },
- function() {
- var e,
- t = this._t,
- n = this._i;
- return n >= t.length
- ? { value: void 0, done: !0 }
- : ((e = St(t, n)), (this._i += e.length), { value: e, done: !1 });
- }
- );
- var Et = function(e, t) {
- return { value: t, done: !!e };
- };
- Mt(
- Array,
- 'Array',
- function(e, t) {
- (this._t = l(e)), (this._i = 0), (this._k = t);
- },
- function() {
- var e = this._t,
- t = this._k,
- n = this._i++;
- return !e || n >= e.length
- ? ((this._t = void 0), Et(1))
- : Et(0, 'keys' == t ? n : 'values' == t ? e[n] : [n, e[n]]);
- },
- 'values'
- );
- mt.Arguments = mt.Array;
- for (
- var Tt = V('toStringTag'),
- Ct = 'CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList'.split(
- ','
- ),
- Dt = 0;
- Dt < Ct.length;
- Dt++
- ) {
- var Ot = Ct[Dt],
- jt = b[Ot],
- Nt = jt && jt.prototype;
- Nt && !Nt[Tt] && N(Nt, Tt, Ot), (mt[Ot] = mt.Array);
- }
- var Pt,
- zt,
- Lt,
- Rt = V('toStringTag'),
- Yt =
- 'Arguments' ==
- s(
- (function() {
- return arguments;
- })()
- ),
- Wt = function(e) {
- var t, n, r;
- return void 0 === e
- ? 'Undefined'
- : null === e
- ? 'Null'
- : 'string' ==
- typeof (n = (function(e, t) {
- try {
- return e[t];
- } catch (e) {}
- })((t = Object(e)), Rt))
- ? n
- : Yt
- ? s(t)
- : 'Object' == (r = s(t)) && 'function' == typeof t.callee
- ? 'Arguments'
- : r;
- },
- qt = function(e, t, n, r) {
- if (!(e instanceof t) || (void 0 !== r && r in e))
- throw TypeError(n + ': incorrect invocation!');
- return e;
- },
- Ht = function(t, e, n, r) {
- try {
- return r ? e(D(n)[0], n[1]) : e(n);
- } catch (e) {
- var a = t.return;
- throw (void 0 !== a && D(a.call(t)), e);
- }
- },
- It = V('iterator'),
- Ft = Array.prototype,
- Gt = function(e) {
- return void 0 !== e && (mt.Array === e || Ft[It] === e);
- },
- Bt = V('iterator'),
- Ut = (E.getIteratorMethod = function(e) {
- if (null != e) return e[Bt] || e['@@iterator'] || mt[Wt(e)];
- }),
- $t = e(function(e) {
- var h = {},
- d = {},
- t = (e.exports = function(e, t, n, r, a) {
- var i,
- o,
- s,
- c,
- l = a
- ? function() {
- return e;
- }
- : Ut(e),
- u = C(n, r, t ? 2 : 1),
- f = 0;
- if ('function' != typeof l) throw TypeError(e + ' is not iterable!');
- if (Gt(l)) {
- for (i = ie(e.length); f < i; f++)
- if (
- (c = t ? u(D((o = e[f]))[0], o[1]) : u(e[f])) === h ||
- c === d
- )
- return c;
- } else
- for (s = l.call(e); !(o = s.next()).done; )
- if ((c = Ht(s, u, o.value, t)) === h || c === d) return c;
- });
- (t.BREAK = h), (t.RETURN = d);
- }),
- Vt = V('species'),
- Kt = function(e, t) {
- var n,
- r = D(e).constructor;
- return void 0 === r || null == (n = D(r)[Vt]) ? t : T(n);
- },
- Jt = b.process,
- Xt = b.setImmediate,
- Zt = b.clearImmediate,
- Qt = b.MessageChannel,
- en = b.Dispatch,
- tn = 0,
- nn = {},
- rn = 'onreadystatechange',
- an = function() {
- var e = +this;
- if (nn.hasOwnProperty(e)) {
- var t = nn[e];
- delete nn[e], t();
- }
- },
- on = function(e) {
- an.call(e.data);
- };
- (Xt && Zt) ||
- ((Xt = function(e) {
- for (var t = [], n = 1; arguments.length > n; ) t.push(arguments[n++]);
- return (
- (nn[++tn] = function() {
- !(function(e, t, n) {
- var r = void 0 === n;
- switch (t.length) {
- case 0:
- return r ? e() : e.call(n);
- case 1:
- return r ? e(t[0]) : e.call(n, t[0]);
- case 2:
- return r ? e(t[0], t[1]) : e.call(n, t[0], t[1]);
- case 3:
- return r ? e(t[0], t[1], t[2]) : e.call(n, t[0], t[1], t[2]);
- case 4:
- return r
- ? e(t[0], t[1], t[2], t[3])
- : e.call(n, t[0], t[1], t[2], t[3]);
- }
- e.apply(n, t);
- })('function' == typeof e ? e : Function(e), t);
- }),
- Pt(tn),
- tn
- );
- }),
- (Zt = function(e) {
- delete nn[e];
- }),
- 'process' == s(Jt)
- ? (Pt = function(e) {
- Jt.nextTick(C(an, e, 1));
- })
- : en && en.now
- ? (Pt = function(e) {
- en.now(C(an, e, 1));
- })
- : Qt
- ? ((Lt = (zt = new Qt()).port2),
- (zt.port1.onmessage = on),
- (Pt = C(Lt.postMessage, Lt, 1)))
- : b.addEventListener &&
- 'function' == typeof postMessage &&
- !b.importScripts
- ? ((Pt = function(e) {
- b.postMessage(e + '', '*');
- }),
- b.addEventListener('message', on, !1))
- : (Pt =
- rn in x('script')
- ? function(e) {
- be.appendChild(x('script'))[rn] = function() {
- be.removeChild(this), an.call(e);
- };
- }
- : function(e) {
- setTimeout(C(an, e, 1), 0);
- }));
- var sn = { set: Xt, clear: Zt },
- cn = sn.set,
- ln = b.MutationObserver || b.WebKitMutationObserver,
- un = b.process,
- fn = b.Promise,
- hn = 'process' == s(un);
- function dn(e) {
- var n, r;
- (this.promise = new e(function(e, t) {
- if (void 0 !== n || void 0 !== r)
- throw TypeError('Bad Promise constructor');
- (n = e), (r = t);
- })),
- (this.resolve = T(n)),
- (this.reject = T(r));
- }
- var pn = {
- f: function(e) {
- return new dn(e);
- },
- },
- mn = function(e) {
- try {
- return { e: !1, v: e() };
- } catch (e) {
- return { e: !0, v: e };
- }
- },
- gn = b.navigator,
- vn = (gn && gn.userAgent) || '',
- yn = function(e, t) {
- if ((D(e), h(t) && t.constructor === e)) return t;
- var n = pn.f(e);
- return (0, n.resolve)(t), n.promise;
- },
- bn = function(e, t, n) {
- for (var r in t) n && e[r] ? (e[r] = t[r]) : N(e, r, t[r]);
- return e;
- },
- _n = V('species'),
- wn = function(e) {
- var t = 'function' == typeof E[e] ? E[e] : b[e];
- y &&
- t &&
- !t[_n] &&
- j.f(t, _n, {
- configurable: !0,
- get: function() {
- return this;
- },
- });
- },
- An = V('iterator'),
- xn = !1;
- try {
- [7][An]().return = function() {
- xn = !0;
- };
- } catch (e) {}
- var kn,
- Mn,
- Sn,
- En,
- Tn = function(e, t) {
- if (!t && !xn) return !1;
- var n = !1;
- try {
- var r = [7],
- a = r[An]();
- (a.next = function() {
- return { done: (n = !0) };
- }),
- (r[An] = function() {
- return a;
- }),
- e(r);
- } catch (e) {}
- return n;
- },
- Cn = sn.set,
- Dn = (function() {
- var n,
- r,
- a,
- e = function() {
- var e, t;
- for (hn && (e = un.domain) && e.exit(); n; ) {
- (t = n.fn), (n = n.next);
- try {
- t();
- } catch (e) {
- throw (n ? a() : (r = void 0), e);
- }
- }
- (r = void 0), e && e.enter();
- };
- if (hn)
- a = function() {
- un.nextTick(e);
- };
- else if (!ln || (b.navigator && b.navigator.standalone))
- if (fn && fn.resolve) {
- var t = fn.resolve(void 0);
- a = function() {
- t.then(e);
- };
- } else
- a = function() {
- cn.call(b, e);
- };
- else {
- var i = !0,
- o = document.createTextNode('');
- new ln(e).observe(o, { characterData: !0 }),
- (a = function() {
- o.data = i = !i;
- });
- }
- return function(e) {
- var t = { fn: e, next: void 0 };
- r && (r.next = t), n || ((n = t), a()), (r = t);
- };
- })(),
- On = 'Promise',
- jn = b.TypeError,
- Nn = b.process,
- Pn = Nn && Nn.versions,
- zn = (Pn && Pn.v8) || '',
- Ln = b[On],
- Rn = 'process' == Wt(Nn),
- Yn = function() {},
- Wn = (Mn = pn.f),
- qn = !!(function() {
- try {
- var e = Ln.resolve(1),
- t = ((e.constructor = {})[V('species')] = function(e) {
- e(Yn, Yn);
- });
- return (
- (Rn || 'function' == typeof PromiseRejectionEvent) &&
- e.then(Yn) instanceof t &&
- 0 !== zn.indexOf('6.6') &&
- -1 === vn.indexOf('Chrome/66')
- );
- } catch (e) {}
- })(),
- Hn = function(e) {
- var t;
- return !(!h(e) || 'function' != typeof (t = e.then)) && t;
- },
- In = function(u, n) {
- if (!u._n) {
- u._n = !0;
- var r = u._c;
- Dn(function() {
- for (
- var c = u._v,
- l = 1 == u._s,
- e = 0,
- t = function(e) {
- var t,
- n,
- r,
- a = l ? e.ok : e.fail,
- i = e.resolve,
- o = e.reject,
- s = e.domain;
- try {
- a
- ? (l || (2 == u._h && Bn(u), (u._h = 1)),
- !0 === a
- ? (t = c)
- : (s && s.enter(),
- (t = a(c)),
- s && (s.exit(), (r = !0))),
- t === e.promise
- ? o(jn('Promise-chain cycle'))
- : (n = Hn(t))
- ? n.call(t, i, o)
- : i(t))
- : o(c);
- } catch (e) {
- s && !r && s.exit(), o(e);
- }
- };
- r.length > e;
-
- )
- t(r[e++]);
- (u._c = []), (u._n = !1), n && !u._h && Fn(u);
- });
- }
- },
- Fn = function(i) {
- Cn.call(b, function() {
- var e,
- t,
- n,
- r = i._v,
- a = Gn(i);
- if (
- (a &&
- ((e = mn(function() {
- Rn
- ? Nn.emit('unhandledRejection', r, i)
- : (t = b.onunhandledrejection)
- ? t({ promise: i, reason: r })
- : (n = b.console) &&
- n.error &&
- n.error('Unhandled promise rejection', r);
- })),
- (i._h = Rn || Gn(i) ? 2 : 1)),
- (i._a = void 0),
- a && e.e)
- )
- throw e.v;
- });
- },
- Gn = function(e) {
- return 1 !== e._h && 0 === (e._a || e._c).length;
- },
- Bn = function(t) {
- Cn.call(b, function() {
- var e;
- Rn
- ? Nn.emit('rejectionHandled', t)
- : (e = b.onrejectionhandled) && e({ promise: t, reason: t._v });
- });
- },
- Un = function(e) {
- var t = this;
- t._d ||
- ((t._d = !0),
- ((t = t._w || t)._v = e),
- (t._s = 2),
- t._a || (t._a = t._c.slice()),
- In(t, !0));
- },
- Vn = function(e) {
- var n,
- r = this;
- if (!r._d) {
- (r._d = !0), (r = r._w || r);
- try {
- if (r === e) throw jn("Promise can't be resolved itself");
- (n = Hn(e))
- ? Dn(function() {
- var t = { _w: r, _d: !1 };
- try {
- n.call(e, C(Vn, t, 1), C(Un, t, 1));
- } catch (e) {
- Un.call(t, e);
- }
- })
- : ((r._v = e), (r._s = 1), In(r, !1));
- } catch (e) {
- Un.call({ _w: r, _d: !1 }, e);
- }
- }
- };
- qn ||
- ((Ln = function(e) {
- qt(this, Ln, On, '_h'), T(e), kn.call(this);
- try {
- e(C(Vn, this, 1), C(Un, this, 1));
- } catch (e) {
- Un.call(this, e);
- }
- }),
- ((kn = function(e) {
- (this._c = []),
- (this._a = void 0),
- (this._s = 0),
- (this._d = !1),
- (this._v = void 0),
- (this._h = 0),
- (this._n = !1);
- }).prototype = bn(Ln.prototype, {
- then: function(e, t) {
- var n = Wn(Kt(this, Ln));
- return (
- (n.ok = 'function' != typeof e || e),
- (n.fail = 'function' == typeof t && t),
- (n.domain = Rn ? Nn.domain : void 0),
- this._c.push(n),
- this._a && this._a.push(n),
- this._s && In(this, !1),
- n.promise
- );
- },
- catch: function(e) {
- return this.then(void 0, e);
- },
- })),
- (Sn = function() {
- var e = new kn();
- (this.promise = e),
- (this.resolve = C(Vn, e, 1)),
- (this.reject = C(Un, e, 1));
- }),
- (pn.f = Wn = function(e) {
- return e === Ln || e === En ? new Sn(e) : Mn(e);
- })),
- L(L.G + L.W + L.F * !qn, { Promise: Ln }),
- X(Ln, On),
- wn(On),
- (En = E[On]),
- L(L.S + L.F * !qn, On, {
- reject: function(e) {
- var t = Wn(this);
- return (0, t.reject)(e), t.promise;
- },
- }),
- L(L.S + !0 * L.F, On, {
- resolve: function(e) {
- return yn(this === En ? Ln : this, e);
- },
- }),
- L(
- L.S +
- L.F *
- !(
- qn &&
- Tn(function(e) {
- Ln.all(e).catch(Yn);
- })
- ),
- On,
- {
- all: function(e) {
- var o = this,
- t = Wn(o),
- s = t.resolve,
- c = t.reject,
- n = mn(function() {
- var r = [],
- a = 0,
- i = 1;
- $t(e, !1, function(e) {
- var t = a++,
- n = !1;
- r.push(void 0),
- i++,
- o.resolve(e).then(function(e) {
- n || ((n = !0), (r[t] = e), --i || s(r));
- }, c);
- }),
- --i || s(r);
- });
- return n.e && c(n.v), t.promise;
- },
- race: function(e) {
- var t = this,
- n = Wn(t),
- r = n.reject,
- a = mn(function() {
- $t(e, !1, function(e) {
- t.resolve(e).then(n.resolve, r);
- });
- });
- return a.e && r(a.v), n.promise;
- },
- }
- ),
- L(L.P + L.R, 'Promise', {
- finally: function(t) {
- var n = Kt(this, E.Promise || b.Promise),
- e = 'function' == typeof t;
- return this.then(
- e
- ? function(e) {
- return yn(n, t()).then(function() {
- return e;
- });
- }
- : t,
- e
- ? function(e) {
- return yn(n, t()).then(function() {
- throw e;
- });
- }
- : t
- );
- },
- }),
- L(L.S, 'Promise', {
- try: function(e) {
- var t = pn.f(this),
- n = mn(e);
- return (n.e ? t.reject : t.resolve)(n.v), t.promise;
- },
- });
- var Kn = E.Promise;
- function Jn(e, t, n, r, a, i, o) {
- try {
- var s = e[i](o),
- c = s.value;
- } catch (e) {
- return void n(e);
- }
- s.done ? t(c) : Kn.resolve(c).then(r, a);
- }
- var Xn = function(s) {
- return function() {
- var e = this,
- o = arguments;
- return new Kn(function(t, n) {
- var r = s.apply(e, o);
- function a(e) {
- Jn(r, t, n, a, i, 'next', e);
- }
- function i(e) {
- Jn(r, t, n, a, i, 'throw', e);
- }
- a(void 0);
- });
- };
- },
- Zn =
- 'undefined' != typeof global
- ? global
- : 'undefined' != typeof self
- ? self
- : 'undefined' != typeof window
- ? window
- : {},
- Qn = e(function(O, j) {
- !(function(e) {
- var t = j && !j.nodeType && j,
- n = O && !O.nodeType && O,
- r = 'object' == typeof Zn && Zn;
- (r.global !== r && r.window !== r && r.self !== r) || (e = r);
- var a,
- i,
- v = 2147483647,
- y = 36,
- b = 1,
- _ = 26,
- o = 38,
- s = 700,
- w = 72,
- A = 128,
- x = '-',
- c = /^xn--/,
- l = /[^\x20-\x7E]/,
- u = /[\x2E\u3002\uFF0E\uFF61]/g,
- f = {
- overflow: 'Overflow: input needs wider integers to process',
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
- 'invalid-input': 'Invalid input',
- },
- h = y - b,
- k = Math.floor,
- M = String.fromCharCode;
- function S(e) {
- throw RangeError(f[e]);
- }
- function d(e, t) {
- for (var n = e.length, r = []; n--; ) r[n] = t(e[n]);
- return r;
- }
- function p(e, t) {
- var n = e.split('@'),
- r = '';
- return (
- 1 < n.length && ((r = n[0] + '@'), (e = n[1])),
- r + d((e = e.replace(u, '.')).split('.'), t).join('.')
- );
- }
- function E(e) {
- for (var t, n, r = [], a = 0, i = e.length; a < i; )
- 55296 <= (t = e.charCodeAt(a++)) && t <= 56319 && a < i
- ? 56320 == (64512 & (n = e.charCodeAt(a++)))
- ? r.push(((1023 & t) << 10) + (1023 & n) + 65536)
- : (r.push(t), a--)
- : r.push(t);
- return r;
- }
- function T(e) {
- return d(e, function(e) {
- var t = '';
- return (
- 65535 < e &&
- ((t += M((((e -= 65536) >>> 10) & 1023) | 55296)),
- (e = 56320 | (1023 & e))),
- (t += M(e))
- );
- }).join('');
- }
- function C(e, t) {
- return e + 22 + 75 * (e < 26) - ((0 != t) << 5);
- }
- function D(e, t, n) {
- var r = 0;
- for (
- e = n ? k(e / s) : e >> 1, e += k(e / t);
- (h * _) >> 1 < e;
- r += y
- )
- e = k(e / h);
- return k(r + ((h + 1) * e) / (e + o));
- }
- function m(e) {
- var t,
- n,
- r,
- a,
- i,
- o,
- s,
- c,
- l,
- u,
- f,
- h = [],
- d = e.length,
- p = 0,
- m = A,
- g = w;
- for ((n = e.lastIndexOf(x)) < 0 && (n = 0), r = 0; r < n; ++r)
- 128 <= e.charCodeAt(r) && S('not-basic'), h.push(e.charCodeAt(r));
- for (a = 0 < n ? n + 1 : 0; a < d; ) {
- for (
- i = p, o = 1, s = y;
- d <= a && S('invalid-input'),
- (f = e.charCodeAt(a++)),
- (y <=
- (c =
- f - 48 < 10
- ? f - 22
- : f - 65 < 26
- ? f - 65
- : f - 97 < 26
- ? f - 97
- : y) ||
- c > k((v - p) / o)) &&
- S('overflow'),
- (p += c * o),
- !(c < (l = s <= g ? b : g + _ <= s ? _ : s - g));
- s += y
- )
- o > k(v / (u = y - l)) && S('overflow'), (o *= u);
- (g = D(p - i, (t = h.length + 1), 0 == i)),
- k(p / t) > v - m && S('overflow'),
- (m += k(p / t)),
- (p %= t),
- h.splice(p++, 0, m);
- }
- return T(h);
- }
- function g(e) {
- var t,
- n,
- r,
- a,
- i,
- o,
- s,
- c,
- l,
- u,
- f,
- h,
- d,
- p,
- m,
- g = [];
- for (h = (e = E(e)).length, t = A, i = w, o = n = 0; o < h; ++o)
- (f = e[o]) < 128 && g.push(M(f));
- for (r = a = g.length, a && g.push(x); r < h; ) {
- for (s = v, o = 0; o < h; ++o) t <= (f = e[o]) && f < s && (s = f);
- for (
- s - t > k((v - n) / (d = r + 1)) && S('overflow'),
- n += (s - t) * d,
- t = s,
- o = 0;
- o < h;
- ++o
- )
- if (((f = e[o]) < t && ++n > v && S('overflow'), f == t)) {
- for (
- c = n, l = y;
- !(c < (u = l <= i ? b : i + _ <= l ? _ : l - i));
- l += y
- )
- (m = c - u),
- (p = y - u),
- g.push(M(C(u + (m % p), 0))),
- (c = k(m / p));
- g.push(M(C(c, 0))), (i = D(n, d, r == a)), (n = 0), ++r;
- }
- ++n, ++t;
- }
- return g.join('');
- }
- if (
- ((a = {
- version: '1.3.2',
- ucs2: { decode: E, encode: T },
- decode: m,
- encode: g,
- toASCII: function(e) {
- return p(e, function(e) {
- return l.test(e) ? 'xn--' + g(e) : e;
- });
- },
- toUnicode: function(e) {
- return p(e, function(e) {
- return c.test(e) ? m(e.slice(4).toLowerCase()) : e;
- });
- },
- }),
- t && n)
- )
- if (O.exports == t) n.exports = a;
- else for (i in a) a.hasOwnProperty(i) && (t[i] = a[i]);
- else e.punycode = a;
- })(this);
- }),
- er = {
- isString: function(e) {
- return 'string' == typeof e;
- },
- isObject: function(e) {
- return 'object' == typeof e && null !== e;
- },
- isNull: function(e) {
- return null === e;
- },
- isNullOrUndefined: function(e) {
- return null == e;
- },
- };
- var tr = function(e, t, n, r) {
- (t = t || '&'), (n = n || '=');
- var a = {};
- if ('string' != typeof e || 0 === e.length) return a;
- var i = /\+/g;
- e = e.split(t);
- var o = 1e3;
- r && 'number' == typeof r.maxKeys && (o = r.maxKeys);
- var s,
- c,
- l = e.length;
- 0 < o && o < l && (l = o);
- for (var u = 0; u < l; ++u) {
- var f,
- h,
- d,
- p,
- m = e[u].replace(i, '%20'),
- g = m.indexOf(n);
- (h = 0 <= g ? ((f = m.substr(0, g)), m.substr(g + 1)) : ((f = m), '')),
- (d = decodeURIComponent(f)),
- (p = decodeURIComponent(h)),
- (s = a),
- (c = d),
- Object.prototype.hasOwnProperty.call(s, c)
- ? Array.isArray(a[d])
- ? a[d].push(p)
- : (a[d] = [a[d], p])
- : (a[d] = p);
- }
- return a;
- },
- nr = function(e) {
- switch (typeof e) {
- case 'string':
- return e;
- case 'boolean':
- return e ? 'true' : 'false';
- case 'number':
- return isFinite(e) ? e : '';
- default:
- return '';
- }
- },
- rr = function(n, r, a, e) {
- return (
- (r = r || '&'),
- (a = a || '='),
- null === n && (n = void 0),
- 'object' == typeof n
- ? Object.keys(n)
- .map(function(e) {
- var t = encodeURIComponent(nr(e)) + a;
- return Array.isArray(n[e])
- ? n[e]
- .map(function(e) {
- return t + encodeURIComponent(nr(e));
- })
- .join(r)
- : t + encodeURIComponent(nr(n[e]));
- })
- .join(r)
- : e
- ? encodeURIComponent(nr(e)) + a + encodeURIComponent(nr(n))
- : ''
- );
- },
- ar = e(function(e, t) {
- (t.decode = t.parse = tr), (t.encode = t.stringify = rr);
- }),
- ir = (ar.decode, ar.parse, ar.encode, ar.stringify, xr),
- or = function(e, t) {
- return xr(e, !1, !0).resolve(t);
- },
- sr = function(e, t) {
- return e ? xr(e, !1, !0).resolveObject(t) : t;
- },
- cr = function(e) {
- er.isString(e) && (e = xr(e));
- return e instanceof ur ? e.format() : ur.prototype.format.call(e);
- },
- lr = ur;
- function ur() {
- (this.protocol = null),
- (this.slashes = null),
- (this.auth = null),
- (this.host = null),
- (this.port = null),
- (this.hostname = null),
- (this.hash = null),
- (this.search = null),
- (this.query = null),
- (this.pathname = null),
- (this.path = null),
- (this.href = null);
- }
- var fr = /^([a-z0-9.+-]+:)/i,
- hr = /:[0-9]*$/,
- dr = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
- pr = ['{', '}', '|', '\\', '^', '`'].concat([
- '<',
- '>',
- '"',
- '`',
- ' ',
- '\r',
- '\n',
- '\t',
- ]),
- mr = ["'"].concat(pr),
- gr = ['%', '/', '?', ';', '#'].concat(mr),
- vr = ['/', '?', '#'],
- yr = /^[+a-z0-9A-Z_-]{0,63}$/,
- br = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
- _r = { javascript: !0, 'javascript:': !0 },
- wr = { javascript: !0, 'javascript:': !0 },
- Ar = {
- http: !0,
- https: !0,
- ftp: !0,
- gopher: !0,
- file: !0,
- 'http:': !0,
- 'https:': !0,
- 'ftp:': !0,
- 'gopher:': !0,
- 'file:': !0,
- };
- function xr(e, t, n) {
- if (e && er.isObject(e) && e instanceof ur) return e;
- var r = new ur();
- return r.parse(e, t, n), r;
- }
- (ur.prototype.parse = function(e, t, n) {
- if (!er.isString(e))
- throw new TypeError("Parameter 'url' must be a string, not " + typeof e);
- var r = e.indexOf('?'),
- a = -1 !== r && r < e.indexOf('#') ? '?' : '#',
- i = e.split(a);
- i[0] = i[0].replace(/\\/g, '/');
- var o = (e = i.join(a));
- if (((o = o.trim()), !n && 1 === e.split('#').length)) {
- var s = dr.exec(o);
- if (s)
- return (
- (this.path = o),
- (this.href = o),
- (this.pathname = s[1]),
- s[2]
- ? ((this.search = s[2]),
- (this.query = t
- ? ar.parse(this.search.substr(1))
- : this.search.substr(1)))
- : t && ((this.search = ''), (this.query = {})),
- this
- );
- }
- var c = fr.exec(o);
- if (c) {
- var l = (c = c[0]).toLowerCase();
- (this.protocol = l), (o = o.substr(c.length));
- }
- if (n || c || o.match(/^\/\/[^@\/]+@[^@\/]+/)) {
- var u = '//' === o.substr(0, 2);
- !u || (c && wr[c]) || ((o = o.substr(2)), (this.slashes = !0));
- }
- if (!wr[c] && (u || (c && !Ar[c]))) {
- for (var f, h, d = -1, p = 0; p < vr.length; p++) {
- -1 !== (m = o.indexOf(vr[p])) && (-1 === d || m < d) && (d = m);
- }
- -1 !== (h = -1 === d ? o.lastIndexOf('@') : o.lastIndexOf('@', d)) &&
- ((f = o.slice(0, h)),
- (o = o.slice(h + 1)),
- (this.auth = decodeURIComponent(f))),
- (d = -1);
- for (p = 0; p < gr.length; p++) {
- var m;
- -1 !== (m = o.indexOf(gr[p])) && (-1 === d || m < d) && (d = m);
- }
- -1 === d && (d = o.length),
- (this.host = o.slice(0, d)),
- (o = o.slice(d)),
- this.parseHost(),
- (this.hostname = this.hostname || '');
- var g =
- '[' === this.hostname[0] &&
- ']' === this.hostname[this.hostname.length - 1];
- if (!g)
- for (
- var v = this.hostname.split(/\./), y = ((p = 0), v.length);
- p < y;
- p++
- ) {
- var b = v[p];
- if (b && !b.match(yr)) {
- for (var _ = '', w = 0, A = b.length; w < A; w++)
- 127 < b.charCodeAt(w) ? (_ += 'x') : (_ += b[w]);
- if (!_.match(yr)) {
- var x = v.slice(0, p),
- k = v.slice(p + 1),
- M = b.match(br);
- M && (x.push(M[1]), k.unshift(M[2])),
- k.length && (o = '/' + k.join('.') + o),
- (this.hostname = x.join('.'));
- break;
- }
- }
- }
- 255 < this.hostname.length
- ? (this.hostname = '')
- : (this.hostname = this.hostname.toLowerCase()),
- g || (this.hostname = Qn.toASCII(this.hostname));
- var S = this.port ? ':' + this.port : '',
- E = this.hostname || '';
- (this.host = E + S),
- (this.href += this.host),
- g &&
- ((this.hostname = this.hostname.substr(1, this.hostname.length - 2)),
- '/' !== o[0] && (o = '/' + o));
- }
- if (!_r[l])
- for (p = 0, y = mr.length; p < y; p++) {
- var T = mr[p];
- if (-1 !== o.indexOf(T)) {
- var C = encodeURIComponent(T);
- C === T && (C = escape(T)), (o = o.split(T).join(C));
- }
- }
- var D = o.indexOf('#');
- -1 !== D && ((this.hash = o.substr(D)), (o = o.slice(0, D)));
- var O = o.indexOf('?');
- if (
- (-1 !== O
- ? ((this.search = o.substr(O)),
- (this.query = o.substr(O + 1)),
- t && (this.query = ar.parse(this.query)),
- (o = o.slice(0, O)))
- : t && ((this.search = ''), (this.query = {})),
- o && (this.pathname = o),
- Ar[l] && this.hostname && !this.pathname && (this.pathname = '/'),
- this.pathname || this.search)
- ) {
- S = this.pathname || '';
- var j = this.search || '';
- this.path = S + j;
- }
- return (this.href = this.format()), this;
- }),
- (ur.prototype.format = function() {
- var e = this.auth || '';
- e && ((e = (e = encodeURIComponent(e)).replace(/%3A/i, ':')), (e += '@'));
- var t = this.protocol || '',
- n = this.pathname || '',
- r = this.hash || '',
- a = !1,
- i = '';
- this.host
- ? (a = e + this.host)
- : this.hostname &&
- ((a =
- e +
- (-1 === this.hostname.indexOf(':')
- ? this.hostname
- : '[' + this.hostname + ']')),
- this.port && (a += ':' + this.port)),
- this.query &&
- er.isObject(this.query) &&
- Object.keys(this.query).length &&
- (i = ar.stringify(this.query));
- var o = this.search || (i && '?' + i) || '';
- return (
- t && ':' !== t.substr(-1) && (t += ':'),
- this.slashes || ((!t || Ar[t]) && !1 !== a)
- ? ((a = '//' + (a || '')), n && '/' !== n.charAt(0) && (n = '/' + n))
- : a || (a = ''),
- r && '#' !== r.charAt(0) && (r = '#' + r),
- o && '?' !== o.charAt(0) && (o = '?' + o),
- t +
- a +
- (n = n.replace(/[?#]/g, function(e) {
- return encodeURIComponent(e);
- })) +
- (o = o.replace('#', '%23')) +
- r
- );
- }),
- (ur.prototype.resolve = function(e) {
- return this.resolveObject(xr(e, !1, !0)).format();
- }),
- (ur.prototype.resolveObject = function(e) {
- if (er.isString(e)) {
- var t = new ur();
- t.parse(e, !1, !0), (e = t);
- }
- for (var n = new ur(), r = Object.keys(this), a = 0; a < r.length; a++) {
- var i = r[a];
- n[i] = this[i];
- }
- if (((n.hash = e.hash), '' === e.href)) return (n.href = n.format()), n;
- if (e.slashes && !e.protocol) {
- for (var o = Object.keys(e), s = 0; s < o.length; s++) {
- var c = o[s];
- 'protocol' !== c && (n[c] = e[c]);
- }
- return (
- Ar[n.protocol] &&
- n.hostname &&
- !n.pathname &&
- (n.path = n.pathname = '/'),
- (n.href = n.format()),
- n
- );
- }
- if (e.protocol && e.protocol !== n.protocol) {
- if (!Ar[e.protocol]) {
- for (var l = Object.keys(e), u = 0; u < l.length; u++) {
- var f = l[u];
- n[f] = e[f];
- }
- return (n.href = n.format()), n;
- }
- if (((n.protocol = e.protocol), e.host || wr[e.protocol]))
- n.pathname = e.pathname;
- else {
- for (
- var h = (e.pathname || '').split('/');
- h.length && !(e.host = h.shift());
-
- );
- e.host || (e.host = ''),
- e.hostname || (e.hostname = ''),
- '' !== h[0] && h.unshift(''),
- h.length < 2 && h.unshift(''),
- (n.pathname = h.join('/'));
- }
- if (
- ((n.search = e.search),
- (n.query = e.query),
- (n.host = e.host || ''),
- (n.auth = e.auth),
- (n.hostname = e.hostname || e.host),
- (n.port = e.port),
- n.pathname || n.search)
- ) {
- var d = n.pathname || '',
- p = n.search || '';
- n.path = d + p;
- }
- return (n.slashes = n.slashes || e.slashes), (n.href = n.format()), n;
- }
- var m = n.pathname && '/' === n.pathname.charAt(0),
- g = e.host || (e.pathname && '/' === e.pathname.charAt(0)),
- v = g || m || (n.host && e.pathname),
- y = v,
- b = (n.pathname && n.pathname.split('/')) || [],
- _ = ((h = (e.pathname && e.pathname.split('/')) || []),
- n.protocol && !Ar[n.protocol]);
- if (
- (_ &&
- ((n.hostname = ''),
- (n.port = null),
- n.host && ('' === b[0] ? (b[0] = n.host) : b.unshift(n.host)),
- (n.host = ''),
- e.protocol &&
- ((e.hostname = null),
- (e.port = null),
- e.host && ('' === h[0] ? (h[0] = e.host) : h.unshift(e.host)),
- (e.host = null)),
- (v = v && ('' === h[0] || '' === b[0]))),
- g)
- )
- (n.host = e.host || '' === e.host ? e.host : n.host),
- (n.hostname =
- e.hostname || '' === e.hostname ? e.hostname : n.hostname),
- (n.search = e.search),
- (n.query = e.query),
- (b = h);
- else if (h.length)
- b || (b = []),
- b.pop(),
- (b = b.concat(h)),
- (n.search = e.search),
- (n.query = e.query);
- else if (!er.isNullOrUndefined(e.search)) {
- if (_)
- (n.hostname = n.host = b.shift()),
- (M = !!(n.host && 0 < n.host.indexOf('@')) && n.host.split('@')) &&
- ((n.auth = M.shift()), (n.host = n.hostname = M.shift()));
- return (
- (n.search = e.search),
- (n.query = e.query),
- (er.isNull(n.pathname) && er.isNull(n.search)) ||
- (n.path =
- (n.pathname ? n.pathname : '') + (n.search ? n.search : '')),
- (n.href = n.format()),
- n
- );
- }
- if (!b.length)
- return (
- (n.pathname = null),
- n.search ? (n.path = '/' + n.search) : (n.path = null),
- (n.href = n.format()),
- n
- );
- for (
- var w = b.slice(-1)[0],
- A =
- ((n.host || e.host || 1 < b.length) && ('.' === w || '..' === w)) ||
- '' === w,
- x = 0,
- k = b.length;
- 0 <= k;
- k--
- )
- '.' === (w = b[k])
- ? b.splice(k, 1)
- : '..' === w
- ? (b.splice(k, 1), x++)
- : x && (b.splice(k, 1), x--);
- if (!v && !y) for (; x--; x) b.unshift('..');
- !v || '' === b[0] || (b[0] && '/' === b[0].charAt(0)) || b.unshift(''),
- A && '/' !== b.join('/').substr(-1) && b.push('');
- var M,
- S = '' === b[0] || (b[0] && '/' === b[0].charAt(0));
- _ &&
- ((n.hostname = n.host = S ? '' : b.length ? b.shift() : ''),
- (M = !!(n.host && 0 < n.host.indexOf('@')) && n.host.split('@')) &&
- ((n.auth = M.shift()), (n.host = n.hostname = M.shift())));
- return (
- (v = v || (n.host && b.length)) && !S && b.unshift(''),
- b.length
- ? (n.pathname = b.join('/'))
- : ((n.pathname = null), (n.path = null)),
- (er.isNull(n.pathname) && er.isNull(n.search)) ||
- (n.path =
- (n.pathname ? n.pathname : '') + (n.search ? n.search : '')),
- (n.auth = e.auth || n.auth),
- (n.slashes = n.slashes || e.slashes),
- (n.href = n.format()),
- n
- );
- }),
- (ur.prototype.parseHost = function() {
- var e = this.host,
- t = hr.exec(e);
- t &&
- (':' !== (t = t[0]) && (this.port = t.substr(1)),
- (e = e.substr(0, e.length - t.length))),
- e && (this.hostname = e);
- });
- var kr,
- Mr = { parse: ir, resolve: or, resolveObject: sr, format: cr, Url: lr },
- Sr = e(function(e) {
- var t, n;
- (t = 'undefined' != typeof window ? window : this),
- (n = function(x, e) {
- var t = [],
- k = x.document,
- r = Object.getPrototypeOf,
- s = t.slice,
- m = t.concat,
- c = t.push,
- a = t.indexOf,
- n = {},
- i = n.toString,
- g = n.hasOwnProperty,
- o = g.toString,
- l = o.call(Object),
- v = {},
- y = function(e) {
- return 'function' == typeof e && 'number' != typeof e.nodeType;
- },
- b = function(e) {
- return null != e && e === e.window;
- },
- u = { type: !0, src: !0, noModule: !0 };
- function _(e, t, n) {
- var r,
- a = (t = t || k).createElement('script');
- if (((a.text = e), n)) for (r in u) n[r] && (a[r] = n[r]);
- t.head.appendChild(a).parentNode.removeChild(a);
- }
- function w(e) {
- return null == e
- ? e + ''
- : 'object' == typeof e || 'function' == typeof e
- ? n[i.call(e)] || 'object'
- : typeof e;
- }
- var M = function(e, t) {
- return new M.fn.init(e, t);
- },
- f = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
- function h(e) {
- var t = !!e && 'length' in e && e.length,
- n = w(e);
- return (
- !y(e) &&
- !b(e) &&
- ('array' === n ||
- 0 === t ||
- ('number' == typeof t && 0 < t && t - 1 in e))
- );
- }
- (M.fn = M.prototype = {
- jquery: '3.3.1',
- constructor: M,
- length: 0,
- toArray: function() {
- return s.call(this);
- },
- get: function(e) {
- return null == e
- ? s.call(this)
- : e < 0
- ? this[e + this.length]
- : this[e];
- },
- pushStack: function(e) {
- var t = M.merge(this.constructor(), e);
- return (t.prevObject = this), t;
- },
- each: function(e) {
- return M.each(this, e);
- },
- map: function(n) {
- return this.pushStack(
- M.map(this, function(e, t) {
- return n.call(e, t, e);
- })
- );
- },
- slice: function() {
- return this.pushStack(s.apply(this, arguments));
- },
- first: function() {
- return this.eq(0);
- },
- last: function() {
- return this.eq(-1);
- },
- eq: function(e) {
- var t = this.length,
- n = +e + (e < 0 ? t : 0);
- return this.pushStack(0 <= n && n < t ? [this[n]] : []);
- },
- end: function() {
- return this.prevObject || this.constructor();
- },
- push: c,
- sort: t.sort,
- splice: t.splice,
- }),
- (M.extend = M.fn.extend = function() {
- var e,
- t,
- n,
- r,
- a,
- i,
- o = arguments[0] || {},
- s = 1,
- c = arguments.length,
- l = !1;
- for (
- 'boolean' == typeof o &&
- ((l = o), (o = arguments[s] || {}), s++),
- 'object' == typeof o || y(o) || (o = {}),
- s === c && ((o = this), s--);
- s < c;
- s++
- )
- if (null != (e = arguments[s]))
- for (t in e)
- (n = o[t]),
- o !== (r = e[t]) &&
- (l &&
- r &&
- (M.isPlainObject(r) || (a = Array.isArray(r)))
- ? ((i = a
- ? ((a = !1), n && Array.isArray(n) ? n : [])
- : n && M.isPlainObject(n)
- ? n
- : {}),
- (o[t] = M.extend(l, i, r)))
- : void 0 !== r && (o[t] = r));
- return o;
- }),
- M.extend({
- expando: 'jQuery' + ('3.3.1' + Math.random()).replace(/\D/g, ''),
- isReady: !0,
- error: function(e) {
- throw new Error(e);
- },
- noop: function() {},
- isPlainObject: function(e) {
- var t, n;
- return !(
- !e ||
- '[object Object]' !== i.call(e) ||
- ((t = r(e)) &&
- ('function' !=
- typeof (n = g.call(t, 'constructor') && t.constructor) ||
- o.call(n) !== l))
- );
- },
- isEmptyObject: function(e) {
- var t;
- for (t in e) return !1;
- return !0;
- },
- globalEval: function(e) {
- _(e);
- },
- each: function(e, t) {
- var n,
- r = 0;
- if (h(e))
- for (
- n = e.length;
- r < n && !1 !== t.call(e[r], r, e[r]);
- r++
- );
- else for (r in e) if (!1 === t.call(e[r], r, e[r])) break;
- return e;
- },
- trim: function(e) {
- return null == e ? '' : (e + '').replace(f, '');
- },
- makeArray: function(e, t) {
- var n = t || [];
- return (
- null != e &&
- (h(Object(e))
- ? M.merge(n, 'string' == typeof e ? [e] : e)
- : c.call(n, e)),
- n
- );
- },
- inArray: function(e, t, n) {
- return null == t ? -1 : a.call(t, e, n);
- },
- merge: function(e, t) {
- for (var n = +t.length, r = 0, a = e.length; r < n; r++)
- e[a++] = t[r];
- return (e.length = a), e;
- },
- grep: function(e, t, n) {
- for (var r = [], a = 0, i = e.length, o = !n; a < i; a++)
- !t(e[a], a) !== o && r.push(e[a]);
- return r;
- },
- map: function(e, t, n) {
- var r,
- a,
- i = 0,
- o = [];
- if (h(e))
- for (r = e.length; i < r; i++)
- null != (a = t(e[i], i, n)) && o.push(a);
- else for (i in e) null != (a = t(e[i], i, n)) && o.push(a);
- return m.apply([], o);
- },
- guid: 1,
- support: v,
- }),
- 'function' == typeof Symbol &&
- (M.fn[Symbol.iterator] = t[Symbol.iterator]),
- M.each(
- 'Boolean Number String Function Array Date RegExp Object Error Symbol'.split(
- ' '
- ),
- function(e, t) {
- n['[object ' + t + ']'] = t.toLowerCase();
- }
- );
- var d = (function(n) {
- var e,
- d,
- _,
- i,
- a,
- p,
- f,
- m,
- w,
- c,
- l,
- A,
- x,
- o,
- k,
- g,
- s,
- u,
- v,
- M = 'sizzle' + 1 * new Date(),
- y = n.document,
- S = 0,
- r = 0,
- h = oe(),
- b = oe(),
- E = oe(),
- T = function(e, t) {
- return e === t && (l = !0), 0;
- },
- C = {}.hasOwnProperty,
- t = [],
- D = t.pop,
- O = t.push,
- j = t.push,
- N = t.slice,
- P = function(e, t) {
- for (var n = 0, r = e.length; n < r; n++)
- if (e[n] === t) return n;
- return -1;
- },
- z =
- 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped',
- L = '[\\x20\\t\\r\\n\\f]',
- R = '(?:\\\\.|[\\w-]|[^\0-\\xa0])+',
- Y =
- '\\[' +
- L +
- '*(' +
- R +
- ')(?:' +
- L +
- '*([*^$|!~]?=)' +
- L +
- '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' +
- R +
- '))|)' +
- L +
- '*\\]',
- W =
- ':(' +
- R +
- ')(?:\\(((\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|' +
- Y +
- ')*)|.*)\\)|)',
- q = new RegExp(L + '+', 'g'),
- H = new RegExp(
- '^' + L + '+|((?:^|[^\\\\])(?:\\\\.)*)' + L + '+$',
- 'g'
- ),
- I = new RegExp('^' + L + '*,' + L + '*'),
- F = new RegExp('^' + L + '*([>+~]|' + L + ')' + L + '*'),
- G = new RegExp('=' + L + '*([^\\]\'"]*?)' + L + '*\\]', 'g'),
- B = new RegExp(W),
- U = new RegExp('^' + R + '$'),
- $ = {
- ID: new RegExp('^#(' + R + ')'),
- CLASS: new RegExp('^\\.(' + R + ')'),
- TAG: new RegExp('^(' + R + '|[*])'),
- ATTR: new RegExp('^' + Y),
- PSEUDO: new RegExp('^' + W),
- CHILD: new RegExp(
- '^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' +
- L +
- '*(even|odd|(([+-]|)(\\d*)n|)' +
- L +
- '*(?:([+-]|)' +
- L +
- '*(\\d+)|))' +
- L +
- '*\\)|)',
- 'i'
- ),
- bool: new RegExp('^(?:' + z + ')$', 'i'),
- needsContext: new RegExp(
- '^' +
- L +
- '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' +
- L +
- '*((?:-\\d)?\\d*)' +
- L +
- '*\\)|)(?=[^-]|$)',
- 'i'
- ),
- },
- V = /^(?:input|select|textarea|button)$/i,
- K = /^h\d$/i,
- J = /^[^{]+\{\s*\[native \w/,
- X = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
- Z = /[+~]/,
- Q = new RegExp(
- '\\\\([\\da-f]{1,6}' + L + '?|(' + L + ')|.)',
- 'ig'
- ),
- ee = function(e, t, n) {
- var r = '0x' + t - 65536;
- return r != r || n
- ? t
- : r < 0
- ? String.fromCharCode(r + 65536)
- : String.fromCharCode((r >> 10) | 55296, (1023 & r) | 56320);
- },
- te = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
- ne = function(e, t) {
- return t
- ? '\0' === e
- ? '�'
- : e.slice(0, -1) +
- '\\' +
- e.charCodeAt(e.length - 1).toString(16) +
- ' '
- : '\\' + e;
- },
- re = function() {
- A();
- },
- ae = ye(
- function(e) {
- return !0 === e.disabled && ('form' in e || 'label' in e);
- },
- { dir: 'parentNode', next: 'legend' }
- );
- try {
- j.apply((t = N.call(y.childNodes)), y.childNodes),
- t[y.childNodes.length].nodeType;
- } catch (n) {
- j = {
- apply: t.length
- ? function(e, t) {
- O.apply(e, N.call(t));
- }
- : function(e, t) {
- for (var n = e.length, r = 0; (e[n++] = t[r++]); );
- e.length = n - 1;
- },
- };
- }
- function ie(e, t, n, r) {
- var a,
- i,
- o,
- s,
- c,
- l,
- u,
- f = t && t.ownerDocument,
- h = t ? t.nodeType : 9;
- if (
- ((n = n || []),
- 'string' != typeof e || !e || (1 !== h && 9 !== h && 11 !== h))
- )
- return n;
- if (
- !r &&
- ((t ? t.ownerDocument || t : y) !== x && A(t), (t = t || x), k)
- ) {
- if (11 !== h && (c = X.exec(e)))
- if ((a = c[1])) {
- if (9 === h) {
- if (!(o = t.getElementById(a))) return n;
- if (o.id === a) return n.push(o), n;
- } else if (
- f &&
- (o = f.getElementById(a)) &&
- v(t, o) &&
- o.id === a
- )
- return n.push(o), n;
- } else {
- if (c[2]) return j.apply(n, t.getElementsByTagName(e)), n;
- if (
- (a = c[3]) &&
- d.getElementsByClassName &&
- t.getElementsByClassName
- )
- return j.apply(n, t.getElementsByClassName(a)), n;
- }
- if (d.qsa && !E[e + ' '] && (!g || !g.test(e))) {
- if (1 !== h) (f = t), (u = e);
- else if ('object' !== t.nodeName.toLowerCase()) {
- for (
- (s = t.getAttribute('id'))
- ? (s = s.replace(te, ne))
- : t.setAttribute('id', (s = M)),
- i = (l = p(e)).length;
- i--;
-
- )
- l[i] = '#' + s + ' ' + ve(l[i]);
- (u = l.join(',')),
- (f = (Z.test(e) && me(t.parentNode)) || t);
- }
- if (u)
- try {
- return j.apply(n, f.querySelectorAll(u)), n;
- } catch (e) {
- } finally {
- s === M && t.removeAttribute('id');
- }
- }
- }
- return m(e.replace(H, '$1'), t, n, r);
- }
- function oe() {
- var r = [];
- return function e(t, n) {
- return (
- r.push(t + ' ') > _.cacheLength && delete e[r.shift()],
- (e[t + ' '] = n)
- );
- };
- }
- function se(e) {
- return (e[M] = !0), e;
- }
- function ce(e) {
- var t = x.createElement('fieldset');
- try {
- return !!e(t);
- } catch (e) {
- return !1;
- } finally {
- t.parentNode && t.parentNode.removeChild(t), (t = null);
- }
- }
- function le(e, t) {
- for (var n = e.split('|'), r = n.length; r--; )
- _.attrHandle[n[r]] = t;
- }
- function ue(e, t) {
- var n = t && e,
- r =
- n &&
- 1 === e.nodeType &&
- 1 === t.nodeType &&
- e.sourceIndex - t.sourceIndex;
- if (r) return r;
- if (n) for (; (n = n.nextSibling); ) if (n === t) return -1;
- return e ? 1 : -1;
- }
- function fe(t) {
- return function(e) {
- return 'input' === e.nodeName.toLowerCase() && e.type === t;
- };
- }
- function he(n) {
- return function(e) {
- var t = e.nodeName.toLowerCase();
- return ('input' === t || 'button' === t) && e.type === n;
- };
- }
- function de(t) {
- return function(e) {
- return 'form' in e
- ? e.parentNode && !1 === e.disabled
- ? 'label' in e
- ? 'label' in e.parentNode
- ? e.parentNode.disabled === t
- : e.disabled === t
- : e.isDisabled === t ||
- (e.isDisabled !== !t && ae(e) === t)
- : e.disabled === t
- : 'label' in e && e.disabled === t;
- };
- }
- function pe(o) {
- return se(function(i) {
- return (
- (i = +i),
- se(function(e, t) {
- for (var n, r = o([], e.length, i), a = r.length; a--; )
- e[(n = r[a])] && (e[n] = !(t[n] = e[n]));
- })
- );
- });
- }
- function me(e) {
- return e && void 0 !== e.getElementsByTagName && e;
- }
- for (e in ((d = ie.support = {}),
- (a = ie.isXML = function(e) {
- var t = e && (e.ownerDocument || e).documentElement;
- return !!t && 'HTML' !== t.nodeName;
- }),
- (A = ie.setDocument = function(e) {
- var t,
- n,
- r = e ? e.ownerDocument || e : y;
- return (
- r !== x &&
- 9 === r.nodeType &&
- r.documentElement &&
- ((o = (x = r).documentElement),
- (k = !a(x)),
- y !== x &&
- (n = x.defaultView) &&
- n.top !== n &&
- (n.addEventListener
- ? n.addEventListener('unload', re, !1)
- : n.attachEvent && n.attachEvent('onunload', re)),
- (d.attributes = ce(function(e) {
- return (e.className = 'i'), !e.getAttribute('className');
- })),
- (d.getElementsByTagName = ce(function(e) {
- return (
- e.appendChild(x.createComment('')),
- !e.getElementsByTagName('*').length
- );
- })),
- (d.getElementsByClassName = J.test(x.getElementsByClassName)),
- (d.getById = ce(function(e) {
- return (
- (o.appendChild(e).id = M),
- !x.getElementsByName || !x.getElementsByName(M).length
- );
- })),
- d.getById
- ? ((_.filter.ID = function(e) {
- var t = e.replace(Q, ee);
- return function(e) {
- return e.getAttribute('id') === t;
- };
- }),
- (_.find.ID = function(e, t) {
- if (void 0 !== t.getElementById && k) {
- var n = t.getElementById(e);
- return n ? [n] : [];
- }
- }))
- : ((_.filter.ID = function(e) {
- var n = e.replace(Q, ee);
- return function(e) {
- var t =
- void 0 !== e.getAttributeNode &&
- e.getAttributeNode('id');
- return t && t.value === n;
- };
- }),
- (_.find.ID = function(e, t) {
- if (void 0 !== t.getElementById && k) {
- var n,
- r,
- a,
- i = t.getElementById(e);
- if (i) {
- if ((n = i.getAttributeNode('id')) && n.value === e)
- return [i];
- for (
- a = t.getElementsByName(e), r = 0;
- (i = a[r++]);
-
- )
- if (
- (n = i.getAttributeNode('id')) &&
- n.value === e
- )
- return [i];
- }
- return [];
- }
- })),
- (_.find.TAG = d.getElementsByTagName
- ? function(e, t) {
- return void 0 !== t.getElementsByTagName
- ? t.getElementsByTagName(e)
- : d.qsa
- ? t.querySelectorAll(e)
- : void 0;
- }
- : function(e, t) {
- var n,
- r = [],
- a = 0,
- i = t.getElementsByTagName(e);
- if ('*' !== e) return i;
- for (; (n = i[a++]); ) 1 === n.nodeType && r.push(n);
- return r;
- }),
- (_.find.CLASS =
- d.getElementsByClassName &&
- function(e, t) {
- if (void 0 !== t.getElementsByClassName && k)
- return t.getElementsByClassName(e);
- }),
- (s = []),
- (g = []),
- (d.qsa = J.test(x.querySelectorAll)) &&
- (ce(function(e) {
- (o.appendChild(e).innerHTML =
- ""),
- e.querySelectorAll("[msallowcapture^='']").length &&
- g.push('[*^$]=' + L + '*(?:\'\'|"")'),
- e.querySelectorAll('[selected]').length ||
- g.push('\\[' + L + '*(?:value|' + z + ')'),
- e.querySelectorAll('[id~=' + M + '-]').length ||
- g.push('~='),
- e.querySelectorAll(':checked').length ||
- g.push(':checked'),
- e.querySelectorAll('a#' + M + '+*').length ||
- g.push('.#.+[+~]');
- }),
- ce(function(e) {
- e.innerHTML =
- "";
- var t = x.createElement('input');
- t.setAttribute('type', 'hidden'),
- e.appendChild(t).setAttribute('name', 'D'),
- e.querySelectorAll('[name=d]').length &&
- g.push('name' + L + '*[*^$|!~]?='),
- 2 !== e.querySelectorAll(':enabled').length &&
- g.push(':enabled', ':disabled'),
- (o.appendChild(e).disabled = !0),
- 2 !== e.querySelectorAll(':disabled').length &&
- g.push(':enabled', ':disabled'),
- e.querySelectorAll('*,:x'),
- g.push(',.*:');
- })),
- (d.matchesSelector = J.test(
- (u =
- o.matches ||
- o.webkitMatchesSelector ||
- o.mozMatchesSelector ||
- o.oMatchesSelector ||
- o.msMatchesSelector)
- )) &&
- ce(function(e) {
- (d.disconnectedMatch = u.call(e, '*')),
- u.call(e, "[s!='']:x"),
- s.push('!=', W);
- }),
- (g = g.length && new RegExp(g.join('|'))),
- (s = s.length && new RegExp(s.join('|'))),
- (t = J.test(o.compareDocumentPosition)),
- (v =
- t || J.test(o.contains)
- ? function(e, t) {
- var n = 9 === e.nodeType ? e.documentElement : e,
- r = t && t.parentNode;
- return (
- e === r ||
- !(
- !r ||
- 1 !== r.nodeType ||
- !(n.contains
- ? n.contains(r)
- : e.compareDocumentPosition &&
- 16 & e.compareDocumentPosition(r))
- )
- );
- }
- : function(e, t) {
- if (t)
- for (; (t = t.parentNode); ) if (t === e) return !0;
- return !1;
- }),
- (T = t
- ? function(e, t) {
- if (e === t) return (l = !0), 0;
- var n =
- !e.compareDocumentPosition -
- !t.compareDocumentPosition;
- return (
- n ||
- (1 &
- (n =
- (e.ownerDocument || e) === (t.ownerDocument || t)
- ? e.compareDocumentPosition(t)
- : 1) ||
- (!d.sortDetached &&
- t.compareDocumentPosition(e) === n)
- ? e === x || (e.ownerDocument === y && v(y, e))
- ? -1
- : t === x || (t.ownerDocument === y && v(y, t))
- ? 1
- : c
- ? P(c, e) - P(c, t)
- : 0
- : 4 & n
- ? -1
- : 1)
- );
- }
- : function(e, t) {
- if (e === t) return (l = !0), 0;
- var n,
- r = 0,
- a = e.parentNode,
- i = t.parentNode,
- o = [e],
- s = [t];
- if (!a || !i)
- return e === x
- ? -1
- : t === x
- ? 1
- : a
- ? -1
- : i
- ? 1
- : c
- ? P(c, e) - P(c, t)
- : 0;
- if (a === i) return ue(e, t);
- for (n = e; (n = n.parentNode); ) o.unshift(n);
- for (n = t; (n = n.parentNode); ) s.unshift(n);
- for (; o[r] === s[r]; ) r++;
- return r
- ? ue(o[r], s[r])
- : o[r] === y
- ? -1
- : s[r] === y
- ? 1
- : 0;
- })),
- x
- );
- }),
- (ie.matches = function(e, t) {
- return ie(e, null, null, t);
- }),
- (ie.matchesSelector = function(e, t) {
- if (
- ((e.ownerDocument || e) !== x && A(e),
- (t = t.replace(G, "='$1']")),
- d.matchesSelector &&
- k &&
- !E[t + ' '] &&
- (!s || !s.test(t)) &&
- (!g || !g.test(t)))
- )
- try {
- var n = u.call(e, t);
- if (
- n ||
- d.disconnectedMatch ||
- (e.document && 11 !== e.document.nodeType)
- )
- return n;
- } catch (e) {}
- return 0 < ie(t, x, null, [e]).length;
- }),
- (ie.contains = function(e, t) {
- return (e.ownerDocument || e) !== x && A(e), v(e, t);
- }),
- (ie.attr = function(e, t) {
- (e.ownerDocument || e) !== x && A(e);
- var n = _.attrHandle[t.toLowerCase()],
- r =
- n && C.call(_.attrHandle, t.toLowerCase())
- ? n(e, t, !k)
- : void 0;
- return void 0 !== r
- ? r
- : d.attributes || !k
- ? e.getAttribute(t)
- : (r = e.getAttributeNode(t)) && r.specified
- ? r.value
- : null;
- }),
- (ie.escape = function(e) {
- return (e + '').replace(te, ne);
- }),
- (ie.error = function(e) {
- throw new Error('Syntax error, unrecognized expression: ' + e);
- }),
- (ie.uniqueSort = function(e) {
- var t,
- n = [],
- r = 0,
- a = 0;
- if (
- ((l = !d.detectDuplicates),
- (c = !d.sortStable && e.slice(0)),
- e.sort(T),
- l)
- ) {
- for (; (t = e[a++]); ) t === e[a] && (r = n.push(a));
- for (; r--; ) e.splice(n[r], 1);
- }
- return (c = null), e;
- }),
- (i = ie.getText = function(e) {
- var t,
- n = '',
- r = 0,
- a = e.nodeType;
- if (a) {
- if (1 === a || 9 === a || 11 === a) {
- if ('string' == typeof e.textContent) return e.textContent;
- for (e = e.firstChild; e; e = e.nextSibling) n += i(e);
- } else if (3 === a || 4 === a) return e.nodeValue;
- } else for (; (t = e[r++]); ) n += i(t);
- return n;
- }),
- ((_ = ie.selectors = {
- cacheLength: 50,
- createPseudo: se,
- match: $,
- attrHandle: {},
- find: {},
- relative: {
- '>': { dir: 'parentNode', first: !0 },
- ' ': { dir: 'parentNode' },
- '+': { dir: 'previousSibling', first: !0 },
- '~': { dir: 'previousSibling' },
- },
- preFilter: {
- ATTR: function(e) {
- return (
- (e[1] = e[1].replace(Q, ee)),
- (e[3] = (e[3] || e[4] || e[5] || '').replace(Q, ee)),
- '~=' === e[2] && (e[3] = ' ' + e[3] + ' '),
- e.slice(0, 4)
- );
- },
- CHILD: function(e) {
- return (
- (e[1] = e[1].toLowerCase()),
- 'nth' === e[1].slice(0, 3)
- ? (e[3] || ie.error(e[0]),
- (e[4] = +(e[4]
- ? e[5] + (e[6] || 1)
- : 2 * ('even' === e[3] || 'odd' === e[3]))),
- (e[5] = +(e[7] + e[8] || 'odd' === e[3])))
- : e[3] && ie.error(e[0]),
- e
- );
- },
- PSEUDO: function(e) {
- var t,
- n = !e[6] && e[2];
- return $.CHILD.test(e[0])
- ? null
- : (e[3]
- ? (e[2] = e[4] || e[5] || '')
- : n &&
- B.test(n) &&
- (t = p(n, !0)) &&
- (t = n.indexOf(')', n.length - t) - n.length) &&
- ((e[0] = e[0].slice(0, t)), (e[2] = n.slice(0, t))),
- e.slice(0, 3));
- },
- },
- filter: {
- TAG: function(e) {
- var t = e.replace(Q, ee).toLowerCase();
- return '*' === e
- ? function() {
- return !0;
- }
- : function(e) {
- return e.nodeName && e.nodeName.toLowerCase() === t;
- };
- },
- CLASS: function(e) {
- var t = h[e + ' '];
- return (
- t ||
- ((t = new RegExp('(^|' + L + ')' + e + '(' + L + '|$)')) &&
- h(e, function(e) {
- return t.test(
- ('string' == typeof e.className && e.className) ||
- (void 0 !== e.getAttribute &&
- e.getAttribute('class')) ||
- ''
- );
- }))
- );
- },
- ATTR: function(n, r, a) {
- return function(e) {
- var t = ie.attr(e, n);
- return null == t
- ? '!=' === r
- : !r ||
- ((t += ''),
- '=' === r
- ? t === a
- : '!=' === r
- ? t !== a
- : '^=' === r
- ? a && 0 === t.indexOf(a)
- : '*=' === r
- ? a && -1 < t.indexOf(a)
- : '$=' === r
- ? a && t.slice(-a.length) === a
- : '~=' === r
- ? -1 < (' ' + t.replace(q, ' ') + ' ').indexOf(a)
- : '|=' === r &&
- (t === a ||
- t.slice(0, a.length + 1) === a + '-'));
- };
- },
- CHILD: function(p, e, t, m, g) {
- var v = 'nth' !== p.slice(0, 3),
- y = 'last' !== p.slice(-4),
- b = 'of-type' === e;
- return 1 === m && 0 === g
- ? function(e) {
- return !!e.parentNode;
- }
- : function(e, t, n) {
- var r,
- a,
- i,
- o,
- s,
- c,
- l = v !== y ? 'nextSibling' : 'previousSibling',
- u = e.parentNode,
- f = b && e.nodeName.toLowerCase(),
- h = !n && !b,
- d = !1;
- if (u) {
- if (v) {
- for (; l; ) {
- for (o = e; (o = o[l]); )
- if (
- b
- ? o.nodeName.toLowerCase() === f
- : 1 === o.nodeType
- )
- return !1;
- c = l = 'only' === p && !c && 'nextSibling';
- }
- return !0;
- }
- if (
- ((c = [y ? u.firstChild : u.lastChild]), y && h)
- ) {
- for (
- d =
- (s =
- (r =
- (a =
- (i = (o = u)[M] || (o[M] = {}))[
- o.uniqueID
- ] || (i[o.uniqueID] = {}))[p] ||
- [])[0] === S && r[1]) && r[2],
- o = s && u.childNodes[s];
- (o =
- (++s && o && o[l]) || (d = s = 0) || c.pop());
-
- )
- if (1 === o.nodeType && ++d && o === e) {
- a[p] = [S, s, d];
- break;
- }
- } else if (
- (h &&
- (d = s =
- (r =
- (a =
- (i = (o = e)[M] || (o[M] = {}))[
- o.uniqueID
- ] || (i[o.uniqueID] = {}))[p] || [])[0] ===
- S && r[1]),
- !1 === d)
- )
- for (
- ;
- (o =
- (++s && o && o[l]) || (d = s = 0) || c.pop()) &&
- ((b
- ? o.nodeName.toLowerCase() !== f
- : 1 !== o.nodeType) ||
- !++d ||
- (h &&
- ((a =
- (i = o[M] || (o[M] = {}))[o.uniqueID] ||
- (i[o.uniqueID] = {}))[p] = [S, d]),
- o !== e));
-
- );
- return (d -= g) === m || (d % m == 0 && 0 <= d / m);
- }
- };
- },
- PSEUDO: function(e, i) {
- var t,
- o =
- _.pseudos[e] ||
- _.setFilters[e.toLowerCase()] ||
- ie.error('unsupported pseudo: ' + e);
- return o[M]
- ? o(i)
- : 1 < o.length
- ? ((t = [e, e, '', i]),
- _.setFilters.hasOwnProperty(e.toLowerCase())
- ? se(function(e, t) {
- for (var n, r = o(e, i), a = r.length; a--; )
- e[(n = P(e, r[a]))] = !(t[n] = r[a]);
- })
- : function(e) {
- return o(e, 0, t);
- })
- : o;
- },
- },
- pseudos: {
- not: se(function(e) {
- var r = [],
- a = [],
- s = f(e.replace(H, '$1'));
- return s[M]
- ? se(function(e, t, n, r) {
- for (var a, i = s(e, null, r, []), o = e.length; o--; )
- (a = i[o]) && (e[o] = !(t[o] = a));
- })
- : function(e, t, n) {
- return (
- (r[0] = e), s(r, null, n, a), (r[0] = null), !a.pop()
- );
- };
- }),
- has: se(function(t) {
- return function(e) {
- return 0 < ie(t, e).length;
- };
- }),
- contains: se(function(t) {
- return (
- (t = t.replace(Q, ee)),
- function(e) {
- return (
- -1 < (e.textContent || e.innerText || i(e)).indexOf(t)
- );
- }
- );
- }),
- lang: se(function(n) {
- return (
- U.test(n || '') || ie.error('unsupported lang: ' + n),
- (n = n.replace(Q, ee).toLowerCase()),
- function(e) {
- var t;
- do {
- if (
- (t = k
- ? e.lang
- : e.getAttribute('xml:lang') ||
- e.getAttribute('lang'))
- )
- return (
- (t = t.toLowerCase()) === n ||
- 0 === t.indexOf(n + '-')
- );
- } while ((e = e.parentNode) && 1 === e.nodeType);
- return !1;
- }
- );
- }),
- target: function(e) {
- var t = n.location && n.location.hash;
- return t && t.slice(1) === e.id;
- },
- root: function(e) {
- return e === o;
- },
- focus: function(e) {
- return (
- e === x.activeElement &&
- (!x.hasFocus || x.hasFocus()) &&
- !!(e.type || e.href || ~e.tabIndex)
- );
- },
- enabled: de(!1),
- disabled: de(!0),
- checked: function(e) {
- var t = e.nodeName.toLowerCase();
- return (
- ('input' === t && !!e.checked) ||
- ('option' === t && !!e.selected)
- );
- },
- selected: function(e) {
- return (
- e.parentNode && e.parentNode.selectedIndex,
- !0 === e.selected
- );
- },
- empty: function(e) {
- for (e = e.firstChild; e; e = e.nextSibling)
- if (e.nodeType < 6) return !1;
- return !0;
- },
- parent: function(e) {
- return !_.pseudos.empty(e);
- },
- header: function(e) {
- return K.test(e.nodeName);
- },
- input: function(e) {
- return V.test(e.nodeName);
- },
- button: function(e) {
- var t = e.nodeName.toLowerCase();
- return (
- ('input' === t && 'button' === e.type) || 'button' === t
- );
- },
- text: function(e) {
- var t;
- return (
- 'input' === e.nodeName.toLowerCase() &&
- 'text' === e.type &&
- (null == (t = e.getAttribute('type')) ||
- 'text' === t.toLowerCase())
- );
- },
- first: pe(function() {
- return [0];
- }),
- last: pe(function(e, t) {
- return [t - 1];
- }),
- eq: pe(function(e, t, n) {
- return [n < 0 ? n + t : n];
- }),
- even: pe(function(e, t) {
- for (var n = 0; n < t; n += 2) e.push(n);
- return e;
- }),
- odd: pe(function(e, t) {
- for (var n = 1; n < t; n += 2) e.push(n);
- return e;
- }),
- lt: pe(function(e, t, n) {
- for (var r = n < 0 ? n + t : n; 0 <= --r; ) e.push(r);
- return e;
- }),
- gt: pe(function(e, t, n) {
- for (var r = n < 0 ? n + t : n; ++r < t; ) e.push(r);
- return e;
- }),
- },
- }).pseudos.nth = _.pseudos.eq),
- { radio: !0, checkbox: !0, file: !0, password: !0, image: !0 }))
- _.pseudos[e] = fe(e);
- for (e in { submit: !0, reset: !0 }) _.pseudos[e] = he(e);
- function ge() {}
- function ve(e) {
- for (var t = 0, n = e.length, r = ''; t < n; t++) r += e[t].value;
- return r;
- }
- function ye(s, e, t) {
- var c = e.dir,
- l = e.next,
- u = l || c,
- f = t && 'parentNode' === u,
- h = r++;
- return e.first
- ? function(e, t, n) {
- for (; (e = e[c]); )
- if (1 === e.nodeType || f) return s(e, t, n);
- return !1;
- }
- : function(e, t, n) {
- var r,
- a,
- i,
- o = [S, h];
- if (n) {
- for (; (e = e[c]); )
- if ((1 === e.nodeType || f) && s(e, t, n)) return !0;
- } else
- for (; (e = e[c]); )
- if (1 === e.nodeType || f)
- if (
- ((a =
- (i = e[M] || (e[M] = {}))[e.uniqueID] ||
- (i[e.uniqueID] = {})),
- l && l === e.nodeName.toLowerCase())
- )
- e = e[c] || e;
- else {
- if ((r = a[u]) && r[0] === S && r[1] === h)
- return (o[2] = r[2]);
- if (((a[u] = o)[2] = s(e, t, n))) return !0;
- }
- return !1;
- };
- }
- function be(a) {
- return 1 < a.length
- ? function(e, t, n) {
- for (var r = a.length; r--; ) if (!a[r](e, t, n)) return !1;
- return !0;
- }
- : a[0];
- }
- function _e(e, t, n, r, a) {
- for (
- var i, o = [], s = 0, c = e.length, l = null != t;
- s < c;
- s++
- )
- (i = e[s]) &&
- ((n && !n(i, r, a)) || (o.push(i), l && t.push(s)));
- return o;
- }
- function we(d, p, m, g, v, e) {
- return (
- g && !g[M] && (g = we(g)),
- v && !v[M] && (v = we(v, e)),
- se(function(e, t, n, r) {
- var a,
- i,
- o,
- s = [],
- c = [],
- l = t.length,
- u =
- e ||
- (function(e, t, n) {
- for (var r = 0, a = t.length; r < a; r++)
- ie(e, t[r], n);
- return n;
- })(p || '*', n.nodeType ? [n] : n, []),
- f = !d || (!e && p) ? u : _e(u, s, d, n, r),
- h = m ? (v || (e ? d : l || g) ? [] : t) : f;
- if ((m && m(f, h, n, r), g))
- for (a = _e(h, c), g(a, [], n, r), i = a.length; i--; )
- (o = a[i]) && (h[c[i]] = !(f[c[i]] = o));
- if (e) {
- if (v || d) {
- if (v) {
- for (a = [], i = h.length; i--; )
- (o = h[i]) && a.push((f[i] = o));
- v(null, (h = []), a, r);
- }
- for (i = h.length; i--; )
- (o = h[i]) &&
- -1 < (a = v ? P(e, o) : s[i]) &&
- (e[a] = !(t[a] = o));
- }
- } else (h = _e(h === t ? h.splice(l, h.length) : h)), v ? v(null, t, h, r) : j.apply(t, h);
- })
- );
- }
- function Ae(e) {
- for (
- var a,
- t,
- n,
- r = e.length,
- i = _.relative[e[0].type],
- o = i || _.relative[' '],
- s = i ? 1 : 0,
- c = ye(
- function(e) {
- return e === a;
- },
- o,
- !0
- ),
- l = ye(
- function(e) {
- return -1 < P(a, e);
- },
- o,
- !0
- ),
- u = [
- function(e, t, n) {
- var r =
- (!i && (n || t !== w)) ||
- ((a = t).nodeType ? c(e, t, n) : l(e, t, n));
- return (a = null), r;
- },
- ];
- s < r;
- s++
- )
- if ((t = _.relative[e[s].type])) u = [ye(be(u), t)];
- else {
- if ((t = _.filter[e[s].type].apply(null, e[s].matches))[M]) {
- for (n = ++s; n < r && !_.relative[e[n].type]; n++);
- return we(
- 1 < s && be(u),
- 1 < s &&
- ve(
- e
- .slice(0, s - 1)
- .concat({ value: ' ' === e[s - 2].type ? '*' : '' })
- ).replace(H, '$1'),
- t,
- s < n && Ae(e.slice(s, n)),
- n < r && Ae((e = e.slice(n))),
- n < r && ve(e)
- );
- }
- u.push(t);
- }
- return be(u);
- }
- return (
- (ge.prototype = _.filters = _.pseudos),
- (_.setFilters = new ge()),
- (p = ie.tokenize = function(e, t) {
- var n,
- r,
- a,
- i,
- o,
- s,
- c,
- l = b[e + ' '];
- if (l) return t ? 0 : l.slice(0);
- for (o = e, s = [], c = _.preFilter; o; ) {
- for (i in ((n && !(r = I.exec(o))) ||
- (r && (o = o.slice(r[0].length) || o), s.push((a = []))),
- (n = !1),
- (r = F.exec(o)) &&
- ((n = r.shift()),
- a.push({ value: n, type: r[0].replace(H, ' ') }),
- (o = o.slice(n.length))),
- _.filter))
- !(r = $[i].exec(o)) ||
- (c[i] && !(r = c[i](r))) ||
- ((n = r.shift()),
- a.push({ value: n, type: i, matches: r }),
- (o = o.slice(n.length)));
- if (!n) break;
- }
- return t ? o.length : o ? ie.error(e) : b(e, s).slice(0);
- }),
- (f = ie.compile = function(e, t) {
- var n,
- g,
- v,
- y,
- b,
- r,
- a = [],
- i = [],
- o = E[e + ' '];
- if (!o) {
- for (t || (t = p(e)), n = t.length; n--; )
- (o = Ae(t[n]))[M] ? a.push(o) : i.push(o);
- (o = E(
- e,
- ((g = i),
- (v = a),
- (y = 0 < v.length),
- (b = 0 < g.length),
- (r = function(e, t, n, r, a) {
- var i,
- o,
- s,
- c = 0,
- l = '0',
- u = e && [],
- f = [],
- h = w,
- d = e || (b && _.find.TAG('*', a)),
- p = (S += null == h ? 1 : Math.random() || 0.1),
- m = d.length;
- for (
- a && (w = t === x || t || a);
- l !== m && null != (i = d[l]);
- l++
- ) {
- if (b && i) {
- for (
- o = 0,
- t || i.ownerDocument === x || (A(i), (n = !k));
- (s = g[o++]);
-
- )
- if (s(i, t || x, n)) {
- r.push(i);
- break;
- }
- a && (S = p);
- }
- y && ((i = !s && i) && c--, e && u.push(i));
- }
- if (((c += l), y && l !== c)) {
- for (o = 0; (s = v[o++]); ) s(u, f, t, n);
- if (e) {
- if (0 < c)
- for (; l--; ) u[l] || f[l] || (f[l] = D.call(r));
- f = _e(f);
- }
- j.apply(r, f),
- a &&
- !e &&
- 0 < f.length &&
- 1 < c + v.length &&
- ie.uniqueSort(r);
- }
- return a && ((S = p), (w = h)), u;
- }),
- y ? se(r) : r)
- )).selector = e;
- }
- return o;
- }),
- (m = ie.select = function(e, t, n, r) {
- var a,
- i,
- o,
- s,
- c,
- l = 'function' == typeof e && e,
- u = !r && p((e = l.selector || e));
- if (((n = n || []), 1 === u.length)) {
- if (
- 2 < (i = u[0] = u[0].slice(0)).length &&
- 'ID' === (o = i[0]).type &&
- 9 === t.nodeType &&
- k &&
- _.relative[i[1].type]
- ) {
- if (
- !(t = (_.find.ID(o.matches[0].replace(Q, ee), t) ||
- [])[0])
- )
- return n;
- l && (t = t.parentNode),
- (e = e.slice(i.shift().value.length));
- }
- for (
- a = $.needsContext.test(e) ? 0 : i.length;
- a-- && ((o = i[a]), !_.relative[(s = o.type)]);
-
- )
- if (
- (c = _.find[s]) &&
- (r = c(
- o.matches[0].replace(Q, ee),
- (Z.test(i[0].type) && me(t.parentNode)) || t
- ))
- ) {
- if ((i.splice(a, 1), !(e = r.length && ve(i))))
- return j.apply(n, r), n;
- break;
- }
- }
- return (
- (l || f(e, u))(
- r,
- t,
- !k,
- n,
- !t || (Z.test(e) && me(t.parentNode)) || t
- ),
- n
- );
- }),
- (d.sortStable =
- M.split('')
- .sort(T)
- .join('') === M),
- (d.detectDuplicates = !!l),
- A(),
- (d.sortDetached = ce(function(e) {
- return (
- 1 & e.compareDocumentPosition(x.createElement('fieldset'))
- );
- })),
- ce(function(e) {
- return (
- (e.innerHTML = ""),
- '#' === e.firstChild.getAttribute('href')
- );
- }) ||
- le('type|href|height|width', function(e, t, n) {
- if (!n)
- return e.getAttribute(
- t,
- 'type' === t.toLowerCase() ? 1 : 2
- );
- }),
- (d.attributes &&
- ce(function(e) {
- return (
- (e.innerHTML = ''),
- e.firstChild.setAttribute('value', ''),
- '' === e.firstChild.getAttribute('value')
- );
- })) ||
- le('value', function(e, t, n) {
- if (!n && 'input' === e.nodeName.toLowerCase())
- return e.defaultValue;
- }),
- ce(function(e) {
- return null == e.getAttribute('disabled');
- }) ||
- le(z, function(e, t, n) {
- var r;
- if (!n)
- return !0 === e[t]
- ? t.toLowerCase()
- : (r = e.getAttributeNode(t)) && r.specified
- ? r.value
- : null;
- }),
- ie
- );
- })(x);
- (M.find = d),
- (M.expr = d.selectors),
- (M.expr[':'] = M.expr.pseudos),
- (M.uniqueSort = M.unique = d.uniqueSort),
- (M.text = d.getText),
- (M.isXMLDoc = d.isXML),
- (M.contains = d.contains),
- (M.escapeSelector = d.escape);
- var p = function(e, t, n) {
- for (
- var r = [], a = void 0 !== n;
- (e = e[t]) && 9 !== e.nodeType;
-
- )
- if (1 === e.nodeType) {
- if (a && M(e).is(n)) break;
- r.push(e);
- }
- return r;
- },
- A = function(e, t) {
- for (var n = []; e; e = e.nextSibling)
- 1 === e.nodeType && e !== t && n.push(e);
- return n;
- },
- S = M.expr.match.needsContext;
- function E(e, t) {
- return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase();
- }
- var T = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
- function C(e, n, r) {
- return y(n)
- ? M.grep(e, function(e, t) {
- return !!n.call(e, t, e) !== r;
- })
- : n.nodeType
- ? M.grep(e, function(e) {
- return (e === n) !== r;
- })
- : 'string' != typeof n
- ? M.grep(e, function(e) {
- return -1 < a.call(n, e) !== r;
- })
- : M.filter(n, e, r);
- }
- (M.filter = function(e, t, n) {
- var r = t[0];
- return (
- n && (e = ':not(' + e + ')'),
- 1 === t.length && 1 === r.nodeType
- ? M.find.matchesSelector(r, e)
- ? [r]
- : []
- : M.find.matches(
- e,
- M.grep(t, function(e) {
- return 1 === e.nodeType;
- })
- )
- );
- }),
- M.fn.extend({
- find: function(e) {
- var t,
- n,
- r = this.length,
- a = this;
- if ('string' != typeof e)
- return this.pushStack(
- M(e).filter(function() {
- for (t = 0; t < r; t++)
- if (M.contains(a[t], this)) return !0;
- })
- );
- for (n = this.pushStack([]), t = 0; t < r; t++)
- M.find(e, a[t], n);
- return 1 < r ? M.uniqueSort(n) : n;
- },
- filter: function(e) {
- return this.pushStack(C(this, e || [], !1));
- },
- not: function(e) {
- return this.pushStack(C(this, e || [], !0));
- },
- is: function(e) {
- return !!C(
- this,
- 'string' == typeof e && S.test(e) ? M(e) : e || [],
- !1
- ).length;
- },
- });
- var D,
- O = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;
- ((M.fn.init = function(e, t, n) {
- var r, a;
- if (!e) return this;
- if (((n = n || D), 'string' != typeof e))
- return e.nodeType
- ? ((this[0] = e), (this.length = 1), this)
- : y(e)
- ? void 0 !== n.ready
- ? n.ready(e)
- : e(M)
- : M.makeArray(e, this);
- if (
- !(r =
- '<' === e[0] && '>' === e[e.length - 1] && 3 <= e.length
- ? [null, e, null]
- : O.exec(e)) ||
- (!r[1] && t)
- )
- return !t || t.jquery
- ? (t || n).find(e)
- : this.constructor(t).find(e);
- if (r[1]) {
- if (
- ((t = t instanceof M ? t[0] : t),
- M.merge(
- this,
- M.parseHTML(
- r[1],
- t && t.nodeType ? t.ownerDocument || t : k,
- !0
- )
- ),
- T.test(r[1]) && M.isPlainObject(t))
- )
- for (r in t) y(this[r]) ? this[r](t[r]) : this.attr(r, t[r]);
- return this;
- }
- return (
- (a = k.getElementById(r[2])) &&
- ((this[0] = a), (this.length = 1)),
- this
- );
- }).prototype = M.fn),
- (D = M(k));
- var j = /^(?:parents|prev(?:Until|All))/,
- N = { children: !0, contents: !0, next: !0, prev: !0 };
- function P(e, t) {
- for (; (e = e[t]) && 1 !== e.nodeType; );
- return e;
- }
- M.fn.extend({
- has: function(e) {
- var t = M(e, this),
- n = t.length;
- return this.filter(function() {
- for (var e = 0; e < n; e++)
- if (M.contains(this, t[e])) return !0;
- });
- },
- closest: function(e, t) {
- var n,
- r = 0,
- a = this.length,
- i = [],
- o = 'string' != typeof e && M(e);
- if (!S.test(e))
- for (; r < a; r++)
- for (n = this[r]; n && n !== t; n = n.parentNode)
- if (
- n.nodeType < 11 &&
- (o
- ? -1 < o.index(n)
- : 1 === n.nodeType && M.find.matchesSelector(n, e))
- ) {
- i.push(n);
- break;
- }
- return this.pushStack(1 < i.length ? M.uniqueSort(i) : i);
- },
- index: function(e) {
- return e
- ? 'string' == typeof e
- ? a.call(M(e), this[0])
- : a.call(this, e.jquery ? e[0] : e)
- : this[0] && this[0].parentNode
- ? this.first().prevAll().length
- : -1;
- },
- add: function(e, t) {
- return this.pushStack(M.uniqueSort(M.merge(this.get(), M(e, t))));
- },
- addBack: function(e) {
- return this.add(
- null == e ? this.prevObject : this.prevObject.filter(e)
- );
- },
- }),
- M.each(
- {
- parent: function(e) {
- var t = e.parentNode;
- return t && 11 !== t.nodeType ? t : null;
- },
- parents: function(e) {
- return p(e, 'parentNode');
- },
- parentsUntil: function(e, t, n) {
- return p(e, 'parentNode', n);
- },
- next: function(e) {
- return P(e, 'nextSibling');
- },
- prev: function(e) {
- return P(e, 'previousSibling');
- },
- nextAll: function(e) {
- return p(e, 'nextSibling');
- },
- prevAll: function(e) {
- return p(e, 'previousSibling');
- },
- nextUntil: function(e, t, n) {
- return p(e, 'nextSibling', n);
- },
- prevUntil: function(e, t, n) {
- return p(e, 'previousSibling', n);
- },
- siblings: function(e) {
- return A((e.parentNode || {}).firstChild, e);
- },
- children: function(e) {
- return A(e.firstChild);
- },
- contents: function(e) {
- return E(e, 'iframe')
- ? e.contentDocument
- : (E(e, 'template') && (e = e.content || e),
- M.merge([], e.childNodes));
- },
- },
- function(r, a) {
- M.fn[r] = function(e, t) {
- var n = M.map(this, a, e);
- return (
- 'Until' !== r.slice(-5) && (t = e),
- t && 'string' == typeof t && (n = M.filter(t, n)),
- 1 < this.length &&
- (N[r] || M.uniqueSort(n), j.test(r) && n.reverse()),
- this.pushStack(n)
- );
- };
- }
- );
- var z = /[^\x20\t\r\n\f]+/g;
- function L(e) {
- return e;
- }
- function R(e) {
- throw e;
- }
- function Y(e, t, n, r) {
- var a;
- try {
- e && y((a = e.promise))
- ? a
- .call(e)
- .done(t)
- .fail(n)
- : e && y((a = e.then))
- ? a.call(e, t, n)
- : t.apply(void 0, [e].slice(r));
- } catch (e) {
- n.apply(void 0, [e]);
- }
- }
- (M.Callbacks = function(r) {
- var e, n;
- r =
- 'string' == typeof r
- ? ((e = r),
- (n = {}),
- M.each(e.match(z) || [], function(e, t) {
- n[t] = !0;
- }),
- n)
- : M.extend({}, r);
- var a,
- t,
- i,
- o,
- s = [],
- c = [],
- l = -1,
- u = function() {
- for (o = o || r.once, i = a = !0; c.length; l = -1)
- for (t = c.shift(); ++l < s.length; )
- !1 === s[l].apply(t[0], t[1]) &&
- r.stopOnFalse &&
- ((l = s.length), (t = !1));
- r.memory || (t = !1), (a = !1), o && (s = t ? [] : '');
- },
- f = {
- add: function() {
- return (
- s &&
- (t && !a && ((l = s.length - 1), c.push(t)),
- (function n(e) {
- M.each(e, function(e, t) {
- y(t)
- ? (r.unique && f.has(t)) || s.push(t)
- : t && t.length && 'string' !== w(t) && n(t);
- });
- })(arguments),
- t && !a && u()),
- this
- );
- },
- remove: function() {
- return (
- M.each(arguments, function(e, t) {
- for (var n; -1 < (n = M.inArray(t, s, n)); )
- s.splice(n, 1), n <= l && l--;
- }),
- this
- );
- },
- has: function(e) {
- return e ? -1 < M.inArray(e, s) : 0 < s.length;
- },
- empty: function() {
- return s && (s = []), this;
- },
- disable: function() {
- return (o = c = []), (s = t = ''), this;
- },
- disabled: function() {
- return !s;
- },
- lock: function() {
- return (o = c = []), t || a || (s = t = ''), this;
- },
- locked: function() {
- return !!o;
- },
- fireWith: function(e, t) {
- return (
- o ||
- ((t = [e, (t = t || []).slice ? t.slice() : t]),
- c.push(t),
- a || u()),
- this
- );
- },
- fire: function() {
- return f.fireWith(this, arguments), this;
- },
- fired: function() {
- return !!i;
- },
- };
- return f;
- }),
- M.extend({
- Deferred: function(e) {
- var i = [
- [
- 'notify',
- 'progress',
- M.Callbacks('memory'),
- M.Callbacks('memory'),
- 2,
- ],
- [
- 'resolve',
- 'done',
- M.Callbacks('once memory'),
- M.Callbacks('once memory'),
- 0,
- 'resolved',
- ],
- [
- 'reject',
- 'fail',
- M.Callbacks('once memory'),
- M.Callbacks('once memory'),
- 1,
- 'rejected',
- ],
- ],
- a = 'pending',
- o = {
- state: function() {
- return a;
- },
- always: function() {
- return s.done(arguments).fail(arguments), this;
- },
- catch: function(e) {
- return o.then(null, e);
- },
- pipe: function() {
- var a = arguments;
- return M.Deferred(function(r) {
- M.each(i, function(e, t) {
- var n = y(a[t[4]]) && a[t[4]];
- s[t[1]](function() {
- var e = n && n.apply(this, arguments);
- e && y(e.promise)
- ? e
- .promise()
- .progress(r.notify)
- .done(r.resolve)
- .fail(r.reject)
- : r[t[0] + 'With'](this, n ? [e] : arguments);
- });
- }),
- (a = null);
- }).promise();
- },
- then: function(t, n, r) {
- var c = 0;
- function l(a, i, o, s) {
- return function() {
- var n = this,
- r = arguments,
- e = function() {
- var e, t;
- if (!(a < c)) {
- if ((e = o.apply(n, r)) === i.promise())
- throw new TypeError(
- 'Thenable self-resolution'
- );
- (t =
- e &&
- ('object' == typeof e ||
- 'function' == typeof e) &&
- e.then),
- y(t)
- ? s
- ? t.call(e, l(c, i, L, s), l(c, i, R, s))
- : (c++,
- t.call(
- e,
- l(c, i, L, s),
- l(c, i, R, s),
- l(c, i, L, i.notifyWith)
- ))
- : (o !== L && ((n = void 0), (r = [e])),
- (s || i.resolveWith)(n, r));
- }
- },
- t = s
- ? e
- : function() {
- try {
- e();
- } catch (e) {
- M.Deferred.exceptionHook &&
- M.Deferred.exceptionHook(e, t.stackTrace),
- c <= a + 1 &&
- (o !== R && ((n = void 0), (r = [e])),
- i.rejectWith(n, r));
- }
- };
- a
- ? t()
- : (M.Deferred.getStackHook &&
- (t.stackTrace = M.Deferred.getStackHook()),
- x.setTimeout(t));
- };
- }
- return M.Deferred(function(e) {
- i[0][3].add(l(0, e, y(r) ? r : L, e.notifyWith)),
- i[1][3].add(l(0, e, y(t) ? t : L)),
- i[2][3].add(l(0, e, y(n) ? n : R));
- }).promise();
- },
- promise: function(e) {
- return null != e ? M.extend(e, o) : o;
- },
- },
- s = {};
- return (
- M.each(i, function(e, t) {
- var n = t[2],
- r = t[5];
- (o[t[1]] = n.add),
- r &&
- n.add(
- function() {
- a = r;
- },
- i[3 - e][2].disable,
- i[3 - e][3].disable,
- i[0][2].lock,
- i[0][3].lock
- ),
- n.add(t[3].fire),
- (s[t[0]] = function() {
- return (
- s[t[0] + 'With'](
- this === s ? void 0 : this,
- arguments
- ),
- this
- );
- }),
- (s[t[0] + 'With'] = n.fireWith);
- }),
- o.promise(s),
- e && e.call(s, s),
- s
- );
- },
- when: function(e) {
- var n = arguments.length,
- t = n,
- r = Array(t),
- a = s.call(arguments),
- i = M.Deferred(),
- o = function(t) {
- return function(e) {
- (r[t] = this),
- (a[t] = 1 < arguments.length ? s.call(arguments) : e),
- --n || i.resolveWith(r, a);
- };
- };
- if (
- n <= 1 &&
- (Y(e, i.done(o(t)).resolve, i.reject, !n),
- 'pending' === i.state() || y(a[t] && a[t].then))
- )
- return i.then();
- for (; t--; ) Y(a[t], o(t), i.reject);
- return i.promise();
- },
- });
- var W = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
- (M.Deferred.exceptionHook = function(e, t) {
- x.console &&
- x.console.warn &&
- e &&
- W.test(e.name) &&
- x.console.warn(
- 'jQuery.Deferred exception: ' + e.message,
- e.stack,
- t
- );
- }),
- (M.readyException = function(e) {
- x.setTimeout(function() {
- throw e;
- });
- });
- var q = M.Deferred();
- function H() {
- k.removeEventListener('DOMContentLoaded', H),
- x.removeEventListener('load', H),
- M.ready();
- }
- (M.fn.ready = function(e) {
- return (
- q.then(e).catch(function(e) {
- M.readyException(e);
- }),
- this
- );
- }),
- M.extend({
- isReady: !1,
- readyWait: 1,
- ready: function(e) {
- (!0 === e ? --M.readyWait : M.isReady) ||
- (((M.isReady = !0) !== e && 0 < --M.readyWait) ||
- q.resolveWith(k, [M]));
- },
- }),
- (M.ready.then = q.then),
- 'complete' === k.readyState ||
- ('loading' !== k.readyState && !k.documentElement.doScroll)
- ? x.setTimeout(M.ready)
- : (k.addEventListener('DOMContentLoaded', H),
- x.addEventListener('load', H));
- var I = function(e, t, n, r, a, i, o) {
- var s = 0,
- c = e.length,
- l = null == n;
- if ('object' === w(n))
- for (s in ((a = !0), n)) I(e, t, s, n[s], !0, i, o);
- else if (
- void 0 !== r &&
- ((a = !0),
- y(r) || (o = !0),
- l &&
- (t = o
- ? (t.call(e, r), null)
- : ((l = t),
- function(e, t, n) {
- return l.call(M(e), n);
- })),
- t)
- )
- for (; s < c; s++)
- t(e[s], n, o ? r : r.call(e[s], s, t(e[s], n)));
- return a ? e : l ? t.call(e) : c ? t(e[0], n) : i;
- },
- F = /^-ms-/,
- G = /-([a-z])/g;
- function B(e, t) {
- return t.toUpperCase();
- }
- function U(e) {
- return e.replace(F, 'ms-').replace(G, B);
- }
- var $ = function(e) {
- return 1 === e.nodeType || 9 === e.nodeType || !+e.nodeType;
- };
- function V() {
- this.expando = M.expando + V.uid++;
- }
- (V.uid = 1),
- (V.prototype = {
- cache: function(e) {
- var t = e[this.expando];
- return (
- t ||
- ((t = {}),
- $(e) &&
- (e.nodeType
- ? (e[this.expando] = t)
- : Object.defineProperty(e, this.expando, {
- value: t,
- configurable: !0,
- }))),
- t
- );
- },
- set: function(e, t, n) {
- var r,
- a = this.cache(e);
- if ('string' == typeof t) a[U(t)] = n;
- else for (r in t) a[U(r)] = t[r];
- return a;
- },
- get: function(e, t) {
- return void 0 === t
- ? this.cache(e)
- : e[this.expando] && e[this.expando][U(t)];
- },
- access: function(e, t, n) {
- return void 0 === t ||
- (t && 'string' == typeof t && void 0 === n)
- ? this.get(e, t)
- : (this.set(e, t, n), void 0 !== n ? n : t);
- },
- remove: function(e, t) {
- var n,
- r = e[this.expando];
- if (void 0 !== r) {
- if (void 0 !== t) {
- n = (t = Array.isArray(t)
- ? t.map(U)
- : (t = U(t)) in r
- ? [t]
- : t.match(z) || []).length;
- for (; n--; ) delete r[t[n]];
- }
- (void 0 === t || M.isEmptyObject(r)) &&
- (e.nodeType
- ? (e[this.expando] = void 0)
- : delete e[this.expando]);
- }
- },
- hasData: function(e) {
- var t = e[this.expando];
- return void 0 !== t && !M.isEmptyObject(t);
- },
- });
- var K = new V(),
- J = new V(),
- X = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
- Z = /[A-Z]/g;
- function Q(e, t, n) {
- var r, a;
- if (void 0 === n && 1 === e.nodeType)
- if (
- ((r = 'data-' + t.replace(Z, '-$&').toLowerCase()),
- 'string' == typeof (n = e.getAttribute(r)))
- ) {
- try {
- n =
- 'true' === (a = n) ||
- ('false' !== a &&
- ('null' === a
- ? null
- : a === +a + ''
- ? +a
- : X.test(a)
- ? JSON.parse(a)
- : a));
- } catch (e) {}
- J.set(e, t, n);
- } else n = void 0;
- return n;
- }
- M.extend({
- hasData: function(e) {
- return J.hasData(e) || K.hasData(e);
- },
- data: function(e, t, n) {
- return J.access(e, t, n);
- },
- removeData: function(e, t) {
- J.remove(e, t);
- },
- _data: function(e, t, n) {
- return K.access(e, t, n);
- },
- _removeData: function(e, t) {
- K.remove(e, t);
- },
- }),
- M.fn.extend({
- data: function(n, e) {
- var t,
- r,
- a,
- i = this[0],
- o = i && i.attributes;
- if (void 0 !== n)
- return 'object' == typeof n
- ? this.each(function() {
- J.set(this, n);
- })
- : I(
- this,
- function(e) {
- var t;
- if (i && void 0 === e) {
- if (void 0 !== (t = J.get(i, n))) return t;
- if (void 0 !== (t = Q(i, n))) return t;
- } else
- this.each(function() {
- J.set(this, n, e);
- });
- },
- null,
- e,
- 1 < arguments.length,
- null,
- !0
- );
- if (
- this.length &&
- ((a = J.get(i)),
- 1 === i.nodeType && !K.get(i, 'hasDataAttrs'))
- ) {
- for (t = o.length; t--; )
- o[t] &&
- 0 === (r = o[t].name).indexOf('data-') &&
- ((r = U(r.slice(5))), Q(i, r, a[r]));
- K.set(i, 'hasDataAttrs', !0);
- }
- return a;
- },
- removeData: function(e) {
- return this.each(function() {
- J.remove(this, e);
- });
- },
- }),
- M.extend({
- queue: function(e, t, n) {
- var r;
- if (e)
- return (
- (t = (t || 'fx') + 'queue'),
- (r = K.get(e, t)),
- n &&
- (!r || Array.isArray(n)
- ? (r = K.access(e, t, M.makeArray(n)))
- : r.push(n)),
- r || []
- );
- },
- dequeue: function(e, t) {
- t = t || 'fx';
- var n = M.queue(e, t),
- r = n.length,
- a = n.shift(),
- i = M._queueHooks(e, t);
- 'inprogress' === a && ((a = n.shift()), r--),
- a &&
- ('fx' === t && n.unshift('inprogress'),
- delete i.stop,
- a.call(
- e,
- function() {
- M.dequeue(e, t);
- },
- i
- )),
- !r && i && i.empty.fire();
- },
- _queueHooks: function(e, t) {
- var n = t + 'queueHooks';
- return (
- K.get(e, n) ||
- K.access(e, n, {
- empty: M.Callbacks('once memory').add(function() {
- K.remove(e, [t + 'queue', n]);
- }),
- })
- );
- },
- }),
- M.fn.extend({
- queue: function(t, n) {
- var e = 2;
- return (
- 'string' != typeof t && ((n = t), (t = 'fx'), e--),
- arguments.length < e
- ? M.queue(this[0], t)
- : void 0 === n
- ? this
- : this.each(function() {
- var e = M.queue(this, t, n);
- M._queueHooks(this, t),
- 'fx' === t &&
- 'inprogress' !== e[0] &&
- M.dequeue(this, t);
- })
- );
- },
- dequeue: function(e) {
- return this.each(function() {
- M.dequeue(this, e);
- });
- },
- clearQueue: function(e) {
- return this.queue(e || 'fx', []);
- },
- promise: function(e, t) {
- var n,
- r = 1,
- a = M.Deferred(),
- i = this,
- o = this.length,
- s = function() {
- --r || a.resolveWith(i, [i]);
- };
- for (
- 'string' != typeof e && ((t = e), (e = void 0)),
- e = e || 'fx';
- o--;
-
- )
- (n = K.get(i[o], e + 'queueHooks')) &&
- n.empty &&
- (r++, n.empty.add(s));
- return s(), a.promise(t);
- },
- });
- var ee = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
- te = new RegExp('^(?:([+-])=|)(' + ee + ')([a-z%]*)$', 'i'),
- ne = ['Top', 'Right', 'Bottom', 'Left'],
- re = function(e, t) {
- return (
- 'none' === (e = t || e).style.display ||
- ('' === e.style.display &&
- M.contains(e.ownerDocument, e) &&
- 'none' === M.css(e, 'display'))
- );
- },
- ae = function(e, t, n, r) {
- var a,
- i,
- o = {};
- for (i in t) (o[i] = e.style[i]), (e.style[i] = t[i]);
- for (i in ((a = n.apply(e, r || [])), t)) e.style[i] = o[i];
- return a;
- };
- function ie(e, t, n, r) {
- var a,
- i,
- o = 20,
- s = r
- ? function() {
- return r.cur();
- }
- : function() {
- return M.css(e, t, '');
- },
- c = s(),
- l = (n && n[3]) || (M.cssNumber[t] ? '' : 'px'),
- u =
- (M.cssNumber[t] || ('px' !== l && +c)) && te.exec(M.css(e, t));
- if (u && u[3] !== l) {
- for (c /= 2, l = l || u[3], u = +c || 1; o--; )
- M.style(e, t, u + l),
- (1 - i) * (1 - (i = s() / c || 0.5)) <= 0 && (o = 0),
- (u /= i);
- (u *= 2), M.style(e, t, u + l), (n = n || []);
- }
- return (
- n &&
- ((u = +u || +c || 0),
- (a = n[1] ? u + (n[1] + 1) * n[2] : +n[2]),
- r && ((r.unit = l), (r.start = u), (r.end = a))),
- a
- );
- }
- var oe = {};
- function se(e, t) {
- for (var n, r, a = [], i = 0, o = e.length; i < o; i++)
- (r = e[i]).style &&
- ((n = r.style.display),
- t
- ? ('none' === n &&
- ((a[i] = K.get(r, 'display') || null),
- a[i] || (r.style.display = '')),
- '' === r.style.display &&
- re(r) &&
- (a[i] = ((f = l = c = void 0),
- (l = (s = r).ownerDocument),
- (u = s.nodeName),
- (f = oe[u]) ||
- ((c = l.body.appendChild(l.createElement(u))),
- (f = M.css(c, 'display')),
- c.parentNode.removeChild(c),
- 'none' === f && (f = 'block'),
- (oe[u] = f)))))
- : 'none' !== n && ((a[i] = 'none'), K.set(r, 'display', n)));
- var s, c, l, u, f;
- for (i = 0; i < o; i++) null != a[i] && (e[i].style.display = a[i]);
- return e;
- }
- M.fn.extend({
- show: function() {
- return se(this, !0);
- },
- hide: function() {
- return se(this);
- },
- toggle: function(e) {
- return 'boolean' == typeof e
- ? e
- ? this.show()
- : this.hide()
- : this.each(function() {
- re(this) ? M(this).show() : M(this).hide();
- });
- },
- });
- var ce = /^(?:checkbox|radio)$/i,
- le = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i,
- ue = /^$|^module$|\/(?:java|ecma)script/i,
- fe = {
- option: [1, "'],
- thead: [1, ''],
- col: [2, ''],
- tr: [2, ''],
- td: [3, ''],
- _default: [0, '', ''],
- };
- function he(e, t) {
- var n;
- return (
- (n =
- void 0 !== e.getElementsByTagName
- ? e.getElementsByTagName(t || '*')
- : void 0 !== e.querySelectorAll
- ? e.querySelectorAll(t || '*')
- : []),
- void 0 === t || (t && E(e, t)) ? M.merge([e], n) : n
- );
- }
- function de(e, t) {
- for (var n = 0, r = e.length; n < r; n++)
- K.set(e[n], 'globalEval', !t || K.get(t[n], 'globalEval'));
- }
- (fe.optgroup = fe.option),
- (fe.tbody = fe.tfoot = fe.colgroup = fe.caption = fe.thead),
- (fe.th = fe.td);
- var pe,
- me,
- ge = /<|?\w+;/;
- function ve(e, t, n, r, a) {
- for (
- var i,
- o,
- s,
- c,
- l,
- u,
- f = t.createDocumentFragment(),
- h = [],
- d = 0,
- p = e.length;
- d < p;
- d++
- )
- if ((i = e[d]) || 0 === i)
- if ('object' === w(i)) M.merge(h, i.nodeType ? [i] : i);
- else if (ge.test(i)) {
- for (
- o = o || f.appendChild(t.createElement('div')),
- s = (le.exec(i) || ['', ''])[1].toLowerCase(),
- c = fe[s] || fe._default,
- o.innerHTML = c[1] + M.htmlPrefilter(i) + c[2],
- u = c[0];
- u--;
-
- )
- o = o.lastChild;
- M.merge(h, o.childNodes),
- ((o = f.firstChild).textContent = '');
- } else h.push(t.createTextNode(i));
- for (f.textContent = '', d = 0; (i = h[d++]); )
- if (r && -1 < M.inArray(i, r)) a && a.push(i);
- else if (
- ((l = M.contains(i.ownerDocument, i)),
- (o = he(f.appendChild(i), 'script')),
- l && de(o),
- n)
- )
- for (u = 0; (i = o[u++]); ) ue.test(i.type || '') && n.push(i);
- return f;
- }
- (pe = k.createDocumentFragment().appendChild(k.createElement('div'))),
- (me = k.createElement('input')).setAttribute('type', 'radio'),
- me.setAttribute('checked', 'checked'),
- me.setAttribute('name', 't'),
- pe.appendChild(me),
- (v.checkClone = pe.cloneNode(!0).cloneNode(!0).lastChild.checked),
- (pe.innerHTML = ''),
- (v.noCloneChecked = !!pe.cloneNode(!0).lastChild.defaultValue);
- var ye = k.documentElement,
- be = /^key/,
- _e = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
- we = /^([^.]*)(?:\.(.+)|)/;
- function Ae() {
- return !0;
- }
- function xe() {
- return !1;
- }
- function ke() {
- try {
- return k.activeElement;
- } catch (e) {}
- }
- function Me(e, t, n, r, a, i) {
- var o, s;
- if ('object' == typeof t) {
- for (s in ('string' != typeof n && ((r = r || n), (n = void 0)),
- t))
- Me(e, s, n, r, t[s], i);
- return e;
- }
- if (
- (null == r && null == a
- ? ((a = n), (r = n = void 0))
- : null == a &&
- ('string' == typeof n
- ? ((a = r), (r = void 0))
- : ((a = r), (r = n), (n = void 0))),
- !1 === a)
- )
- a = xe;
- else if (!a) return e;
- return (
- 1 === i &&
- ((o = a),
- ((a = function(e) {
- return M().off(e), o.apply(this, arguments);
- }).guid = o.guid || (o.guid = M.guid++))),
- e.each(function() {
- M.event.add(this, t, a, r, n);
- })
- );
- }
- (M.event = {
- global: {},
- add: function(t, e, n, r, a) {
- var i,
- o,
- s,
- c,
- l,
- u,
- f,
- h,
- d,
- p,
- m,
- g = K.get(t);
- if (g)
- for (
- n.handler && ((n = (i = n).handler), (a = i.selector)),
- a && M.find.matchesSelector(ye, a),
- n.guid || (n.guid = M.guid++),
- (c = g.events) || (c = g.events = {}),
- (o = g.handle) ||
- (o = g.handle = function(e) {
- return void 0 !== M && M.event.triggered !== e.type
- ? M.event.dispatch.apply(t, arguments)
- : void 0;
- }),
- l = (e = (e || '').match(z) || ['']).length;
- l--;
-
- )
- (d = m = (s = we.exec(e[l]) || [])[1]),
- (p = (s[2] || '').split('.').sort()),
- d &&
- ((f = M.event.special[d] || {}),
- (d = (a ? f.delegateType : f.bindType) || d),
- (f = M.event.special[d] || {}),
- (u = M.extend(
- {
- type: d,
- origType: m,
- data: r,
- handler: n,
- guid: n.guid,
- selector: a,
- needsContext: a && M.expr.match.needsContext.test(a),
- namespace: p.join('.'),
- },
- i
- )),
- (h = c[d]) ||
- (((h = c[d] = []).delegateCount = 0),
- (f.setup && !1 !== f.setup.call(t, r, p, o)) ||
- (t.addEventListener && t.addEventListener(d, o))),
- f.add &&
- (f.add.call(t, u),
- u.handler.guid || (u.handler.guid = n.guid)),
- a ? h.splice(h.delegateCount++, 0, u) : h.push(u),
- (M.event.global[d] = !0));
- },
- remove: function(e, t, n, r, a) {
- var i,
- o,
- s,
- c,
- l,
- u,
- f,
- h,
- d,
- p,
- m,
- g = K.hasData(e) && K.get(e);
- if (g && (c = g.events)) {
- for (l = (t = (t || '').match(z) || ['']).length; l--; )
- if (
- ((d = m = (s = we.exec(t[l]) || [])[1]),
- (p = (s[2] || '').split('.').sort()),
- d)
- ) {
- for (
- f = M.event.special[d] || {},
- h =
- c[(d = (r ? f.delegateType : f.bindType) || d)] || [],
- s =
- s[2] &&
- new RegExp(
- '(^|\\.)' + p.join('\\.(?:.*\\.|)') + '(\\.|$)'
- ),
- o = i = h.length;
- i--;
-
- )
- (u = h[i]),
- (!a && m !== u.origType) ||
- (n && n.guid !== u.guid) ||
- (s && !s.test(u.namespace)) ||
- (r &&
- r !== u.selector &&
- ('**' !== r || !u.selector)) ||
- (h.splice(i, 1),
- u.selector && h.delegateCount--,
- f.remove && f.remove.call(e, u));
- o &&
- !h.length &&
- ((f.teardown && !1 !== f.teardown.call(e, p, g.handle)) ||
- M.removeEvent(e, d, g.handle),
- delete c[d]);
- } else for (d in c) M.event.remove(e, d + t[l], n, r, !0);
- M.isEmptyObject(c) && K.remove(e, 'handle events');
- }
- },
- dispatch: function(e) {
- var t,
- n,
- r,
- a,
- i,
- o,
- s = M.event.fix(e),
- c = new Array(arguments.length),
- l = (K.get(this, 'events') || {})[s.type] || [],
- u = M.event.special[s.type] || {};
- for (c[0] = s, t = 1; t < arguments.length; t++)
- c[t] = arguments[t];
- if (
- ((s.delegateTarget = this),
- !u.preDispatch || !1 !== u.preDispatch.call(this, s))
- ) {
- for (
- o = M.event.handlers.call(this, s, l), t = 0;
- (a = o[t++]) && !s.isPropagationStopped();
-
- )
- for (
- s.currentTarget = a.elem, n = 0;
- (i = a.handlers[n++]) && !s.isImmediatePropagationStopped();
-
- )
- (s.rnamespace && !s.rnamespace.test(i.namespace)) ||
- ((s.handleObj = i),
- (s.data = i.data),
- void 0 !==
- (r = (
- (M.event.special[i.origType] || {}).handle ||
- i.handler
- ).apply(a.elem, c)) &&
- !1 === (s.result = r) &&
- (s.preventDefault(), s.stopPropagation()));
- return u.postDispatch && u.postDispatch.call(this, s), s.result;
- }
- },
- handlers: function(e, t) {
- var n,
- r,
- a,
- i,
- o,
- s = [],
- c = t.delegateCount,
- l = e.target;
- if (c && l.nodeType && !('click' === e.type && 1 <= e.button))
- for (; l !== this; l = l.parentNode || this)
- if (
- 1 === l.nodeType &&
- ('click' !== e.type || !0 !== l.disabled)
- ) {
- for (i = [], o = {}, n = 0; n < c; n++)
- void 0 === o[(a = (r = t[n]).selector + ' ')] &&
- (o[a] = r.needsContext
- ? -1 < M(a, this).index(l)
- : M.find(a, this, null, [l]).length),
- o[a] && i.push(r);
- i.length && s.push({ elem: l, handlers: i });
- }
- return (
- (l = this),
- c < t.length && s.push({ elem: l, handlers: t.slice(c) }),
- s
- );
- },
- addProp: function(t, e) {
- Object.defineProperty(M.Event.prototype, t, {
- enumerable: !0,
- configurable: !0,
- get: y(e)
- ? function() {
- if (this.originalEvent) return e(this.originalEvent);
- }
- : function() {
- if (this.originalEvent) return this.originalEvent[t];
- },
- set: function(e) {
- Object.defineProperty(this, t, {
- enumerable: !0,
- configurable: !0,
- writable: !0,
- value: e,
- });
- },
- });
- },
- fix: function(e) {
- return e[M.expando] ? e : new M.Event(e);
- },
- special: {
- load: { noBubble: !0 },
- focus: {
- trigger: function() {
- if (this !== ke() && this.focus) return this.focus(), !1;
- },
- delegateType: 'focusin',
- },
- blur: {
- trigger: function() {
- if (this === ke() && this.blur) return this.blur(), !1;
- },
- delegateType: 'focusout',
- },
- click: {
- trigger: function() {
- if (
- 'checkbox' === this.type &&
- this.click &&
- E(this, 'input')
- )
- return this.click(), !1;
- },
- _default: function(e) {
- return E(e.target, 'a');
- },
- },
- beforeunload: {
- postDispatch: function(e) {
- void 0 !== e.result &&
- e.originalEvent &&
- (e.originalEvent.returnValue = e.result);
- },
- },
- },
- }),
- (M.removeEvent = function(e, t, n) {
- e.removeEventListener && e.removeEventListener(t, n);
- }),
- (M.Event = function(e, t) {
- if (!(this instanceof M.Event)) return new M.Event(e, t);
- e && e.type
- ? ((this.originalEvent = e),
- (this.type = e.type),
- (this.isDefaultPrevented =
- e.defaultPrevented ||
- (void 0 === e.defaultPrevented && !1 === e.returnValue)
- ? Ae
- : xe),
- (this.target =
- e.target && 3 === e.target.nodeType
- ? e.target.parentNode
- : e.target),
- (this.currentTarget = e.currentTarget),
- (this.relatedTarget = e.relatedTarget))
- : (this.type = e),
- t && M.extend(this, t),
- (this.timeStamp = (e && e.timeStamp) || Date.now()),
- (this[M.expando] = !0);
- }),
- (M.Event.prototype = {
- constructor: M.Event,
- isDefaultPrevented: xe,
- isPropagationStopped: xe,
- isImmediatePropagationStopped: xe,
- isSimulated: !1,
- preventDefault: function() {
- var e = this.originalEvent;
- (this.isDefaultPrevented = Ae),
- e && !this.isSimulated && e.preventDefault();
- },
- stopPropagation: function() {
- var e = this.originalEvent;
- (this.isPropagationStopped = Ae),
- e && !this.isSimulated && e.stopPropagation();
- },
- stopImmediatePropagation: function() {
- var e = this.originalEvent;
- (this.isImmediatePropagationStopped = Ae),
- e && !this.isSimulated && e.stopImmediatePropagation(),
- this.stopPropagation();
- },
- }),
- M.each(
- {
- altKey: !0,
- bubbles: !0,
- cancelable: !0,
- changedTouches: !0,
- ctrlKey: !0,
- detail: !0,
- eventPhase: !0,
- metaKey: !0,
- pageX: !0,
- pageY: !0,
- shiftKey: !0,
- view: !0,
- char: !0,
- charCode: !0,
- key: !0,
- keyCode: !0,
- button: !0,
- buttons: !0,
- clientX: !0,
- clientY: !0,
- offsetX: !0,
- offsetY: !0,
- pointerId: !0,
- pointerType: !0,
- screenX: !0,
- screenY: !0,
- targetTouches: !0,
- toElement: !0,
- touches: !0,
- which: function(e) {
- var t = e.button;
- return null == e.which && be.test(e.type)
- ? null != e.charCode
- ? e.charCode
- : e.keyCode
- : !e.which && void 0 !== t && _e.test(e.type)
- ? 1 & t
- ? 1
- : 2 & t
- ? 3
- : 4 & t
- ? 2
- : 0
- : e.which;
- },
- },
- M.event.addProp
- ),
- M.each(
- {
- mouseenter: 'mouseover',
- mouseleave: 'mouseout',
- pointerenter: 'pointerover',
- pointerleave: 'pointerout',
- },
- function(e, a) {
- M.event.special[e] = {
- delegateType: a,
- bindType: a,
- handle: function(e) {
- var t,
- n = e.relatedTarget,
- r = e.handleObj;
- return (
- (n && (n === this || M.contains(this, n))) ||
- ((e.type = r.origType),
- (t = r.handler.apply(this, arguments)),
- (e.type = a)),
- t
- );
- },
- };
- }
- ),
- M.fn.extend({
- on: function(e, t, n, r) {
- return Me(this, e, t, n, r);
- },
- one: function(e, t, n, r) {
- return Me(this, e, t, n, r, 1);
- },
- off: function(e, t, n) {
- var r, a;
- if (e && e.preventDefault && e.handleObj)
- return (
- (r = e.handleObj),
- M(e.delegateTarget).off(
- r.namespace ? r.origType + '.' + r.namespace : r.origType,
- r.selector,
- r.handler
- ),
- this
- );
- if ('object' != typeof e)
- return (
- (!1 !== t && 'function' != typeof t) ||
- ((n = t), (t = void 0)),
- !1 === n && (n = xe),
- this.each(function() {
- M.event.remove(this, e, n, t);
- })
- );
- for (a in e) this.off(a, t, e[a]);
- return this;
- },
- });
- var Se = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
- Ee = /