从来吾爱后,第一次发这种帖子,从前最多就是分享一些福利资源而已。
近来在听这本小说, 不外资源部好找, 找到一个在线听书的,想把资源下载下来,就尝试反编译一下,然后把过程分享一下。
F12获取他播放的音频文件 是m4a的。
在查看对应的目录结构,里面是没有m4a的文件,只有data-path一个 加密字符串,看起来是base64的。
通过地址、文件名等关键词搜索,也没有搜索到相关信息,怎么办呢,继续找找其他的吧。
通过断点找到一个这个加密解密相关的文件,,把他格式化一下。
[JavaScript] 纯文本查看 复制代码var CryptoJS = CryptoJS ||function(u, p) { var d = {}, l = d.lib = {}, s = function() {}, t = l.Base = { extend: function(a) { s.prototype = this; var c = new s; a && c.mixIn(a); c.hasOwnProperty("init") || (c.init = function() { c.$super.init.apply(this, arguments) }); c.init.prototype = c; c.$super = this; return c }, create: function() { var a = this.extend(); a.init.apply(a, arguments); return a }, init: function() {}, mixIn: function(a) { for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]); a.hasOwnProperty("toString") && (this.toString = a.toString) }, clone: function() { return this.init.prototype.extend(this) } }, r = l.WordArray = t.extend({ init: function(a, c) { a = this.words = a || []; this.sigBytes = c != p ? c : 4 * a.length }, toString: function(a) { return (a || v).stringify(this) }, concat: function(a) { var c = this.words, e = a.words, j = this.sigBytes; a = a.sigBytes; this.clamp(); if (j % 4) for (var k = 0; k < a; k++) c[j + k >>> 2] |= (e[k >>> 2] >>> 24 - 8 * (k % 4) & 255) >> 2] = e[k >>> 2]; else c.push.apply(c, e); this.sigBytes += a; return this }, clamp: function() { var a = this.words, c = this.sigBytes; a[c >>> 2] &= 4294967295 >> 2] >>> 24 - 8 * (j % 4) & 255; e.push((k >>> 4).toString(16)); e.push((k & 15).toString(16)) } return e.join("") }, parse: function(a) { for (var c = a.length, e = [], j = 0; j < c; j += 2) e[j >>> 3] |= parseInt(a.substr(j, 2), 16) >> 2] >>> 24 - 8 * (j % 4) & 255)); return e.join("") }, parse: function(a) { for (var c = a.length, e = [], j = 0; j < c; j++) e[j >>> 2] |= (a.charCodeAt(j) & 255) >> 2] >>> 24 - 8 * (a % 4) & 255) >> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) >> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) b.push(c.charAt(d >>> 6 * (3 - g) & 63)); if (e = c.charAt(64)) for (; b.length % 4;) b.push(e); return b.join("") }, parse: function(b) { var e = b.length, f = this._map, c = f.charAt(64); c && (c = b.indexOf(c), -1 != c && (e = c)); for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { var g = f.indexOf(b.charAt(d - 1)) >> 6 - 2 * (d % 4); c[a >>> 2] |= (g | h) c; c++) a[c] = 128 > c ? c 8; r[e] = y >> 16; w[e] = y >> 24; v[e] = y; y = 16843009 * G ^ 65537 * F ^ 257 * z ^ 16843008 * e; b[k] = y >> 8; x[k] = y >> 16; q[k] = y >> 24; n[k] = y; e ? (e = z ^ a[a[a[G ^ z]]], j ^= a[a[j]]) : e = j = 1 } var H = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], d = d.AES = p.extend({ _doReset: function() { for (var a = this._key, c = a.words, d = a.sigBytes / 4, a = 4 * ((this._nRounds = d + 6) + 1), e = this._keySchedule = [], j = 0; j < a; j++) if (j < d) e[j] = c[j]; else { var k = e[j - 1]; j % d ? 6 < d && 4 == j % d && (k = l[k >>> 24] >> 16 & 255] >> 8 & 255] > 24, k = l[k >>> 24] >> 16 & 255] >> 8 & 255] = j ? k : b[l[k >>> 24]] ^ x[l[k >>> 16 & 255]] ^ q[l[k >>> 8 & 255]] ^ n[l[k & 255]] }, encryptBlock: function(a, b) { this._doCryptBlock(a, b, this._keySchedule, t, r, w, v, l) }, decryptBlock: function(a, c) { var d = a[c + 1]; a[c + 1] = a[c + 3]; a[c + 3] = d; this._doCryptBlock(a, c, this._invKeySchedule, b, x, q, n, s); d = a[c + 1]; a[c + 1] = a[c + 3]; a[c + 3] = d }, _doCryptBlock: function(a, b, c, d, e, j, l, f) { for (var m = this._nRounds, g = a ^ c[0], h = a[b + 1] ^ c[1], k = a[b + 2] ^ c[2], n = a[b + 3] ^ c[3], p = 4, r = 1; r < m; r++) var q = d[g >>> 24] ^ e[h >>> 16 & 255] ^ j[k >>> 8 & 255] ^ l[n & 255] ^ c[p++], s = d[h >>> 24] ^ e[k >>> 16 & 255] ^ j[n >>> 8 & 255] ^ l[g & 255] ^ c[p++], t = d[k >>> 24] ^ e[n >>> 16 & 255] ^ j[g >>> 8 & 255] ^ l[h & 255] ^ c[p++], n = d[n >>> 24] ^ e[g >>> 16 & 255] ^ j[h >>> 8 & 255] ^ l[k & 255] ^ c[p++], g = q, h = s, k = t; q = (f[g >>> 24] >> 16 & 255] >> 8 & 255] >> 24] >> 16 & 255] >> 8 & 255] >> 24] >> 16 & 255] >> 8 & 255] >> 24] >> 16 & 255] >> 8 & 255] > 2; enc2 = ((chr1 & 3) > 4); enc3 = ((chr2 & 15) > 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64 } else if (isNaN(chr3)) { enc4 = 64 } output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); } return output; }, this.decode = function(input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = _keyStr.indexOf(input.charAt(i++)); enc2 = _keyStr.indexOf(input.charAt(i++)); enc3 = _keyStr.indexOf(input.charAt(i++)); enc4 = _keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 > 4); chr2 = ((enc2 & 15) > 2); chr3 = ((enc3 & 3) 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128) } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, _utf8_decode = function(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++ } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) > _0x49452d ^ _0x39af96;}(_0x37e8, 0x90, 0x9000));var _0x2555 = function(_0x3f9a28, _0x47dd6f) { _0x3f9a28 = ~~'0x' ['concat'](_0x3f9a28); var _0x1e1327 = _0x37e8[_0x3f9a28]; if (_0x2555['XVHLTR'] === undefined) { (function() { var _0x1885d1 = typeof window !== 'undefined' ? window : typeof process === 'object' && typeof require === 'function' && typeof global === 'object' ? global : this; var _0x2fc5e2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; _0x1885d1['atob'] || (_0x1885d1['atob'] = function(_0x5918bb) { var _0x51db74 = String(_0x5918bb)['replace'](/=+$/, ''); for (var _0x544078 = 0x0, _0x574720, _0x44586c, _0x2ec80e = 0x0, _0x511cb7 = ''; _0x44586c = _0x51db74['charAt'](_0x2ec80e++);~_0x44586c && (_0x574720 = _0x544078 % 0x4 ? _0x574720 * 0x40 + _0x44586c : _0x44586c, _0x544078++ % 0x4) ? _0x511cb7 += String['fromCharCode'](0xff & _0x574720 >> (-0x2 * _0x544078 & 0x6)) : 0x0) { _0x44586c = _0x2fc5e2['indexOf'](_0x44586c); } return _0x511cb7; }); }()); var _0x2d7e9f = function(_0x188f49, _0x47dd6f) { var _0x49cbdc = [], _0x2a5905 = 0x0, _0x5b9e45, _0x253e96 = '', _0xb75a96 = ''; _0x188f49 = atob(_0x188f49); for (var _0x5bfa5d = 0x0, _0x42e242 = _0x188f49['length']; _0x5bfa5d < _0x42e242; _0x5bfa5d++) { _0xb75a96 += '%' + ('00' + _0x188f49['charCodeAt'](_0x5bfa5d)['toString'](0x10))['slice'](-0x2); } _0x188f49 = decodeURIComponent(_0xb75a96); for (var _0x2be2b7 = 0x0; _0x2be2b7 < 0x100; _0x2be2b7++) { _0x49cbdc[_0x2be2b7] = _0x2be2b7; } for (_0x2be2b7 = 0x0; _0x2be2b7 < 0x100; _0x2be2b7++) { _0x2a5905 = (_0x2a5905 + _0x49cbdc[_0x2be2b7] + _0x47dd6f['charCodeAt'](_0x2be2b7 % _0x47dd6f['length'])) % 0x100; _0x5b9e45 = _0x49cbdc[_0x2be2b7]; _0x49cbdc[_0x2be2b7] = _0x49cbdc[_0x2a5905]; _0x49cbdc[_0x2a5905] = _0x5b9e45; } _0x2be2b7 = 0x0; _0x2a5905 = 0x0; for (var _0x204da7 = 0x0; _0x204da7 < _0x188f49['length']; _0x204da7++) { _0x2be2b7 = (_0x2be2b7 + 0x1) % 0x100; _0x2a5905 = (_0x2a5905 + _0x49cbdc[_0x2be2b7]) % 0x100; _0x5b9e45 = _0x49cbdc[_0x2be2b7]; _0x49cbdc[_0x2be2b7] = _0x49cbdc[_0x2a5905]; _0x49cbdc[_0x2a5905] = _0x5b9e45; _0x253e96 += String['fromCharCode'](_0x188f49['charCodeAt'](_0x204da7) ^ _0x49cbdc[(_0x49cbdc[_0x2be2b7] + _0x49cbdc[_0x2a5905]) % 0x100]); } return _0x253e96; }; _0x2555['hQGVbW'] = _0x2d7e9f; _0x2555['wPdCUn'] = {}; _0x2555['XVHLTR'] = !! []; } var _0x16ec99 = _0x2555['wPdCUn'][_0x3f9a28]; if (_0x16ec99 === undefined) { if (_0x2555['gmKTTM'] === undefined) { _0x2555['gmKTTM'] = !! []; } _0x1e1327 = _0x2555['hQGVbW'](_0x1e1327, _0x47dd6f); _0x2555['wPdCUn'][_0x3f9a28] = _0x1e1327; } else { _0x1e1327 = _0x16ec99; } return _0x1e1327; };var _0x12c907 = function() { var _0x5874b2 = { 'LAvwk': function(_0x2fbbe3, _0x8ba10b) { return _0x2fbbe3 === _0x8ba10b; }, 'PjrYs': 'fxerH' }; var _0x18e9ee = !! []; return function(_0x28f71e, _0xd97c64) { var _0xc4d46e = { 'oqJiP': function(_0x11f4da, _0x116167) { return _0x5874b2['LAvwk'](_0x11f4da, _0x116167); }, 'EiOAz': _0x5874b2['PjrYs'] }; var _0x25f1bd = _0x18e9ee ? function() { if (_0xc4d46e['oqJiP'](_0xc4d46e[_0x2555('0', 'IWU5')], _0x2555('1', 'SRZU'))) { if (_0xd97c64) { var _0x56b5ec = _0xd97c64[_0x2555('2', 'S12o')](_0x28f71e, arguments); _0xd97c64 = null; return _0x56b5ec; } } else { func(); } } : function() {}; _0x18e9ee = ![]; return _0x25f1bd; }; }();var _0x334e01 = _0x12c907(this, function() { var _0x439407 = { 'KcRco': function(_0x6bd48a, _0x443f38) { return _0x6bd48a !== _0x443f38; }, 'DhKbO': _0x2555('3', '%H!6'), 'nsuTX': function(_0x446408, _0x33c56f) { return _0x446408 == _0x33c56f; }, 'kfgre': 'Nifhd', 'hYihY': _0x2555('4', '&G5%'), 'ZAJoA': _0x2555('5', 'eZfw'), 'LzRMS': _0x2555('6', 'j%xJ'), 'jDFlQ': 'object', 'pNZIM': function(_0x337dcd, _0x12872a) { return _0x337dcd === _0x12872a; }, 'gBShl': _0x2555('7', 'RzD6'), 'LJtdk': function(_0x1bb670, _0x1d3ca0) { return _0x1bb670 === _0x1d3ca0; }, 'pLCVa': _0x2555('8', 'U4nZ'), 'daOPy': '[hzdJjxeesrklGQTJSlbOGrQRsJBIYZUIHeJd]', 'vxrdx': function(_0x1ac519, _0x23de7f) { return _0x1ac519 !== _0x23de7f; }, 'qyFfA': 'RDmqB', 'ofedG': function(_0x2eccb4, _0x5aa725) { return _0x2eccb4 == _0x5aa725; }, 'KPOxl': function(_0x2f9fd4, _0x1f4536) { return _0x2f9fd4 !== _0x1f4536; }, 'fBfBL': _0x2555('9', 'zfh#'), 'NDSzd': function(_0x3d1484, _0x4d05a0) { return _0x3d1484 == _0x4d05a0; }, 'EsPSb': 'TTzOH', 'ELnoL': 'AOtaz', 'VkFsA': function(_0x1e7142, _0x813b5b) { return _0x1e7142 || _0x813b5b; }, 'ayBan': _0x2555('a', 'q&Y)'), 'YmTXQ': function(_0x538aaa, _0x3da27f) { return _0x538aaa < _0x3da27f; }, 'narNd': function(_0x22fd16, _0x3ec484) { return _0x22fd16 - _0x3ec484; }, 'tbnFd': function(_0x5d7b3f, _0x5d4985) { return _0x5d7b3f !== _0x5d4985; }, 'oOXzR': function(_0x2cb824, _0x300f75) { return _0x2cb824 === _0x300f75; }, 'xiuZi': _0x2555('b', 'xPUC'), 'mfnUZ': _0x2555('c', 'Zf9)'), 'CCZNa': function(_0x521a01, _0x5af6db) { return _0x521a01 !== _0x5af6db; }, 'ktKQW': function(_0x26210b) { return _0x26210b(); } }; var _0x3ebaae = _0x439407[_0x2555('d', '!UHc')](typeof window, _0x439407[_0x2555('e', 'CJp%')]) ? window : typeof process === _0x439407['jDFlQ'] && _0x439407['pNZIM'](typeof require, _0x439407[_0x2555('f', '!mco')]) && _0x439407[_0x2555('10', 'yzGm')](typeof global, _0x439407[_0x2555('11', '%H!6')]) ? global : this; var _0x35b617 = [ [0x0, 0x0, 0x0, 0x0, 0x0], [_0x439407[_0x2555('12', 'UbKX')][_0x2555('13', 'xWy0')](new RegExp(_0x439407[_0x2555('14', '[Lbx')], 'g'), '')[_0x2555('15', 'EWh!')](';'), ![]], [function(_0x41ccf2, _0x1eb0f2, _0x395c47) { return _0x41ccf2[_0x2555('16', 'TJ&E')](_0x1eb0f2) == _0x395c47; }, function(_0xccc123, _0x5299d6, _0x238449) { _0x35b617[_0xccc123][_0x5299d6] = _0x238449; }, function() { if (_0x439407['KcRco'](_0x2555('17', 'Zdc9'), _0x439407['DhKbO'])) { return !0x0; } else { _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]][_0x35b617[0x0][0x4]] = _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]][_0x35b617[0x0][0x4]]; } }] ]; var _0x4dfb46 = function() { var _0x2051f6 = { 'eupta': function(_0x218c68, _0x34fd0f) { return _0x439407[_0x2555('18', 'x(Ho')](_0x218c68, _0x34fd0f); } }; if (_0x439407['kfgre'] !== _0x439407[_0x2555('19', 'EWh!')]) { if (_0x2051f6[_0x2555('1a', 'HN*G')](_0x26e5fd['length'], 0x4) && _0x35b617[0x2][0x0](_0x26e5fd, 0x3, 0x66)) { _0x35b617[0x2][0x1](0x0, 0x4, _0x26e5fd); } else if (_0x26e5fd['length'] == 0x8 && _0x35b617[0x2][0x0](_0x26e5fd, 0x7, 0x65) && _0x35b617[0x2][0x0](_0x26e5fd, 0x0, 0x68)) { _0x35b617[0x2][0x1](0x0, 0x3, _0x26e5fd); } } else { while (_0x35b617[0x2][0x2]()) { if (_0x439407['hYihY'] === _0x439407[_0x2555('1b', 'yzGm')]) { var _0x4d5a27 = fn['apply'](context, arguments); fn = null; return _0x4d5a27; } else { _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]][_0x35b617[0x0][0x4]] = _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]][_0x35b617[0x0][0x4]]; } }; } }; for (var _0x223501 in _0x3ebaae) { if (_0x439407[_0x2555('1c', '!mco')](_0x223501[_0x2555('1d', 'yzGm')], 0x8) && _0x35b617[0x2][0x0](_0x223501, 0x7, 0x74) && _0x35b617[0x2][0x0](_0x223501, 0x5, 0x65) && _0x35b617[0x2][0x0](_0x223501, 0x3, 0x75) && _0x35b617[0x2][0x0](_0x223501, 0x0, 0x64)) { if (_0x439407[_0x2555('1e', 'eZfw')](_0x2555('1f', 'IyVv'), _0x439407['qyFfA'])) { _0x35b617[0x2][0x1](0x0, 0x0, _0x223501); break; } else { _0x35b617[a] = c; } } } for (var _0x5c3a71 in _0x3ebaae[_0x35b617[0x0][0x0]]) { if (_0x439407[_0x2555('20', 'Wra5')](_0x5c3a71[_0x2555('21', 'SRZU')], 0x6) && _0x35b617[0x2][0x0](_0x5c3a71, 0x5, 0x6e) && _0x35b617[0x2][0x0](_0x5c3a71, 0x0, 0x64)) { if (_0x439407[_0x2555('22', 'S12o')](_0x2555('23', 'xPUC'), _0x439407[_0x2555('24', 'UbKX')])) { return; } else { _0x35b617[0x2][0x1](0x0, 0x1, _0x5c3a71); break; } } } for (var _0x5db779 in _0x3ebaae[_0x35b617[0x0][0x0]]) { if (_0x5db779[_0x2555('25', 'Zdc9')] == 0x8 && _0x35b617[0x2][0x0](_0x5db779, 0x7, 0x6e) && _0x35b617[0x2][0x0](_0x5db779, 0x0, 0x6c)) { _0x35b617[0x2][0x1](0x0, 0x2, _0x5db779); break; } } for (var _0x26e5fd in _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]]) { if (_0x26e5fd[_0x2555('26', 'GFv@')] == 0x4 && _0x35b617[0x2][0x0](_0x26e5fd, 0x3, 0x66)) { _0x35b617[0x2][0x1](0x0, 0x4, _0x26e5fd); } else if (_0x439407[_0x2555('27', '8B^R')](_0x26e5fd[_0x2555('25', 'Zdc9')], 0x8) && _0x35b617[0x2][0x0](_0x26e5fd, 0x7, 0x65) && _0x35b617[0x2][0x0](_0x26e5fd, 0x0, 0x68)) { if (_0x439407['EsPSb'] === _0x439407[_0x2555('28', 'X@gA')]) { return !0x0; } else { _0x35b617[0x2][0x1](0x0, 0x3, _0x26e5fd); } } } if (!_0x35b617[0x0][0x0] || !_0x3ebaae[_0x35b617[0x0][0x0]]) { return; } var _0x5725b0 = _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x1]]; var _0x4ab975 = !! _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]] && _0x3ebaae[_0x35b617[0x0][0x0]][_0x35b617[0x0][0x2]][_0x35b617[0x0][0x3]]; var _0x244366 = _0x439407[_0x2555('29', 'V*oM')](_0x5725b0, _0x4ab975); if (!_0x244366) { if (_0x439407[_0x2555('2a', '!UHc')] === _0x2555('2b', 'RzD6')) { _0x35b617[0x2][0x1](0x0, 0x3, _0x26e5fd); } else { return; } } _0x2107f3: for (var _0x3a5359 = 0x0; _0x439407['YmTXQ'](_0x3a5359, _0x35b617[0x1][0x0]['length']); _0x3a5359++) { var _0x380aeb = _0x35b617[0x1][0x0][_0x3a5359]; var _0x324495 = _0x439407[_0x2555('2c', 'zfh#')](_0x244366[_0x2555('2d', 'es]w')], _0x380aeb[_0x2555('2e', 'QC3(')]); var _0x438dca = _0x244366[_0x2555('2f', 'es]w')](_0x380aeb, _0x324495); var _0x93d578 = _0x439407['tbnFd'](_0x438dca, -0x1) && _0x439407['LJtdk'](_0x438dca, _0x324495); if (_0x93d578) { if (_0x244366[_0x2555('30', 'iHE]')] == _0x380aeb['length'] || _0x439407[_0x2555('31', 'x(Ho')](_0x380aeb[_0x2555('32', '1^Yy')]('.'), 0x0)) { if (_0x439407['oOXzR'](_0x439407['xiuZi'], _0x439407[_0x2555('33', 'QC3(')])) { var _0x3ff077 = firstCall ? function() { if (fn) { var _0x2c0571 = fn[_0x2555('34', 'Z5o9')](context, arguments); fn = null; return _0x2c0571; } } : function() {}; firstCall = ![]; return _0x3ff077; } else { _0x35b617[0x1][0x0] = _0x2555('35', 'SRZU'); break _0x2107f3; } } } } if (_0x439407['CCZNa'](_0x35b617[0x1][0x0], '_0x334e01')) { _0x439407['ktKQW'](_0x4dfb46); }});_0x334e01();function secret(_0x644a5d, _0x36a8a9) { var _0x40d7c6 = { 'xAfDQ': _0x2555('36', 'EWh!') }; var _0x2038be = CryptoJS[_0x2555('37', 'Wra5')][_0x2555('38', 'S12o')][_0x2555('39', '[78$')](_0x40d7c6[_0x2555('3a', '1^Yy')]), _0x36a8a9 = CryptoJS['enc'][_0x2555('3b', '[78$')][_0x2555('3c', '[Lbx')](_0x36a8a9); return CryptoJS[_0x2555('3d', '@$AB')][_0x2555('3e', '[78$')](_0x644a5d, _0x36a8a9, { 'iv': _0x2038be, 'padding': CryptoJS[_0x2555('3f', 'g$ky')]['Pkcs7'] })[_0x2555('40', 'mVK)')](CryptoJS[_0x2555('41', 'jsoz')]['Utf8']);};_0xodl = 'jsjiami.com.v6';(function($) { var audio = document.createElement('audio'), source = document.createElement('source'); audio.appendChild(source); var duration = 0; var currenttime = 0; var all_nub = 0; var playing = false; var frist_load = true; var up_load = false; var pagesize = 10; audio.volume = 1.0; ajax(novel_id); function ajax(novel_j) { var page = Math.ceil(novel_j / pagesize); if (window.innerWidth > 799 && window.innerHeight > 599 && typeof(window.navigator.webdriver) == "undefined") { $.ajax({ url: "/api.php?c=Json&id=" + tingid + "&page=" + page + "&pagesize=" + pagesize, type: "get", dataType: "JSONP", async: false, headers: { "sign": $.now() }, success: function(msg) { if (up_load) { UpsetList(msg); up_load = false } else { setList(msg) } }, error: function(msg) { console.log(msg) } }) } } function setList(msg) { var list = msg.playlist; for (var i = 0; i < list.length; i++) { var strHtml = '<li class="section-item" id="item' + list.pid + '" data-path="' + list.file + '" data-url="' + list.url + '" data-atp="' + list.atp + '">' + '' + '' + '' + list.pid + '' + '' + '
' + '' + list.trackName + '' + '
' + '' + msg.announcer + '
' + ''; $('.section-body').append(strHtml) } if (frist_load) { all_nub = msg.limit; defaultStart(novel_id); frist_load = false } } function UpsetList(msg) { var list = msg.playlist; for (var i = list.length - 1; i >= 0; i--) { var strHtml = '<li class="section-item" id="item' + list.pid + '" data-path="' + list.file + '" data-url="' + list.url + '" data-atp="' + list.atp + '">' + '' + '' + '' + list.pid + '' + '' + '
' + '' + list.trackName + '' + '
' + '' + msg.announcer + '
' + ''; $('.section-body').prepend(strHtml) } } var click_li; function defaultStart(id) { if (id = pagesize) { up_load = true; ajax(nub - pagesize) } if (click_li.next().length != 1) { click_li = $(".section-body li").eq($(".section-body li").length - 1); nub = parseInt(click_li.find(".section-number").text()); if (Math.ceil(nub / (pagesize + 1)) 1) { var prev_li = click_li.prev(); var url = prev_li.data("url"); top.location.href = url } }); $(".player-next").click(function() { var nub = parseInt(click_li.find(".section-number").text()); if (nub < all_nub) { var next_li = click_li.next(); var url = next_li.data("url"); top.location.href = url } }); $('.player-play').click(function() { click_li.removeClass('section-pause'); toPlay("play"); playing = true; $(this).hide(); $('.player-pause').show(); }); $('.player-pause').click(function() { if (playing) { click_li.addClass('section-pause').siblings().removeClass('section-pause'); toPlay("pause"); $(this).hide(); $('.player-play').show() } }); audio.addEventListener("canplay", function() { $('.player-volume-position').css('width', (audio.volume * 100) + '%'); duration = parseInt(audio.duration); $('.player-duration-time').text(conversionTime(duration)); var p_height = $('.player-progress').width(), tag = false; $('.player-progress-control').mousedown(function(e) { tag = true }); $(document).mouseup(function() { tag = false }); $(".player-progress").mousemove(function(e) { if (tag) { var actLage = e.clientX - $(this).offset().left; if (actLage p_height) { actLage = p_height } var progressBP = progressBarPercentage(p_height, actLage); $('.player-progress-control').css('left', progressBP + '%'); $('.player-progress-position').css('width', progressBP + '%'); var SongProgress = progressBP * duration / 100; songProgressAdjust(SongProgress) } }); $('.player-progress').click(function(e) { if (playing) { var actLage = e.clientX - $(this).offset().left, progressBP = progressBarPercentage(p_height, actLage); $('.player-progress-control').css('left', progressBP + '%'); $('.player-progress-position').css('width', progressBP + '%'); var SongProgress = progressBP * duration / 100; songProgressAdjust(SongProgress) } }); var s_width = $('.player-volume-progress').width(); $('.player-volume-progress').click(function(e) { var actLage = e.clientX - $(this).offset().left, progressBP = progressBarPercentage(s_width, actLage); $('.player-volume-position').css('width', progressBP + '%'); audio.volume = progressBP / 100 }) }); function play() { $('.top-set').text(click_li.find('.set').text()); var txt = click_li.find('.set').text().split("_"), ua = /(?=.*Mac)(?!.*Chrome)[|(?=.*Safari)]/.test(navigator.userAgent); $('.title h1').text(txt[1] + " " + txt[0]); if (ua) { toPlay("pause"); } else { toPlay("play"); } playing = true; $('.player-play').hide(); $('.player-pause').show() } audio.onended = function() { playing = false; var nub = parseInt(click_li.find(".section-number").text()); if (nub < all_nub) { click_li = click_li.next(); nub = parseInt(click_li.find(".section-number").text()); if (Math.ceil(nub / (pagesize + 1)) 2); chr3 = ((enc3 & 3) 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) |