Opening content script only if an element is present on the page?

I want to show my extension in a sidebar only if a certain value is present in the html of the page. Im looking to show the extension content sidebar only if the json+ld schema matches @article. I have a scraper function that returns content if it exists (which I already have working perfectly) but lets just pretend for this question that it simply returns a boolean. for example could this: export const config: PlasmoCSConfig = { matches: ["https://www.medium.com/*"], // could be 10000000 more // if I can match by schema type I may only need 1 line of code }; be accomplished somehow with something like this: const checkIfItsTheContentIWant = (scrapedHTMLFromPage) => { // for berevity return true; } export const config: PlasmoCSConfig = { matches: checkIfItsTheContentIWant(); } Or failing that can I pass in a array of sites like matches: [...sources] ?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server