硬肝一个加密过的JS解码
本帖最后由 zch11230 于 2021-2-26 21:41 编辑在POST一网站数据,发现其返回的JSON中的DATA值为类似BASE64编码的文本,但解码后依然看不懂,怀疑网站一般有GZIP压缩,试了也是解不出来,只好研究一下网页是如何解码的,发现其主要核心JS文件是加密过的,用的是sojson加密的V5版,但依旧可以把我这个小白拒之于十万八千里之外,尝试找人付费解,因自己仅是个人兴趣,完全没得利益,报价承受不起,只好自己尝试来搞,完全靠硬肝,完了发一下贴子,也希望得到一些指点,毕竟还原成功运气成分太大,不会下断点。
comm.js文件乱得人抓狂
随便输一个用户名登陆,抓包返回数据,其中中data看不懂,然后会弹窗提示没有这个用户,样式为新插入的dvi,所以对整个网页body下了个变更断点。
_jsonp5ulibdsae({"compress":1,"data":"7eJyrVipKLdS7NKVGy0jXWUUpJLElUsjLQUcpNLS5OTE9VslKKKTVLTjQEkuYGljGlFmkpQNIk1SgxptTc1MgCKG5kbK5UCwAdnhWz"})
先通过单步、步进、步出确认了大概出明文的位置,然后在出明文前一直单步进到第一次出需要的明文数据为止,可能是js只有一行,在自己觉得可疑的地方右键执行到此处,依然会跳过,不知道有没有更方便的下断点方式,这里完全是自己硬肝出来的,如果JS内的循环次数过多,不知道跟到猴年马月。
在js解密网站sojson中,可以将加密的一行js格式化成正常的多行,搜索明文变量_0xd5c61c发现由_0xd5c61c['data'] = JSON(String(null, new Uint16Array(_0x133ba6)));赋值
在控制台直接输入_0x17f8('0x6b8', 'Ecwt')直接查看变量内容,根据查到的变量值可以将这句还原为JSON.parse(String.fromCharCode.apply(null,new Uint16Array(_0x133ba6)));并且在控制台中验证通过。
接着同样的方法查找到变量的来源_0x133ba6 = _0x1d3e75(_0x77c17d);在控制台中查看_0x17f8('0x6b7', 'J(KT')值为inflate,变量_0x77c17d在前面步进调试时在pako.js中返回的,所以这一句是调用pako.js解压,可以进一步还原为JSON.parse(String.fromCharCode.apply(null, new Uint16Array(_0x1d3e75.inflate(_0x77c17d))));并且在控制台验证通过。_0x1d3e75为pako的对象可以不用管,后面自己写就是了。
继续查找变量_0x77c17d ,就只是变换了下类型,还原为JSON.parse(String.fromCharCode.apply(null, new Uint16Array(_0x1d3e75.inflate(new Uint8Array(_0x5ebca0)))));
同样的方法查找变量_0x5ebca0,由_0x94f147 bae64解码atob而来,还原为
atob(_0x94f147).split('').map(function(x){return x.charCodeAt(0);});
var _0x94f147 = _0x3f451c['xmIOm'](_0x5ea490(0x1, _0x1c6a9a), _0x5ea490['substr'](_0x3f451c(_0x1c6a9a, 0x2)));
接近真相了,_0x3f451c['xmIOm']为一个函数,在js中搜索xmIOm找到函数,就是将参数1和参数2相加并返回,
分开来还原参数1_0x5ea490(0x1, _0x1c6a9a)为_0x5ea490.substr(1,_0x1c6a9a),其中_0x5ea490就是为加密的data内容,_0x1c6a9a在下面也有算法,非常简单
还原参数2_0x5ea490['substr'](_0x3f451c(_0x1c6a9a, 0x2))中的_0x17f8('0x6b3', 'XcjP')也是xmIOm,就是上面的将参数1,2相加,也就是_0x1c6a9a + 0x2
所以这一整段话就可以还原为_0x5ea490.substr(1,_0x1c6a9a) + _0x5ea490.substr(_0x1c6a9a+2)
查看最后一个变量_0x1c6a9a在case判断前switch中_0x790310变量的由来_0x790310 = _0x3f451c(parseInt, _0x5ea490(0x0));通过控制台得到_0x17f8('0x6b0', 'rnJQ')的值为iKHla,搜索iKHla找到函数,就是参数1(参数2),参数1已经写明了parseInt将字符转为整数,参数2中的_0x17f8('0x6b1', 'c0#B')为charAt,所以这一句可还原为parseInt(_0x5ea490.charAt(0));简单说就是取原始文本中的第一位,转为整数,用来判断后面substr时从第几位开始,取两次后组合成一个新的base64值,由atob解码,类型转换后由pako.js解压,最后还原为文本由JSON解析
最后算法如下:网址在附件内.解压密码www.52pojie.cn不是太希望不感兴趣的朋友研究得网站改了算法,我也没得用了。
<html>
<body>
<script type="text/javascript" src="pako.js"></script>
<script >
var b64Data = '7eJyrVipKLdS7NKVGy0jXWUUpJLElUsjLQUcpNLS5OTE9VslKKKTVLTjQEkuYGljGlFmkpQNIk1SgxptTc1MgCKG5kbK5UCwAdnhWz'
var charData= atob(newstr(b64Data,getindex(b64Data))).split('').map(function(x){return x.charCodeAt(0);});
document.write(b64Data)
document.write("<br>")
document.write(JSON.stringify(JSON.parse(String.fromCharCode.apply(null, new Uint16Array(pako.inflate(new Uint8Array(charData)))))));
function newstr(teststr,subindex){
var str1 = teststr.substr(1,subindex)
var str2 = teststr.substr(subindex + 2)
return str1 + str2
}
function getindex(teststr){
var tmpchar = teststr.charAt(0)
switch (tmpchar) {
case '1':
return 3;
case '2':
return 5;
case '3':
return 2;
case '4':
return 4;
case '5':
return 1;
case '6':
return 7;
case '7':
return 9;
case '8':
return 6;
case '9':
return 8;
default:
return 1;
}
}
</script>
</body>
</html>
本帖最后由 涛之雨 于 2021-2-27 18:21 编辑
comm.js还原的内容:
``` javascript
define(["pako"], function (_0x1d3e75) {
var _0x579b3a = {
'empty': '',
'booleanValue': {
'yes': '1',
'no': '0'
},
'authStatus': {
'success': 0x1,
'successText': "RESULT_SUCESS",
'successText2': "RESULT_SUCCESS",
'failed': 0x0,
'not_login': -0x1,
'not_permiss': -0x2,
'passwd_simple': -0x7
},
'modules': {
'user': "user",
'device': "device",
'agents': "agents"
},
'actions': {
'tems': {
'getmyteamlist': "getmyteamlist",
'getmyteamone': "getmyteamone",
'dismissteam': 'dismissteam',
'quitmyteam': "quitmyteam",
'quitteambyowner': "quitteambyowner",
'newteam': "newteam",
'updateteam': "updateteam",
'jointeam': "jointeam",
'getteamuserforme': "getteamuserforme",
'queryteamjoin': "queryteamjoin",
'agreeteamjoin': "agreeteamjoin",
'queryteam': "queryteam",
'queryteambyid': "queryteambyid",
'getteammemo': "getteammemo",
'addteammemo': "addteammemo",
'deleteteammemo': 'deleteteammemo',
'getteamuserformap': "getteamuserformap"
},
'device': {
'devicelist': "devicelist"
},
'other': {
'get_cities': "get_cities",
'get_brands': 'get_brands'
}
},
'mapType': {
'prefer': "baidu",
'baidu': "baidu",
'google': "google",
'amap': "amap",
'bing': "bing",
'tmap': "tmap"
},
'mapKey': {
'baidu': "9KbipA4zmOrBhdNfjOaofk3G",
'google': "AIzaSyB_VPsLYyYqC6cA7FvSnfXTxnYIjq6Hb_k",
'amap': g_amap_key,
'bing': "Au071A6iVWT0tSsA9RQyoZWPOiR6SC7AF-GzgKjeXFq9dPvFMw0KlEzKgoU_9PZd",
'tmap': "RSGBZ-DC23J-VQAFL-F2XYW-3C6N5-UVBFU"
},
'getMapScript': function () {
if (webApp.comm.getMapType() == webApp.comm.mapType.google) {
return ["script/map", "script/google-label-marker", "script/gmap"];
} else if (webApp.comm.getMapType() == webApp.comm.mapType.bing) {
return ["script/map", "async!https://www.bing.com/api/maps/mapcontrol?key=" + webApp.comm.mapKey.bing];
} else if (webApp.comm.getMapType() == webApp.comm.mapType.amap) {
return ['script/map'];
} else if (webApp.comm.getMapType() == webApp.comm.mapType.tmap) {
return ["script/map", "async!https://map.qq.com/api/js?v=2.exp&key=" + webApp.comm.mapKey.tmap];
} else {
return ['script/map', 'async!https://api.map.baidu.com/api?v=3.0&ak=' + webApp.comm.mapKey.baidu];
}
},
'getGMapKey': function () {
var _0x2b3729 = localStorageGet("gmap_key");
if (null == _0x2b3729 || 0x27 != _0x2b3729.length) return webApp.comm.mapKey.google;
_0x2b3729 = _0x2b3729.substr(0x1a, 0xd) + _0x2b3729.substr(0x0, 0xd) + _0x2b3729.substr(0xd, 0xd);
return _0x2b3729;
},
'setGMapKey': function (_0x56ef9b) {
if (_0x56ef9b) localStorageSet("gmap_key", _0x56ef9b);
},
'getHomepageStyle': function () {
var _0x32d731 = localStorageGet('homepage_style');
if (null == _0x32d731) return g_homepage_style;
return localStorageGet("homepage_style");
},
'setHomepageStyle': function (_0x36089b) {
_0x36089b = parseInt(_0x36089b);
if (_0x36089b < 0x0 || _0x36089b > 0x1) _0x36089b = 0x0;
localStorageSet("homepage_style", _0x36089b);
},
'getGoogleStyle': function () {
var _0x22e15c = localStorageGet("google_style");
if (null == _0x22e15c) return g_google_style;
return localStorageGet("google_style");
},
'setGoogleStyle': function (_0x4594d6) {
_0x4594d6 = parseInt(_0x4594d6);
if (_0x4594d6 < 0x0 || _0x4594d6 > 0x1) _0x4594d6 = 0x0;
localStorageSet("google_style", _0x4594d6);
},
'getAutoHideControlPanel': function () {
var _0x21a628 = localStorageGet('auto_hide_control_panel');
if (null == _0x21a628) return g_homepage_auto_hide_panel;
return localStorageGet('auto_hide_control_panel');
},
'setAutoHideControlPanel': function (_0x5df60) {
localStorageSet("auto_hide_control_panel", _0x5df60);
},
'getAutoHideControlTianqi': function () {
var _0x1bef5a = localStorageGet("auto_hide_control_tianqi");
if (null == _0x1bef5a) return g_homepage_auto_hide_tianqi;
return localStorageGet("auto_hide_control_tianqi");
},
'setAutoHideControlTianqi': function (_0x5b12f6) {
localStorageSet("auto_hide_control_tianqi", _0x5b12f6);
},
'getAlarmMusicPlay': function () {
var _0x281798 = localStorageGet('alarm_music_play');
if (null == _0x281798) return 0x1;
return localStorageGet('alarm_music_play');
},
'setAlarmMusicPlay': function (_0x5139fb) {
localStorageSet("alarm_music_play", _0x5139fb);
},
'getHomepageBgcolor': function () {
var _0x39f959 = localStorageGet("homepage_bgcolor");
if (null == _0x39f959) return g_homepage_bgcolor;
return localStorageGet("homepage_bgcolor");
},
'setHomepageBgcolor': function (_0x3a40a1) {
localStorageSet("homepage_bgcolor", _0x3a40a1);
},
'getHomepageBgcolorArr': function () {
return ["#FFF", "#87CEEB", "#FFD700", "#FF6100", "#00C957", "#DA70D6", "#FF4500", "#C0C0C0", "#D2B48C"];
},
'getColorNameFromCode': function (_0xcf6015) {
var _0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_white;
switch (_0xcf6015) {
case "#87CEEB":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_skyblue;
break;
case "#FFD700":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_gold;
break;
case "#FF6100":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_orange;
break;
case "#00C957":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_emerald;
break;
case "#DA70D6":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_lavender;
break;
case "#FF4500":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_nacarat;
break;
case "#C0C0C0":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_gray;
break;
case "#D2B48C":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_tan;
break;
default:
break;
}
return _0x5b1cf8;
},
'getLanguageId': function () {
var _0x4c9ef0 = localStorageGet("LanguageId");
if (_0x4c9ef0 > g_Language_cn && _0x4c9ef0 <= g_Language_numbers) return _0x4c9ef0;
return g_Language_cn;
},
'setLanguageId': function (_0x580dab) {
if (_0x580dab > g_Language_cn && _0x580dab <= g_Language_numbers) {
localStorageSet("LanguageId", _0x580dab);
mobile_store_set("LanguageId", _0x580dab);
} else {
localStorageSet('LanguageId', g_Language_cn);
mobile_store_set("LanguageId", g_Language_cn);
}
},
'getLanguageDir': function () {
var _0x59eb38 = _0x579b3a.getLanguageId();
if (_0x59eb38 > g_Language_cn && _0x59eb38 <= g_Language_numbers) return g_LanguageDir;
return '';
},
'setLanguageSelect': function (_0x5a183f) {
var _0x1442a7 = _0x579b3a.getLanguageId();
_0x5a183f.setFirstSelectValue = _0x1442a7;
_0x5a183f.init({
'trigger': "#flag_id",
'data': g_json_language,
'position': "bottom",
'buttons': [{
'yes': webApp.gVal.str_confirm
}, {
'no': webApp.gVal.str_cancel
}],
'callback': function (_0x24e1c5, _0x38f711, _0x255df2) {
var _0x3197fd = parseInt(_0x255df2.toString());
if (_0x3197fd != _0x1442a7) {
_0x579b3a.setLanguageId(_0x3197fd);
location.reload();
}
}
});
},
'getServerId': function () {
var _0x96dff9 = localStorageGet("serverId");
if (_0x96dff9 > g_Server_cn && _0x96dff9 <= g_Server_numbers) return _0x96dff9;
return g_Server_cn;
},
'setServerId': function (_0x54aacb) {
if (_0x54aacb > g_Server_cn && _0x54aacb <= g_Server_numbers) {
localStorageSet("serverId", _0x54aacb);
} else {
localStorageSet("serverId", _0x54aacb);
}
},
'setServerSelect': function (_0x4c0b2f) {
var _0x381255 = _0x579b3a.getServerId();
_0x4c0b2f.setFirstSelectValue = _0x381255;
_0x4c0b2f.init({
'trigger': "#server_id",
'data': g_json_server,
'position': "bottom",
'buttons': [{
'yes': webApp.gVal.str_confirm
}, {
'no': webApp.gVal.str_cancel
}],
'callback': function (_0x4c7b6d, _0x586fdb, _0x1f349c) {
var _0x16e4c8 = parseInt(_0x1f349c.toString());
if (_0x16e4c8 != _0x381255) {
_0x579b3a.setServerId(_0x16e4c8);
location.reload();
}
}
});
},
'getLoginUser': function () {
return localStorageGet("username");
},
'setLoginUser': function (_0x5756e4) {
localStorageSet("username", _0x5756e4);
mobile_store_set("username", _0x5756e4);
},
'getUserTid': function () {
return localStorageGet("userTid");
},
'setUserTid': function (_0xee0c48) {
localStorageSet("userTid", _0xee0c48);
mobile_store_set('userTid', _0xee0c48);
},
'getLoginStatus': function () {
return localStorageGet("login_status");
},
'setLoginStatus': function (_0x1fe98e) {
localStorageSet("login_status", _0x1fe98e);
},
'getLoginUserBak': function () {
return localStorageGet("username_bak");
},
'setLoginUserBak': function (_0x441fda) {
localStorageSet("username_bak", _0x441fda);
},
'getUID': function () {
return localStorageGet("uid");
},
'setUID': function (_0x203075) {
localStorageSet('uid', _0x203075);
},
'getDID': function () {
if (!_0x579b3a.checkLogin()) return -0x1;
var _0x58eb23 = localStorageGet("car_did");
if (typeof _0x58eb23 == "undefined" || null == _0x58eb23) return 0x0;
return parseInt(_0x58eb23);
},
'setDID': function (_0x532003) {
localStorageSet("car_did", _0x532003);
},
'getIMEI': function (_0x227c6d) {
return localStorageGet("dev_imei_" + _0x227c6d);
},
'setIMEI': function (_0x5e78b3, _0x372134) {
localStorageSet("dev_imei_" + _0x5e78b3, _0x372134);
},
'getMID': function () {
return localStorageGet("dev_mid");
},
'setMID': function (_0x4919d1) {
localStorageSet("dev_mid", _0x4919d1);
},
'getDeviceAgentId': function (_0x4f20ee) {
return localStorageGet("dev_agentid_" + _0x4f20ee);
},
'setDeviceAgentId': function (_0x5b5ab0, _0xd2526b) {
localStorageSet("dev_agentid_" + _0x5b5ab0, _0xd2526b);
},
'getDevicePrivatePolicy': function (_0x4858b4) {
if (_0x4858b4 < 0x41eb0 && g_tester_did != _0x4858b4) return 0x1;
var _0x573f66 = localStorageGet("dev_private_policy");
if (typeof _0x573f66 == "undefined" || null == _0x573f66) return 0x0;
return parseInt(_0x573f66) > 0x0 ? 0x1 : 0x0;
},
'setDevicePrivatePolicy': function (_0xdcb3f0) {
localStorageSet("dev_private_policy", parseInt(_0xdcb3f0));
},
'getBrand': function (_0x396b39) {
return localStorageGet("dev_brand_" + _0x396b39);
},
'setBrand': function (_0x596b2d, _0x29823c) {
localStorageSet("dev_brand_" + _0x596b2d, _0x29823c);
},
'getShowAdPanel': function () {
return localStorageGet("show_ad_panel");
},
'setShowAdPanel': function (_0x56be23) {
localStorageSet("show_ad_panel", _0x56be23);
},
'getHomepageSkinImg': function () {
return JSON.parse(localStorageGet("homepage_skin_arr"));
},
'setHomepageSkinImg': function (_0x5b7052) {
localStorageSet("homepage_skin_arr", JSON.stringify(_0x5b7052));
},
'getAdData': function (_0x27edaf) {
return JSON.parse(localStorageGet("dev_ad_data_" + _0x27edaf));
},
'setAdData': function (_0x21c67f, _0x30999f) {
localStorageSet("dev_ad_data_" + _0x21c67f, JSON.stringify(_0x30999f));
},
'setCallNumber': function (_0x31f5b, _0x3645ac) {
localStorageSet("dev_call_number_" + _0x31f5b, _0x3645ac);
},
'getCallNumber': function (_0x4307b8) {
return localStorageGet("dev_call_number_" + _0x4307b8);
},
'setCrashNumber': function (_0x207c22, _0x1346a6) {
localStorageSet("dev_crash_number_" + _0x207c22, _0x1346a6);
},
'getCrashNumber': function (_0x577f60) {
return localStorageGet("dev_crash_number_" + _0x577f60);
},
'setSupportedList': function (_0x27efcd, _0x436a87) {
if (typeof _0x436a87 != "undefined") {
var _0x142a7d = JSON.stringify(_0x436a87);
localStorageSet("dev_supported_list_" + _0x27efcd, _0x142a7d);
} else {
localStorageSet("dev_supported_list_" + _0x27efcd, '');
}
},
'getSupportedList': function (_0x35a5bc) {
var _0x551e89 = localStorageGet('dev_supported_list_' + _0x35a5bc);
var _0x4b1ab9 = JSON.parse(_0x551e89);
return _0x4b1ab9;
},
'getDevNickName': function () {
return localStorageGet("dev_nick_name");
},
'setDevNickName': function (_0x95888f) {
localStorageSet("dev_nick_name", _0x95888f);
},
'getUserNickName': function () {
return localStorageGet("user_nick_name");
},
'setUserNickName': function (_0x3648e3) {
localStorageSet("user_nick_name", _0x3648e3);
},
'clearLogin': function () {
webApp.comm.setLoginUser(webApp.comm.empty);
webApp.comm.setLoginStatus(webApp.comm.empty);
webApp.comm.setUserTid(webApp.comm.empty);
},
'checkLogin': function () {
if (_0x579b3a.getLoginUser() != undefined && _0x579b3a.getLoginUser().length > 0x0 && _0x579b3a.getLoginStatus() == _0x579b3a.authStatus.success) {
return true;
} else {
return false;
}
},
'setMapType': function (_0x191bf8) {
localStorageSet("map_type", _0x191bf8);
},
'getMapType': function () {
var _0x17f704 = localStorageGet("map_type");
if (typeof _0x17f704 == "undefined" || null == _0x17f704) {
return _0x579b3a.mapType.prefer;
}
return localStorageGet("map_type");
},
'setWeixinOpenID': function (_0x3cb017, _0x5a8e59) {
localStorageSet("openid_" + _0x5a8e59, _0x3cb017);
},
'getWeixinOpenID': function (_0x4d246f) {
return localStorageGet("openid_" + _0x4d246f);
},
'setStorePoint': function (_0x22311b, _0x54d12b) {
if (!_0x22311b || !_0x54d12b) return;
localStorageSet("store_point", parseFloat(_0x22311b) + ',' + parseFloat(_0x54d12b));
},
'getStorePoint': function () {
var _0x44031e = localStorageGet("store_point");
if (null == _0x44031e || !_0x44031e || typeof _0x44031e == "undefined") {
_0x44031e = {
'lng': 0x0,
'lat': 0x0
};
} else {
_0x44031e = _0x44031e.split(',');
if (0x2 == _0x44031e.length) {
_0x44031e = {
'lng': parseFloat(_0x44031e),
'lat': parseFloat(_0x44031e)
};
} else {
_0x44031e = {
'lng': 0x0,
'lat': 0x0
};
}
}
return _0x44031e;
},
'setLastPointNavigation': function (_0x41d528, _0x37a7e9) {
if (!_0x41d528 || !_0x37a7e9) return;
localStorageSet("navigation_last_" + webApp.comm.getDID(), parseFloat(_0x41d528) + ',' + parseFloat(_0x37a7e9));
},
'getLastPointNavigation': function () {
var _0x376cd3 = localStorageGet("navigation_last_" + webApp.comm.getDID());
if (null == _0x376cd3 || !_0x376cd3 || typeof _0x376cd3 == "undefined") {
_0x376cd3 = {
'lng': 0x0,
'lat': 0x0
};
} else {
_0x376cd3 = _0x376cd3.split(',');
if (0x2 == _0x376cd3.length) {
_0x376cd3 = {
'lng': parseFloat(_0x376cd3),
'lat': parseFloat(_0x376cd3)
};
} else {
_0x376cd3 = {
'lng': 0x0,
'lat': 0x0
};
}
}
return _0x376cd3;
},
'setLastPoint': function (_0x4e2589, _0x448d81, _0x1afe01) {
if (!_0x4e2589 || !_0x448d81) return;
if ("gps" != _0x1afe01) {
_0x1afe01 = webApp.comm.getMapType();
}
localStorageSet(_0x1afe01 + "_last_" + webApp.comm.getDID(), parseFloat(_0x4e2589) + ',' + parseFloat(_0x448d81));
},
'getLastPoint': function (_0x437df2) {
if ("gps" != _0x437df2) {
_0x437df2 = webApp.comm.getMapType();
}
var _0x165fa1 = localStorageGet(_0x437df2 + "_last_" + webApp.comm.getDID());
if (null == _0x165fa1 || !_0x165fa1 || typeof _0x165fa1 == "undefined") {
_0x165fa1 = {
'lng': 0x0,
'lat': 0x0
};
} else {
_0x165fa1 = _0x165fa1.split(',');
if (0x2 == _0x165fa1.length) {
_0x165fa1 = {
'lng': parseFloat(_0x165fa1),
'lat': parseFloat(_0x165fa1)
};
} else {
_0x165fa1 = {
'lng': 0x0,
'lat': 0x0
};
}
}
return _0x165fa1;
},
'setVersion': function (_0x20ba3b, _0x571a2e) {
localStorageSet("version_" + _0x20ba3b, _0x571a2e);
},
'getVersion': function (_0x345cd3) {
return localStorageGet("version_" + _0x345cd3);
},
'setProduct': function (_0x429d28, _0x547834) {
localStorageSet("product_" + _0x429d28, _0x547834);
},
'getProduct': function (_0xc3afd4) {
return localStorageGet("product_" + _0xc3afd4);
},
'setDeviceNumber': function (_0x3e2858) {
localStorageSet('device_number', _0x3e2858);
},
'getDeviceNumber': function () {
return localStorageGet("device_number");
},
'setAdTimestmap': function (_0x22062f, _0x54d619) {
localStorageSet("agents_sync_timestamp_" + _0x22062f, _0x54d619);
},
'getAdTimestmap': function (_0x570936) {
return localStorageGet("agents_sync_timestamp_" + _0x570936);
},
'setPostTimestmap': function (_0x3a8369) {
localStorageSet("post_timestamp", _0x3a8369);
},
'getPostTimestmap': function () {
return localStorageGet("post_timestamp");
},
'setPostData': function (_0x302bf6) {
localStorageSet("post_data", _0x302bf6);
},
'getPostData': function () {
return localStorageGet("post_data");
},
'setHomepageJump': function (_0x229ecb, _0x42340d) {
localStorageSet("homepage_jump_" + _0x229ecb, _0x42340d);
},
'getHomepageJump': function (_0x2f2578) {
return localStorageGet("homepage_jump_" + _0x2f2578);
},
'setMapHeight': function (_0x1d9c85) {
var _0x4e97e9 = $(window).height();
$("#mapid").css("height", parseInt(_0x4e97e9 * _0x1d9c85));
},
'autoSetMapHeight': function () {
var _0x35bfa2 = $("#mapid").offset();
var _0x199a7d = $(window).height() - _0x35bfa2.top;
$("#mapid").css("height", _0x199a7d);
},
'drawMapLine': function (_0x993075, _0xdaa812) {
var _0x2d04cd = [];
_0x2d04cd.push(_0x993075);
_0x2d04cd.push(_0xdaa812);
return webApp.comm.drawMapLineFromArr(_0x2d04cd);
},
'showMapAddress': function (_0x235e03, _0x100d70, _0xe793e8, _0x45d5bc) {
if (null == _0xe793e8 || !_0xe793e8) return;
var _0x325ba3 = document.getElementById(_0xe793e8);
if (typeof _0x325ba3 == "undefined" || null == _0x325ba3) return;
var _0x60263a = webApp.comm.removePostcode(_0x235e03);
if (_0x45d5bc) _0x45d5bc = '[' + _0x45d5bc + "] ";
if ("gps" == _0x100d70) {
_0x60263a = _0x45d5bc + _0x60263a + webApp.gVal.str_comm_gps_position;
} else if ("lbs" == _0x100d70) {
_0x60263a = _0x45d5bc + _0x60263a + webApp.gVal.str_comm_lbs_position;
} else if ("mobile" == _0x100d70) {
_0x60263a = _0x45d5bc + _0x60263a + webApp.gVal.str_comm_mobile_position;
} else if ("trace" == _0x100d70) {}
_0x325ba3.innerHTML = _0x60263a;
},
'removePostcode': function (_0x3a1715) {
var _0x2d5a89 = _0x3a1715.indexOf(webApp.gVal.str_comm_postcode);
if (_0x2d5a89 > 0x0) {
_0x3a1715 = _0x3a1715.substring(0x0, _0x2d5a89 - 0x1);
}
return _0x3a1715;
},
'distanceByTwoLnglat': function (_0x21b335, _0x2ccce5, _0x26d5bf, _0x1b4d06) {
function _0x14d1f1(_0x2d6cc7) {
return _0x2d6cc7 * Math.PI / 0xb4;
}
if (!_0x21b335 || !_0x2ccce5 || !_0x26d5bf || !_0x1b4d06) return 0x0;
var _0x55b5da = _0x14d1f1(_0x2ccce5);
var _0x3a11df = _0x14d1f1(_0x1b4d06);
var _0x33a5de = _0x55b5da - _0x3a11df;
var _0x27e58f = _0x14d1f1(_0x21b335) - _0x14d1f1(_0x26d5bf);
var _0x2c68bd = 0x2 * Math.asin(Math.sqrt(Math.pow(Math.sin(_0x33a5de / 0x2), 0x2) + Math.cos(_0x55b5da) * Math.cos(_0x3a11df) * Math.pow(Math.sin(_0x27e58f / 0x2), 0x2)));
_0x2c68bd = _0x2c68bd * 0x615299;
_0x2c68bd = Math.round(_0x2c68bd * 0x2710) / 0x2710;
return _0x2c68bd;
},
'timeIntervalBetween': function (_0x4bb44b, _0x4e3b8c) {
var _0x455717 = parseInt(webApp.comm.UnixTimestamp(_0x4bb44b));
var _0x3a6c50 = parseInt(webApp.comm.UnixTimestamp(_0x4e3b8c));
return Math.abs(_0x455717 - _0x3a6c50);
},
'formatSecondsToHours': function (_0xb6bbe1) {
var _0x520ebc = parseInt(_0xb6bbe1);
var _0x41dd00 = 0x0;
var _0x5f01cb = 0x0;
if (_0x520ebc > 0x3c) {
_0x41dd00 = parseInt(_0x520ebc / 0x3c);
_0x520ebc = parseInt(_0x520ebc % 0x3c);
if (_0x41dd00 > 0x3c) {
_0x5f01cb = parseInt(_0x41dd00 / 0x3c);
_0x41dd00 = parseInt(_0x41dd00 % 0x3c);
}
}
var _0x20b0db = '';
if (_0x520ebc > 0x0) {
_0x20b0db = '' + parseInt(_0x520ebc) + webApp.gVal.str_second;
}
if (_0x41dd00 > 0x0) {
_0x20b0db = '' + parseInt(_0x41dd00) + webApp.gVal.str_minute + _0x20b0db;
}
if (_0x5f01cb > 0x0) {
_0x20b0db = '' + parseInt(_0x5f01cb) + webApp.gVal.str_hour + _0x20b0db;
}
return _0x20b0db;
},
'afterDeviceSelected': function (_0x3b57f9, _0x2c7b91, _0x491a46) {
var _0x125369 = _0x491a46.toString();
var _0x485fee = _0x2c7b91.toString();
g_deviceListCtr.setFirstSelectValue = _0x125369;
webApp.comm.setDID(_0x125369);
webApp.comm.setDevNickName(_0x485fee);
$("#device_list_did").attr("value", _0x125369);
$("#device_list_txt").val(_0x485fee);
},
'initDeviceListCtr': function (_0x1462a5, _0x2eabd6, _0x2af6d5) {
if (!_0x1462a5 || _0x1462a5.length <= 0x0) {
$("#device_list_id").hide();
} else if (_0x1462a5.length <= 0x1) {
$("#device_list_did").attr("value", webApp.comm.getDID());
$("#device_list_txt").val(webApp.comm.getDevNickName());
$("#device_list_id").hide();
} else {
$("#device_list_did").attr("value", webApp.comm.getDID());
$("#device_list_txt").val(webApp.comm.getDevNickName());
$("#device_list_id").show();
var _0x26ed3d = [];
for (var _0x983298 = 0x0; _0x983298 < _0x1462a5.length; _0x983298++) {
_0x26ed3d.push({
'id': _0x1462a5.did,
'name': _0x1462a5.nickname
});
}
g_deviceListCtr.init({
'trigger': "#device_list_txt",
'data': _0x26ed3d,
'position': "bottom",
'buttons': [{
'yes': webApp.gVal.str_confirm
}, {
'no': webApp.gVal.str_cancel
}],
'callback': _0x2af6d5
});
g_deviceListCtr.setFirstSelectValue = webApp.comm.getDID();
}
if (null != _0x2eabd6) _0x2eabd6();
},
'setDeviceListCache': function (_0x46ce02) {
if (_0x46ce02.length <= 0x0) return;
var _0x3f3c25 = [];
for (var _0x1b22ad = 0x0; _0x1b22ad < _0x46ce02.length; _0x1b22ad++) {
_0x3f3c25.push(_0x46ce02.did);
localStorageSet("device_list_cache_" + _0x46ce02.did, JSON.stringify(_0x46ce02));
}
localStorageSet("device_list_cache_did", JSON.stringify(_0x3f3c25));
},
'getDeviceListCache': function () {
var _0x1d9bbd = [];
var _0x1703e4 = JSON.parse(localStorageGet("device_list_cache_did"));
for (var _0x2f87cf = 0x0; _0x2f87cf < _0x1703e4.length; _0x2f87cf++) {
_0x1d9bbd.push(JSON.parse(localStorageGet("device_list_cache_" + _0x1703e4)));
}
return _0x1d9bbd;
},
'setDeviceListCacheDid': function (_0x4d7a70, _0x64031c) {
localStorageSet("device_list_cache_" + _0x4d7a70, JSON.stringify(_0x64031c));
},
'getDeviceListCacheDid': function (_0x2301aa) {
return JSON.parse(localStorageGet("device_list_cache_" + _0x2301aa));
},
'getDeviceList': function (_0x5e532c, _0x1397f7, _0x443099) {
if (_0x5e532c) {
var _0xaf78d1 = webApp.comm.getDeviceListCache();
if (_0xaf78d1 != null && typeof _0xaf78d1 != "undefined") {
webApp.comm.initDeviceListCtr(_0xaf78d1, _0x1397f7, _0x443099);
return;
}
}
webApp.As.baseRequest("service.php", {
'data': _0x1e9ba3,
'callback': function (_0x4755ca) {
if (_0x4755ca.result == webApp.comm.authStatus.success) {
if (_0x4755ca.data.length > 0x0) {
if (_0x4755ca.data.length > g_bound_devices_warn_count) {
webApp.toastr.info({
'msg': webApp.gVal.str_warn_too_much_devices1 + _0x4755ca.data.length + webApp.gVal.str_warn_too_much_devices2 + webApp.gVal.str_400,
'options': {
'timeOut': 0x1388,
'hideDuration': 0xbb8
}
});
}
webApp.comm.setDeviceListCache(_0x4755ca.data);
var _0x1c2bc3 = webApp.comm.getDID();
var _0x42436b = 0x0;
var _0x23ccd9 = 0x0;
var _0x30d97b = _0x4755ca.data;
for (var _0x405610 = 0x0; _0x405610 < _0x30d97b.length; _0x405610++) {
webApp.comm.setVersion(_0x30d97b.did, _0x30d97b.version);
webApp.comm.setProduct(_0x30d97b.did, _0x30d97b.product);
webApp.comm.setIMEI(_0x30d97b.did, _0x30d97b.imei);
webApp.comm.setBrand(_0x30d97b.did, _0x30d97b.brand);
webApp.comm.setDeviceAgentId(_0x30d97b.did, _0x30d97b.agentid);
webApp.comm.setSupportedList(_0x30d97b.did, _0x30d97b.supported_list);
if (_0x1c2bc3 == _0x30d97b.did) {
_0x42436b = 0x1;
webApp.comm.setDevNickName(_0x30d97b.nickname);
webApp.comm.setMID(_0x30d97b.mid);
_0x23ccd9 = _0x30d97b.supported_list.shake_sensor;
}
}
if (0x0 == _0x42436b) {
var _0x5136ec = _0x4755ca.data;
if (_0x5136ec) {
if (_0x5136ec.did) {
_0x1c2bc3 = _0x5136ec.did;
webApp.comm.setDID(_0x5136ec.did);
webApp.comm.setDevNickName(_0x5136ec.nickname);
webApp.comm.setMID(_0x5136ec.mid);
_0x23ccd9 = _0x5136ec.supported_list.shake_sensor;
}
}
}
webApp.comm.setDeviceNumber(_0x30d97b.length);
webApp.comm.initDeviceListCtr(_0x30d97b, _0x1397f7, _0x443099);
let _0x22e83b = "zhihui-center";
if (0x1 == _0x23ccd9) {
_0x22e83b = "gyroscope-home";
}
if (_0x22e83b != get_homepage()) {
set_homepage(_0x1c2bc3, _0x22e83b);
}
if ("zhihui-center" == webApp.activePage.pageName) {
if ("gyroscope-home" == _0x22e83b) {
if ("no_jump" != webApp.comm.getHomepageJump(webApp.comm.getDID())) {
webApp.router.go(_0x22e83b);
}
webApp.comm.setHomepageJump(webApp.comm.getDID(), '');
}
}
} else {
showAlertDialog(webApp.gVal.str_error_no_device_binding + webApp.gVal.str_400, '', function () {
webApp.comm.clearLogin();
webApp.router.go("login");
}, null);
}
}
}
});
},
'resizeMapImageSize': function () {
var _0x372895 = parseInt($(window).width() / 0x9);
if (_0x372895 > g_width_max) _0x372895 = g_width_max;else if (_0x372895 < g_width_min) _0x372895 = g_width_min;
$(".link-span").css("width", _0x372895);
$(".map-box .link-span a").css("width", _0x372895);
$('.map-box\x20.link-span\x20a').css("height", _0x372895);
return _0x372895;
},
'logout': function () {
if (isXAMS()) {
_0x4513f1 = {
'module': "agents",
'action': "logout"
};
}
webApp.As.baseRequest("service.php", {
'data': _0x4513f1,
'callback': function (_0x31cc0d) {
if (_0x31cc0d.result == webApp.comm.authStatus.success) {
webApp.comm.clearLogin();
webApp.toastr.info({
'msg': webApp.gVal.str_login_out_success
});
setTimeout(function () {
webApp.router.go("login");
}, 0x4b0);
}
}
});
},
'checkIOSUpdate': function () {
webApp.As.baseRequest("service.php", {
'data': _0x5ba76f,
'callback': function (_0x4b16ac) {
if (_0x4b16ac.result == webApp.comm.authStatus.success) {
if (_0x4b16ac.data.version > g_current_softver) {
showConfirmDialog(webApp.gVal.str_comm_new_version, '', '', function () {
window.open(_0x4b16ac.data.url, "_blank", 'location=no,toolbarposition=top,closebuttoncaption=' + webApp.gVal.str_comm_exit_update);
}, null);
}
}
}
});
},
'isDeviceSupported': function (_0x54ba31, _0x2a6031) {
var _0x15a347 = webApp.comm.getSupportedList(_0x54ba31);
if (typeof _0x15a347 == "undefined" || _0x15a347 == null) return 0x0;
switch (_0x2a6031) {
case "fire":
return typeof _0x15a347.fire_supported != "undefined" ? _0x15a347.fire_supported : 0x0;
case 'switch':
return typeof _0x15a347.switch_supported != "undefined" ? _0x15a347.switch_supported : 0x0;
case "parking":
return typeof _0x15a347.parking_supported != "undefined" ? _0x15a347.parking_supported : 0x0;
case "inside_battery":
return typeof _0x15a347.inside_battery_supported != "undefined" ? _0x15a347.inside_battery_supported : 0x0;
case "power_alltime":
return typeof _0x15a347.power_alltime_supported != "undefined" ? _0x15a347.power_alltime_supported : 0x0;
case "shake_sensor":
return typeof _0x15a347.shake_sensor != "undefined" ? _0x15a347.shake_sensor : 0x0;
}
return 0x0;
},
'getCurrentDeviceImgLocal': function () {
var _0x2970d7 = localStorageGet("device_img_local");
if (!_0x2970d7) return g_homepage_img;
return _0x2970d7;
},
'setCurrentDeviceImgLocal': function (_0x593296) {
if (!_0x593296) return;
localStorageSet("device_img_local", _0x593296);
},
'getCurrentDevice': function () {
return webApp.comm.getDeviceListCacheDid(webApp.comm.getDID());
},
'getLocalDeviceType': function (_0x4bdbcc) {
var _0x4ea485 = localStorageGet('device_local_type_' + _0x4bdbcc);
if (!_0x4ea485) return g_default_local_device_type;
return _0x4ea485;
},
'setLocalDeviceType': function (_0x40afae, _0x168f5a) {
if (!_0x168f5a) return;
localStorageSet('device_local_type_' + _0x40afae, _0x168f5a);
},
'getCurrentDeviceImg': function (_0x4c8944, _0x23b204) {
if (0x0 != g_device_img_local) {
return webApp.comm.getCurrentDeviceImgLocal();
}
var _0x28e15b = webApp.comm.getCurrentDevice();
if (null != _0x28e15b) {
var _0x396782 = _0x28e15b.pic_url;
if (_0x396782) {
if (_0x4c8944 && _0x396782.indexOf(_0x4c8944) >= 0x0) {
_0x396782 = _0x396782.replace(_0x4c8944, _0x23b204);
}
return _0x396782;
}
}
return g_homepage_img;
},
'setCurrentDeviceImg': function (_0x3a3c46) {
if (!_0x3a3c46) return;
var _0x438415 = webApp.comm.getDID();
var _0x5bff73 = webApp.comm.getDeviceListCacheDid(_0x438415);
if (!_0x5bff73) return;
if (_0x5bff73.pic_url != _0x3a3c46) {
_0x5bff73.pic_url = _0x3a3c46;
webApp.comm.setDeviceListCacheDid(_0x438415, _0x5bff73);
}
},
'getRemainPowerPercent': function (_0x35be95, _0x36be01) {
switch (_0x36be01) {
case 0xc:
g_pvol_min = 10.8;
g_pvol_max = 13.3;
break;
case 0x18:
g_pvol_min = 21.6;
g_pvol_max = 26.6;
break;
case 0x24:
g_pvol_min = 32.4;
g_pvol_max = 39.9;
break;
case 0x3c:
g_pvol_min = 0x36;
g_pvol_max = 66.5;
break;
case 0x40:
g_pvol_min = 0x38;
g_pvol_max = 73.6;
break;
case 0x48:
g_pvol_min = 64.8;
g_pvol_max = 79.8;
break;
}
if (null == _0x35be95) _0x35be95 = 0x0;
_0x35be95 = parseFloat(_0x35be95);
if (isNaN(_0x35be95)) _0x35be95 = 0x0;
if (_0x35be95 < g_pvol_min) return 0x0;
if (_0x35be95 > g_pvol_max) return 0x64;
return parseInt(0x64 * (_0x35be95 - g_pvol_min) / (g_pvol_max - g_pvol_min));
},
'getRemainPower': function (_0x3fdb94, _0x151d61) {
var _0x1ae742 = _0x579b3a.getRemainPowerPercent(_0x3fdb94, _0x151d61);
if (_0x1ae742 < 0x14) return "<font color='red'>" + _0x1ae742 + "%</font>";
return "<font color='green'>" + _0x1ae742 + "%</font>";
},
'getRemainPowerNumber': function (_0x448003, _0x82ba61) {
var _0x7da9a7 = _0x579b3a.getRemainPowerPercent(_0x448003, _0x82ba61);
if (_0x7da9a7 < 0x5) return 0x0;
if (_0x7da9a7 < 0x23) return 0x1;
if (_0x7da9a7 < 0x41) return 0x2;
if (_0x7da9a7 < 0x5f) return 0x3;
return 0x4;
},
'getEstimateMiles': function (_0x5e0dc1) {
if (_0x5e0dc1) return parseInt(_0x5e0dc1);
return parseInt(0x64 * Math.random());
}
};
_0x579b3a.initPrototype = function () {
String.prototype.trim = function () {
return this.replace(/(^\s*)|(\s*$)/g, '');
};
Date.prototype.Format = function (_0x521f0d) {
var _0x51a23b = {
'M+': this.getMonth() + 0x1,
'd+': this.getDate(),
'h+': this.getHours(),
'm+': this.getMinutes(),
's+': this.getSeconds(),
'q+': Math.floor((this.getMonth() + 0x3) / 0x3),
'S': this.getMilliseconds()
};
if (/(y+)/.test(_0x521f0d)) _0x521f0d = _0x521f0d.replace(RegExp.$1, (this.getFullYear() + '').substr(0x4 - RegExp.$1.length));
for (var _0x52ee26 in _0x51a23b) if (new RegExp('(' + _0x52ee26 + ')').test(_0x521f0d)) _0x521f0d = _0x521f0d.replace(RegExp.$1, RegExp.$1.length == 0x1 ? _0x51a23b : ('00' + _0x51a23b).substr(('' + _0x51a23b).length));
return _0x521f0d;
};
};
_0x579b3a.toUnicode = function (_0xdef767) {
var _0x37bca7 = [];
if (_0xdef767 != undefined) {
for (var _0x16fd45 = 0x0; _0x16fd45 < _0xdef767.length; _0x16fd45++) _0x37bca7 = ('00' + _0xdef767.charCodeAt(_0x16fd45).toString(0x10)).slice(-0x4);
} else {
return '';
}
return '\x5cu' + _0x37bca7.join('\x5cu');
};
_0x579b3a.toCn = function (_0x40032b) {
if (_0x40032b != undefined) {
_0x40032b = _0x40032b.replace(/\\/g, '%');
} else {
return '';
}
return unescape(_0x40032b);
};
_0x579b3a.getRandom = function (_0x1492b0) {
return Math.floor(Math.random() * Math.pow(0xa, _0x1492b0) + 0x1);
};
_0x579b3a.round = function (_0x287ef9, _0xb727d7) {
var _0x36402b = 0x1;
for (; _0xb727d7 > 0x0; _0x36402b *= 0xa, _0xb727d7--) {}
for (; _0xb727d7 < 0x0; _0x36402b /= 0xa, _0xb727d7++) {}
return Math.round(_0x287ef9 * _0x36402b) / _0x36402b;
};
_0x579b3a.randomNumBoth = function (_0x6a0f73, _0x27a5d9) {
var _0x1fd6ab = _0x27a5d9 - _0x6a0f73;
var _0x36e0ee = Math.random();
var _0x4f1d56 = _0x6a0f73 + Math.round(_0x36e0ee * _0x1fd6ab);
return _0x4f1d56;
};
_0x579b3a.mb_strlen = function (_0x4ad63d) {
var _0x59f4c4 = 0x0;
for (var _0x31b2ee = 0x0; _0x31b2ee < _0x4ad63d.length; _0x31b2ee++) {
_0x59f4c4 += _0x4ad63d.charCodeAt(_0x31b2ee) < 0x0 || _0x4ad63d.charCodeAt(_0x31b2ee) > 0xff ? document.charset == "utf-8" ? 0x3 : 0x2 : 0x1;
}
return _0x59f4c4;
};
_0x579b3a.is_numeric = function (_0x4cc20a) {
var _0x44c8bb = /^+$/;
if (!_0x44c8bb.test(_0x4cc20a)) return false;
return true;
};
_0x579b3a.UnixTimeStr = function (_0x52feab) {
var _0x2dbb6a = new Date(_0x52feab * 0x3e8);
var _0x377a41 = _0x2dbb6a.toLocaleString();
return _0x377a41;
};
_0x579b3a.UnixTimestamp = function (_0x4b7c4a) {
var _0x1b1d2e = _0x4b7c4a.replace(/-/g, '/');
var _0x5169e6 = new Date(_0x1b1d2e);
var _0x9d6a8 = _0x5169e6.getTime().toString();
return parseInt(_0x9d6a8.substr(0x0, 0xa));
};
_0x579b3a.getNowFormatDate = function () {
var _0x347e2c = new Date();
var _0x2e5c97 = '-';
var _0x176855 = ':';
var _0x34855e = _0x347e2c.getMonth() + 0x1;
var _0x17842f = _0x347e2c.getDate();
if (_0x34855e >= 0x1 && _0x34855e <= 0x9) {
_0x34855e = '0' + _0x34855e;
}
if (_0x17842f >= 0x0 && _0x17842f <= 0x9) {
_0x17842f = '0' + _0x17842f;
}
var _0x3b5fc1 = _0x347e2c.getHours();
if (_0x3b5fc1 >= 0x0 && _0x3b5fc1 <= 0x9) {
_0x3b5fc1 = '0' + _0x3b5fc1;
}
var _0x47e873 = _0x347e2c.getMinutes();
if (_0x47e873 >= 0x0 && _0x47e873 <= 0x9) {
_0x47e873 = '0' + _0x47e873;
}
var _0x37e696 = _0x347e2c.getSeconds();
if (_0x37e696 >= 0x0 && _0x37e696 <= 0x9) {
_0x37e696 = '0' + _0x37e696;
}
var _0x5cda18 = _0x347e2c.getFullYear() + _0x2e5c97 + _0x34855e + _0x2e5c97 + _0x17842f + '\x20' + _0x3b5fc1 + _0x176855 + _0x47e873 + _0x176855 + _0x37e696;
return _0x5cda18;
};
_0x579b3a.setCookie = function (_0x5e25d1, _0x3d78f2, _0x504f41) {
if (!_0x5e25d1) return;
_0x504f41 = parseInt(_0x504f41);
if (!_0x504f41) _0x504f41 = 0x1e;
var _0x1cb01a = new Date();
_0x1cb01a.setDate(_0x1cb01a.getDate() + _0x504f41);
document.cookie = _0x5e25d1 + '=' + escape(_0x3d78f2) + ";expires=" + _0x1cb01a.toGMTString();
};
_0x579b3a.getCookie = function (_0x3ed7dd) {
if (document.cookie.length > 0x0) {
c_start = document.cookie.indexOf(_0x3ed7dd + '=');
if (c_start != -0x1) {
c_start = c_start + _0x3ed7dd.length + 0x1;
c_end = document.cookie.indexOf(';', c_start);
if (c_end == -0x1) c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
}
}
return '';
};
_0x579b3a.replaceAll = function (_0x1954da, _0xf0267a, _0x414380) {
while (_0x1954da.indexOf(_0xf0267a) >= 0x0) {
_0x1954da = _0x1954da.replace(_0xf0267a, _0x414380);
}
return _0x1954da;
};
_0x579b3a.transSecond2str = function (_0x224944) {
var _0x1f3425 = '';
var _0x1743f5 = Math.floor(_0x224944 / (0x18 * 0x3c * 0x3c));
if (_0x1743f5) _0x1f3425 = _0x1743f5 + webApp.gVal.str_trace_days;
var _0x57a7da = _0x224944 % (0x18 * 0x3c * 0x3c);
var _0x324c4c = Math.floor(_0x57a7da / (0x3c * 0x3c));
if (_0x324c4c) _0x1f3425 += _0x324c4c + webApp.gVal.str_trace_hours;
_0x57a7da = _0x57a7da % (0x3c * 0x3c);
var _0x1dc7b3 = Math.floor(_0x57a7da / 0x3c);
if (_0x1dc7b3) _0x1f3425 += _0x1dc7b3 + webApp.gVal.str_trace_minutes;
_0x57a7da = _0x57a7da % 0x3c;
return _0x1f3425 + _0x57a7da + webApp.gVal.str_trace_seconds;
};
_0x579b3a.get_direction_from_long_lat_int = function (_0x298cd6, _0x5acd8b) {
var _0x5b6eb4 = 0x0;
if (0x0 == _0x5acd8b) {
_0x5b6eb4 = 0x64;
} else {
_0x5b6eb4 = Math.abs(_0x298cd6 / _0x5acd8b);
}
if (_0x298cd6 < 0x0 && _0x5b6eb4 > 4.5) {
return 0x2;
} else if (_0x298cd6 > 0x0 && _0x5b6eb4 > 4.5) {
return 0x6;
} else if (_0x5acd8b < 0x0 && _0x5b6eb4 < 0.4) {
return 0x0;
} else if (_0x5acd8b > 0x0 && _0x5b6eb4 < 0.4) {
return 0x4;
}
if (_0x5b6eb4 < 4.5 && _0x5b6eb4 >= 0.4) {
if (_0x298cd6 < 0x0 && _0x5acd8b < 0x0) {
return 0x1;
} else if (_0x298cd6 > 0x0 && _0x5acd8b > 0x0) {
return 0x5;
} else if (_0x298cd6 < 0x0 && _0x5acd8b > 0x0) {
return 0x3;
} else if (_0x298cd6 > 0x0 && _0x5acd8b < 0x0) {
return 0x7;
}
}
return -0x1;
};
_0x579b3a.get_direction_from_2points = function (_0x26fac8, _0x92871c, _0x4064a3, _0x26ebfe) {
var _0x5d1f2d = _0x4064a3 - _0x26fac8;
var _0x44c492 = _0x26ebfe - _0x92871c;
return _0x579b3a.get_direction_from_long_lat_int(_0x5d1f2d, _0x44c492);
};
_0x579b3a.get_rotation_from_2points = function (_0x4c4a72, _0x253502, _0x5a2667, _0x758c24) {
let _0x152652 = _0x5a2667 - _0x4c4a72;
let _0x24274a = _0x758c24 - _0x253502;
let _0x50da75 = 0xb4;
if (0x0 == _0x152652) {
if (_0x24274a > 0x0) {
return _0x50da75;
} else if (0x0 == _0x24274a) {
return 0x0;
} else {
return 0x0;
}
}
let _0x167439 = Math.abs(_0x24274a) / Math.abs(_0x152652);
let _0x5e9aa6 = Math.abs(_0x152652) / Math.abs(_0x24274a);
let _0x32e6dd = 0x0;
if (_0x152652 > 0x0) {
if (_0x24274a > 0x0) {
_0x32e6dd = _0x50da75 * 0x1 / 0x2 + Math.atan(_0x167439);
} else if (0x0 == _0x24274a) {
_0x32e6dd = _0x50da75 * 0x1 / 0x2;
} else {
_0x32e6dd = _0x50da75 * 0x1 / 0x2 - Math.atan(_0x167439);
}
} else {
if (_0x24274a > 0x0) {
_0x32e6dd = _0x50da75 + Math.atan(_0x167439);
} else if (0x0 == _0x24274a) {
_0x32e6dd = _0x50da75 * 0x3 / 0x2;
} else {
_0x32e6dd = _0x50da75 * 0x3 / 0x2 + Math.atan(_0x167439);
}
}
return parseInt(_0x32e6dd);
};
webApp.config = {
'baseUrl': "https://m.motorgps.net/",
'wxappUrl': "https://wxapp.motorgps.net/",
'wwwUrl': "https://www.motorgps.net/",
'appDownloadUrl': "http://app.motorgps.net/",
'isRealTime': false,
'timer': 0x2710,
'debug': false
};
webApp.toolbar = {
'setTitle': function (_0x1b6c1a) {
$(".logo span").text(_0x1b6c1a);
if (isWeiXinBrowser()) {
document.title = webApp.gVal.str_center_title;
$("#head-title").text(webApp.gVal.str_center_title);
} else {
document.title = _0x1b6c1a;
$("#head-title").text(_0x1b6c1a);
}
if (webApp.gVal.str_center_title == _0x1b6c1a) {
$(".logo").hide();
$("article").css("padding-top", '0');
} else {
$(".logo").show();
$("article").css("padding-top", '50');
}
},
'showBack': function () {
$('.logo\x20.Return').show();
$(".logo .Return").unbind();
$('.logo\x20.Return').click(function () {
if (!webApp.activePage || !webApp.activePage.pageName) {
webApp.router.go(g_homepage);
return;
}
if (isXAMS() && "zhihui-center" == webApp.activePage.pageName) {
webApp.router.go(g_homepage);
return;
}
switch (webApp.activePage.pageName) {
case "history":
case "morth":
case "car-setting":
case "warn-search":
case "self-setting":
case 'pay':
case "help":
case "streetview":
webApp.router.go(g_homepage);
break;
default:
window.history.go(-0x1);
break;
}
});
},
'hideBack': function () {
$(".logo .Return").hide();
},
'showTeam': function () {
webApp.toolbar.showBack();
$(".logo .searchClk").show();
$(".logo .addClk").show();
},
'hideTeam': function () {
webApp.toolbar.hideBack();
$(".logo .searchClk").hide();
$(".logo .addClk").hide();
},
'showHistory': function () {
webApp.toolbar.showBack();
$(".logo .dataClk").show();
$('.logo\x20.carClk').show();
},
'hideHistory': function () {
webApp.toolbar.hideBack();
$(".logo .dataClk").hide();
$(".logo .carClk").hide();
}
};
webApp.resetRefresh = function () {
storeLog("webApp.resetRefresh timestamp: " + new Date().getTime());
clearTimeout(webApp.timerReloadID);
webApp.timerReloadID = 0x0;
localStorageSet("auto_refresh_times", 0x0);
};
webApp.realTimeFun = function (_0x450519) {
if (webApp.config.isRealTime && typeof _0x450519 == 'function') {
setTimeout(_0x450519, webApp.config.timer);
}
};
webApp.As = {
'baseUrl': webApp.config.baseUrl,
'baseRequest': function (_0x5c1b2a, _0xd6644f) {
if (!isXAMS() && webApp.comm.getDID() == g_tester_did) {
var _0x5f08d0 = _0xd6644f.data.action;
if (typeof _0x5f08d0 != "undefined") {
var _0x42ae8e = ["set", "new", "add", "del", "update", "change", "dismiss", "quit", "unbind", "weixin", "join", "agree"];
for (var _0xca16bf = 0x0; _0xca16bf < _0x42ae8e.length; _0xca16bf++) {
if (_0x5f08d0.indexOf(_0x42ae8e) >= 0x0) {
if ("offset" != _0x5f08d0) {
webApp.toastr.success({
'msg': webApp.gVal.str_try_mode_success,
'options': {
'timeOut': 0x3e8,
'progressBar': true,
'hideDuration': 0x12c
}
});
return;
}
}
}
}
}
var _0x2384d3 = JSON.stringify(_0xd6644f.data);
var _0x1e3c04 = webApp.comm.getPostData();
var _0x4b0d4a = parseInt(new Date().getTime());
if (_0x2384d3 == _0x1e3c04) {
var _0x208dcf = webApp.comm.getPostTimestmap();
if (null == _0x208dcf) {
_0x208dcf = 0x0;
} else {
_0x208dcf = parseInt(_0x208dcf);
}
var _0x20fdf9 = _0x4b0d4a - _0x208dcf;
if (_0x20fdf9 < 0x1f4) {
return;
}
}
webApp.comm.setPostData(_0x2384d3);
webApp.comm.setPostTimestmap(_0x4b0d4a);
var _0x3d824a = _0xd6644f.callback || {};
var _0xa6d738 = _0xd6644f.errorback || {};
if (webApp.comm.getUserTid() != undefined && webApp.comm.getUserTid() != webApp.comm.empty) {
if (_0xd6644f != null && _0xd6644f.data != null) {
_0xd6644f.data.tid = webApp.comm.getUserTid();
}
}
_0xd6644f.data.languageid = webApp.comm.getLanguageId();
_0xd6644f.data.app_agentid = getAgentId();
_0xd6644f.data.compress = 0x1;
_0xd6644f.data.qtype = localStorageGet("qtype");
Vue.http.jsonp(this.baseUrl + _0x5c1b2a, _0xd6644f.data, {}).then(function (_0xd5c61c) {
if (0x1 == _0xd5c61c.data.compress) {
var _0x5ea490 = _0xd5c61c.data.data;
var _0x1c6a9a = 0x1;
var _0x790310 = parseInt(_0x5ea490.charAt(0x0));
switch (_0x790310) {
case 0x1:
_0x1c6a9a = 0x3;
break;
case 0x2:
_0x1c6a9a = 0x5;
break;
case 0x3:
_0x1c6a9a = 0x2;
break;
case 0x4:
_0x1c6a9a = 0x4;
break;
case 0x5:
_0x1c6a9a = 0x1;
break;
case 0x6:
_0x1c6a9a = 0x7;
break;
case 0x7:
_0x1c6a9a = 0x9;
break;
case 0x8:
_0x1c6a9a = 0x6;
break;
case 0x9:
_0x1c6a9a = 0x8;
break;
default:
break;
}
var _0x94f147 = _0x5ea490.substr(0x1, _0x1c6a9a) + _0x5ea490.substr(_0x1c6a9a + 0x2);
var _0x502d00 = atob(_0x94f147);
var _0x5ebca0 = _0x502d00.split('').map(function (_0x1a3e0a) {
return _0x1a3e0a.charCodeAt(0x0);
});
var _0x77c17d = new Uint8Array(_0x5ebca0);
var _0x133ba6 = _0x1d3e75.inflate(_0x77c17d);
_0xd5c61c.data = JSON.parse(String.fromCharCode.apply(null, new Uint16Array(_0x133ba6)));
}
if (_0xd5c61c.data.result == webApp.comm.authStatus.success || _0xd5c61c.data.result == webApp.comm.authStatus.successText || _0xd5c61c.data.result == webApp.comm.authStatus.successText2) {
if (typeof _0x3d824a == "function" && typeof _0xd5c61c.data != "undefined") {
_0x3d824a(_0xd5c61c.data);
}
} else if (_0xd5c61c.data.result == webApp.comm.authStatus.not_login || _0xd5c61c.data.result == webApp.comm.authStatus.not_permiss) {
webApp.toastr.error({
'msg': webApp.comm.toCn(_0xd5c61c.data.message)
});
showAlertDialog(webApp.comm.toCn(_0xd5c61c.data.message), '', function () {
webApp.comm.clearLogin();
webApp.router.go("login");
});
} else if (_0xd5c61c.data.result == webApp.comm.authStatus.passwd_simple) {
webApp.toastr.warning({
'msg': webApp.comm.toCn(_0xd5c61c.data.message)
});
showAlertDialog(webApp.comm.toCn(_0xd5c61c.data.message), '', function () {
webApp.router.go("change-pas");
});
} else {
if (_0xd6644f.data.action != undefined && _0xd6644f.data.action == "login") {
if (typeof _0xd6644f.errorback == "function") {
_0xd6644f.errorback(_0xd5c61c);
}
} else {
webApp.toastr.error({
'msg': webApp.comm.toCn(_0xd5c61c.data.message)
});
if (typeof _0xd6644f.errorback == "function") {
_0xd6644f.errorback(_0xd5c61c);
}
}
}
}, function (_0x47882f) {
if (0x194 == _0x47882f.status) {
webApp.toastr.error({
'msg': webApp.gVal.str_network_error
});
} else {
var _0x293ff3 = webApp.gVal.str_unknown_error;
if (_0x47882f.data != null) _0x293ff3 = webApp.comm.toCn(_0x47882f.data.message);
webApp.toastr.error({
'msg': _0x293ff3
});
}
if (typeof _0xd6644f.errorback == "function") {
_0xd6644f.errorback(_0x47882f);
}
});
}
};
return _0x579b3a;
});
```
(http://jsnice.org/)混淆一下,就好看多了
``` javascript
'use strict';
define(["pako"], function(options) {
var self = {
"empty" : "",
"booleanValue" : {
"yes" : "1",
"no" : "0"
},
"authStatus" : {
"success" : 1,
"successText" : "RESULT_SUCESS",
"successText2" : "RESULT_SUCCESS",
"failed" : 0,
"not_login" : -1,
"not_permiss" : -2,
"passwd_simple" : -7
},
"modules" : {
"user" : "user",
"device" : "device",
"agents" : "agents"
},
"actions" : {
"tems" : {
"getmyteamlist" : "getmyteamlist",
"getmyteamone" : "getmyteamone",
"dismissteam" : "dismissteam",
"quitmyteam" : "quitmyteam",
"quitteambyowner" : "quitteambyowner",
"newteam" : "newteam",
"updateteam" : "updateteam",
"jointeam" : "jointeam",
"getteamuserforme" : "getteamuserforme",
"queryteamjoin" : "queryteamjoin",
"agreeteamjoin" : "agreeteamjoin",
"queryteam" : "queryteam",
"queryteambyid" : "queryteambyid",
"getteammemo" : "getteammemo",
"addteammemo" : "addteammemo",
"deleteteammemo" : "deleteteammemo",
"getteamuserformap" : "getteamuserformap"
},
"device" : {
"devicelist" : "devicelist"
},
"other" : {
"get_cities" : "get_cities",
"get_brands" : "get_brands"
}
},
"mapType" : {
"prefer" : "baidu",
"baidu" : "baidu",
"google" : "google",
"amap" : "amap",
"bing" : "bing",
"tmap" : "tmap"
},
"mapKey" : {
"baidu" : "9KbipA4zmOrBhdNfjOaofk3G",
"google" : "AIzaSyB_VPsLYyYqC6cA7FvSnfXTxnYIjq6Hb_k",
"amap" : g_amap_key,
"bing" : "Au071A6iVWT0tSsA9RQyoZWPOiR6SC7AF-GzgKjeXFq9dPvFMw0KlEzKgoU_9PZd",
"tmap" : "RSGBZ-DC23J-VQAFL-F2XYW-3C6N5-UVBFU"
},
"getMapScript" : function() {
if (webApp.comm.getMapType() == webApp.comm.mapType.google) {
return ["script/map", "script/google-label-marker", "script/gmap"];
} else {
if (webApp.comm.getMapType() == webApp.comm.mapType.bing) {
return ["script/map", "async!https://www.bing.com/api/maps/mapcontrol?key=" + webApp.comm.mapKey.bing];
} else {
if (webApp.comm.getMapType() == webApp.comm.mapType.amap) {
return ["script/map"];
} else {
if (webApp.comm.getMapType() == webApp.comm.mapType.tmap) {
return ["script/map", "async!https://map.qq.com/api/js?v=2.exp&key=" + webApp.comm.mapKey.tmap];
} else {
return ["script/map", "async!https://api.map.baidu.com/api?v=3.0&ak=" + webApp.comm.mapKey.baidu];
}
}
}
}
},
"getGMapKey" : function() {
var a_embed = localStorageGet("gmap_key");
if (null == a_embed || 39 != a_embed.length) {
return webApp.comm.mapKey.google;
}
a_embed = a_embed.substr(26, 13) + a_embed.substr(0, 13) + a_embed.substr(13, 13);
return a_embed;
},
"setGMapKey" : function(mmCoreSplitViewBlock) {
if (mmCoreSplitViewBlock) {
localStorageSet("gmap_key", mmCoreSplitViewBlock);
}
},
"getHomepageStyle" : function() {
var _0x32d731 = localStorageGet("homepage_style");
if (null == _0x32d731) {
return g_homepage_style;
}
return localStorageGet("homepage_style");
},
"setHomepageStyle" : function(intPercentOfMax) {
/** @type {number} */
intPercentOfMax = parseInt(intPercentOfMax);
if (intPercentOfMax < 0 || intPercentOfMax > 1) {
/** @type {number} */
intPercentOfMax = 0;
}
localStorageSet("homepage_style", intPercentOfMax);
},
"getGoogleStyle" : function() {
var _0x22e15c = localStorageGet("google_style");
if (null == _0x22e15c) {
return g_google_style;
}
return localStorageGet("google_style");
},
"setGoogleStyle" : function(intPercentOfMax) {
/** @type {number} */
intPercentOfMax = parseInt(intPercentOfMax);
if (intPercentOfMax < 0 || intPercentOfMax > 1) {
/** @type {number} */
intPercentOfMax = 0;
}
localStorageSet("google_style", intPercentOfMax);
},
"getAutoHideControlPanel" : function() {
var _0x21a628 = localStorageGet("auto_hide_control_panel");
if (null == _0x21a628) {
return g_homepage_auto_hide_panel;
}
return localStorageGet("auto_hide_control_panel");
},
"setAutoHideControlPanel" : function(mmCoreSplitViewBlock) {
localStorageSet("auto_hide_control_panel", mmCoreSplitViewBlock);
},
"getAutoHideControlTianqi" : function() {
var _0x1bef5a = localStorageGet("auto_hide_control_tianqi");
if (null == _0x1bef5a) {
return g_homepage_auto_hide_tianqi;
}
return localStorageGet("auto_hide_control_tianqi");
},
"setAutoHideControlTianqi" : function(mmCoreSplitViewBlock) {
localStorageSet("auto_hide_control_tianqi", mmCoreSplitViewBlock);
},
"getAlarmMusicPlay" : function() {
var _0x281798 = localStorageGet("alarm_music_play");
if (null == _0x281798) {
return 1;
}
return localStorageGet("alarm_music_play");
},
"setAlarmMusicPlay" : function(mmCoreSplitViewBlock) {
localStorageSet("alarm_music_play", mmCoreSplitViewBlock);
},
"getHomepageBgcolor" : function() {
var _0x39f959 = localStorageGet("homepage_bgcolor");
if (null == _0x39f959) {
return g_homepage_bgcolor;
}
return localStorageGet("homepage_bgcolor");
},
"setHomepageBgcolor" : function(mmCoreSplitViewBlock) {
localStorageSet("homepage_bgcolor", mmCoreSplitViewBlock);
},
"getHomepageBgcolorArr" : function() {
return ["#FFF", "#87CEEB", "#FFD700", "#FF6100", "#00C957", "#DA70D6", "#FF4500", "#C0C0C0", "#D2B48C"];
},
"getColorNameFromCode" : function(canCreateDiscussions) {
var _0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_white;
switch(canCreateDiscussions) {
case "#87CEEB":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_skyblue;
break;
case "#FFD700":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_gold;
break;
case "#FF6100":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_orange;
break;
case "#00C957":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_emerald;
break;
case "#DA70D6":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_lavender;
break;
case "#FF4500":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_nacarat;
break;
case "#C0C0C0":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_gray;
break;
case "#D2B48C":
_0x5b1cf8 = webApp.gVal.str_homepage_bgcolor_tan;
break;
default:
break;
}
return _0x5b1cf8;
},
"getLanguageId" : function() {
var _0x4c9ef0 = localStorageGet("LanguageId");
if (_0x4c9ef0 > g_Language_cn && _0x4c9ef0 <= g_Language_numbers) {
return _0x4c9ef0;
}
return g_Language_cn;
},
"setLanguageId" : function(key) {
if (key > g_Language_cn && key <= g_Language_numbers) {
localStorageSet("LanguageId", key);
mobile_store_set("LanguageId", key);
} else {
localStorageSet("LanguageId", g_Language_cn);
mobile_store_set("LanguageId", g_Language_cn);
}
},
"getLanguageDir" : function() {
var indexLookupKey = self.getLanguageId();
if (indexLookupKey > g_Language_cn && indexLookupKey <= g_Language_numbers) {
return g_LanguageDir;
}
return "";
},
"setLanguageSelect" : function($) {
var undefined = self.getLanguageId();
$.setFirstSelectValue = undefined;
$.init({
"trigger" : "#flag_id",
"data" : g_json_language,
"position" : "bottom",
"buttons" : [{
"yes" : webApp.gVal.str_confirm
}, {
"no" : webApp.gVal.str_cancel
}],
"callback" : function(result, color, label) {
/** @type {number} */
var person = parseInt(label.toString());
if (person != undefined) {
self.setLanguageId(person);
location.reload();
}
}
});
},
"getServerId" : function() {
var index = localStorageGet("serverId");
if (index > g_Server_cn && index <= g_Server_numbers) {
return index;
}
return g_Server_cn;
},
"setServerId" : function(key) {
if (key > g_Server_cn && key <= g_Server_numbers) {
localStorageSet("serverId", key);
} else {
localStorageSet("serverId", key);
}
},
"setServerSelect" : function($) {
var undefined = self.getServerId();
$.setFirstSelectValue = undefined;
$.init({
"trigger" : "#server_id",
"data" : g_json_server,
"position" : "bottom",
"buttons" : [{
"yes" : webApp.gVal.str_confirm
}, {
"no" : webApp.gVal.str_cancel
}],
"callback" : function(formats, color, pointSizeParam) {
/** @type {number} */
var person = parseInt(pointSizeParam.toString());
if (person != undefined) {
self.setServerId(person);
location.reload();
}
}
});
},
"getLoginUser" : function() {
return localStorageGet("username");
},
"setLoginUser" : function(mmCoreSplitViewBlock) {
localStorageSet("username", mmCoreSplitViewBlock);
mobile_store_set("username", mmCoreSplitViewBlock);
},
"getUserTid" : function() {
return localStorageGet("userTid");
},
"setUserTid" : function(mmCoreSplitViewBlock) {
localStorageSet("userTid", mmCoreSplitViewBlock);
mobile_store_set("userTid", mmCoreSplitViewBlock);
},
"getLoginStatus" : function() {
return localStorageGet("login_status");
},
"setLoginStatus" : function($http) {
localStorageSet("login_status", $http);
},
"getLoginUserBak" : function() {
return localStorageGet("username_bak");
},
"setLoginUserBak" : function(mmCoreSplitViewBlock) {
localStorageSet("username_bak", mmCoreSplitViewBlock);
},
"getUID" : function() {
return localStorageGet("uid");
},
"setUID" : function(uid) {
localStorageSet("uid", uid);
},
"getDID" : function() {
if (!self.checkLogin()) {
return -1;
}
var id = localStorageGet("car_did");
if (typeof id == "undefined" || null == id) {
return 0;
}
return parseInt(id);
},
"setDID" : function(alwaysDownload) {
localStorageSet("car_did", alwaysDownload);
},
"getIMEI" : function(result) {
return localStorageGet("dev_imei_" + result);
},
"setIMEI" : function(mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName) {
localStorageSet("dev_imei_" + mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName);
},
"getMID" : function() {
return localStorageGet("dev_mid");
},
"setMID" : function(id) {
localStorageSet("dev_mid", id);
},
"getDeviceAgentId" : function(canCreateDiscussions) {
return localStorageGet("dev_agentid_" + canCreateDiscussions);
},
"setDeviceAgentId" : function(mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName) {
localStorageSet("dev_agentid_" + mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName);
},
"getDevicePrivatePolicy" : function(canCreateDiscussions) {
if (canCreateDiscussions < 27E4 && g_tester_did != canCreateDiscussions) {
return 1;
}
var id = localStorageGet("dev_private_policy");
if (typeof id == "undefined" || null == id) {
return 0;
}
return parseInt(id) > 0 ? 1 : 0;
},
"setDevicePrivatePolicy" : function(id_local) {
localStorageSet("dev_private_policy", parseInt(id_local));
},
"getBrand" : function(number) {
return localStorageGet("dev_brand_" + number);
},
"setBrand" : function(brand, extra) {
localStorageSet("dev_brand_" + brand, extra);
},
"getShowAdPanel" : function() {
return localStorageGet("show_ad_panel");
},
"setShowAdPanel" : function(mmCoreSplitViewBlock) {
localStorageSet("show_ad_panel", mmCoreSplitViewBlock);
},
"getHomepageSkinImg" : function() {
return JSON.parse(localStorageGet("homepage_skin_arr"));
},
"setHomepageSkinImg" : function(storedComponents) {
localStorageSet("homepage_skin_arr", JSON.stringify(storedComponents));
},
"getAdData" : function(canCreateDiscussions) {
return JSON.parse(localStorageGet("dev_ad_data_" + canCreateDiscussions));
},
"setAdData" : function(elem, new_type) {
localStorageSet("dev_ad_data_" + elem, JSON.stringify(new_type));
},
"setCallNumber" : function(mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName) {
localStorageSet("dev_call_number_" + mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName);
},
"getCallNumber" : function(canCreateDiscussions) {
return localStorageGet("dev_call_number_" + canCreateDiscussions);
},
"setCrashNumber" : function(mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName) {
localStorageSet("dev_crash_number_" + mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName);
},
"getCrashNumber" : function(canCreateDiscussions) {
return localStorageGet("dev_crash_number_" + canCreateDiscussions);
},
"setSupportedList" : function(parent_real, level) {
if (typeof level != "undefined") {
/** @type {string} */
var numberOfTiles = JSON.stringify(level);
localStorageSet("dev_supported_list_" + parent_real, numberOfTiles);
} else {
localStorageSet("dev_supported_list_" + parent_real, "");
}
},
"getSupportedList" : function(uriString) {
var permissions = localStorageGet("dev_supported_list_" + uriString);
/** @type {*} */
var groupPermissionsRef = JSON.parse(permissions);
return groupPermissionsRef;
},
"getDevNickName" : function() {
return localStorageGet("dev_nick_name");
},
"setDevNickName" : function(isBgroundImg) {
localStorageSet("dev_nick_name", isBgroundImg);
},
"getUserNickName" : function() {
return localStorageGet("user_nick_name");
},
"setUserNickName" : function(mmCoreSplitViewBlock) {
localStorageSet("user_nick_name", mmCoreSplitViewBlock);
},
"clearLogin" : function() {
webApp.comm.setLoginUser(webApp.comm.empty);
webApp.comm.setLoginStatus(webApp.comm.empty);
webApp.comm.setUserTid(webApp.comm.empty);
},
"checkLogin" : function() {
if (self.getLoginUser() != undefined && self.getLoginUser().length > 0 && self.getLoginStatus() == self.authStatus.success) {
return true;
} else {
return false;
}
},
"setMapType" : function(type) {
localStorageSet("map_type", type);
},
"getMapType" : function() {
var data = localStorageGet("map_type");
if (typeof data == "undefined" || null == data) {
return self.mapType.prefer;
}
return localStorageGet("map_type");
},
"setWeixinOpenID" : function(mmCoreSplitViewBlock, $state) {
localStorageSet("openid_" + $state, mmCoreSplitViewBlock);
},
"getWeixinOpenID" : function(canCreateDiscussions) {
return localStorageGet("openid_" + canCreateDiscussions);
},
"setStorePoint" : function(IDM_s0, IDM_b) {
if (!IDM_s0 || !IDM_b) {
return;
}
localStorageSet("store_point", parseFloat(IDM_s0) + "," + parseFloat(IDM_b));
},
"getStorePoint" : function() {
var attrs = localStorageGet("store_point");
if (null == attrs || !attrs || typeof attrs == "undefined") {
attrs = {
"lng" : 0,
"lat" : 0
};
} else {
attrs = attrs.split(",");
if (2 == attrs.length) {
attrs = {
"lng" : parseFloat(attrs),
"lat" : parseFloat(attrs)
};
} else {
attrs = {
"lng" : 0,
"lat" : 0
};
}
}
return attrs;
},
"setLastPointNavigation" : function(IDM_s0, IDM_b) {
if (!IDM_s0 || !IDM_b) {
return;
}
localStorageSet("navigation_last_" + webApp.comm.getDID(), parseFloat(IDM_s0) + "," + parseFloat(IDM_b));
},
"getLastPointNavigation" : function() {
var attrs = localStorageGet("navigation_last_" + webApp.comm.getDID());
if (null == attrs || !attrs || typeof attrs == "undefined") {
attrs = {
"lng" : 0,
"lat" : 0
};
} else {
attrs = attrs.split(",");
if (2 == attrs.length) {
attrs = {
"lng" : parseFloat(attrs),
"lat" : parseFloat(attrs)
};
} else {
attrs = {
"lng" : 0,
"lat" : 0
};
}
}
return attrs;
},
"setLastPoint" : function(IDM_s0, fltScore, fltMaxScore) {
if (!IDM_s0 || !fltScore) {
return;
}
if ("gps" != fltMaxScore) {
fltMaxScore = webApp.comm.getMapType();
}
localStorageSet(fltMaxScore + "_last_" + webApp.comm.getDID(), parseFloat(IDM_s0) + "," + parseFloat(fltScore));
},
"getLastPoint" : function(graph_id) {
if ("gps" != graph_id) {
graph_id = webApp.comm.getMapType();
}
var attrs = localStorageGet(graph_id + "_last_" + webApp.comm.getDID());
if (null == attrs || !attrs || typeof attrs == "undefined") {
attrs = {
"lng" : 0,
"lat" : 0
};
} else {
attrs = attrs.split(",");
if (2 == attrs.length) {
attrs = {
"lng" : parseFloat(attrs),
"lat" : parseFloat(attrs)
};
} else {
attrs = {
"lng" : 0,
"lat" : 0
};
}
}
return attrs;
},
"setVersion" : function(version, template) {
localStorageSet("version_" + version, template);
},
"getVersion" : function(version) {
return localStorageGet("version_" + version);
},
"setProduct" : function(val, formStyles) {
localStorageSet("product_" + val, formStyles);
},
"getProduct" : function(callback) {
return localStorageGet("product_" + callback);
},
"setDeviceNumber" : function(mmCoreSplitViewBlock) {
localStorageSet("device_number", mmCoreSplitViewBlock);
},
"getDeviceNumber" : function() {
return localStorageGet("device_number");
},
"setAdTimestmap" : function(mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName) {
localStorageSet("agents_sync_timestamp_" + mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName);
},
"getAdTimestmap" : function(canCreateDiscussions) {
return localStorageGet("agents_sync_timestamp_" + canCreateDiscussions);
},
"setPostTimestmap" : function(termOrder) {
localStorageSet("post_timestamp", termOrder);
},
"getPostTimestmap" : function() {
return localStorageGet("post_timestamp");
},
"setPostData" : function(data) {
localStorageSet("post_data", data);
},
"getPostData" : function() {
return localStorageGet("post_data");
},
"setHomepageJump" : function(backgroundColorFunc, textColorFunc) {
localStorageSet("homepage_jump_" + backgroundColorFunc, textColorFunc);
},
"getHomepageJump" : function(canCreateDiscussions) {
return localStorageGet("homepage_jump_" + canCreateDiscussions);
},
"setMapHeight" : function(i) {
var classNumber = $(window).height();
$("#mapid").css("height", parseInt(classNumber * i));
},
"autoSetMapHeight" : function() {
var itemCSS = $("#mapid").offset();
/** @type {number} */
var meterPos = $(window).height() - itemCSS.top;
$("#mapid").css("height", meterPos);
},
"drawMapLine" : function(inWeb, inTopic) {
/** @type {!Array} */
var pathComps = [];
pathComps.push(inWeb);
pathComps.push(inTopic);
return webApp.comm.drawMapLineFromArr(pathComps);
},
"showMapAddress" : function(context, state, value, type) {
if (null == value || !value) {
return;
}
/** @type {(Element|null)} */
var t = document.getElementById(value);
if (typeof t == "undefined" || null == t) {
return;
}
var content = webApp.comm.removePostcode(context);
if (type) {
/** @type {string} */
type = "[" + type + "] ";
}
if ("gps" == state) {
content = type + content + webApp.gVal.str_comm_gps_position;
} else {
if ("lbs" == state) {
content = type + content + webApp.gVal.str_comm_lbs_position;
} else {
if ("mobile" == state) {
content = type + content + webApp.gVal.str_comm_mobile_position;
} else {
if ("trace" == state) {
}
}
}
}
t.innerHTML = content;
},
"removePostcode" : function(a) {
var b = a.indexOf(webApp.gVal.str_comm_postcode);
if (b > 0) {
a = a.substring(0, b - 1);
}
return a;
},
"distanceByTwoLnglat" : function(x, y, r, p) {
/**
* @param {number} x
* @return {?}
*/
function expm1(x) {
return x * Math.PI / 180;
}
if (!x || !y || !r || !p) {
return 0;
}
var a = expm1(y);
var b = expm1(p);
/** @type {number} */
var diff = a - b;
/** @type {number} */
var delta_lng = expm1(x) - expm1(r);
/** @type {number} */
var base_cost = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(diff / 2), 2) + Math.cos(a) * Math.cos(b) * Math.pow(Math.sin(delta_lng / 2), 2)));
/** @type {number} */
base_cost = base_cost * 6378137;
/** @type {number} */
base_cost = Math.round(base_cost * 1E4) / 1E4;
return base_cost;
},
"timeIntervalBetween" : function(childCompute, parentCompute) {
/** @type {number} */
var auth0_time = parseInt(webApp.comm.UnixTimestamp(childCompute));
/** @type {number} */
var local_time = parseInt(webApp.comm.UnixTimestamp(parentCompute));
return Math.abs(auth0_time - local_time);
},
"formatSecondsToHours" : function(value) {
/** @type {number} */
var theTime = parseInt(value);
/** @type {number} */
var theTime1 = 0;
/** @type {number} */
var slideNo = 0;
if (theTime > 60) {
/** @type {number} */
theTime1 = parseInt(theTime / 60);
/** @type {number} */
theTime = parseInt(theTime % 60);
if (theTime1 > 60) {
/** @type {number} */
slideNo = parseInt(theTime1 / 60);
/** @type {number} */
theTime1 = parseInt(theTime1 % 60);
}
}
/** @type {string} */
var th_field = "";
if (theTime > 0) {
/** @type {string} */
th_field = "" + parseInt(theTime) + webApp.gVal.str_second;
}
if (theTime1 > 0) {
/** @type {string} */
th_field = "" + parseInt(theTime1) + webApp.gVal.str_minute + th_field;
}
if (slideNo > 0) {
/** @type {string} */
th_field = "" + parseInt(slideNo) + webApp.gVal.str_hour + th_field;
}
return th_field;
},
"afterDeviceSelected" : function(fn, param, trainsize) {
var alwaysDownload = trainsize.toString();
var newPageIdex = param.toString();
g_deviceListCtr.setFirstSelectValue = alwaysDownload;
webApp.comm.setDID(alwaysDownload);
webApp.comm.setDevNickName(newPageIdex);
$("#device_list_did").attr("value", alwaysDownload);
$("#device_list_txt").val(newPageIdex);
},
"initDeviceListCtr" : function(data, fn, module) {
if (!data || data.length <= 0) {
$("#device_list_id").hide();
} else {
if (data.length <= 1) {
$("#device_list_did").attr("value", webApp.comm.getDID());
$("#device_list_txt").val(webApp.comm.getDevNickName());
$("#device_list_id").hide();
} else {
$("#device_list_did").attr("value", webApp.comm.getDID());
$("#device_list_txt").val(webApp.comm.getDevNickName());
$("#device_list_id").show();
/** @type {!Array} */
var cloudLocations = [];
/** @type {number} */
var i = 0;
for (; i < data.length; i++) {
cloudLocations.push({
"id" : data.did,
"name" : data.nickname
});
}
g_deviceListCtr.init({
"trigger" : "#device_list_txt",
"data" : cloudLocations,
"position" : "bottom",
"buttons" : [{
"yes" : webApp.gVal.str_confirm
}, {
"no" : webApp.gVal.str_cancel
}],
"callback" : module
});
g_deviceListCtr.setFirstSelectValue = webApp.comm.getDID();
}
}
if (null != fn) {
fn();
}
},
"setDeviceListCache" : function(cache) {
if (cache.length <= 0) {
return;
}
/** @type {!Array} */
var picmenu_list = [];
/** @type {number} */
var i = 0;
for (; i < cache.length; i++) {
picmenu_list.push(cache.did);
localStorageSet("device_list_cache_" + cache.did, JSON.stringify(cache));
}
localStorageSet("device_list_cache_did", JSON.stringify(picmenu_list));
},
"getDeviceListCache" : function() {
/** @type {!Array} */
var newNodeLists = [];
/** @type {*} */
var crossfilterable_layers = JSON.parse(localStorageGet("device_list_cache_did"));
/** @type {number} */
var layer_i = 0;
for (; layer_i < crossfilterable_layers.length; layer_i++) {
newNodeLists.push(JSON.parse(localStorageGet("device_list_cache_" + crossfilterable_layers)));
}
return newNodeLists;
},
"setDeviceListCacheDid" : function(canCreateDiscussions, obj) {
localStorageSet("device_list_cache_" + canCreateDiscussions, JSON.stringify(obj));
},
"getDeviceListCacheDid" : function(canCreateDiscussions) {
return JSON.parse(localStorageGet("device_list_cache_" + canCreateDiscussions));
},
"getDeviceList" : function(minWeightMagnitude, callback, element) {
if (minWeightMagnitude) {
var selected = webApp.comm.getDeviceListCache();
if (selected != null && typeof selected != "undefined") {
webApp.comm.initDeviceListCtr(selected, callback, element);
return;
}
}
webApp.As.baseRequest("service.php", {
"data" : _0x1e9ba3,
"callback" : function(stat) {
if (stat.result == webApp.comm.authStatus.success) {
if (stat.data.length > 0) {
if (stat.data.length > g_bound_devices_warn_count) {
webApp.toastr.info({
"msg" : webApp.gVal.str_warn_too_much_devices1 + stat.data.length + webApp.gVal.str_warn_too_much_devices2 + webApp.gVal.str_400,
"options" : {
"timeOut" : 5E3,
"hideDuration" : 3E3
}
});
}
webApp.comm.setDeviceListCache(stat.data);
var temp = webApp.comm.getDID();
/** @type {number} */
var _0x42436b = 0;
/** @type {number} */
var _0x23ccd9 = 0;
var result = stat.data;
/** @type {number} */
var i = 0;
for (; i < result.length; i++) {
webApp.comm.setVersion(result.did, result.version);
webApp.comm.setProduct(result.did, result.product);
webApp.comm.setIMEI(result.did, result.imei);
webApp.comm.setBrand(result.did, result.brand);
webApp.comm.setDeviceAgentId(result.did, result.agentid);
webApp.comm.setSupportedList(result.did, result.supported_list);
if (temp == result.did) {
/** @type {number} */
_0x42436b = 1;
webApp.comm.setDevNickName(result.nickname);
webApp.comm.setMID(result.mid);
_0x23ccd9 = result.supported_list.shake_sensor;
}
}
if (0 == _0x42436b) {
var data = stat.data;
if (data) {
if (data.did) {
temp = data.did;
webApp.comm.setDID(data.did);
webApp.comm.setDevNickName(data.nickname);
webApp.comm.setMID(data.mid);
_0x23ccd9 = data.supported_list.shake_sensor;
}
}
}
webApp.comm.setDeviceNumber(result.length);
webApp.comm.initDeviceListCtr(result, callback, element);
let redirectIdx = "zhihui-center";
if (1 == _0x23ccd9) {
/** @type {string} */
redirectIdx = "gyroscope-home";
}
if (redirectIdx != get_homepage()) {
set_homepage(temp, redirectIdx);
}
if ("zhihui-center" == webApp.activePage.pageName) {
if ("gyroscope-home" == redirectIdx) {
if ("no_jump" != webApp.comm.getHomepageJump(webApp.comm.getDID())) {
webApp.router.go(redirectIdx);
}
webApp.comm.setHomepageJump(webApp.comm.getDID(), "");
}
}
} else {
showAlertDialog(webApp.gVal.str_error_no_device_binding + webApp.gVal.str_400, "", function() {
webApp.comm.clearLogin();
webApp.router.go("login");
}, null);
}
}
}
});
},
"resizeMapImageSize" : function() {
/** @type {number} */
var exHeight = parseInt($(window).width() / 9);
if (exHeight > g_width_max) {
exHeight = g_width_max;
} else {
if (exHeight < g_width_min) {
exHeight = g_width_min;
}
}
$(".link-span").css("width", exHeight);
$(".map-box .link-span a").css("width", exHeight);
$(".map-box .link-span a").css("height", exHeight);
return exHeight;
},
"logout" : function() {
if (isXAMS()) {
_0x4513f1 = {
"module" : "agents",
"action" : "logout"
};
}
webApp.As.baseRequest("service.php", {
"data" : _0x4513f1,
"callback" : function(result) {
if (result.result == webApp.comm.authStatus.success) {
webApp.comm.clearLogin();
webApp.toastr.info({
"msg" : webApp.gVal.str_login_out_success
});
setTimeout(function() {
webApp.router.go("login");
}, 1200);
}
}
});
},
"checkIOSUpdate" : function() {
webApp.As.baseRequest("service.php", {
"data" : _0x5ba76f,
"callback" : function(result) {
if (result.result == webApp.comm.authStatus.success) {
if (result.data.version > g_current_softver) {
showConfirmDialog(webApp.gVal.str_comm_new_version, "", "", function() {
window.open(result.data.url, "_blank", "location=no,toolbarposition=top,closebuttoncaption=" + webApp.gVal.str_comm_exit_update);
}, null);
}
}
}
});
},
"isDeviceSupported" : function(components, name) {
var d = webApp.comm.getSupportedList(components);
if (typeof d == "undefined" || d == null) {
return 0;
}
switch(name) {
case "fire":
return typeof d.fire_supported != "undefined" ? d.fire_supported : 0;
case "switch":
return typeof d.switch_supported != "undefined" ? d.switch_supported : 0;
case "parking":
return typeof d.parking_supported != "undefined" ? d.parking_supported : 0;
case "inside_battery":
return typeof d.inside_battery_supported != "undefined" ? d.inside_battery_supported : 0;
case "power_alltime":
return typeof d.power_alltime_supported != "undefined" ? d.power_alltime_supported : 0;
case "shake_sensor":
return typeof d.shake_sensor != "undefined" ? d.shake_sensor : 0;
}
return 0;
},
"getCurrentDeviceImgLocal" : function() {
var _0x2970d7 = localStorageGet("device_img_local");
if (!_0x2970d7) {
return g_homepage_img;
}
return _0x2970d7;
},
"setCurrentDeviceImgLocal" : function(mmCoreSplitViewBlock) {
if (!mmCoreSplitViewBlock) {
return;
}
localStorageSet("device_img_local", mmCoreSplitViewBlock);
},
"getCurrentDevice" : function() {
return webApp.comm.getDeviceListCacheDid(webApp.comm.getDID());
},
"getLocalDeviceType" : function(canCreateDiscussions) {
var _0x4ea485 = localStorageGet("device_local_type_" + canCreateDiscussions);
if (!_0x4ea485) {
return g_default_local_device_type;
}
return _0x4ea485;
},
"setLocalDeviceType" : function(mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName) {
if (!mmCoreLogEnabledConfigName) {
return;
}
localStorageSet("device_local_type_" + mmCoreLogEnabledDefault, mmCoreLogEnabledConfigName);
},
"getCurrentDeviceImg" : function(className, moduleName) {
if (0 != g_device_img_local) {
return webApp.comm.getCurrentDeviceImgLocal();
}
var point = webApp.comm.getCurrentDevice();
if (null != point) {
var node = point.pic_url;
if (node) {
if (className && node.indexOf(className) >= 0) {
node = node.replace(className, moduleName);
}
return node;
}
}
return g_homepage_img;
},
"setCurrentDeviceImg" : function(now) {
if (!now) {
return;
}
var canCreateDiscussions = webApp.comm.getDID();
var newAttributes = webApp.comm.getDeviceListCacheDid(canCreateDiscussions);
if (!newAttributes) {
return;
}
if (newAttributes.pic_url != now) {
/** @type {string} */
newAttributes.pic_url = now;
webApp.comm.setDeviceListCacheDid(canCreateDiscussions, newAttributes);
}
},
"getRemainPowerPercent" : function(key, stepAttachment) {
switch(stepAttachment) {
case 12:
/** @type {number} */
g_pvol_min = 10.8;
/** @type {number} */
g_pvol_max = 13.3;
break;
case 24:
/** @type {number} */
g_pvol_min = 21.6;
/** @type {number} */
g_pvol_max = 26.6;
break;
case 36:
/** @type {number} */
g_pvol_min = 32.4;
/** @type {number} */
g_pvol_max = 39.9;
break;
case 60:
/** @type {number} */
g_pvol_min = 54;
/** @type {number} */
g_pvol_max = 66.5;
break;
case 64:
/** @type {number} */
g_pvol_min = 56;
/** @type {number} */
g_pvol_max = 73.6;
break;
case 72:
/** @type {number} */
g_pvol_min = 64.8;
/** @type {number} */
g_pvol_max = 79.8;
break;
}
if (null == key) {
/** @type {number} */
key = 0;
}
/** @type {number} */
key = parseFloat(key);
if (isNaN(key)) {
/** @type {number} */
key = 0;
}
if (key < g_pvol_min) {
return 0;
}
if (key > g_pvol_max) {
return 100;
}
return parseInt(100 * (key - g_pvol_min) / (g_pvol_max - g_pvol_min));
},
"getRemainPower" : function(stepName, stepAttachment) {
var parameters = self.getRemainPowerPercent(stepName, stepAttachment);
if (parameters < 20) {
return "<font color='red'>" + parameters + "%</font>";
}
return "<font color='green'>" + parameters + "%</font>";
},
"getRemainPowerNumber" : function(stepName, stepAttachment) {
var parameters = self.getRemainPowerPercent(stepName, stepAttachment);
if (parameters < 5) {
return 0;
}
if (parameters < 35) {
return 1;
}
if (parameters < 65) {
return 2;
}
if (parameters < 95) {
return 3;
}
return 4;
},
"getEstimateMiles" : function(id_local) {
if (id_local) {
return parseInt(id_local);
}
return parseInt(100 * Math.random());
}
};
/**
* @return {undefined}
*/
self.initPrototype = function() {
/**
* @return {string}
* @this {!String}
*/
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
};
/**
* @param {string} format
* @return {?}
*/
Date.prototype.Format = function(format) {
var o = {
"M+" : this.getMonth() + 1,
"d+" : this.getDate(),
"h+" : this.getHours(),
"m+" : this.getMinutes(),
"s+" : this.getSeconds(),
"q+" : Math.floor((this.getMonth() + 3) / 3),
"S" : this.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
var str;
for (str in o) {
if ((new RegExp("(" + str + ")")).test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o : ("00" + o).substr(("" + o).length));
}
}
return format;
};
};
/**
* @param {string} value
* @return {?}
*/
self.toUnicode = function(value) {
/** @type {!Array} */
var calIds = [];
if (value != undefined) {
/** @type {number} */
var i = 0;
for (; i < value.length; i++) {
calIds = ("00" + value.charCodeAt(i).toString(16)).slice(-4);
}
} else {
return "";
}
return "\\u" + calIds.join("\\u");
};
/**
* @param {string} format
* @return {?}
*/
self.toCn = function(format) {
if (format != undefined) {
format = format.replace(/\\/g, "%");
} else {
return "";
}
return unescape(format);
};
/**
* @param {?} n
* @return {?}
*/
self.getRandom = function(n) {
return Math.floor(Math.random() * Math.pow(10, n) + 1);
};
/**
* @param {number} step
* @param {number} i
* @return {?}
*/
self.round = function(step, i) {
/** @type {number} */
var m = 1;
for (; i > 0; m = m * 10, i--) {
}
for (; i < 0; m = m / 10, i++) {
}
return Math.round(step * m) / m;
};
/**
* @param {number} index
* @param {string} value
* @return {?}
*/
self.randomNumBoth = function(index, value) {
/** @type {number} */
var diff = value - index;
/** @type {number} */
var perc = Math.random();
var G__5771 = index + Math.round(perc * diff);
return G__5771;
};
/**
* @param {string} param_hash
* @return {?}
*/
self.mb_strlen = function(param_hash) {
/** @type {number} */
var _0x59f4c4 = 0;
/** @type {number} */
var i = 0;
for (; i < param_hash.length; i++) {
/** @type {number} */
_0x59f4c4 = _0x59f4c4 + (param_hash.charCodeAt(i) < 0 || param_hash.charCodeAt(i) > 255 ? document.charset == "utf-8" ? 3 : 2 : 1);
}
return _0x59f4c4;
};
/**
* @param {?} value
* @return {?}
*/
self.is_numeric = function(value) {
/** @type {!RegExp} */
var trueRE = /^+$/;
if (!trueRE.test(value)) {
return false;
}
return true;
};
/**
* @param {number} value_in_seconds
* @return {?}
*/
self.UnixTimeStr = function(value_in_seconds) {
/** @type {!Date} */
var commentDate = new Date(value_in_seconds * 1E3);
/** @type {string} */
var _0x377a41 = commentDate.toLocaleString();
return _0x377a41;
};
/**
* @param {string} value
* @return {?}
*/
self.UnixTimestamp = function(value) {
var text = value.replace(/-/g, "/");
/** @type {!Date} */
var tt = new Date(text);
/** @type {string} */
var relativeFromCwd = tt.getTime().toString();
return parseInt(relativeFromCwd.substr(0, 10));
};
/**
* @return {?}
*/
self.getNowFormatDate = function() {
/** @type {!Date} */
var d = new Date;
/** @type {string} */
var type = "-";
/** @type {string} */
var files = ":";
/** @type {number} */
var value = d.getMonth() + 1;
/** @type {number} */
var key = d.getDate();
if (value >= 1 && value <= 9) {
/** @type {string} */
value = "0" + value;
}
if (key >= 0 && key <= 9) {
/** @type {string} */
key = "0" + key;
}
/** @type {number} */
var currProj = d.getHours();
if (currProj >= 0 && currProj <= 9) {
/** @type {string} */
currProj = "0" + currProj;
}
/** @type {number} */
var id = d.getMinutes();
if (id >= 0 && id <= 9) {
/** @type {string} */
id = "0" + id;
}
/** @type {number} */
var strDate = d.getSeconds();
if (strDate >= 0 && strDate <= 9) {
/** @type {string} */
strDate = "0" + strDate;
}
/** @type {string} */
var currentdate = d.getFullYear() + type + value + type + key + " " + currProj + files + id + files + strDate;
return currentdate;
};
/**
* @param {string} strName
* @param {?} strValue
* @param {number} value
* @return {undefined}
*/
self.setCookie = function(strName, strValue, value) {
if (!strName) {
return;
}
/** @type {number} */
value = parseInt(value);
if (!value) {
/** @type {number} */
value = 30;
}
/** @type {!Date} */
var d = new Date;
d.setDate(d.getDate() + value);
/** @type {string} */
document.cookie = strName + "=" + escape(strValue) + ";expires=" + d.toGMTString();
};
/**
* @param {string} c_name
* @return {?}
*/
self.getCookie = function(c_name) {
if (document.cookie.length > 0) {
/** @type {number} */
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
/** @type {number} */
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
/** @type {number} */
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
};
/**
* @param {string} str
* @param {?} substr
* @param {?} newstr
* @return {?}
*/
self.replaceAll = function(str, substr, newstr) {
for (; str.indexOf(substr) >= 0;) {
str = str.replace(substr, newstr);
}
return str;
};
/**
* @param {number} pSeconds
* @return {?}
*/
self.transSecond2str = function(pSeconds) {
/** @type {string} */
var ret = "";
/** @type {number} */
var offset = Math.floor(pSeconds / (24 * 60 * 60));
if (offset) {
ret = offset + webApp.gVal.str_trace_days;
}
/** @type {number} */
var seconds = pSeconds % (24 * 60 * 60);
/** @type {number} */
var secs = Math.floor(seconds / (60 * 60));
if (secs) {
ret = ret + (secs + webApp.gVal.str_trace_hours);
}
/** @type {number} */
seconds = seconds % (60 * 60);
/** @type {number} */
var sign = Math.floor(seconds / 60);
if (sign) {
ret = ret + (sign + webApp.gVal.str_trace_minutes);
}
/** @type {number} */
seconds = seconds % 60;
return ret + seconds + webApp.gVal.str_trace_seconds;
};
/**
* @param {number} volumeDaily
* @param {number} absolute
* @return {?}
*/
self.get_direction_from_long_lat_int = function(volumeDaily, absolute) {
/** @type {number} */
var height_main_sort_chat = 0;
if (0 == absolute) {
/** @type {number} */
height_main_sort_chat = 100;
} else {
/** @type {number} */
height_main_sort_chat = Math.abs(volumeDaily / absolute);
}
if (volumeDaily < 0 && height_main_sort_chat > 4.5) {
return 2;
} else {
if (volumeDaily > 0 && height_main_sort_chat > 4.5) {
return 6;
} else {
if (absolute < 0 && height_main_sort_chat < 0.4) {
return 0;
} else {
if (absolute > 0 && height_main_sort_chat < 0.4) {
return 4;
}
}
}
}
if (height_main_sort_chat < 4.5 && height_main_sort_chat >= 0.4) {
if (volumeDaily < 0 && absolute < 0) {
return 1;
} else {
if (volumeDaily > 0 && absolute > 0) {
return 5;
} else {
if (volumeDaily < 0 && absolute > 0) {
return 3;
} else {
if (volumeDaily > 0 && absolute < 0) {
return 7;
}
}
}
}
}
return -1;
};
/**
* @param {(boolean|number|string)} currentPriceNextPeriod
* @param {(boolean|number|string)} ptX
* @param {(boolean|number|string)} futurePrice
* @param {(boolean|number|string)} side
* @return {?}
*/
self.get_direction_from_2points = function(currentPriceNextPeriod, ptX, futurePrice, side) {
/** @type {number} */
var priceDiff = futurePrice - currentPriceNextPeriod;
/** @type {number} */
var root = side - ptX;
return self.get_direction_from_long_lat_int(priceDiff, root);
};
/**
* @param {?} boardManager
* @param {?} isSlidingUp
* @param {?} $cont
* @param {?} $slides
* @return {?}
*/
self.get_rotation_from_2points = function(boardManager, isSlidingUp, $cont, $slides) {
let changeX = $cont - boardManager;
let changeY = $slides - isSlidingUp;
let finalPrefix = 180;
if (0 == changeX) {
if (changeY > 0) {
return finalPrefix;
} else {
if (0 == changeY) {
return 0;
} else {
return 0;
}
}
}
let val = Math.abs(changeY) / Math.abs(changeX);
let _0x5e9aa6 = Math.abs(changeX) / Math.abs(changeY);
let total_pageviews_raw = 0;
if (changeX > 0) {
if (changeY > 0) {
/** @type {number} */
total_pageviews_raw = finalPrefix * 1 / 2 + Math.atan(val);
} else {
if (0 == changeY) {
/** @type {number} */
total_pageviews_raw = finalPrefix * 1 / 2;
} else {
/** @type {number} */
total_pageviews_raw = finalPrefix * 1 / 2 - Math.atan(val);
}
}
} else {
if (changeY > 0) {
total_pageviews_raw = finalPrefix + Math.atan(val);
} else {
if (0 == changeY) {
/** @type {number} */
total_pageviews_raw = finalPrefix * 3 / 2;
} else {
/** @type {number} */
total_pageviews_raw = finalPrefix * 3 / 2 + Math.atan(val);
}
}
}
return parseInt(total_pageviews_raw);
};
webApp.config = {
"baseUrl" : "https://m.motorgps.net/",
"wxappUrl" : "https://wxapp.motorgps.net/",
"wwwUrl" : "https://www.motorgps.net/",
"appDownloadUrl" : "http://app.motorgps.net/",
"isRealTime" : false,
"timer" : 1E4,
"debug" : false
};
webApp.toolbar = {
"setTitle" : function(text) {
$(".logo span").text(text);
if (isWeiXinBrowser()) {
document.title = webApp.gVal.str_center_title;
$("#head-title").text(webApp.gVal.str_center_title);
} else {
/** @type {string} */
document.title = text;
$("#head-title").text(text);
}
if (webApp.gVal.str_center_title == text) {
$(".logo").hide();
$("article").css("padding-top", "0");
} else {
$(".logo").show();
$("article").css("padding-top", "50");
}
},
"showBack" : function() {
$(".logo .Return").show();
$(".logo .Return").unbind();
$(".logo .Return").click(function() {
if (!webApp.activePage || !webApp.activePage.pageName) {
webApp.router.go(g_homepage);
return;
}
if (isXAMS() && "zhihui-center" == webApp.activePage.pageName) {
webApp.router.go(g_homepage);
return;
}
switch(webApp.activePage.pageName) {
case "history":
case "morth":
case "car-setting":
case "warn-search":
case "self-setting":
case "pay":
case "help":
case "streetview":
webApp.router.go(g_homepage);
break;
default:
window.history.go(-1);
break;
}
});
},
"hideBack" : function() {
$(".logo .Return").hide();
},
"showTeam" : function() {
webApp.toolbar.showBack();
$(".logo .searchClk").show();
$(".logo .addClk").show();
},
"hideTeam" : function() {
webApp.toolbar.hideBack();
$(".logo .searchClk").hide();
$(".logo .addClk").hide();
},
"showHistory" : function() {
webApp.toolbar.showBack();
$(".logo .dataClk").show();
$(".logo .carClk").show();
},
"hideHistory" : function() {
webApp.toolbar.hideBack();
$(".logo .dataClk").hide();
$(".logo .carClk").hide();
}
};
/**
* @return {undefined}
*/
webApp.resetRefresh = function() {
storeLog("webApp.resetRefresh timestamp: " + (new Date).getTime());
clearTimeout(webApp.timerReloadID);
/** @type {number} */
webApp.timerReloadID = 0;
localStorageSet("auto_refresh_times", 0);
};
/**
* @param {?} opt_cb
* @return {undefined}
*/
webApp.realTimeFun = function(opt_cb) {
if (webApp.config.isRealTime && typeof opt_cb == "function") {
setTimeout(opt_cb, webApp.config.timer);
}
};
webApp.As = {
"baseUrl" : webApp.config.baseUrl,
"baseRequest" : function(value, that) {
if (!isXAMS() && webApp.comm.getDID() == g_tester_did) {
var ret = that.data.action;
if (typeof ret != "undefined") {
/** @type {!Array} */
var methods = ["set", "new", "add", "del", "update", "change", "dismiss", "quit", "unbind", "weixin", "join", "agree"];
/** @type {number} */
var i = 0;
for (; i < methods.length; i++) {
if (ret.indexOf(methods) >= 0) {
if ("offset" != ret) {
webApp.toastr.success({
"msg" : webApp.gVal.str_try_mode_success,
"options" : {
"timeOut" : 1E3,
"progressBar" : true,
"hideDuration" : 300
}
});
return;
}
}
}
}
}
/** @type {string} */
var data = JSON.stringify(that.data);
var PREF_VERBOSE = webApp.comm.getPostData();
/** @type {number} */
var i = parseInt((new Date).getTime());
if (data == PREF_VERBOSE) {
var width = webApp.comm.getPostTimestmap();
if (null == width) {
/** @type {number} */
width = 0;
} else {
/** @type {number} */
width = parseInt(width);
}
/** @type {number} */
var pos = i - width;
if (pos < 500) {
return;
}
}
webApp.comm.setPostData(data);
webApp.comm.setPostTimestmap(i);
var setIncsearchStat = that.callback || {};
var _0xa6d738 = that.errorback || {};
if (webApp.comm.getUserTid() != undefined && webApp.comm.getUserTid() != webApp.comm.empty) {
if (that != null && that.data != null) {
that.data.tid = webApp.comm.getUserTid();
}
}
that.data.languageid = webApp.comm.getLanguageId();
that.data.app_agentid = getAgentId();
/** @type {number} */
that.data.compress = 1;
that.data.qtype = localStorageGet("qtype");
Vue.http.jsonp(this.baseUrl + value, that.data, {}).then(function(e) {
if (1 == e.data.compress) {
var Hashed = e.data.data;
/** @type {number} */
var i = 1;
/** @type {number} */
var whiteRating = parseInt(Hashed.charAt(0));
switch(whiteRating) {
case 1:
/** @type {number} */
i = 3;
break;
case 2:
/** @type {number} */
i = 5;
break;
case 3:
/** @type {number} */
i = 2;
break;
case 4:
/** @type {number} */
i = 4;
break;
case 5:
/** @type {number} */
i = 1;
break;
case 6:
/** @type {number} */
i = 7;
break;
case 7:
/** @type {number} */
i = 9;
break;
case 8:
/** @type {number} */
i = 6;
break;
case 9:
/** @type {number} */
i = 8;
break;
default:
break;
}
var ciphertext = Hashed.substr(1, i) + Hashed.substr(i + 2);
/** @type {string} */
var ctext = atob(ciphertext);
/** @type {!Array<?>} */
var data_arraybuffer = ctext.split("").map(function(strUtf8) {
return strUtf8.charCodeAt(0);
});
/** @type {!Uint8Array} */
var data = new Uint8Array(data_arraybuffer);
var recordData = options.inflate(data);
/** @type {*} */
e.data = JSON.parse(String.fromCharCode.apply(null, new Uint16Array(recordData)));
}
if (e.data.result == webApp.comm.authStatus.success || e.data.result == webApp.comm.authStatus.successText || e.data.result == webApp.comm.authStatus.successText2) {
if (typeof setIncsearchStat == "function" && typeof e.data != "undefined") {
setIncsearchStat(e.data);
}
} else {
if (e.data.result == webApp.comm.authStatus.not_login || e.data.result == webApp.comm.authStatus.not_permiss) {
webApp.toastr.error({
"msg" : webApp.comm.toCn(e.data.message)
});
showAlertDialog(webApp.comm.toCn(e.data.message), "", function() {
webApp.comm.clearLogin();
webApp.router.go("login");
});
} else {
if (e.data.result == webApp.comm.authStatus.passwd_simple) {
webApp.toastr.warning({
"msg" : webApp.comm.toCn(e.data.message)
});
showAlertDialog(webApp.comm.toCn(e.data.message), "", function() {
webApp.router.go("change-pas");
});
} else {
if (that.data.action != undefined && that.data.action == "login") {
if (typeof that.errorback == "function") {
that.errorback(e);
}
} else {
webApp.toastr.error({
"msg" : webApp.comm.toCn(e.data.message)
});
if (typeof that.errorback == "function") {
that.errorback(e);
}
}
}
}
}
}, function(e) {
if (404 == e.status) {
webApp.toastr.error({
"msg" : webApp.gVal.str_network_error
});
} else {
var bigLogStr = webApp.gVal.str_unknown_error;
if (e.data != null) {
bigLogStr = webApp.comm.toCn(e.data.message);
}
webApp.toastr.error({
"msg" : bigLogStr
});
}
if (typeof that.errorback == "function") {
that.errorback(e);
}
});
}
};
return self;
});
```
今晚打老虎 发表于 2021-2-27 22:07
有没视频教程呀 想学学
我以前倒是发过,不过被某jiami作者找了,维权了,(人家有著作权<_<)
大概的解密思路就是解套娃。
我之前用正则表达式实现的,270多处正则表达式。。。
而且只能实现_0x这种形式的解密还原
推荐学学使用ast去处理,
大概思路就是前面的是配置部分,直接运行就好。
然后后后面去把所有抽取出来的字符串全都塞回来 大神!你这是又掌握了一个发财技能。网上找解密js.一个文件都要几百块
使用ast反混淆可以使得js代码容易阅读 论坛里的大神,都用小号吗 jsjiami v5 不是很难。。。 这个太复杂了,,,看不懂 可以参考下上面漁滒的帖子,讲AST法还原 学习了。 这个技术还行,获得了哥的认可 可以可以,只是我不太明白研究人家JS能干嘛