Last active
August 29, 2015 14:23
-
-
Save robbiemu/02882b97f38ef98774d4 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name HotSLogs Role Sorting icons | |
// @namespace https://gist.github.com/robbiemu/02882b97f38ef98774d4/ | |
// @version 0.9 | |
// @description Provides roll icons for each class, which are clickable to toggle hiding of other classes | |
// @author Robbiemu | |
// @include /https?\:\/\/www.hotslogs.com\// | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
window.jQ=jQuery.noConflict(true); | |
MoaH = { | |
"warrior": ["Anubarak","Tyrael","Johanna","Sonya","Arthas","Muradin","Chen","Diablo","ETC","Stitches"], | |
"support": ["Brightwing","Rehgar","Uther","LiLi","Tyrande","Malfurion","Tassadar"], | |
"assassin": ["Jaina","Kaelthas","Zeratul","Illidan","Kerrigan","Thrall","Falstad","Nova","Valla","Raynor","Tychus"], | |
"specialist": ["TheLostVikings","Murky","Sylvanas","Nazeebo","Zagara","Azmodan","Gazlowe","Abathur","SgtHammer"] | |
}; | |
jQ(document).ready(function() { | |
jQ('thead tr[role=row] > th[scope=col]:contains("Hero"), thead tr > th[scope=col] > a:contains("Hero")').parents('table').each(function(i,datatable) { | |
jQ(Object.keys(MoaH)).each(function(k,role) { | |
var image = '<img src="http://www.heroesfire.com/images/wikibase/icon/roles/'+role+'.png" title="'+ role.charAt(0).toUpperCase() + role.slice(1) +'" style="max-width: 20px; margin-right: 2px; background-color: rgba(0,0,0,0);" />'; | |
jQ(MoaH[role]).each(function(k,hero) { | |
jQ(jQ(image).insertBefore(jQ(datatable).find('tbody tr img[id$=imgcolumn][src*='+hero+']')).parents('tr')[0]).addClass(role); | |
}); | |
jQ('img[title='+role.charAt(0).toUpperCase()+role.slice(1)+']').click(function() { | |
jQ(datatable).find('tbody tr:not(.'+role+')').toggle(); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment