Last active
September 13, 2021 19:26
-
-
Save Darkle/02986dcecf347c44434677c7d7d3ffe3 to your computer and use it in GitHub Desktop.
Sorts the namecheap domain name search by price (the regular price, not the special)
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 getLiItemPrice(element){ | |
var specialPrice = element.querySelector('.price .domain-dollar-value') | |
var regPrice = element.querySelector('.reg-price>div') | |
if(regPrice){ | |
return Number(regPrice.childNodes[7].textContent) | |
} | |
else if(specialPrice){ | |
return Number(specialPrice.childNodes[1].textContent) | |
} | |
} | |
var liItems = Array.from(document.querySelectorAll('.ga-event-ul li')) | |
liItems | |
.sort((prevElem, nextElem) => getLiItemPrice(prevElem) - getLiItemPrice(nextElem)) | |
.forEach(elem => { | |
document.querySelector('.ga-event-ul').appendChild(elem) | |
}) |
Note: This gist is very old, 2016 year. Probably no longer works.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mirror link
https://greasyfork.org/en/scripts/36327-namecheap-sort-results-by-regular-price