Added stand-alone Spizoo sites.

This commit is contained in:
DebaucheryLibrarian
2022-02-07 21:58:27 +01:00
parent 5630b16e99
commit fffe9080f3
52 changed files with 127 additions and 17 deletions

View File

@@ -117,13 +117,13 @@ function getElements(context, selector, first = false) {
return Array.from(context.querySelectorAll(selector));
}
function q(context, selector, attrArg, applyTrim = true) {
if (!selector && context.nodeName === '#document') {
function q(context, selectors, attrArg, applyTrim = true) {
if (!selectors && context.nodeName === '#document') {
return null;
}
const attr = attrArg === true ? 'textContent' : attrArg;
const element = getElements(context, selector, true);
const element = [].concat(selectors).reduce((acc, selector) => acc || getElements(context, selector, true), null);
if (!element) {
return null;
@@ -138,9 +138,9 @@ function q(context, selector, attrArg, applyTrim = true) {
return element;
}
function all(context, selector, attrArg, applyTrim = true) {
function all(context, selectors, attrArg, applyTrim = true) {
const attr = attrArg === true ? 'textContent' : attrArg;
const elements = getElements(context, selector);
const elements = [].concat(selectors).reduce((acc, selector) => acc || getElements(context, selector), null);
if (attr) {
return elements.map((el) => q(el, null, attr, applyTrim));