Created
March 30, 2020 19:57
-
-
Save ahamilton9/1cf17fbec6f06c90bd0243231b6da53b to your computer and use it in GitHub Desktop.
$ to π Bookmarklet
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
/** | |
* Converts dollar signs to bell symbols | |
* Tom Nook prefers it this way | |
*/ | |
var node, | |
nodes = [], | |
walk = document.createTreeWalker( | |
document.body, | |
NodeFilter.SHOW_TEXT, | |
null, | |
false | |
); | |
while(node = walk.nextNode()) {nodes.push(node);} | |
nodes.forEach(function(node) { | |
if(node.textContent.includes('$')) { | |
node.nodeValue = node.nodeValue.replace('$', 'π'); | |
} | |
}); | |
/** | |
* To make a bookmark item that converts the current page, | |
* copy this minified version to the "location" of a bookmark: | |
*/ | |
javascript: for(var node,nodes=[],walk=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1);node=walk.nextNode();)nodes.push(node);nodes.forEach(function(e){e.textContent.includes("$")&&(e.nodeValue=e.nodeValue.replace("$","π"))});; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment