Skip to content

Instantly share code, notes, and snippets.

@ahamilton9
Created March 30, 2020 19:57
Show Gist options
  • Save ahamilton9/1cf17fbec6f06c90bd0243231b6da53b to your computer and use it in GitHub Desktop.
Save ahamilton9/1cf17fbec6f06c90bd0243231b6da53b to your computer and use it in GitHub Desktop.
$ to πŸ•­ Bookmarklet
/**
* 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