ScholarWithCode
ScholarWithCode copied to clipboard
Support Semantic Scholar
Added the requested support. Some notes:
- Semantic Scholar takes its time when retrieving the results (there is a loading animation but the page is considered idle) so I needed a hook for delaying the script execution. I used a
MutationObserver
ondocument.body
that waits until the results' nodes are added. - The observer should
disconnect()
but I can't figure how to self-inform that the execution is done and it's no longer needed. - The script should match only "https://www.semanticscholar.org/search*" but for some reason when redirected to the results' page from the home page the script isn't executed. A refresh solves it as it recognizes an explicit loading of a matched page but that's of course not good enough. So currently "https://www.semanticscholar.org/*" is used but it's inefficient because the observer is registered in the home page for no reason.
- The icon is embedded into the code as an SVG HTML element. I guess it's OK...
- Fixes #4
Looks great! We should probably also support paper pages, as in Arxiv
, and not only search pages.