Created
December 23, 2011 22:12
-
-
Save erikvold/1515501 to your computer and use it in GitHub Desktop.
Github MD5 Hashes
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== | |
// @id github-md5-hashes@erikvold.com | |
// @name Github MD5 Hashes | |
// @version 1.0 | |
// @namespace github-md5-hashes | |
// @author Erik Vold | |
// @description | |
// @include http*//github.com* | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
var $ = function(id) document.getElementById(id); | |
var rawURL = $("raw-url"); | |
var infoDiv = GM_xpath({ | |
path: "//div[@class='file']/div[@class='meta']/div[@class='info']" | |
}); | |
if (!rawURL || !infoDiv) return; | |
var ret = GM_xmlhttpRequest({ | |
method: "GET", | |
url: rawURL.getAttribute("href"), | |
ignoreCache: true, | |
onload: function(res) { | |
var md5 = document.createElement("span"); | |
md5.setAttribute("class", "md5"); | |
md5.appendChild(document.createTextNode(GM_cryptoHash(res.responseText, "MD5"))); | |
infoDiv.appendChild(md5); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment