Last active
October 6, 2015 04:20
-
-
Save Guidhouse/4030d6ac7ba5bc723d88 to your computer and use it in GitHub Desktop.
Fun in the browser
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
Just for fun, hidding all shirts that doesn't have breast-pockets. | |
http://www.hawesandcurtis.co.uk/menswear/formal_shirts?fit=39&viewAll=True | |
Vanilla JS: | |
Firefox: | |
[].slice.call(document.getElementsByClassName('standard-product')).filter(x =>!(x.textContent.contains('Pocket'))).forEach(function(el){el.style.display = 'none'}) | |
Edge (No contains): | |
String.prototype.contains = function(stringToSearchFor){return this.indexOf(stringToSearchFor) >-1;} | |
[].slice.call(document.getElementsByClassName('standard-product')).filter(x =>!(x.textContent.contains('Pocket'))).forEach(function(el){el.style.display = 'none'}) | |
Chrome(No fat arrow, no contains): | |
[].slice.call(document.getElementsByClassName('standard-product')).filter(function(el){return el.textContent.indexOf('Pocket') === -1}).forEach(function(el){el.style.display = 'none'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment