diff --git a/changedetectionio/processors/restock_diff.py b/changedetectionio/processors/restock_diff.py index 9751a195..a590f73d 100644 --- a/changedetectionio/processors/restock_diff.py +++ b/changedetectionio/processors/restock_diff.py @@ -61,4 +61,4 @@ class perform_site_check(difference_detection_processor): # Always record the new checksum update_obj["previous_md5"] = fetched_md5 - return changed_detected, update_obj, self.fetcher.instock_data.encode('utf-8') + return changed_detected, update_obj, self.fetcher.instock_data.encode('utf-8').strip() diff --git a/changedetectionio/res/stock-not-in-stock.js b/changedetectionio/res/stock-not-in-stock.js index d2d870b5..efc1c4eb 100644 --- a/changedetectionio/res/stock-not-in-stock.js +++ b/changedetectionio/res/stock-not-in-stock.js @@ -61,12 +61,12 @@ function isItemInStock() { negateOutOfStockRegexs_r.push(new RegExp(negateOutOfStockRegexs[0], 'g')); } - - const elementsWithZeroChildren = Array.from(document.getElementsByTagName('*')).filter(element => element.children.length === 0); + const elementsToScan = Array.from(document.getElementsByTagName('*')); + //const elementsWithZeroChildren = Array.from(document.getElementsByTagName('*')).filter(element => element.children.length === 0); // REGEXS THAT REALLY MEAN IT'S IN STOCK - for (let i = elementsWithZeroChildren.length - 1; i >= 0; i--) { - const element = elementsWithZeroChildren[i]; + for (let i = elementsToScan.length - 1; i >= 0; i--) { + const element = elementsToScan[i]; if (element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0) { var elementText=""; if (element.tagName.toLowerCase() === "input") { @@ -87,8 +87,8 @@ function isItemInStock() { } // OTHER STUFF THAT COULD BE THAT IT'S OUT OF STOCK - for (let i = elementsWithZeroChildren.length - 1; i >= 0; i--) { - const element = elementsWithZeroChildren[i]; + for (let i = elementsToScan.length - 1; i >= 0; i--) { + const element = elementsToScan[i]; if (element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0) { var elementText=""; if (element.tagName.toLowerCase() === "input") {