Created
May 28, 2018 21:13
-
-
Save zuphilip/6328ef22c6ac37b0a7e11ecb253ff552 to your computer and use it in GitHub Desktop.
Tampermonkey script: WoS Citation Report Data Grabber.user.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name WoS Citation Report Data Grabber | |
// @namespace https://data.bib.uni-mannheim.de/ | |
// @version 0.0.1 | |
// @description Copy the data from a Web of Science Citation Report page comma-separated to the clipboard. Invoked by Shift+C or clicking on the user script menu entry. | |
// @author Philipp Zumstein | |
// @include https://apps.webofknowledge.com/* | |
// @grant GM_registerMenuCommand | |
// @grant GM_setClipboard | |
// ==/UserScript== | |
/* | |
* Copyright (c) 2018 Philipp Zumstein | |
* | |
* This software may be modified and distributed under the terms | |
* of the MIT license. | |
*/ | |
GM_registerMenuCommand('Grab WoS Data', grabData); | |
document.addEventListener( "keydown", function(i) { | |
if (i.keyCode === 67 && i.shiftKey) // shift+c | |
{ | |
grabData(); | |
} | |
}); | |
function grabData() { | |
var search = document.getElementById('queryNatural'); | |
//alert(search.value); | |
var commafyObjects = document.getElementsByClassName('commafy'); | |
var commafyArray = [...commafyObjects]; | |
var data = commafyArray.map( | |
x => x.textContent.replace(',', '') | |
); | |
//alert(data); | |
// first number is given twice at the beginning | |
data[0] = search.value; | |
GM_setClipboard(data).join(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment