Skip to content

Instantly share code, notes, and snippets.

@divanvisagie
Last active June 17, 2018 14:46
Show Gist options
  • Save divanvisagie/fb490ef8a9c6c93c57ed827b74e04cd0 to your computer and use it in GitHub Desktop.
Save divanvisagie/fb490ef8a9c6c93c57ed827b74e04cd0 to your computer and use it in GitHub Desktop.
Snippet to cheat at this silly color test https://www.xrite.com/hue-test, just paste the script into your console in devtools.
function extractNumber(element) {
const numberString = element.className.toLowerCase().split(" ")[1].split("fm-")[1];
return parseInt(numberString, 10);
}
function fixRow(number) {
let selectedRow = document.querySelectorAll(`.container-${number} #row-${number} > div`);
let rowArray = Array.prototype.slice.call(selectedRow);
rowArray.sort((x,y) => {
return extractNumber(x) > extractNumber(y);
}); //in line sort is yuck but hey
document.querySelectorAll(`.container-${number} #row-${number} > div`).forEach(x => x.remove());
let rowElement = document.querySelector(`.container-${number} #row-${number}`);
rowArray.forEach(x => rowElement.appendChild(x));
}
[1,2,3,4].forEach(fixRow);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment