arXiv Clean Reader

Remove the top navigation bar, beta tag, and bottom right feedback prompt from the arXiv HTML article.

  1. // ==UserScript==
  2. // @name arXiv Clean Reader
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @license MIT
  6. // @description Remove the top navigation bar, beta tag, and bottom right feedback prompt from the arXiv HTML article.
  7. // @author Naive
  8. // @match https://arxiv.org/html/*
  9. // @match https://arxiv.org/abs/*
  10. // @icon https://arxiv.org/favicon.ico
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. function cleanPage() {
  18. // header
  19. const header = document.querySelector('header');
  20. if (header) header.remove();
  21.  
  22. // beta
  23. const observer = new MutationObserver(() => {
  24. const existingStyle = document.querySelector('style#custom-remove-after');
  25. if (!existingStyle) {
  26. const style = document.createElement('style');
  27. style.id = 'custom-remove-after';
  28. style.textContent = 'body::after { content: none !important; }';
  29. document.head.appendChild(style);
  30. }
  31. });
  32. observer.observe(document, {
  33. childList: true,
  34. subtree: true
  35. });
  36.  
  37. // feedback
  38. const feedbackDiv = document.querySelector('#openForm');
  39. if (feedbackDiv) feedbackDiv.remove();
  40.  
  41. //const footer = document.querySelector('footer');
  42. //if (footer) footer.remove();
  43.  
  44. const mainContent = document.querySelector('.ltx_page_main');
  45. if (mainContent) {
  46. mainContent.style.marginTop = '0';
  47. mainContent.style.paddingTop = '20px';
  48. }
  49. }
  50.  
  51. const observer = new MutationObserver((mutations) => {
  52. cleanPage();
  53. });
  54.  
  55. observer.observe(document, {
  56. childList: true,
  57. subtree: true
  58. });
  59.  
  60. // initial
  61. cleanPage();
  62.  
  63. // resize
  64. window.addEventListener('resize', cleanPage);
  65. })();