Last active
May 3, 2020 00:51
-
-
Save acropup/b5149a528316c9adcf10ac274fca8236 to your computer and use it in GitHub Desktop.
ATIC.ca website custom filtering of products in category view
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
/* Category view on ATIC.ca doesn't have any means of filtering items. | |
This script can be run in the browser console and filters based on a product's link text. | |
Used on the Power Supply category: http://www.atic.ca/index.php?page=Products&cat=119 | |
Excellent site for PSU efficiency and noise level testing: | |
https://www.cybenetics.com/index.php?option=database¶ms=1,2,0 | |
*/ | |
document.querySelectorAll("table table table tr td:nth-child(3) a").forEach((item) => { | |
let remove = false; | |
let linkText = item.innerText.toLowerCase(); | |
remove |= !linkText.match(/80PLUS (Gold|Platinum|Titanium)/i);// want high efficiency | |
remove |= !linkText.includes("modular"); // want modular cables | |
let re = linkText.match(/(\d+)W Total Power/i); | |
remove |= (re && re.length == 2 && re[1] < 550); // want higher wattage | |
if (remove) { | |
item.closest('tr').remove(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment