Add quick jump Link in arXiv

Embed OpenReview link with arXiv paper title in the arXiv paper page

当前为 2023-08-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Add quick jump Link in arXiv
  3. // @namespace http://github.com/awyugan
  4. // @version 0.2
  5. // @description Embed OpenReview link with arXiv paper title in the arXiv paper page
  6. // @author awyugan
  7. // @match https://arxiv.org/abs/*
  8. // @grant GM_addStyle
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // 获取 arXiv 页面中的论文标题
  16. let titleElement = document.querySelector('h1.title.mathjax');
  17. if (titleElement) {
  18. let titleText = titleElement.textContent.replace('Title:', '').trim();
  19.  
  20. // 创建 openreview 的链接
  21. let openreviewLink = createLink('https://openreview.net/search?term=', titleText, 'Open in openreview\n');
  22.  
  23. // 创建 hn.algolia 的链接
  24. let algoliaLink = createLink('https://hn.algolia.com/?q=', titleText, 'Search on hn.algolia\n');
  25.  
  26. // 创建 paperswithcode 的链接
  27. let papersWithCodeLink = createLink('https://paperswithcode.com/search?q_meta=&q_type=&q=', titleText, 'Search on Papers with Code\n');
  28.  
  29. // 查找指定的div并将链接插入其中
  30. let fullTextDiv = document.querySelector('div.full-text');
  31. if (fullTextDiv) {
  32. fullTextDiv.appendChild(openreviewLink);
  33. fullTextDiv.appendChild(algoliaLink);
  34. fullTextDiv.appendChild(papersWithCodeLink);
  35. }
  36. }
  37.  
  38. // 辅助函数,用于创建链接
  39. function createLink(baseURL, query, text) {
  40. let link = document.createElement('a');
  41. link.href = baseURL + encodeURIComponent(query);
  42. link.target = '_blank';
  43. link.innerText = text;
  44. link.style.display = 'block';
  45. return link;
  46. }
  47. })();