Skip to content

Instantly share code, notes, and snippets.

@scratchyone
Forked from nathanprocks/scratchusernamehash.user.js
Last active September 18, 2020 05:26
Show Gist options
  • Save scratchyone/4b7551a9c9c76f563b7785359f5c7ea3 to your computer and use it in GitHub Desktop.
Save scratchyone/4b7551a9c9c76f563b7785359f5c7ea3 to your computer and use it in GitHub Desktop.
Scratch Username Hash Userscript
// ==UserScript==
// @name Scratch Username Hash
// @namespace nathanprocks.scratchusernamehash
// @version 0.1
// @description Kaj was here
// @author nathanprocks and scratchyone
// @match https://scratch.mit.edu/*
// @grant none
// @require https://cdn.rawgit.com/jupiterio/466bbd644eb3d4b680326da15520071a/raw/be552d004ab21ab8b3bb04e687bb85d231c20554/4096mostFrequentEnglishWords.js
// @require https://cdn.rawgit.com/emn178/js-sha3/master/build/sha3.min.js
// ==/UserScript==
if(location.pathname.indexOf("/discuss/topic/")>-1) {
for(i=0;i<document.querySelectorAll("a.black.username").length;i++) {
ii=document.querySelectorAll("a.black.username")[i];
ii.title = sha3_512(ii.innerText).slice(0,12).match(/.{1,3}/g).map(function(s){return words[parseInt(s,16)];}).join(" ");
}
} else if(location.pathname.indexOf("/users/")>-1) {
for(i=0;i<document.querySelectorAll("#profile-data > div.box-head > div.header-text > h2").length;i++) {
ii=document.querySelectorAll("#profile-data > div.box-head > div.header-text > h2")[i];
ii.title = sha3_512(ii.innerText).slice(0,12).match(/.{1,3}/g).map(function(s){return words[parseInt(s,16)];}).join(" ");
}
} else if(location.pathname.indexOf("/projects/")>-1) {
for(i=0;i<document.querySelectorAll("#owner").length;i++) {
ii=document.querySelectorAll("#owner")[i];
ii.title = sha3_512(ii.innerText).slice(0,12).match(/.{1,3}/g).map(function(s){return words[parseInt(s,16)];}).join(" ");
}
for(i=0;i<document.querySelectorAll("div.info > div.name > a").length;i++) {
ii=document.querySelectorAll("div.info > div.name > a")[i];
ii.title = sha3_512(ii.innerText).slice(0,12).match(/.{1,3}/g).map(function(s){return words[parseInt(s,16)];}).join(" ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment