Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Javascript snippit to hide/censor price tags on a website. (Note: seems to break interaction with the site, use at own risk)
(function(context) {
var priceCensor = "X.XX";
var pattern=/(\$)(\d([\d\,\.]+)?)/g,
callback=function(_,dollar,price) {
price=price.replace(/,/g,'');
return dollar + price;
},
html = context.innerHTML.replace(pattern,callback);
context.innerHTML = html;
})(document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.