Skip to content

Instantly share code, notes, and snippets.

@djcsdy
Created December 3, 2012 03:15
Show Gist options
  • Save djcsdy/4192422 to your computer and use it in GitHub Desktop.
Save djcsdy/4192422 to your computer and use it in GitHub Desktop.
Convert hex values on a web page to decimal
function fix (node) { while (node) { if (node.nodeType == 3) { node.nodeValue = node.nodeValue.replace(/\$((?:[0-9a-fA-F]{2}){1,2})/g, function (match, value) { return parseInt(value, 16); }); } else { fix(node.firstChild); } node = node.nextSibling; } } fix(document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment