personal_v3.0.js 23 KB

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