personal_v3.0.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. (function(window) {
  2. window.staticImg = "http://static.lolbox.duowan.com/images";
  3. //格式化段位显示,优化前人留下的一大堆重复性代码
  4. var formatDW = function(zdlData) {
  5. var tierName;
  6. if (!zdlData) {
  7. tierName = '无段位';
  8. } else if (zdlData['t_zh'] == '无段位') {
  9. tierName = zdlData['t_zh'];
  10. } else {
  11. tierName = zdlData['t_zh'] + zdlData['r_zh'];
  12. }
  13. return tierName;
  14. }
  15. var personalInfoTpl = __inline("../tpl/personalInfo.tmpl"); //用户信息渲染模板
  16. var generalHistoryTpl = __inline("../tpl/generalHistory.tmpl"); //最近比赛渲染模板
  17. var generalEchartsTpl = __inline("../tpl/generalEcharts.tmpl"); //最近比赛渲染模板
  18. var Personal = function(type) {
  19. this.gameZone = getURLParam("gameZone");
  20. this.userId = getURLParam("userId");
  21. this.urlServerName = getURLParam("serverName");
  22. this.urlPlayerName = getURLParam("playerName");
  23. this.serverName = encodeURIComponent(this.urlServerName);
  24. this.playerName = encodeURIComponent(this.urlPlayerName);
  25. this.boxUserId = $.cookie("boxUserId");
  26. this.boxPlayerName = encodeURIComponent($.cookie("boxPlayerName"));
  27. this.boxPlayerName = encodeURIComponent($.cookie("boxPlayerName"));
  28. this.type = type;//页面类型
  29. this.Services = "http://api.lolbox.duowan.com/api/v3/player/";
  30. this.baseUrl = "http://api.lolbox.duowan.com/api/v3/player/"+ this.gameZone +"/" + this.userId + '/';
  31. //饼图默认设置
  32. this.highchartsOpts = {
  33. chart: {
  34. type: 'pie'
  35. },
  36. plotOptions: {
  37. series: {
  38. dataLabels: {
  39. enabled: false
  40. }
  41. }
  42. },
  43. tooltip: {
  44. enabled:false
  45. },
  46. drilldown: {
  47. series: null
  48. }
  49. };
  50. this.init();
  51. };
  52. Personal.prototype = {
  53. constructor: Personal,
  54. init: function() {
  55. var self = this;
  56. self.bindEvents();
  57. //获取除开KDA那行的其他数据
  58. self._getData().done(function(result, status, xhr) {
  59. // 数据重组
  60. var isMyself = result.is_myself;
  61. var followed = result.followed;
  62. var data = result.player_list[0];
  63. self.userInfo = data; // 缓存数据
  64. data.isSelf = isMyself;
  65. data.followed = followed;
  66. // 视图渲染
  67. self._render(data);
  68. self.renderByPageType();
  69. self._moreGameResult();
  70. });
  71. $('#modeTabs>li').each(function(item) {
  72. var pageName = $(this).data('name');
  73. $(this).find('a').attr('href', pageName + '.html?serverName=' + self.serverName + '&playerName=' + self.playerName + '&userId=' + self.userId + '&gameZone=' + self.gameZone);
  74. });
  75. // 非本人才显示返回按钮
  76. if ( self.boxUserId != self.userId ) {
  77. $('.common-page__goBack').css('visibility', 'visible');
  78. }
  79. },
  80. // 页面渲染路由
  81. renderByPageType: function() {
  82. switch(this.type) {
  83. case 'tab1': this.renderTab1();break;
  84. case 'tab2': this.renderTab2();break;
  85. case 'tab3': this.renderTab3();break;
  86. case 'tab4': this.renderTab4();break;
  87. }
  88. },
  89. // 战绩总览页面渲染入口
  90. renderTab1: function() {
  91. var self = this;
  92. //近20场比赛
  93. $('#compositeRateContainer').highcharts($.extend({}, this.highchartsOpts, {
  94. colors: ['#eeeeee', '#9ec8eb'],
  95. series: [{
  96. colorByPoint: true,
  97. data: [{
  98. y: 100 - self.userInfo.stat_perf.kda.average_win_rate
  99. }, {
  100. y: self.userInfo.stat_perf.kda.average_win_rate
  101. }]
  102. }]
  103. }));
  104. var userPosition = parseInt($('.data-userPosition').attr("data-percent"), 10) || 0;
  105. userPosition = userPosition >= 100 ? 100 : userPosition;
  106. //最强位置
  107. $('#jungleAreaContainer').highcharts($.extend({}, this.highchartsOpts, {
  108. colors: ['#eeeeee','#a1d8b9'],
  109. series: [{
  110. colorByPoint: true,
  111. data: [{
  112. y: 100 - userPosition
  113. }, {
  114. y: userPosition
  115. }]
  116. }]
  117. }));
  118. // 最近比赛跳转
  119. $(document).on('click', '#history li', function() {
  120. var historyId = $(this).index();
  121. location.href = "historyRecord.html?serverName=" + self.serverName + "&playerName=" + self.playerName + "&userId=" + self.userId + "&gameZone=" + self.gameZone + '&historyId=' + historyId;
  122. })
  123. },
  124. // 历史战绩页面渲染入口
  125. renderTab2: function() {},
  126. // 擅长领域页面渲染入口
  127. renderTab3: function() {
  128. var self = this;
  129. var defaultColors = ['#eeeeee', '#9ec8eb'];
  130. var navLists = ['打野','输出','辅助'];
  131. // TAB切换
  132. $('.content-nav li').on('click', function(e) {
  133. e.preventDefault();
  134. var id = $(this).data('id');
  135. renderByNav(id);
  136. $(this).addClass('active').siblings().removeClass('active');
  137. });
  138. //初始化第一个TAB
  139. renderByNav(0);
  140. // 内容渲染
  141. function renderByNav(index) {
  142. var type = decodeURI(navLists[index]);
  143. //获取视频数据
  144. getVideosData(type, 4).done(function(resp) {
  145. if(resp && resp.videos) {
  146. // 更多推荐视频路由
  147. var videos = resp.videos, moreLink;
  148. switch(index) {
  149. case 0: moreLink = 'http://v.huya.com/lol/jiaoxue/daye.html';break;
  150. case 1: moreLink = 'http://v.huya.com/t/shuchushipin.html';break;
  151. case 2: moreLink = 'http://v.huya.com/t/fuzhushipin.html';break;
  152. };
  153. videos.moreLink = moreLink;
  154. // 推荐视频渲染
  155. var templateVideos = _.template($("#detailVideosTemp").html());
  156. $("#detailVideos").html(templateVideos({
  157. data: videos
  158. }));
  159. }
  160. });
  161. // 获取区间数据
  162. self.getUserRank().done(function(o) {
  163. if ( o.results[0] ) {
  164. self.ZoneData = o.results;
  165. renderMainModule(index); // 依赖区间数据
  166. }
  167. })
  168. }
  169. // 擅长领域中间部分数据重组和渲染
  170. function renderMainModule(index) {
  171. // 用户段位
  172. var duanwei = parseInt($('.userDuanwei').attr('data-duanwei'), 10);
  173. // 算法表
  174. var title = [
  175. '个人参团数/团队团战数', //参团率
  176. '小龙击杀数量/小龙复活次数', //大小龙率
  177. '支援成功次数/支援次数', //GANK率
  178. '个人存活时间/游戏持续时间', //存活率
  179. '个人输出量/团队总体输出量', //输出率
  180. '个人插(排)眼数/团队总(插)眼数', //插/反眼率
  181. ];
  182. // 数据构造
  183. var positionEname = ['jungler','adc','support'];
  184. var Position = self.userInfo.stat_perf.position_perf;
  185. var Database = {
  186. // 饼图名字关系表
  187. t_chart__name: [
  188. {'name1': '参团率', 'name2': '小龙率', 'name3': 'GANK率', 'title1': title[0], 'title2': title[1], 'title3': title[2]},
  189. {'name1': '存活率', 'name2': '参团率', 'name3': '输出率', 'title1': title[3], 'title2': title[0], 'title3': title[4]},
  190. {'name1': '存活率', 'name2': '参团率', 'name3': '视野率', 'title1': title[3], 'title2': title[0], 'title3': title[5]}
  191. ],
  192. // 概率关系表
  193. t_chart_rate: [
  194. {'rate1': Position.rate_assists_jungler, 'rate2': Position.rate_dragon_killed_jungler || 0, 'rate3': Position.rate_gank_jungler},
  195. {'rate1': Position.rate_keep_alive_adc, 'rate2': Position.rate_assists_adc, 'rate3': Position.rate_damage_adc},
  196. {'rate1': Position.rate_keep_alive_support, 'rate2': Position.rate_assists_support, 'rate3': Position.rate_vision_support}
  197. ],
  198. // 区间概率
  199. zone: [
  200. {'zone1': self.ZoneData[duanwei]['rate_assists_jungler'], 'zone2': self.ZoneData[duanwei]['rate_dragon_killed_jungler'], 'zone3': self.ZoneData[duanwei]['rate_gank_jungler']},
  201. {'zone1': self.ZoneData[duanwei]['rate_keep_alive_adc'], 'zone2': self.ZoneData[duanwei]['rate_assists_adc'], 'zone3': self.ZoneData[duanwei]['rate_damage_adc']},
  202. {'zone1': self.ZoneData[duanwei]['rate_keep_alive_support'], 'zone2': self.ZoneData[duanwei]['rate_assists_support'], 'zone3': self.ZoneData[duanwei]['rate_vision_support']}
  203. ],
  204. // 列表标题关系表
  205. t_list__name: ['打野', '输出', '辅助'],
  206. // 底部场均信号沟通等数据
  207. t_bottom: [
  208. {signal: Position.signals_sent_jungler, eye: Position.rate_vision_jungler || 0, kill: Position.neutral_minions_killed_jungler, tower: Position.turrets_killed_jungler}, //打野
  209. {signal: Position.signals_sent_adc, eye: Position.rate_vision_adc || 0, kill: Position.neutral_minions_killed_adc, tower: Position.turrets_killed_adc}, //输出
  210. {signal: Position.signals_sent_support, eye: Position.rate_vision_support || 0, kill: Position.neutral_minions_killed_support, tower: Position.turrets_killed_support} //辅助
  211. ]
  212. }
  213. // 渲染
  214. var templateMain = _.template($("#detailMainTemp").html());
  215. $("#detailMain").html(templateMain({
  216. data: {
  217. // 三个概率图
  218. chart1: {
  219. name: Database.t_chart__name[index]['name1'],
  220. rate: Database.t_chart_rate[index]['rate1'],
  221. title: Database.t_chart__name[index]['title1']
  222. },
  223. chart2: {
  224. name: Database.t_chart__name[index]['name2'],
  225. rate: Database.t_chart_rate[index]['rate2'],
  226. title: Database.t_chart__name[index]['title2']
  227. },
  228. chart3: {
  229. name: Database.t_chart__name[index]['name3'],
  230. rate: Database.t_chart_rate[index]['rate3'],
  231. title: Database.t_chart__name[index]['title3']
  232. },
  233. // 常在打野、输出、辅助列表
  234. list: {
  235. title: Database.t_list__name[index],
  236. data: self.userInfo.stat_perf.position_champ[positionEname[index]]
  237. },
  238. // 底部场均信号沟通等数据
  239. bottom: Database.t_bottom[index],
  240. zone: Database.zone[index],
  241. All: Position
  242. }
  243. }));
  244. // 渲染饼图
  245. renderEcharts({
  246. rate1: Database.t_chart_rate[index]['rate1'],
  247. rate2: Database.t_chart_rate[index]['rate2'],
  248. rate3: Database.t_chart_rate[index]['rate3']
  249. });
  250. }
  251. // 渲染饼图
  252. function renderEcharts(rateData) {
  253. $('#gankContainer').highcharts($.extend({}, self.highchartsOpts, {
  254. colors: defaultColors,
  255. series: [{
  256. colorByPoint: true,
  257. data: [{
  258. y: 100 - rateData.rate1
  259. }, {
  260. y: rateData.rate1
  261. }]
  262. }]
  263. }));
  264. $('#joinPartyContainer').highcharts($.extend({}, self.highchartsOpts, {
  265. colors: ['#eeeeee', '#f7cebe'],
  266. series: [{
  267. colorByPoint: true,
  268. data: [{
  269. y: 100 - rateData.rate2
  270. }, {
  271. y: rateData.rate2
  272. }]
  273. }]
  274. }));
  275. $('#dragonContainer').highcharts($.extend({}, self.highchartsOpts, {
  276. colors: defaultColors,
  277. series: [{
  278. colorByPoint: true,
  279. data: [{
  280. y: 100 - rateData.rate3
  281. }, {
  282. y: rateData.rate3
  283. }]
  284. }]
  285. }));
  286. }
  287. // 获取推荐视频
  288. function getVideosData(type, limit) {
  289. var url = 'http://v.huya.com/?r=api/GetVideoForBox&location=' + type + '&limit=' + limit;
  290. return $.ajax({
  291. url: url,
  292. dataType: 'jsonp'
  293. });
  294. }
  295. },
  296. // 个人成就页面渲染入口
  297. renderTab4: function() {
  298. var self = this;
  299. // 个人成就拆分逻辑加载
  300. $.getScript( achievementJS, function() {
  301. App.highchartsOpts = self.highchartsOpts;
  302. App.defaultColors = ['#eeeeee', '#9ec8eb'];
  303. });
  304. },
  305. // 事件绑定
  306. bindEvents: function() {
  307. var self = this;
  308. $("body").delegate(".handles .copy", "click", function(e) {
  309. event.preventDefault();
  310. if (window.clipboardData && window.clipboardData.setData !== undefined) {
  311. var achievement = $(this).parent().find(".copy-text").text();
  312. window.clipboardData.setData('Text', achievement);
  313. alert('复制成功');
  314. }
  315. });
  316. $("body").delegate(".combat-explain,.handles a", 'click', function(e) {
  317. var stat = $(this).attr("stat-sign") || '',
  318. yaDxinesc = $(this).attr("stat-desc") || '',
  319. yaCode = "click/"+stat;
  320. try {
  321. window.external.data_report(yaCode, yaDxinesc);
  322. } catch(err) {}
  323. });
  324. $("body").delegate('.blacklist', 'click', function(e) {
  325. e.preventDefault();
  326. if($(this).hasClass('hide-list')) {
  327. $(this).removeClass('hide-list').html('隐藏拉黑');
  328. $('.blacklist-content2').show();
  329. } else{
  330. $(this).addClass('hide-list').html('拉黑');
  331. $('.blacklist-content2').hide();
  332. }
  333. });
  334. $("body").on('mouseenter', '.table-history__lastseason .toggle-s4-s5', function(e) {
  335. $('.s4-s5').show();
  336. $('.table-arrow').addClass('up');
  337. }).on('mouseleave', '.table-history', function() {
  338. $('.s4-s5').hide();
  339. $('.table-arrow').removeClass('up');
  340. });;
  341. $("#screenshot").on("click", function(e) {
  342. $('.share').removeClass('hover');
  343. setTimeout(function () {
  344. window.location.href = 'lolboxphoto://'+data.game_zone.server_name+'_'+data.pn+'_玩家详情';
  345. }, 200);
  346. });
  347. /* 关注鼠标悬浮显示 */
  348. $(document).on('mouseenter', '.name-info', function(event) {
  349. $('.userInfo-common__focus').show();
  350. }).on('mouseleave', '.name-info', _.debounce(function(){
  351. $('.userInfo-common__focus').hide();
  352. }, 4000))
  353. //关注、取消关注
  354. $("body").delegate(".attention", "click", function(e) {
  355. e.preventDefault();
  356. if(!self.boxUserId) {
  357. alert('非法操作,请至少登陆一次游戏!');
  358. return;
  359. }
  360. var type = $(this).attr("data-action"), that = this;
  361. var action = type == 'addFocus' ? 'follow' : 'unfollow';
  362. var url = "http://api.lolbox.duowan.com/api/v3/player/"+self.gameZone+"/" + self.boxUserId + '/'+action+'/?user_id='+self.userId;
  363. $.ajax({
  364. url: url,
  365. type: 'get',
  366. dataType: 'jsonp',
  367. success: function(result) {
  368. if (result) {
  369. if(type == "addFocus") {
  370. $(that).addClass("already").attr("data-action", "removeFocus")
  371. .find("span").html("已关注");
  372. } else {
  373. $(that).removeClass("already").attr("data-action", "addFocus")
  374. .find("span").html("关注");
  375. }
  376. }
  377. }
  378. });
  379. });
  380. // 返回上一页
  381. $('.common-page__goBack').on('click', function() {
  382. window.history.back();
  383. return false;
  384. });
  385. // 刷新按钮
  386. $('.common-page__reflash').on('click', function() {
  387. location.reload();
  388. });
  389. },
  390. // 获取个人详细信息
  391. _getData: function() {
  392. var url = this.baseUrl;
  393. return $.ajax({
  394. url: url,
  395. type: 'GET',
  396. dataType: 'jsonp'
  397. });
  398. },
  399. _getKDAData: function() {
  400. var url = this.baseUrl + "?_do=personal/positionhonorkda&serverName=" + this.serverName + "&playerName=" + this.playerName;
  401. return $.ajax({
  402. url: url,
  403. type: 'GET',
  404. dataType: 'jsonp'
  405. });
  406. },
  407. // 数据渲染入口
  408. _render: function(data) {
  409. var self = this;
  410. self.userInfo = data; // 数据备份
  411. self.playerId = data.user_id;
  412. // 个人信息数据渲染
  413. self._renderPersonalInfo(data);
  414. //战绩总览数据渲染
  415. if( self.type == 'tab1' ) {
  416. $(".fighting-history__view").html(generalEchartsTpl({data: data}));
  417. try{
  418. self._renderHistory(data);
  419. self._renderKDA(data);
  420. }catch(e){}
  421. }
  422. // 广告接入
  423. $('.p-adwrap').html($('.ad-module a'));
  424. // 内容显示
  425. $(".box-bd").show();
  426. },
  427. // 个人信息通用模块渲染
  428. _renderPersonalInfo: function(data) {
  429. var href = "historyRecord.html?serverName=" + this.serverName + "&playerName=" + this.playerName + "&userId=" + this.userId + "&gameZone=" + this.gameZone;
  430. var attentionUrl = "http://lolbox.duowan.com/webApi.php?serverName=" + this.serverName + "&playerName=" + this.playerName + "&targetServerName=" + this.boxServerName + "&targetPlayerName=" + this.boxPlayerName + "&action=";
  431. //储存个人信息
  432. data.global = {};
  433. //二维码url
  434. data.global.qrcodeUrl = "http://lolbox.duowan.com/qrcode.php?openmode=barcode&serverName=" + this.serverName + "&playerName=" + this.playerName;
  435. //头像url,点击去到战绩页面
  436. data.global.href = href;
  437. //关注/取消关注接口baseUrl
  438. data.global.aUrl = attentionUrl;
  439. $("#currentNav").html(data.pn+"("+data.game_zone.alias+")").attr("href", location.href);
  440. // 头部个人信息模板渲染
  441. $("#personalInfo").html(personalInfoTpl({data: data}));
  442. var client = new ZeroClipboard( document.getElementById("copy-button") );
  443. client.on( "ready", function( readyEvent ) {
  444. client.on( "aftercopy", function( event ) {
  445. alert("复制成功!用户名:" + event.data["text/plain"] );
  446. });
  447. });
  448. // 称号图片地址
  449. // if ( data.honor_title ) {
  450. // var placeholder = $('.userMedal').attr('src');
  451. // var src = placeholder.replace('placeholder', ['a_level_', data.honor_title].join(''));
  452. // $('.userMedal').attr('src', src);
  453. // }
  454. },
  455. _renderKDA: function(data) {
  456. this._renderDaYe(data);
  457. this._renderKDADetail(data);
  458. },
  459. _renderDaYe: function(data) {
  460. var colorsArr = ['#fbb28f','#cea9d7','#fa9f9f','#80c989','#9dc7eb'], setColors = [], setData = [], i=0;
  461. var statPosition = data.stat_position;//英雄位置统计
  462. if(statPosition) {
  463. for(var key in statPosition) {
  464. var value = statPosition[key];
  465. if(key != 'total_game' && value != 0) {
  466. var keyTxt = '';
  467. switch(key) {
  468. case 'adc': keyTxt = 'ADC';break;
  469. case 'jungler': keyTxt = '打野';break;
  470. case 'mid': keyTxt = '中单';break;
  471. case 'support': keyTxt = '辅助';break;
  472. case 'top': keyTxt = '上单';break;
  473. };
  474. setData.push({
  475. value: value,
  476. label: keyTxt
  477. });
  478. setColors.push(colorsArr[i++]);
  479. }
  480. }
  481. }
  482. $("body").delegate("#daYe, .kda-li, .kill-li", "mouseenter", function(e) {
  483. e.preventDefault();
  484. if($(this).hasClass("da-ye")) {
  485. $(".daye-hover").show();
  486. } else if($(this).hasClass("kda-li")) {
  487. $(".kda-hover").show();
  488. } else {
  489. $(".kill-hover").show();
  490. }
  491. });
  492. $("body").delegate("#daYe, .kda-li, .kill-li", "mouseleave", function(e) {
  493. e.preventDefault();
  494. if($(this).hasClass("da-ye")) {
  495. $(".daye-hover").hide();
  496. } else if($(this).hasClass("kda-li")) {
  497. $(".kda-hover").hide();
  498. } else {
  499. $(".kill-hover").hide();
  500. }
  501. });
  502. //近7天英雄使用次数
  503. $("#heroTime").html(statPosition.total_game);
  504. },
  505. _renderKDADetail: function(data) {
  506. var template = _.template($("#kdaTemp").html());
  507. $("#kda").html(template({
  508. data: data
  509. }));
  510. },
  511. _renderHistory: function(data) {
  512. var nextFirstWinTime = data.timestamp_until_next_first_win_bonus;
  513. var currentTime = new Date().getTime();
  514. $(".f-time").html('首胜可用');
  515. $("#firstMsg").addClass('active-status');
  516. if ( currentTime < nextFirstWinTime*1000 ) {
  517. $("#firstMsg").removeClass('active-status');
  518. countDown(nextFirstWinTime, '.f-time');
  519. }
  520. $("#firstMsg").on('mouseenter', function(e) {
  521. $('.first-win-hover').show();
  522. }).on('mouseleave', function(e) {
  523. $('.first-win-hover').hide();
  524. });
  525. // 倒计时方法
  526. function countDown(times, target) {
  527. var times = Math.ceil(parseInt(times)*1000);
  528. var timerId = setInterval(function() {
  529. if ( times <= 0 ) {
  530. $(target).html('首胜可用');
  531. $("#firstMsg").addClass('active-status');
  532. return;
  533. }
  534. var h = parseInt(times % 86400 / 3600),
  535. m = parseInt(times % 86400 % 3600 / 60),
  536. s = parseInt(times % 86400 % 3600 % 60 % 60);
  537. s = s < 10 ? '0' + s : s;
  538. $(target).html([h,':',m,':',s].join(''));
  539. times--;
  540. }, 1*1000);
  541. }
  542. //最近战绩
  543. setTimeout(function() {
  544. $("#history").html(generalHistoryTpl({
  545. data: data.game_recent_list
  546. })).niceScroll({
  547. cursorcolor: "#D9D9D9",
  548. cursorwidth: "8",
  549. cursoropacitymin: 1,
  550. cursorborder: 'none'
  551. });
  552. });
  553. },
  554. _moreGameResult: function() {
  555. var href = "historyRecord.html?serverName=" + this.urlServerName + "&playerName=" + this.urlPlayerName+'&userId='+this.userId+'&gameZone='+this.gameZone;
  556. $("#moreGameResult").attr("href", href);
  557. },
  558. // 获取【擅长领域】TAB区间数据
  559. getUserRank: function() {
  560. var self = this;
  561. return $.ajax({
  562. url: self.Services + self.gameZone + '/perf_ave/',
  563. dataType: 'jsonp'
  564. });
  565. }
  566. };
  567. function getURLParam(name) {
  568. var value = location.search.match(new RegExp("[?&]" + name + "=([^&]*)(&?)", "i"));
  569. return value ? decodeURIComponent(value[1]) : value;
  570. }
  571. function getCookie(cookieName) {
  572. var cookieString = document.cookie;
  573. var start = cookieString.indexOf(cookieName + '=');
  574. // 加上等号的原因是避免在某些 Cookie 的值里有
  575. // 与 cookieName 一样的字符串。
  576. if (start == -1) // 找不到
  577. return null;
  578. start += cookieName.length + 1;
  579. var end = cookieString.indexOf(';', start);
  580. if (end == -1)
  581. return cookieString.substring(start);
  582. return cookieString.substring(start, end);
  583. }
  584. function beenBlockedTimes(action) {
  585. var boxPlayerName = decodeURI(getCookie('boxPlayerName'));
  586. var boxServerName = decodeURI(getCookie('boxServerName'));
  587. $.ajax({
  588. url: "http://lolbox.duowan.com/webApi.php",
  589. data: {serverName: boxServerName, playerName: boxPlayerName, action: action},
  590. cache: false,
  591. success: function (msg) {
  592. if (msg == 1) {
  593. location.reload();
  594. } else if (msg == -1) {
  595. alert('非法操作,请至少登陆一次游戏!');
  596. }
  597. },
  598. error: function () {
  599. }
  600. });
  601. }
  602. window.Personal = Personal;
  603. })(window);
  604. $(function() {
  605. new Personal('tab1');
  606. });