Created
May 17, 2013 15:33
-
-
Save matthewsimo/5599842 to your computer and use it in GitHub Desktop.
Sort NeonMob collections from Extremely Rare to Common.
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
var common = [], uncommon = [], rare = [], veryRare = [], extremelyRare = [], itemGrid, items; | |
itemGrid = $("div.collection ul.item-grid"); | |
items = itemGrid.children(); | |
items.each(function(i,e){ | |
var rarity; | |
if($(this).find("span.title").children("a").attr("class")) { | |
rarity = $(this).find("span.title").children("a").attr("class"); | |
} else { | |
rarity = $(this).find("div.piece").attr("class"); | |
rarity = rarity.replace("piece ", ""); | |
rarity = rarity.replace("one-quarter ", ""); | |
rarity = rarity.replace("empty ", ""); | |
} | |
switch(rarity) { | |
case "common": | |
common.push(e); | |
break; | |
case "uncommon": | |
uncommon.push(e); | |
break; | |
case "rare": | |
rare.push(e); | |
break; | |
case "veryRare": | |
veryRare.push(e); | |
break; | |
case "extremelyRare": | |
extremelyRare.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); | |
}); |
Awesome! I created a userscript for this so that you don't have to manually activate the bookmarklet: http://userscripts.org/scripts/show/167773
I also added the 'Chase' rarity to the script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source file for NeonMob Sort bookmarklet. Only tested in chrome...
To add the bookmarklet, goto chrome://bookmarks/
Then make a new one and copy/paste the following line in & presto-change-o you can now sort the neonmob collections by rarity.
javascript:(function(){var neonMobSort = document.createElement('script');neonMobSort.setAttribute('src', 'https://gist.github.com/matthewsimo/5599842/raw/aa17caeaafc444c5c2f59e646b7a116dbd44a1b9/neonmob-collection-sort.js');document.body.appendChild(neonMobSort);})();