-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.js
41 lines (40 loc) · 1.58 KB
/
user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ==UserScript==
// @name Add DOI Link in Reaxys
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Add a doi direct link after 'Full Text'
// @author Wehnes
// @match https://www.reaxys.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=reaxys.com
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.onhashchange = function () {
var i = 0;
waitForKeyElements(".els-btn.els-btn-link.blue-compact.els-btn-xs.e2e-full-text", re);
setTimeout(re, 1000);
function re(){
var li,doi,a,doi_a;
li = $(".els-btn.els-btn-link.blue-compact.els-btn-xs.e2e-full-text");
for (var len = li.length; i<len ; i++){
doi = li[i].getAttribute("data-doi");
if (doi != null){
doi_a = doi.replace(/\//g,'_');
if ($("a#settled_doi_" + i).length != 1){
doi = "https://doi.org/" + doi;
a = document.createElement("a");
li[i].after(a);
a.setAttribute("href", doi);
a.setAttribute("id", "settled_doi_" + i);
a.setAttribute("target","_blank");
a.innerHTML = 'DOI';
}
}
}
console.log('doi link done');
}
};
})();