Skip to content

Meaningful titles for tabs and PDF downloads! Also supports tab search.

License

Notifications You must be signed in to change notification settings

j3soon/arxiv-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arxiv-utils

tests tests build

icon

A collection of features that enhance your reading experience on ArXiv (and some other sites):

  • Renames the title of PDF page to the paper's title.
  • Adds a button and hotkey (Alt+A) to navigate back to Abstract page for arXiv, OpenReview, and more.
  • Download PDF with paper's title as filename.
  • Open the paper in extra services such as ar5iv.
  • Works with Native Tab Search, and other plugins! (See the Solution Descriptions section for more details)
  • All required permissions are documented in detail.

Please open an issue if you have any questions, feature requests, or bug reports.

Download Links

Supports Chrome, Firefox, Edge, Firefox on Android. (Not tested on Android)

Alternatively, these 3 browsers can also load arxiv-utils directly from source. First, download the source code release from Releases, and then load the extension as an unpacked extension following the Development Section.

Screenshots

The paper id in the title has been removed automatically!
A direct download link is added to download PDF with paper's title as the filename!
Open in extra services such as ar5iv! Finally... Meaningful paper title instead of paper id! (For Firefox, this is achieved through a custom PDF container.) Difficult to get back to abstract page...
Click to get back to abstract page! TADA~ The abstract page is shown at the right of the PDF page! Both with meaningful title! The button is disabled if not in ArXiv's domain.
Meaningful bookmark titles. Meaningful OneTab entries! (Chrome & Edge only) Opened too many tabs? Search in terms of the paper title! Works well with vertical tabs. Right-click the extension icon and select Options to set your preference. (Chrome & Edge) Go to add-ons page, click the extension select Options to set your preference. (Firefox)

Solution Descriptions

For ArXiv PDF / abstract tabs:

  • Renames the title to paper's title automatically in the background. (Originally is meaningless paper id, or start with paper id)
  • Add an action button (or Alt+A) to open its corresponding abstract / PDF page. (Originally is hard to get back to abstract page from PDF page)
  • Add a direct download link on abstract page, click it to download the PDF with the title as filename. (Originally is paper id as filename)
  • Open the paper in extra services such as ar5iv.
  • Better title even for bookmarks and the OneTab plugin!
  • Firefox has strict restrictions on PDF.js. So it doesn't work well with OneTab, the PDF renaming is achieved by intercepting requests and show the PDF in a container. The bookmark works well though.
  • Works well with native tab search (credits: @The Rooler)

Options

  • filename format:
    • Default: ${title}, ${firstAuthor} et al., ${publishedYear}, v${version}.pdf
    • ${title} is replaced with the paper title.
    • ${firstAuthor} is replaced with the first author of the paper.
    • ${authors} is replaced with all authors separated by commas.
    • ${publishedYear} is replaced with the published year of the paper.
    • ${updatedYear} is replaced with the updated year of the current paper version.
    • ${version} is replaced with the version of the current paper.
    • ${paperid} is replaced with the arXiv paper id.
  • Open in new tab:
    • Default: true
    • Set to false to open in existing tab when clicking the action button.
  • (Firefox) Enable PDF redirection:
    • Default: true
    • Set to false to disable PDF redirection. This will disallow renaming for PDF tabs.
  • (Firefox, Experimental) external PDF viewer URL prefix:
    • Default: (empty), uses the custom PDF container.
    • Set to https://mozilla.github.io/pdf.js/web/viewer.html?file=, enables Screenshots and Go Back by using pdf.js as PDF viewer.

Privacy Policy

We do not gather your personal data. If in doubt, please refer to the source code.

Chrome / Edge Permissions

  • tabs: On extension button click, open a new tab and move it to the right of the old active tab.
  • activeTab: Read active tab's title and modify it using the tab's url.
  • storage: Save extension configurations.
  • contextMenus: When right-click the extension button, show a help menu item.
  • scripting: Inject content scripts to existing tabs.
  • downloads: Direct download PDF with paper's title as filename.
  • *://arxiv.org/*: Inject content scripts to existing tabs.
  • *://export.arxiv.org/*: Inject content scripts to existing tabs.
  • *://browse.arxiv.org/*: Inject content scripts to existing tabs.
  • *://www.arxiv.org/*: Inject content scripts to existing tabs.
  • *://ar5iv.labs.arxiv.org/*: Inject content scripts to existing tabs.

Firefox Permissions

  • tabs: On extension button click, open a new tab and move it to the right of the old active tab.
  • activeTab: Read active tab's title and modify it using the tab's url.
  • storage: Save extension configurations.
  • contextMenus: When right-click the extension button, show a help menu item.
  • webRequest: Intercept ArXiv PDF request.
  • webRequestBlocking: Redirect the ArXiv PDF page to custom PDF container page.
  • bookmarks: When create a new bookmark of the PDF container page, bookmark the actual ArXiv PDF url instead.
  • downloads: Direct download PDF with paper's title as filename.
  • *://arxiv.org/*pdf*: Redirect PDF pages to custom PDF container.
  • *://export.arxiv.org/*pdf*: Redirect PDF pages to custom PDF container.
  • *://browse.arxiv.org/*pdf*: Redirect PDF pages to custom PDF container.
  • *://www.arxiv.org/*pdf*: Redirect PDF pages to custom PDF container.
  • "content_security_policy": "script-src 'self'; object-src 'self' https://arxiv.org https://export.arxiv.org https://browse.arxiv.org https://www.arxiv.org;": For embedding PDF in container.
  • "web_accessible_resources": [ "pdfviewer.html" ]: To redirect from HTTPS to extension custom page requires them to be visible.

Developer Notes

Development

For viewing the content script logs, open the Inspector of the arXiv webpage (as in normal web development).

