Skip to content

Instantly share code, notes, and snippets.

@limitedeternity
Created March 14, 2025 15:06
Show Gist options
  • Save limitedeternity/ac422aaa9e03d591ee16f98b5e6aeb3b to your computer and use it in GitHub Desktop.
Save limitedeternity/ac422aaa9e03d591ee16f98b5e6aeb3b to your computer and use it in GitHub Desktop.
Prettify pypi simple index page
let list = document.createElement("ul");
let links = Array.from(document.body.getElementsByTagName("a")).sort((a, b) => a.innerText.localeCompare(b.innerText, undefined, { numeric: true, sensitivity: "base" }));
for (let link of links)
{
let elem = document.createElement("li");
list.appendChild(elem);
document.body.removeChild(link);
elem.appendChild(link);
}
document.body.appendChild(list);
@limitedeternity
Copy link
Author

javascript:let list=document.createElement("ul"),links=Array.from(document.body.getElementsByTagName("a")).sort((c,a)=>c.innerText.localeCompare(a.innerText,void 0,{numeric:!0,sensitivity:"base"}));for(let a of links){let b=document.createElement("li");list.appendChild(b),document.body.removeChild(a),b.appendChild(a)}document.body.appendChild(list);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment