Last active
July 29, 2023 06:46
-
-
Save abaines/8fb9337cb0fab1312e3b53251f47c0e7 to your computer and use it in GitHub Desktop.
roll20 storage sorter
This file contains hidden or 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
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