Add OpenReview Link in arXiv

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

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

  1. // ==UserScript==
  2. // @name Add OpenReview Link in arXiv
  3. // @namespace http://github.com/awyugan
  4. // @version 0.1
  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.trim();
  19.  
  20. // 创建 openreview 的链接
  21. let openreviewLink = document.createElement('a');
  22. openreviewLink.href = 'https://openreview.net/search?term=' + encodeURIComponent(titleText);
  23. openreviewLink.target = '_blank';
  24. openreviewLink.innerText = 'Open in openreview\n';
  25. openreviewLink.style.display = 'block';
  26.  
  27. // 创建 hn.algolia 的链接
  28. let algoliaLink = document.createElement('a');
  29. algoliaLink.href = 'https://hn.algolia.com/?q=' + encodeURIComponent(titleText);
  30. algoliaLink.target = '_blank';
  31. algoliaLink.innerText = 'Search on hn.algolia\n';
  32. algoliaLink.style.display = 'block';
  33.  
  34. // 查找指定的div并将链接插入其中
  35. let fullTextDiv = document.querySelector('div.full-text');
  36. if (fullTextDiv) {
  37. fullTextDiv.appendChild(openreviewLink);
  38. fullTextDiv.appendChild(algoliaLink);
  39. }
  40. }
  41. })();