0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pubmedのreferenceをいい感じに整形するjavascript書いた【tampermonkey】

Posted at

joslerや退院時サマリーの考察にご使用ください
↓使用例
image.png

pubmed reference 整形
// ==UserScript==
// @name         pubmed reference 整形
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://pubmed.ncbi.nlm.nih.gov/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nih.gov
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
  //必要な箇所の文字を抜き出す
    const publish = document.querySelector('#full-view-journal-trigger').innerText;
    const cit = document.querySelector('#full-view-heading > div.article-citation > div > span.cit').innerText;
    const doi = document.querySelector('#full-view-heading > div.article-citation > span.citation-doi').innerText;
    const title = document.querySelector('#full-view-heading > h1').innerText;
    const author_1 = document.querySelector('#full-view-heading > div.inline-authors > div > div > span:nth-child(1) > a').innerText;
    const author_2 = document.querySelector('#full-view-heading > div.inline-authors > div > div > span:nth-child(2) > a').innerText;
    //htmlを出力
    const markup = `
  <div id="bookinfo" style="background:#333;color:#36d184;padding:.5em;text-align:start;font-family:sans-serif;">
  ${author_1},${author_2},et al.${title}:${publish} ${cit} ${doi}
  </div>
  `
    //htmlを差し込み
    document.querySelector("#article-page").insertAdjacentHTML("beforebegin", markup);

})();

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?