Skip to content

Instantly share code, notes, and snippets.

@matthewsimo
Created May 17, 2013 15:33
Show Gist options
  • Save matthewsimo/5599842 to your computer and use it in GitHub Desktop.
Save matthewsimo/5599842 to your computer and use it in GitHub Desktop.
Sort NeonMob collections from Extremely Rare to Common.
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);
});
@matthewsimo
Copy link
Author

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);})();

@joshnh
Copy link

joshnh commented May 18, 2013

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