Created
October 16, 2012 17:29
-
-
Save julescarbon/3900730 to your computer and use it in GitHub Desktop.
bookmarklet: strip commas #textmeme
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
javascript:(function () { | |
function getTextNodesIn(node, includeWhitespaceNodes) { | |
var textNodes = [], whitespace = /^\s*$/; | |
function getTextNodes(node) { | |
if (node.nodeType == 3) { | |
if (includeWhitespaceNodes || !whitespace.test(node.nodeValue)) { | |
textNodes.push(node); | |
} | |
} else { | |
for (var i = 0, len = node.childNodes.length; i < len; ++i) { | |
getTextNodes(node.childNodes[i]); | |
} | |
} | |
} | |
getTextNodes(node); | |
return textNodes; | |
} | |
var textNodes = getTextNodesIn(document.body); | |
var punctuation = /,/g; | |
for (var i = 0, len = textNodes.length; i < len; i++) { | |
textNodes[i].textContent = textNodes[i].textContent.replace(punctuation,""); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment