ScholarWithCode icon indicating copy to clipboard operation
ScholarWithCode copied to clipboard

Support Semantic Scholar

Open idow09 opened this issue 4 years ago • 1 comments

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 on document.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

idow09 avatar Jul 28 '20 21:07 idow09

Looks great! We should probably also support paper pages, as in Arxiv, and not only search pages.

eladrich avatar Jul 29 '20 13:07 eladrich