-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.roster.min.js
1 lines (1 loc) · 2.09 KB
/
jquery.roster.min.js
1
!function(a){a.fn.extend({roster:function(b){var c={lang:"en",locale:"eu",realm:"",guild:""};return b=a.extend(c,b),this.each(function(){obj=a(this),obj.append('<div id="roster" class="table"><table><thead><tr><th class="name"><a href="#" class="sort-link">Name</a></th><th class="race align-center"><a href="#" class="sort-link">Race</a></th><th class="cls align-center"><a href="#" class="sort-link">Class</a></th><th class="lvl align-center"><a href="#" class="sort-link">Level</a></th><th class="rank align-center"><a href="#" class="sort-link">Guild Rank</a></th><th class="ach-points align-center"><a href="#" class="sort-link">Achievement Points</a></th></tr></thead><tbody></tbody></table></div>');var b="http://"+c.locale+".battle.net/api/wow/guild/"+c.realm+"/"+c.guild+"?fields=members,achievements&jsonp=?";a.ajax({url:b,dataType:"jsonp",error:function(a){throw new Error("Failed to load API ("+a.statusText+")")},success:function(b){a.each(b.members,function(b,d){for(var e="row1",f=0;b>f;f++)e=0===f%2?"row2":"row1";var g='<tr class="'+e+'" data-level="'+d.character.level+'">';g+='<td class="name"><strong><a href="http://'+c.locale+".battle.net/wow/"+c.lang+"/character/"+c.realm+"/"+d.character.name+'/" class="color-c'+d.character.class+'">'+d.character.name+"</a></strong></td>",g+='<td class="race"><span class="icon-frame frame-14"><img src="http://media.blizzard.com/wow/icons/18/race_'+d.character.race+"_"+d.character.gender+'.jpg" alt="" width="14" height="14" /></span></td>',g+='<td class="cls" data-raw="'+d.character.class+'"><span class="icon-frame frame-14"><img src="http://media.blizzard.com/wow/icons/18/class_'+d.character.class+'.jpg" alt="" width="14" height="14" /></span></td>',g+='<td class="lvl">'+d.character.level+"</td>",g+=0!==d.rank?'<td class="rank" data-raw="'+d.rank+'"><span>Rank '+d.rank+"</span></td>":'<td class="rank" data-raw="'+d.rank+'"><span class="guild-master">Guild Master<span class="symbol"></span></span></td>',g+='<td class="ach-points"><span class="ach-icon">'+d.character.achievementPoints+"</span></td>",g+="</tr>",a("#roster table tbody").append(g)})}})})}})}(jQuery);