heroesRank.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  6. <title>英雄数据榜</title>
  7. <meta name="description" content="" />
  8. <meta name="keywords" content="" />
  9. <link rel="stylesheet" href="css/global.css" />
  10. <style>
  11. body { height: 527px; overflow: hidden; }
  12. </style>
  13. <!--[if IE 7]>
  14. <style>
  15. .heroRankCrumbs .fnMenu{margin-top:-23px;}
  16. .sever-select i{margin: -17px 9px 0!important;}
  17. </style>
  18. <![endif]-->
  19. <!--[if gt IE 6]><!-->
  20. <script type="text/javascript">
  21. !function(t){t.loadScript(["http://szhuodong.duowan.com/feq/lolbox/yy-f2e-header-lolbox.min"])}(function(){function t(t){var e=n(t);document.write(e)}function n(t){for(var n,r="",c=0;n=t[c];c++)r+=e(n);return r}function e(t){var n=[unescape("%3Cscript%20type%3D%22text/javascript%22%20src%3D%22"),"",unescape("%22%3E%3C/script%3E")],e=new Date;return e.setSeconds(0),e.setMilliseconds(0),e=e.getTime(),t+="?t_="+e,n[1]=t,n.join("")}return{loadScript:function(n){n&&n.length&&n instanceof Array&&t(n)}}}())
  22. </script>
  23. <!--<![endif]-->
  24. <script src="js/jquery-1.11.1.min.js"></script>
  25. <script src="js/jquery-migrate-1.2.1.min.js"></script>
  26. <script src="js/jquery.cookie.js" type="text/javascript"></script>
  27. <script src="js/heroesList.js" type="text/javascript"></script>
  28. <script>
  29. var IMAGE_URL = "http://img.lolbox.duowan.com";
  30. </script>
  31. </head>
  32. <body scroll="no" style="overflow:hidden;">
  33. <div class="heroRankCrumbs">
  34. <a href="playerSearch.html">战绩查询</a> &gt; 英雄胜率榜
  35. <div class="fnMenu">
  36. <a class="icons back" href="javascript:history.back();"><i></i></a>
  37. <a class="icons refresh" href="javascript:location.reload();"><i></i></a>
  38. </div>
  39. </div>
  40. <div class="box heroRanks-tc">
  41. <div class="box-bd">
  42. <div class="mod-tabs clearfix">
  43. <div class="mod-tabs-bd hero-rank">
  44. <div class="mod-tabs-content">
  45. <div class="hero-left fl">
  46. <div class="choose-type">
  47. <ul class="mod-tabs-trigger">
  48. <li><a class="stat-sign" stat-sign="master" href="rankScoreRank.html" stat-desc="点击/排位高手榜">排位榜</a></li>
  49. <li><a class="stat-sign" stat-sign="action list" href="zdlRank.html" stat-desc="点击/战斗力排行榜">战斗力榜</a></li>
  50. <li class="selected"><a class="stat-sign" stat-sign="hero ace" href="heroesRank.html" stat-desc="点击/英雄高手榜">英雄玩家榜</a></li>
  51. </ul>
  52. </div>
  53. <div class="heros-content">
  54. <div class="common-heros">
  55. <h3>玩家们常用英雄</h3>
  56. <ul class="mod-pic" id="heroList"></ul>
  57. </div>
  58. <div class="heros-search">
  59. <h3>搜索英雄</h3>
  60. <div class="search-input video-search">
  61. <input id="searchInput" class="text" type="text" value="搜索关键词,如”艾克“" onfocus="javascript:if(this.value=='搜索关键词,如”艾克“')this.value='';">
  62. <i id="submitBtn"></i>
  63. </div>
  64. <div class="search-result">
  65. <label>搜索结果:</label><span id="searchResult"></span>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <!-- <div class="hero-right fr video">
  71. <div class="r-c">
  72. <div class="hd">
  73. <h3>热门视频排行</h3>
  74. </div>
  75. <ul class="mod-art rankList"></ul>
  76. </div>
  77. </div> -->
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <script id="heroListTemplate" type="text/template">
  84. <%_.each(data, function(item, i) {
  85. if(i >= 14) return;
  86. var displayName = item.display_name;
  87. var src = IMAGE_URL + "/champions/" + item.name + "_40x40.jpg";
  88. var href = "heroTop10Players.html?hero="+item.name;
  89. %>
  90. <li>
  91. <a href="<%=href%>">
  92. <img src="<%=src%>" alt="<%=displayName%> 点击查看相关比赛" title="<%=item.title%>">
  93. </a>
  94. </li>
  95. <%});%>
  96. </script>
  97. <script id="searchResultTemplate" type="text/template">
  98. <%_.each(data, function(item) {%>
  99. <a href="heroTop10Players.html?hero=<%=item.name%>"><%=item.title%>(<%=item.displayName%>)</a>
  100. <%});%>
  101. </script>
  102. <script type="text/template" id="rankListTemplate">
  103. <li><i class="num"></i><a target="_blank"></a></li>
  104. </script>
  105. <script src="js/jquery-1.11.1.min.js"></script> <script src="js/jquery-migrate-1.2.1.min.js"></script>
  106. <script src="js/underscore.js"></script>
  107. <!--<script type="text/javascript" src="http://sz.duowan.com/s/ya/ya.1.3.1-min.js"></script>-->
  108. <!--<script src="js/new_stat.js"></script>-->
  109. <script>
  110. $(function() {
  111. var Heros = function() {
  112. this.$heroUl = $("#heroList");
  113. this.$heroList = $("#heroList");
  114. this.$submitBtn = $("#submitBtn");
  115. this.$searchInput = $("#searchInput");
  116. this.$searchResult = $("#searchResult");
  117. this.$searchResultTemplate = $("#searchResultTemplate");
  118. this.$heroListTemplate = $("#heroListTemplate");
  119. this.heroData = [];
  120. this.heroListData = this._translateToArray(heroesList);
  121. this.heroUrl = 'http://api.lolbox.duowan.com/api/v2/champion/popular/';
  122. this.videoRankUrl = 'http://lolbox.duowan.com/api/article/index.php?action=preview_jsonp&callback=cb';
  123. };
  124. Heros.prototype = {
  125. constructor: Heros,
  126. init: function() {
  127. var self = this;
  128. this._renderRankList();
  129. this.$submitBtn.on("click", function(e) {
  130. self._searchLogic(e);
  131. });
  132. this.$searchInput.keydown(function(e){
  133. if(e.which == 13){
  134. self._searchLogic(e);
  135. }
  136. });
  137. this._getHeroListData().done(function(resp) {
  138. var list = resp.champion_list;
  139. if(resp && list && list.length > 0) {
  140. self.heroData = list;
  141. self._renderHeroList();
  142. }
  143. });
  144. },
  145. _searchLogic: function(e) {
  146. e.preventDefault();
  147. var value = this.$searchInput.val();
  148. if(value.indexOf(",") != -1) return;
  149. var data = this._getFromHeroList(value);
  150. this._renderSearch(data);
  151. },
  152. _renderHeroList: function() {
  153. var template = _.template(this.$heroListTemplate.html());
  154. this.$heroList.html(template({data:this.heroData}));
  155. },
  156. _getFromHeroList: function(value) {
  157. var data = [];
  158. if(!value) {
  159. data = this.heroListData;
  160. } else {
  161. var hero = heroesList[value];
  162. if(hero != undefined) {
  163. data.push(hero);
  164. } else {
  165. for(var i=0,len=this.heroListData.length;i<len;i++) {
  166. var item = this.heroListData[i];
  167. if(item.name == value || item.displayName == value || item.title == value) {
  168. data.push(item);
  169. break;
  170. }
  171. }
  172. }
  173. }
  174. return data;
  175. },
  176. _translateToArray: function(data) {
  177. var temp = [];
  178. for(var key in data) {
  179. temp.push(data[key]);
  180. }
  181. return temp;
  182. },
  183. _renderSearch: function(data) {
  184. var template = _.template(this.$searchResultTemplate.html());
  185. this.$searchResult.html(template({data:data}));
  186. },
  187. _getHeroListData: function() {
  188. return $.ajax({
  189. url: this.heroUrl,
  190. dataType: 'jsonp'
  191. });
  192. },
  193. _getVideoRankData: function() {
  194. return $.ajax({
  195. url: this.videoRankUrl,
  196. dataType: 'jsonp',
  197. jsonpCallback: 'jQueryJsonp',
  198. jsonp: 'callback'
  199. });
  200. },
  201. _renderRankList: function(){
  202. this._getVideoRankData().done(function(data){
  203. var html = '';
  204. var template = $('#rankListTemplate').html();
  205. _.each(data.hot_video.slice(0, 8), function(item, key){
  206. var _tmp = $(template);
  207. _tmp.find('a').attr('href', item.url_source).text(item.title);
  208. _tmp.find('.num').text(++key);
  209. if(key == 1){
  210. _tmp.addClass('first');
  211. }
  212. html += _tmp[0].outerHTML;
  213. });
  214. $('.rankList').html(html);
  215. });
  216. }
  217. };
  218. new Heros().init();
  219. });
  220. </script>
  221. <!--海度统计-->
  222. <script type="text/javascript">_hiido_no=0;_hiido_wid=["lbox"];</script>
  223. <script src="http://www.duowan.com/duowan.js" type="text/javascript"></script>
  224. <!--百度统计-->
  225. <script>
  226. var _hmt = _hmt || [];
  227. (function() {
  228. var hm = document.createElement("script");
  229. hm.src = "//hm.baidu.com/hm.js?72772dda37b1e926733138415981abcf";
  230. var s = document.getElementsByTagName("script")[0];
  231. s.parentNode.insertBefore(hm, s);
  232. })();
  233. </script>
  234. <!--[if gt IE 6]><!-->
  235. <script type="text/javascript">
  236. window.onerror = function(a,b,c){ return true};!function(t){t.loadScript(["http://szhuodong.duowan.com/feq/lolbox/yy-f2e-lolbox.min"])}(function(){function t(e,a){var n=a[e];if(n){e++;var o=document.createElement("script");o.type="text/javascript",o.setAttribute("async","async"),o.onload=o.onreadystatechange=function(){return o.readyState&&"complete"!==o.readyState&&"loaded"!==o.readyState?!1:(o.onload=o.onreadystatechange=null,void t(e,a))};var c=new Date;c.setSeconds(0),c.setMilliseconds(0),c=c.getTime(),o.async=!0,o.src=n+"?_="+c,document.getElementsByTagName("head")[0].appendChild(o)}}return{loadScript:function(e){e&&e.length&&e instanceof Array&&t(0,e)}}}());
  237. </script>
  238. <!--<![endif]-->
  239. </body>
  240. </html>