For viewing background script logs, open the Inspector of the plugin in the Extensions page.

  • Firefox: Go to about:debugging#/runtime/this-firefox and click Inspect on the temporarily loaded extension.
  • Chrome: Go to chrome://extensions/ and click Inspect views: background page on the loaded (unpacked) extension.
  • Edge: Go to edge://extensions/ and click Inspect views: service worker on the loaded (unpacked) extension.

Tests

The automated tests currently include the following:

  • Default tests: Test the default title name of arXiv abstract/PDF pages.
  • Navigation tests: Test the arxiv-utils button can switch between arXiv abstract/PDF pages, and the title is modified.

The testcases along with their description is stored in tests/testcases/testcases.yaml.

Other functions should still be tested manually:

  • Bookmark tests: Test the bookmarked URL.
    • Try to bookmark an abstract tab, the title should be the new title.
    • Try to bookmark a PDF tab, the title should be the new title.
    • (Firefox Only) Check the PDF bookmark's URL, it should be the original ArXiv PDF link.
  • Download tests: Test the downloaded file name.
    • Test PDF download (Download PDF (arxiv-utils)) in abstract. In firefox, only mouse left-click works, middle-click open up the original PDF page in a new tab.
    • Change filename format options, reload page, and download to verify the filename is changed.
    • Reset filename format option to default, reload page, and download to verify the filename format is default.
    • Test papers with long title.
    • Test papers with special characters in title.
  • The extension button should be disabled outside ArXiv's domain.
  • Clicking the extension button should open a new tab at the right of the current active tab (instead of open at the end of the tab list).
  • (Chrome Only) If OneTab is installed, click its extension button, the list should show the updated titles of both abstract and PDF page.
  • (Chrome Only) Clear the browser cache and reload the PDF page, the title should be the new title after PDF load.
    Test with: https://arxiv.org/abs/1512.03385
  • Verify there are no console errors in both the content script and background script logs.
  • Disable and re-enabling the extension should not cause any errors.
  • Installing or re-enabling the extension should immediately update the title of existing tabs.
  • The help menu item in the context menu should link to this GitHub page.
  • ar5iv tabs should have renamed title, and support navigation.

Run Unit Tests Locally

Launch the docker containers:

cd tests/unit-test
docker compose up -d

Then run the tests:

docker exec -t unit-test-jest-tests-1 \
    /app/tests/unit-test/install-and-run.sh

When done, stop the containers:

cd tests/unit-test
docker compose down

Run End-to-End Tests Locally

Launch the docker containers:

cd tests/end-to-end-test
docker compose up -d

Then run the tests:

docker exec -t end-to-end-test-selenium-tests-1 \
    python "/app/tests/end-to-end-test/test_navigation.py"

When adding new test cases, it is often convenient to comment out existing test cases in tests/testcases/testcases.yaml; When testing specific browsers, you can modify the for browser in [...] part in tests/test_navigation.py to only run tests for the desired browser.

If the test logs stuck at launching the webdriver, you may need to restart the containers.

View the logs or open the following URLs for more details:

The default password for noVNC is secret.

When done, stop the containers:

cd tests/end-to-end-test
docker compose down

Interactive End-to-End Testing

Install VSCode and Dev Containers plugin.

tests/scripts/docker-compose.sh up -d

Press Ctrl + P and select >Dev Container: Attach to Running Container..., then select /end-to-end-test-selenium-tests-1.

In the new VSCode window, click Open Folders and select /app.

Install the Python plugin inside the dev container.

Launch a Terminal inside the dev container and run:

apk add build-base linux-headers

Open tests/end-to-end-test/test_interactive.py, select the first cell and press Shift + Enter and click Install (Install the ipykernel).

You can now begin interactive testing!

Reference: Developing inside a Container

arXiv API

curl "https://export.arxiv.org/api/query?id_list=<ARXIV_ID>"

Reference: arXiv API User's Manual

Build and Publish

Store dashboards:

May need to update description, permission details, and screenshots for Firefox and Chrome store.

Download the signed .crx or .xpi files:

Frequently Asked Questions (FAQ)

  • Q: Why redirect PDFs to a custom viewer in Firefox?

    A: This is due to a bug in Firefox that disallows executing content scripts in the built-in pdf.js viewer, which disallows renaming for PDF tabs. See Firefox Bug 1454760 for more details.

  • Q: Why do the custom PDF viewer in Firefox lacks many features?

    A: Since these features cannot be enabled easily. See #4 and #13 for further details.

  • Q: Selenium (or WebDriver) has no API to click addon/extension buttons, how do the automated tests click the arxiv-utils button?

    A: This can be achieved by any tool that can simulate mouse click. Since we use Selenium Grid, for simplicity, we apply a hacky workaround that use one meta browser to click the arxiv-utils button in another browser through VNC web viewer. I'm not sure if other testing tools can achieve this more easily.

If you have further questions, please open an issue.

Related Extensions

  • musically-ut/arXiv-title-fixer
    This requires a button click to change the pdf title, but will be considered less intrusive than running in the background. (Chrome Only)
  • weakish/arxiv-url
    This claims to add a back button, but I can't get it working.
  • imurray/redirectify
    Automatically redirect PDF links to HTML index page for many academic paper sites. (Compatible with arxiv-utils)
  • vict0rsch/PaperMemory
    If you're looking for an extension with a wider range of useful features, this extension offers just that. Although its UI modifications are slightly more intrusive than arxiv-utils, it is totally acceptable considering that it has so many extra features. It's also worth noting that arxiv-utils does not automatically invoke APIs from external services, which is a difference in design philosophy.
  • AI/ML Papers with Code Everywhere - CatalyzeX [chrome] [firefox]
    Find code links and inject them to a variety of websites. (Compatible with arxiv-utils)