Userscript: Display the PMID for each paper

Problem

It takes at least 4 clicks to get the PMID for a paper:

  1. Click “…”
  2. Click “Edit data”
  3. Look for the PMID field, double-click the PMID, Cmd+C to copy
  4. Click “Cancel”

This might not sound like an important complaint. However, you might consider that repetitive strain injury is a real thing that some of us are actually living with.

Solution

Can we do better? I think so. I got it down to just 2 clicks:

  1. Right-click the PMID
  2. Click “Copy”

How? My userscript pulls out the PMID from each paper and displays it in a clickable text element.

Step by step

  1. Install the Tampermonkey extension for your web browser.

  2. Install the script I wrote below and make sure it is turned on when you are visiting paperpile.com/app

1 Like

I wrote another script to put the DOI in the title bar when we are reading a paper. This makes it easy to copy and paste the DOI into other apps — without going back to the Paperpile Library.

Here is a screenshot of the result:

Look at that easy access to the DOI. :sunglasses:

Sadly, we cannot use Javascript to customize chrome-extension pages like this:

chrome-extension://asdf/view-dm.html?mp=asdf

Here is the code:

var dois = [...document.querySelectorAll("span")].filter(d => d.textContent.includes("doi:"))
if (dois.length > 0) {
	var doi = dois[0].innerText.slice(4)
	var el = document.getElementsByClassName("mp-stretcher")[0]
	el.style.setProperty('user-select', 'all')
	el.innerText = doi
}

You can run it by copying and pasting the code into the developer console.

Paperpile would be on another level if we could write our own Javascript extensions.

2 Likes

Thank you for your feedback, @slowkow. I’m pleased to say that in the new Paperpile web app, in beta, we listened to feedback from beta testers, and now you copy the PMID directly from the reference details in your library. You can do this by clicking on the dots menu beneath a reference, right-clicking on the PMID and copying it. And I’ve recorded your request for having the DOI accessible within the PDF viewer for consideration by the team in the future.

Thanks, @suzanne

If someone could invite me, then I’d be happy to test the beta and measure how many clicks it takes me to get the PMID.

I hope we can still write user scripts to hack the new version to suit our own needs without waiting for Paperpile developers.

@slowkow I have sent you an email invitation. Please share any feedback you have by replying to the email.