;(function(){ try{ window.__oldFeedbackParms = {}; var _musicOauthConfig = { "test":{ clientId:"8dd1084d6f6c8a746775ba3cdb1bf28bb34e85e86b56403447b93c3b15f22c88", url:"http://qa.igame.163.com/m/oauth2/authorize?client_id=", hubbid:'MA-9741-614DEBBCE77B' }, "online":{ clientId:"3afef00b7094e5c8a13e2e5ee67aef00d0dd7d69253e28e3521dd8f08f5ff251", url:"http://music.163.com/m/oauth2/authorize?client_id=", hubbid:'MA-84A2-97524E679B46' } }; var _isCloudMusic = /NeteaseMusic/i.test(navigator.userAgent); var _cloudMusicToken = ""; var afterLoginCB = null; var _iSIOS = window.navigator && window.navigator.userAgent && /ios|iPhone|ipad/i.test(window.navigator.userAgent); $.ajaxSetup ({ cache: false, beforeSend:function(request) { if(/\d+/.test(window.__UID) && window.openIdToken){ window.openIdToken && request.setRequestHeader("openid", window.openIdToken); } request.setRequestHeader("channelappid", window.__APPID || ''); request.setRequestHeader("channeltoken", window.__oldFeedbackParms && window.__oldFeedbackParms.channelUserToken || ''); } }); window.getCookieByName = function(name) { var reg = new RegExp('(;\s*)?' + name + '=([^;]*)(;|$)'), value; if (reg.test(document.cookie)){ value = decodeURIComponent(RegExp.$2); } return value; }; window.setCookie = function(json){ var kvs = []; if($.isPlainObject(json)){ for(var _key in json){ kvs.push(_key + "=" + encodeURIComponent(json[_key])); } } document.cookie = kvs.join(";"); }; window.getJsonFromResponse = function(res){ var json = null; if(res){ if(typeof res === "string" && res.indexOf("{") >= 0){ try{ json = JSON.parse(res); }catch (e) { json = null; } }else if(res instanceof Object){ try { json = Object.assign({}, res); }catch (e) { json = null; } } } return json; }; window.__APPUserInfo = null; window.__APPTOKEN = null; var YixinJSBridgeFirstCall = null; var _jsonRPCTrigger = function (_evt, _dataStr) { var _event = document.createEvent('CustomEvent'); var _json = {}; if (typeof _dataStr == "string" && _dataStr.indexOf("{") >= 0) { try { _json = _dataStr && JSON.parse(_dataStr) || {}; } catch (_error) { console && console.error(_error); } } else if ($.isPlainObject(_dataStr)) { _json = _dataStr; } _event.detail = _json; _event.initCustomEvent(_evt, true, true,_json); document.dispatchEvent(_event); }; function initJsonRpc(){ window.jsonRPC = window.jsonRPC || {}; window.jsonRPC.nativeEvent = window.jsonRPC.nativeEvent || {}; var _oldTrigger = window.jsonRPC.nativeEvent.trigger || null; window.jsonRPC.nativeEvent.trigger = function(event, data){ try{ _oldTrigger && _oldTrigger(event, data); }catch (e) { } _jsonRPCTrigger(event, data); }; }; initJsonRpc(); if(_iSIOS && _isCloudMusic){ window['api'] = { getDeviceInfoCb(_result) { if (typeof _result === 'string') { if (_result.indexOf('{') >= 0) { try { window.APPINFO = JSON.parse(_result); window.__APPINFO = $.extend({},window.__APPINFO, window.APPINFO || {}); } catch (_error) {} } } if(window.api.getAppInfoThen){ window.api.getAppInfoThen(window.APPINFO); } } }; } document.addEventListener("WeixinJSBridgeReady",function(){ window.YixinJSBridge = window.bimaBridge; initJsonRpc(); if(YixinJSBridgeFirstCall){ YixinJSBridgeFirstCall(); YixinJSBridgeFirstCall = null; } },false); document.addEventListener("YixinJSBridgeReady",function(){ initJsonRpc(); if(YixinJSBridgeFirstCall){ YixinJSBridgeFirstCall(); YixinJSBridgeFirstCall = null; } },false); if(!window.DATracker){ (function(document,datracker,root){function loadJsSDK(){var script,first_script;script=document.createElement("script");script.type="text/javascript";script.async=true;script.src="//nosdn-yx.127.net/yxgame/8a49e812660f0a5301660f0a53d80000.js?t=20180420004";first_script=document.getElementsByTagName("script")[0];first_script.parentNode.insertBefore(script,first_script)}if(!datracker["__SV"]){var win=window;var gen_fn,functions,i,lib_name="DATracker";window[lib_name]=datracker;datracker["_i"]=[];datracker["init"]=function(token,config,name){var target=datracker;if(typeof(name)!=="undefined"){target=datracker[name]=[]}else{name=lib_name}target["people"]=target["people"]||[];target["abtest"]=target["abtest"]||[];target["toString"]=function(no_stub){var str=lib_name;if(name!==lib_name){str+="."+name}if(!no_stub){str+=" (stub)"}return str};target["people"]["toString"]=function(){return target.toString(1)+".people (stub)"};function _set_and_defer(target,fn){var split=fn.split(".");if(split.length==2){target=target[split[0]];fn=split[1]}target[fn]=function(){target.push([fn].concat(Array.prototype.slice.call(arguments,0)))}}functions="track_heatmap register_attributes register_attributes_once clear_attributes unregister_attributes current_attributes single_pageview disable time_event get_appStatus track set_userId track_pageview track_links track_forms register register_once alias unregister identify login logout signup name_tag set_config reset people.set people.set_once people.set_realname people.set_country people.set_province people.set_city people.set_age people.set_gender people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.set_populationWithAccount people.set_location people.set_birthday people.set_region people.set_account abtest.get_variation abtest.async_get_variable".split(" ");for(i=0;i= 0){ try{ _tmpAppInfo = JSON.parse(_tmpAppInfo); }catch (_error){ console && console.error(_error); } }else{ _tmpAppInfo = {appId:_tmpAppInfo}; } } } window.__APPID = _tmpAppInfo && _tmpAppInfo.appId || ''; window.__oldFeedbackParms.channelAppId = window.__APPID; _cb && _cb(window.__oldFeedbackParms); window.jsonRPC.nativeEvent.trigger("WEBVIEWNCGObjectREADYANGINIT"); }else if(_iSIOS){ if(window.YixinJSBridge){ window.YixinJSBridge && window.YixinJSBridge.invoke("getAppInfo", null, function(res){ var json = getJsonFromResponse(res); window.api && window.api.getDeviceInfoCb && window.api.getDeviceInfoCb(json); }); }else if(_isCloudMusic){ window.location.href = 'orpheus://device?query=deviceinfo'; } } }; function gotoUrs(_url){ location.href = cfg_game_root + "/c/ursLogin?then=" + encodeURIComponent(_url || location.href); return false; }; function evalLoginCBStringCB(){ var _oldCB = sessionStorage.getItem("cloud_channel_app_loginCB"); if(_oldCB){ sessionStorage.removeItem("cloud_channel_app_loginCB"); try{ var _f = new Function("return " + _oldCB)(); _f(); }catch(_error){ throw _error } } }; window.addEventListener('message',function(event) { var _data= window.getJsonFromResponse(event.data, event.data); if($.isPlainObject(_data) && _data.messageType === 'ursLoginResult' && _data.data && _data.data.status){ } },false); window.__ChannelGetUserId = function(_cb){ try{ if (window.localStorage) { try { var _feedbackParms = window.localStorage.getItem("feedbackparms"); var _storagedAppinfo = window.sessionStorage.getItem("cloud_channel_app_info"); if (_feedbackParms && _feedbackParms.indexOf("}") >= 0) { _feedbackParms = JSON.parse(_feedbackParms) || {}; } if(_storagedAppinfo && _storagedAppinfo.indexOf("}") >= 0){ _storagedAppinfo = JSON.parse(_storagedAppinfo) || {}; } window.__oldFeedbackParms = $.extend({}, window.__oldFeedbackParms,_feedbackParms, _storagedAppinfo); } catch (_error) { } } if(!window.__oldFeedbackParms && window.__oldFeedbackParms.channelAppId){ var _appInfo = window.getCookieByName("ncg_app_info"); if(_appInfo){ _appInfo = window.atob(_appInfo); if(_appInfo && /[{][^{]*appId[^}]+[}]/i.test(_appInfo)){ window.__APPINFO = JSON.parse(_appInfo); window.__APPINFO.channelAppId = window.__APPINFO.appId || window.__APPINFO.channelAppId; window.__oldFeedbackParms = $.extend({}, window.__oldFeedbackParms,window.__APPINFO); } } } }catch(_error){ window.__APPINFO = null; } if(window.__oldFeedbackParms && (window.NCGObject || window.YixinJSBridge) && (location.search.indexOf('code=') >= 0 || window.__APPINFO && window.__APPINFO.code)){ getTokenByCode({cb:_cb}); }else{ if(window.__oldFeedbackParms && window.__oldFeedbackParms.channelUserToken && window.__oldFeedbackParms.channelAppId){ _cb && _cb(window.__oldFeedbackParms.channelUserToken, window.__oldFeedbackParms); window.__UID = window.__oldFeedbackParms.channelUserToken; evalLoginCBStringCB(); }else{ _cb && _cb(window.__oldFeedbackParms.channelUserToken, window.__oldFeedbackParms); evalLoginCBStringCB(); } } }; window.__ChannelGotoLogin = function(_cb){ _cb && sessionStorage.setItem("cloud_channel_app_loginCB", _cb.toString()); afterLoginCB = _cb; if(!window.__APPINFO.openAppAuthLogin){ gotoUrs(); return; } if(_isCloudMusic){ gotoMusicLogin(); }else{ if(!window.NCGObject){ gotoUrs(); return; } otherChannelAppRequestLogin(); } }; window.__getUserIdByToken = function(){ $.get(cfg_game_root + "/api/web/user/info").always(function(_res){ if(_res && _res.code == 200 && _res.result){ window.__APPUserInfo = _res.result; if(window.__APPUserInfo && window.__APPUserInfo.userId && window.DATracker){ window.__DATrackerLogin = function(){ DATracker.login(window.__APPUserInfo.userId); DATracker.people.set(window.__APPUserInfo); }; if(window.DATracker && window.DATracker.track ){ window.__DATrackerLogin(); window.__DATrackerLogin = null; } } window.__APPTOKEN = window.__APPUserInfo.userId; if(window.NCGObject && window.NCGObject.setUserInfo){ try{ window.NCGObject.setUserInfo(JSON.stringify(window.__APPUserInfo)); }catch(_error){ } } } }); }; document.addEventListener("clientLoginCallback", function (_event) { if (_event.detail.code) { getTokenByCode({code:_event.detail.code}); } }); if(window.NCGObject){ if(window.__APPTOKEN || window.__APPINFO){ window.jsonRPC.nativeEvent.trigger("WEBVIEWNCGObjectREADYANGINIT"); } }else{ window.jsonRPC.nativeEvent.trigger("WEBVIEWNCGObjectREADYANGINIT"); } /** * 重新设置其他页面的预定动作 */ function bookGame(_event){ _event.preventDefault(); var _wself = $(this); if(_wself.data("requesting") || _wself.is(".w-btn-disable")){ return; } if(!(window.__UID || (window.__oldFeedbackParms && window.__oldFeedbackParms.channelUserToken))){ window.__ChannelGotoLogin(function(){ $("#J-custom-submit").trigger("click"); }); return; } if(!window.__GameKey && /\/c\/([^\/]+)?/i.test(location.pathname)){ window.__GameKey = RegExp.$1; } _wself.data("requesting", true).fadeOut(); var _config = { type:"post", url:cfg_game_root + "/game-subscriber", data:{ yxUid:window.__UID || window.__oldFeedbackParms && window.__oldFeedbackParms.channelUserToken || '', gameKey:window.__GameKey } }; _config.beforeSend = function (request) { request.setRequestHeader("channelappid", window.__oldFeedbackParms && window.__oldFeedbackParms.channelAppId || ''); request.setRequestHeader("channeltoken", window.__oldFeedbackParms && window.__oldFeedbackParms.channelUserToken || ''); }; $.ajax(_config).always(function(_response){ if(_response && _response.code == 200){ $("#J-custom-user-num").text(_response.count > 0 ? ("已有" + (_response.count + (window.__baseNum || 0)) + "人预约") : "抢先预约"); _wself.addClass("w-btn-disable").text('已预约'); showBookSuccDialog(); }else if(_response && _response.code == 403){ _wself.addClass("w-btn-disable").text("已结束"); $.customDialog("活动已结束"); }else{ $.customToast("请求失败,请稍后重试"); } _wself.data("requesting", false).fadeIn(); }); }; var _baseRemPx = 0; function showBookSuccDialog(){ if(!showBookSuccDialog.__inited){ showBookSuccDialog.__inited = true; var _style = $("style[data-view=commonCss], style:last"); if(!_style.length){ _style = $('