Skip to content

Instantly share code, notes, and snippets.

@abaines
Last active July 29, 2023 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abaines/8fb9337cb0fab1312e3b53251f47c0e7 to your computer and use it in GitHub Desktop.
Save abaines/8fb9337cb0fab1312e3b53251f47c0e7 to your computer and use it in GitHub Desktop.
roll20 storage sorter
let t = { "KB":1, "MB":1000};
function c(a,b)
{
return a.size-b.size;
}
$('.library-container').map( function(cb,el,index){
var c31 = el.children[3].children[1];
if (!c31){
console.log("⁉",el.children[3]);
return {
name: "",
size: -1,
human:""
}}
var hs = c31.innerText;
var split = hs.split(" ");
var main = split[0]
var mult = t[split[1]]
var name = el.children[1].children[0].innerText
var link = el.children[0].children[0].src
console.log("❓", name , link )
return {
name: el.children[1].children[0].innerText,
size: main*mult,
human:hs,
link
};
})
.sort(c)
.each(function(el,n) {
console.log("✅",n )
});;
console.log();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment