Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elem.attribs && elem.attribs.class && elem.attribs.class.indexOf("region-content") >=0,
dom, true);
if (!contentDiv) {
throw new Error("Article content not found (no 'region-content' class)");
}
// remove article body-enclosing div (class "threed-sidebar-article-body"), then re-parent children
const bodyDiv = DomUtils.findOne(elem =>
elem.attribs && elem.attribs.class && elem.attribs.class.indexOf("threed-sidebar-article-body") >= 0,
contentDiv.children, true);
if (bodyDiv) {
const parent: any = bodyDiv.parent;
bodyDiv.children.forEach(child => DomUtils.appendChild(parent, child));
DomUtils.removeElement(bodyDiv);
}
const title = DomUtils.findOne(elem => elem.name === "h1",
contentDiv.children, true);
const titleText = title && DomUtils.getText(title);
article.title = titleText || `Article No. ${index + 1}`;
let imageIndex = 0;
const imageUrls: Dictionary = {};
DomUtils.findOne(elem => {
// download images
if (elem.name === "img" && elem.attribs && elem.attribs.src) {
const src = elem.attribs.src;
const imageUrl = src.startsWith("http") ? src : this.parameters.drupalBaseUrl + src;
elem.attribs && elem.attribs.class && elem.attribs.class.indexOf("region-content") >=0,
dom, true);
if (!contentDiv) {
throw new Error("Article content not found (no 'region-content' class)");
}
// remove article body-enclosing div (class "threed-sidebar-article-body"), then re-parent children
const bodyDiv = DomUtils.findOne(elem =>
elem.attribs && elem.attribs.class && elem.attribs.class.indexOf("threed-sidebar-article-body") >= 0,
contentDiv.children, true);
if (bodyDiv) {
const parent: any = bodyDiv.parent;
bodyDiv.children.forEach(child => DomUtils.appendChild(parent, child));
DomUtils.removeElement(bodyDiv);
}
const title = DomUtils.findOne(elem => elem.name === "h1",
contentDiv.children, true);
const titleText = title && DomUtils.getText(title);
article.title = titleText || `Article No. ${index + 1}`;
let imageIndex = 0;
const imageUrls: Dictionary = {};
DomUtils.findOne(elem => {
// download images
if (elem.name === "img" && elem.attribs && elem.attribs.src) {
const src = elem.attribs.src;
const imageUrl = src.startsWith("http") ? src : context.drupalBaseUrl + src;