Last active
February 26, 2022 22:10
-
-
Save renatopanda/ca0e9cdce1f36258781553cb6a1aa438 to your computer and use it in GitHub Desktop.
Small Tampermonkey Userscript to show current year citation estimate
This file contains 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 Google Scholar Current Year Citation Estimate | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://scholar.google.pt/citations?* | |
// @match https://scholar.google.com/citations?* | |
// @icon https://www.google.com/s2/favicons?domain=google.pt | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var year_citations = parseInt(document.querySelector("a.gsc_g_a:last-child > span:nth-child(1)").textContent) | |
var total_citations = parseInt(document.querySelector("#gsc_rsb_st > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2)").textContent) | |
var today = new Date(); | |
var day_of_the_year = Math.ceil((today - new Date(today.getFullYear(),0,1)) / 86400000); | |
var year_estimated_citations = Math.round(year_citations / day_of_the_year * 365); | |
var total_estimated_citations = (total_citations + year_estimated_citations - year_citations); | |
var str_citations = year_citations + "\ny:" + year_estimated_citations + "\nt:" + total_estimated_citations; | |
document.querySelector("a.gsc_g_a:last-child > span:nth-child(1)").textContent = str_citations; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment