pixabay-sourcer filter out iStock

This commit is contained in:
2023-07-14 09:21:05 -06:00
parent b22ac29b97
commit 9384693013

View File

@@ -1,6 +1,7 @@
(import kiss_firefox.API)
(import js.lib.Promise)
(importAs js.html.XMLHttpRequest XHR)
(import js.html.HTMLCollection)
(import hollywoo_sourcer.Message)
(var :Dynamic document js.Lib.global.document)
(var :Dynamic window js.Lib.global.window)
@@ -46,4 +47,12 @@
(ifLet [cachedInfo (dictGet cachedResults id)]
(handleInfo cachedInfo)
(queryId id cachedResults)))))
(otherwise)))
(otherwise)))
// Filter the iStock divs!
(window.addEventListener "load"
->(let [:HTMLCollection divs (document.getElementsByTagName "div")]
(doFor i (range divs.length)
(let [div (divs.item i)]
(when (and (div.className.contains "title") (div.innerHTML.contains "Sponsored Images iStock"))
(set div.parentElement.hidden true))))))