|
|
@ -170,9 +170,12 @@ if (include_filters.length) {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// is it xpath?
|
|
|
|
// is it xpath?
|
|
|
|
if (f.startsWith('/') || f.startsWith('xpath:')) {
|
|
|
|
if (f.startsWith('/') || f.startsWith('xpath')) {
|
|
|
|
q = document.evaluate(f.replace('xpath:', ''), document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
|
|
var qry_f = f.replace(/xpath(:|\d:)/, '')
|
|
|
|
|
|
|
|
console.log("[xpath] Scanning for included filter " + qry_f)
|
|
|
|
|
|
|
|
q = document.evaluate(qry_f, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.log("[css] Scanning for included filter " + f)
|
|
|
|
q = document.querySelector(f);
|
|
|
|
q = document.querySelector(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
@ -183,7 +186,7 @@ if (include_filters.length) {
|
|
|
|
|
|
|
|
|
|
|
|
if (q) {
|
|
|
|
if (q) {
|
|
|
|
// #1231 - IN the case XPath attribute filter is applied, we will have to traverse up and find the element.
|
|
|
|
// #1231 - IN the case XPath attribute filter is applied, we will have to traverse up and find the element.
|
|
|
|
if (q.hasOwnProperty('getBoundingClientRect')) {
|
|
|
|
if (typeof q.getBoundingClientRect == 'function') {
|
|
|
|
bbox = q.getBoundingClientRect();
|
|
|
|
bbox = q.getBoundingClientRect();
|
|
|
|
console.log("xpath_element_scraper: Got filter element, scroll from top was " + scroll_y)
|
|
|
|
console.log("xpath_element_scraper: Got filter element, scroll from top was " + scroll_y)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -192,7 +195,8 @@ if (include_filters.length) {
|
|
|
|
bbox = q.ownerElement.getBoundingClientRect();
|
|
|
|
bbox = q.ownerElement.getBoundingClientRect();
|
|
|
|
console.log("xpath_element_scraper: Got filter by ownerElement element, scroll from top was " + scroll_y)
|
|
|
|
console.log("xpath_element_scraper: Got filter by ownerElement element, scroll from top was " + scroll_y)
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
console.log("xpath_element_scraper: error looking up ownerElement")
|
|
|
|
console.log(e)
|
|
|
|
|
|
|
|
console.log("xpath_element_scraper: error looking up q.ownerElement")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|