Last active
January 19, 2017 22:27
-
-
Save gabriel-dehan/3654ec7ed6b60261331ab44a8104ec62 to your computer and use it in GitHub Desktop.
filterAmazon script. Copy paste then call filterAmazon(YOUR_NUMBER);
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
var filterAmazon = (function(filterNum) { | |
window.AMZ_FILTER = (function(number) { | |
jQuery('.a-color-price, .sx-price').map(function(i, e) { | |
let num = parseFloat(jQuery(e).text().replace(/£|\$|€/, '')); | |
if (num < number) { | |
return jQuery(e).parents(".zg_itemImmersion, .zg_more_item, .s-item-container").hide(); | |
} else { | |
return null; | |
} | |
}); | |
}); | |
if (! window.jQuery ) { | |
var s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.onload = (function() { window.AMZ_FILTER(filterNum) }); | |
s.src = '//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'; // you can change this url by latest jQuery version | |
(document.getElementsByTagName('head')[0] || | |
document.getElementsByTagName('body')[0]).appendChild(s); | |
} else { | |
window.AMZ_FILTER(filterNum); | |
} | |
}); |
Author
gabriel-dehan
commented
Jan 19, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment