Created
February 11, 2019 03:07
-
-
Save Shilo/62337e724048a14c90491f10aa124f38 to your computer and use it in GitHub Desktop.
Javascript snippit to hide/censor price tags on a website. (Note: seems to break interaction with the site, use at own risk)
This file contains 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
(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