Display image md5s
当前为
// ==UserScript==
// @name 8chan-MD5
// @version 0.2.2
// @description Display image md5s
// @author Anonymous
// @match *://8ch.net/*
// @grant none
// @namespace https://greasyfork.org/users/18941
// ==/UserScript==
String.prototype.hexEncode = function(){
var result = "";
for (var i = 0; i < this.length; i++) { result += this.charCodeAt(i).toString(16); }
return result
}
function appendMD5(root) {
$(root).find('.files .file').each(function() {
$(this).find('.fileinfo .unimportant').append("<br/>MD5: " + window.atob($(this).find('.post-image').attr('data-md5')).hexEncode());
});
}
// apply md5 to all posts now.
appendMD5(document.body);
// add md5 to any posts that may be added.
var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { var newNodes = mutation.addedNodes; if (newNodes !== null) { $(newNodes).each(function() { appendMD5(this); }); } }); });
observer.observe($('.thread')[0], {attributes: true, childList: true, characterData: true});