forked from DebaucheryLibrarian/traxxx
Updated dependencies. Added periodic memory logger.
This commit is contained in:
@@ -102,7 +102,7 @@ function all(context, selector, attrArg, applyTrim = true) {
|
||||
const attr = attrArg === true ? 'textContent' : attrArg;
|
||||
|
||||
if (attr) {
|
||||
return Array.from(context.querySelectorAll(selector), el => q(el, null, attr, applyTrim));
|
||||
return Array.from(context.querySelectorAll(selector), (el) => q(el, null, attr, applyTrim));
|
||||
}
|
||||
|
||||
return Array.from(context.querySelectorAll(selector));
|
||||
@@ -155,7 +155,7 @@ function jsons(context, selector) {
|
||||
function htmls(context, selector) {
|
||||
const els = all(context, selector, null, true);
|
||||
|
||||
return els.map(el => el.innerHTML);
|
||||
return els.map((el) => el.innerHTML);
|
||||
}
|
||||
|
||||
function texts(context, selector, applyTrim = true, filter = true) {
|
||||
@@ -163,8 +163,8 @@ function texts(context, selector, applyTrim = true, filter = true) {
|
||||
if (!el) return null;
|
||||
|
||||
const nodes = Array.from(el.childNodes)
|
||||
.filter(node => node.nodeName === '#text')
|
||||
.map(node => (applyTrim ? trim(node.textContent) : node.textContent));
|
||||
.filter((node) => node.nodeName === '#text')
|
||||
.map((node) => (applyTrim ? trim(node.textContent) : node.textContent));
|
||||
|
||||
return filter ? nodes.filter(Boolean) : nodes;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ function images(context, selector = 'img', attr, { origin, protocol = 'https' }
|
||||
|
||||
const imageEls = all(context, selector, attribute);
|
||||
|
||||
return imageEls.map(imageEl => prefixUrl(imageEl, origin, protocol));
|
||||
return imageEls.map((imageEl) => prefixUrl(imageEl, origin, protocol));
|
||||
}
|
||||
|
||||
function url(context, selector = 'a', attr = 'href', { origin, protocol = 'https', object = false } = {}) {
|
||||
@@ -289,7 +289,7 @@ function url(context, selector = 'a', attr = 'href', { origin, protocol = 'https
|
||||
function urls(context, selector = 'a', attr = 'href', { origin, protocol = 'https' } = {}) {
|
||||
const urlEls = all(context, selector, attr);
|
||||
|
||||
return attr ? urlEls.map(urlEl => prefixUrl(urlEl, origin, protocol)) : urlEls;
|
||||
return attr ? urlEls.map((urlEl) => prefixUrl(urlEl, origin, protocol)) : urlEls;
|
||||
}
|
||||
|
||||
function sourceSet(context, selector, attr = 'srcset', options = {}) {
|
||||
@@ -330,7 +330,7 @@ function sourceSet(context, selector, attr = 'srcset', options = {}) {
|
||||
return sources;
|
||||
}
|
||||
|
||||
return sources.map(source => source.url);
|
||||
return sources.map((source) => source.url);
|
||||
}
|
||||
|
||||
function poster(context, selector = 'video', attr = 'poster', { origin, protocol = 'https' } = {}) {
|
||||
@@ -348,7 +348,7 @@ function video(context, selector = 'source', attr = 'src', { origin, protocol =
|
||||
function videos(context, selector = 'source', attr = 'src', { origin, protocol = 'https' } = {}) {
|
||||
const trailerEls = all(context, selector, attr);
|
||||
|
||||
return attr ? trailerEls.map(trailerEl => prefixUrl(trailerEl, origin, protocol)) : trailerEls;
|
||||
return attr ? trailerEls.map((trailerEl) => prefixUrl(trailerEl, origin, protocol)) : trailerEls;
|
||||
}
|
||||
|
||||
function duration(context, selector, match, attr = 'textContent') {
|
||||
@@ -499,11 +499,11 @@ function init(context, selector, window) {
|
||||
|
||||
function initAll(context, selector, window) {
|
||||
if (Array.isArray(context)) {
|
||||
return context.map(element => init(element, null, window));
|
||||
return context.map((element) => init(element, null, window));
|
||||
}
|
||||
|
||||
return Array.from(context.querySelectorAll(selector))
|
||||
.map(element => init(element, null, window));
|
||||
.map((element) => init(element, null, window));
|
||||
}
|
||||
|
||||
function extract(htmlValue, selector, options) {
|
||||
|
||||
Reference in New Issue
Block a user