Last active
December 20, 2015 00:19
-
-
Save oscarmarcelo/6040965 to your computer and use it in GitHub Desktop.
Sort Neonmob oficial page sets
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
var common = [], uncommon = [], rare = [], veryRare = [], extremelyRare = [], chase = [], variant = [], itemGrid, items; | |
itemGrid = $("div.pod ul.item-list"); | |
items = itemGrid.children(); | |
items.each(function(i,e){ | |
var rarity; | |
if($(this).find("div.thumb ul.attributes li.rarity i").attr("title")) { | |
rarity = $(this).find("div.thumb ul.attributes li.rarity i").attr("title"); | |
} | |
switch(rarity) { | |
case "Common": | |
common.push(e); | |
break; | |
case "Uncommon": | |
uncommon.push(e); | |
break; | |
case "Rare": | |
rare.push(e); | |
break; | |
case "Very rare": | |
veryRare.push(e); | |
break; | |
case "Extremely rare": | |
extremelyRare.push(e); | |
break; | |
case "Chase": | |
chase.push(e); | |
break; | |
case "Variant": | |
variant.push(e); | |
break; | |
} | |
}); | |
prependEl = function(e) { | |
itemGrid.prepend(e); | |
} | |
common.forEach(function(e,i,a){ | |
prependEl(e); | |
}); | |
uncommon.forEach(function(e,i,a){ | |
prependEl(e); | |
}); | |
rare.forEach(function(e,i,a){ | |
prependEl(e); | |
}); | |
veryRare.forEach(function(e,i,a){ | |
prependEl(e); | |
}); | |
extremelyRare.forEach(function(e,i,a){ | |
prependEl(e); | |
}); | |
chase.forEach(function(e,i,a){ | |
prependEl(e); | |
}); | |
variant.forEach(function(e,i,a){ | |
prependEl(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment