WXtrialInterface.html 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>双子星云手机99</title>
  6. <meta name="x5-orientation" content="portrait" />
  7. <meta name="screen-orientation" content="portrait" />
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="viewport"
  10. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no,viewport-fit=cover" />
  11. <!-- 删除苹果默认的工具栏和菜单栏 -->
  12. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  13. <!-- 设置苹果工具栏颜 -->
  14. <meta name="format-detection" content="telphone=no, email=no" />
  15. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  16. <!-- 启用360浏览器的极速模(webkit) -->
  17. <meta name="renderer" content="webkit" />
  18. <!-- 避免IE使用兼容模式 -->
  19. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  20. <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑 -->
  21. <meta name="HandheldFriendly" content="true" />
  22. <!-- 微软的老式浏览 -->
  23. <meta name="MobileOptimized" content="320" />
  24. <!-- 不能旋转,问题出在这 -->
  25. <!-- UC强制全屏 -->
  26. <meta name="full-screen" content="yes" />
  27. <!-- QQ强制全屏 -->
  28. <meta name="x5-fullscreen" content="true" />
  29. <!-- UC应用模式 -->
  30. <meta name="browsermode" content="application" />
  31. <!-- QQ应用模式 -->
  32. <meta name="x5-page-mode" content="app" />
  33. <!-- windows phone 点击无高 -->
  34. <meta name="msapplication-tap-highlight" content="no" />
  35. <link rel="stylesheet" type="text/css" href="css/WXtrialInterface.css" />
  36. <link rel="stylesheet" href="../static/css/weui.min.css" />
  37. <link rel="stylesheet" href="../static/css/jquery-weui.min.css" />
  38. <!-- <link rel="stylesheet" href="../static/lib/swiper/swiper-bundle.min.css" />
  39. <script src="../static/lib/swiper/swiper-bundle.js"></script> -->
  40. <!-- <script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script> -->
  41. <script src="../static/lib/doT-1.1.3/doT.min.js"></script>
  42. <script src="../static/lib/qs.js"></script>
  43. <script src="../static/lib/copy-to-clipboard.js"></script>
  44. </head>
  45. <body class="scroll h-player" style="overscroll-behavior: contain">
  46. <template id="template-phone-size-item">
  47. {{~ it.list :value:index }}
  48. <div class="phone-size-item {{? value.width === it.active.width && value.height === it.active.height }}active{{?}}"
  49. data-id="{{= value.id }}" data-dpi="{{= value.dpi }}" data-width="{{= value.width }}"
  50. data-height="{{= value.height }}">
  51. <span>{{= value.width }}x{{= value.height }}</span>
  52. </div>
  53. {{~}}
  54. </template>
  55. <template id="template-shear">
  56. {{? it.length }}
  57. <div class="title">
  58. 剪贴板
  59. <div class="btn-clear">清空</div>
  60. </div>
  61. <div class="slide-wrapper-content">
  62. {{~ it :item:index }}
  63. <div class="slide-wrapper" data-id="{{= item.id}}">
  64. <div class="slide-scroll animate-slide-start">
  65. <div class="slide-content" data-content="{{= encodeHtml(item.content)}}">
  66. <div>{{= encodeHtml(item.content)}}</div>
  67. </div>
  68. <div class="slide-content-button" data-id="{{= item.id}}">
  69. <button>删除</button>
  70. </div>
  71. </div>
  72. </div>
  73. {{~}}
  74. </div>
  75. {{??}}
  76. <img class="empty" src="img/jianqieban_pic@2x.png" alt="" />
  77. <div class="empty-txt">剪贴板为空</div>
  78. {{?}}
  79. </template>
  80. <div class="container" id="player">
  81. <div class="muted" id="btnMuted">
  82. <div class="control-right-img" data-id="1">
  83. <img src="../static/img/xuanfu_icon.png" />
  84. </div>
  85. </div>
  86. <div id="wine">
  87. <div id="box">
  88. <canvas id="playCanvas" width="450" height="800"></canvas>
  89. </div>
  90. <div class="count-view" id="countView">
  91. <div class="fnca">
  92. <span class="countdown-time" style="color: #ffffff"></span>
  93. <div class="line"></div>
  94. <img class="wh22" src="../static/img/close.png" alt="" onclick="handleclose()" />
  95. </div>
  96. </div>
  97. </div>
  98. <div class="leftmains">
  99. <div class="PictureQualityMain">
  100. <div class="menu-btn PictureQuality" data-id="4">高清</div>
  101. <div class="menu-btn PictureQuality avit" data-id="3">标清</div>
  102. <div class="menu-btn PictureQuality" data-id="2">极速</div>
  103. </div>
  104. <div class="open-set-phone-size-dialog-btn-wrap">
  105. <div class="menu-btn" id="open-set-phone-size-dialog-btn">
  106. <span>分辨率</span>
  107. </div>
  108. </div>
  109. <div class="operation">
  110. <div class="upload" id="showsuss" data-text="uploads">
  111. <img src="../static/img/wx/shangchuan_icon.png" />
  112. <div>上传</div>
  113. </div>
  114. <div class="upload" onclick="showShearPlate()" data-text="Shearplate">
  115. <img src="../static/img/wx/jianqieban_icon.png" />
  116. <div>剪贴板</div>
  117. </div>
  118. <div class="upload" id="upload" data-text="Signout" onclick="handleQuit('quit')">
  119. <img src="../static/img/wx/tuichu_icon.png" />
  120. <div>退出</div>
  121. </div>
  122. <div class="upload" id="dormant" data-text="Dormant" onclick="handleQuit('dormant')">
  123. <img src="../static/img/wx/tuichu_icon.png" />
  124. <div>退出并下机</div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="bottommains">
  129. <div class="botmat1">
  130. <div class="botmat1img" data-text="gengduo">
  131. <img src="../static/img/wx/gengduo_icon.png" />
  132. </div>
  133. </div>
  134. <div class="botmat1">
  135. <div class="botmat1img" data-text="home">
  136. <img src="../static/img/wx/home_icon.png" />
  137. </div>
  138. </div>
  139. <div class="botmat1">
  140. <div class="botmat1img" data-text="return">
  141. <img src="../static/img/wx/fanhui_icon.png" />
  142. </div>
  143. </div>
  144. </div>
  145. <!-- <img class="loading loading_sceen_pic" /> -->
  146. </div>
  147. <div class="mask">
  148. <div class="box-shear-plate"></div>
  149. <img class="close" onclick="handleClose()" src="img/guanbi_icon@2x.png" alt="" />
  150. </div>
  151. <div class="weui-mask_transparent"></div>
  152. <div class="weui-toast weui_loading_toast weui-toast--visible">
  153. <div class="weui_loading">
  154. <i class="weui-loading weui-icon_toast"></i>
  155. </div>
  156. <p class="weui-toast_content">数据加载中</p>
  157. </div>
  158. <div class="try-use-wrap">
  159. <div class="try-use-container">
  160. <video width="100%" height="100%" id="source" autoplay="autoplay" loop="loop" webkit-playsinline="true"
  161. playsinline="true" x5-video-player-type="h5-page">
  162. 您的浏览器不支持 video 标签。
  163. </video>
  164. <div class="time-close-wrap"><span class="time-node"></span> 关闭</div>
  165. </div>
  166. </div>
  167. <div class="buy-phone-wrap">
  168. <div class="bug-wrap">
  169. <div class="bug-title">获得极致体验服务请购买云手机</div>
  170. <div class="btn-list">
  171. <div class="btn cannel-btn">取消</div>
  172. <div class="btn go-bug">去购买</div>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="look-wrap">
  177. <div class="bug-wrap">
  178. <div class="bug-title">关闭广告会退出云手机是否继续观看</div>
  179. <div class="btn-list">
  180. <div class="btn cannel-btn cannel-ad-btn">放弃</div>
  181. <div class="btn go-bug looking">继续观看</div>
  182. </div>
  183. </div>
  184. </div>
  185. <div id="set-phone-size-dialog" class="dialog">
  186. <div class="dialog-mask"></div>
  187. <!-- 设置分辨率的弹窗 -->
  188. <div class="dialog-content-border">
  189. <div class="dialog-content">
  190. <div class="dialog-header">
  191. <div class="dialog-btn cancel">
  192. <span>取消</span>
  193. </div>
  194. <div class="dialog-btn confirm">
  195. <span>确定</span>
  196. </div>
  197. </div>
  198. <div class="dialog-main">
  199. <div id="phone-size-list"></div>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. <div class="dialog-jifei">
  205. <div class="apply-wrap">
  206. <div class="apply-container">
  207. <div class="apply-title">应用推荐</div>
  208. <div class="apply-list"></div>
  209. <div class="apply-list-change">换一批</div>
  210. <img class="apply-close" src="img/close.png" alt="" />
  211. </div>
  212. </div>
  213. <div class="time-lang-wrap">
  214. <div class="time-lang-container">
  215. <img class="time-lang-img" src="img/smallBell.png" />
  216. <div class="time-lang-title">本月时长已用完</div>
  217. <div class="time-lang-tip">您可以去购买时长页面进行购买</div>
  218. <div class="time-lang-btn">续时长</div>
  219. </div>
  220. </div>
  221. <div class="countdown-wrap">
  222. <div class="countdown-container">
  223. <img class="countdown-img" src="img/countdown.png" />
  224. <div class="countdown-title">计费规则</div>
  225. <div class="countdown-tip">
  226. 进入云机开始计时,点击退出并下机停止<br />计时。点击退出云机仍处于计时状态。
  227. </div>
  228. <div class="countdown-tip2">
  229. 云机时长剩余:<span class="countdown-time"></span>
  230. </div>
  231. <div class="countdown-btn">我知道了</div>
  232. </div>
  233. </div>
  234. <script type="text/html" id="apply">
  235. <div class="apply-item">
  236. <img class="apply-img" src="{{imageUrl}}" />
  237. <div class="apply-row">
  238. <div class="apply-row-title">{{filename}}</div>
  239. <div class="apply-row-down">{{installNum}}</div>
  240. </div>
  241. <div
  242. class="apply-down-btn"
  243. data-id="{{id}}"
  244. data-url="{{downloadUrl}}"
  245. >
  246. 下载
  247. </div>
  248. </div>
  249. </script>
  250. </div>
  251. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  252. <script src="https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.0.3.js"></script>
  253. <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
  254. <!-- ffm软解 -->
  255. <script type="text/javascript" src="helper.js"></script>
  256. <script type="text/javascript" src="jquery-weui.min.js"></script>
  257. <script type="text/javascript" src="pcm-player.js"></script>
  258. <script type="text/javascript" src="webgl.js"></script>
  259. <script type="text/javascript" src="rtcEngine.min.js"></script>
  260. <script type="text/javascript" src="../static/js/uni.webview.1.5.2.js"></script>
  261. <script type="text/javascript">
  262. $(function () {
  263. //手指滑动多少距离就认为是滑成功
  264. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  265. var diffXDistance = 50;
  266. //当前滑动的对象
  267. var currentObject;
  268. //上一次滑动的对象
  269. var lastObject;
  270. //是否可以左右滑动,在上下滑的时候禁止左右滑
  271. var canSlide = true;
  272. //用于记录按下的点
  273. var startPoint;
  274. $('.slide-content').css({
  275. width: $('.slide-wrapper').width(),
  276. });
  277. $('.slide-scroll')
  278. .css({
  279. width:
  280. $('.slide-wrapper').width() + $('.slide-content-button').width(),
  281. })
  282. .on('touchstart', function (e) {
  283. currentObject = this;
  284. startPoint = {
  285. x: e.originalEvent.changedTouches[0].pageX,
  286. y: e.originalEvent.changedTouches[0].pageY,
  287. };
  288. })
  289. .on('touchmove', function (e) {
  290. //如果是左右滑动,就禁止上下的滑动
  291. //如果是上下的滑动,就禁止左右滑动
  292. if (
  293. Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) >
  294. Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)
  295. ) {
  296. event.preventDefault();
  297. } else {
  298. canSlide = false;
  299. }
  300. })
  301. .on('touchend', function (e) {
  302. //如果是上下滑动,这里就直接返回了
  303. if (!canSlide) {
  304. canSlide = true;
  305. return true;
  306. }
  307. //点击除当前左滑对象之外的任意其他位置
  308. if (lastObject && currentObject != lastObject) {
  309. //右滑→
  310. $(lastObject).removeClass('animate-slide');
  311. //清空上一个左滑的对象
  312. lastObject = undefined;
  313. }
  314. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  315. if (diffX < -diffXDistance) {
  316. //左滑←
  317. $(currentObject).addClass('animate-slide');
  318. if (lastObject && lastObject != currentObject) {
  319. //右滑→
  320. $(lastObject).removeClass('animate-slide');
  321. }
  322. //记录上一个左滑的对象
  323. lastObject = currentObject;
  324. } else if (diffX >= diffXDistance) {
  325. if (currentObject == lastObject) {
  326. //右滑→
  327. $(currentObject).removeClass('animate-slide');
  328. //清空上一个左滑的对象
  329. lastObject = undefined;
  330. }
  331. }
  332. });
  333. });
  334. </script>
  335. <script>
  336. // let vc = new VConsole()
  337. let webSocketWorker = null
  338. let getResidueTimeBool = true
  339. // 开发环境
  340. var isDev =
  341. /^192\.168\./.test(location.host) || /^localhost/.test(location.host);
  342. // if (isDev) {
  343. // baseUrl = 'http://gntest.phone.androidscloud.com:1280';
  344. // sourceType = 2;
  345. // }
  346. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  347. var url = window.location.href;
  348. url = url.split('/');
  349. var baseUrl = url[0] + '//' + url[2];
  350. var parameters = GetRequest();
  351. var token = parameters['token'];
  352. var mealType = parameters['mealType'];
  353. var userCardId = parameters['userCardId'];
  354. var username = parameters['username'];
  355. var connectStatus = parameters['connectStatus'];
  356. var isTips = +parameters['isTips'];
  357. var videoTimer = null,
  358. videoTime = 0,
  359. adType = 0,
  360. sourceType = isNaN(parameters['sourceType'])
  361. ? sourceType
  362. : +parameters['sourceType'],
  363. userCardType = isNaN(parameters['userCardType'])
  364. ? userCardType
  365. : +parameters['userCardType'],
  366. disconnectionFlag = false,
  367. getDate = false;
  368. // 计时套餐显示退出并下机按钮
  369. if ([1, 2, 3].includes(userCardType)) {
  370. $('#dormant').css({ display: 'block' });
  371. }
  372. /*
  373. if (mealType === 'VIP') {
  374. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_VIP.png');
  375. } else if (mealType === 'SVIP') {
  376. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_SVIP.png');
  377. } else if (mealType === 'STAR') {
  378. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_STAR.png');
  379. } else if (mealType === 'STARPRO') {
  380. $('.loading_sceen_pic').attr('src', '../static/img/home_bg_PRO.png');
  381. }
  382. */
  383. $('#wine').css({
  384. width: window.screen.width,
  385. height: window.screen.height - topwinHeight - 20,
  386. position: 'absolute',
  387. });
  388. $('.loading').css({
  389. width: window.screen.width,
  390. height: window.screen.height - topwinHeight - 20,
  391. });
  392. var winese = document.createElement('wine');
  393. wine.style.top = '-' + winese + 'px';
  394. var isAudioPlay = false;
  395. let dbName = parameters['username'],
  396. version = 1,
  397. storeName = 'usercard';
  398. let indexedDB = window.indexedDB;
  399. let db;
  400. var socketURL;
  401. var cUrl;
  402. var cardToken, resolvingPower;
  403. const request = indexedDB.open(dbName, version);
  404. request.onsuccess = function (event) {
  405. db = event.target.result; // 数据库对象
  406. console.log('数据库打开成功');
  407. };
  408. request.onerror = function (event) {
  409. console.log('数据库打开报错');
  410. };
  411. request.onupgradeneeded = function (event) {
  412. // 数据库创建或升级的时候会触发
  413. console.log('onupgradeneeded');
  414. db = event.target.result; // 数据库对象
  415. let objectStore;
  416. if (!db.objectStoreNames.contains(storeName)) {
  417. objectStore = db.createObjectStore(storeName, { keyPath: 'id' }); // 创建表
  418. }
  419. };
  420. // 添加数据
  421. function addData(db, storeName, data) {
  422. let request = db
  423. .transaction([storeName], 'readwrite') // 事务对象 指定表格名称和操作模式("只读"或"读写")
  424. .objectStore(storeName) // 仓库对象
  425. .add(data);
  426. request.onsuccess = function (event) {
  427. console.log('数据写入成功');
  428. };
  429. request.onerror = function (event) {
  430. console.log('数据写入失败');
  431. // throw new Error(event.target.error);
  432. };
  433. }
  434. // 根据id获取数据
  435. function getDataByKey(db, storeName, key) {
  436. let transaction = db.transaction([storeName]); // 事务
  437. let objectStore = transaction.objectStore(storeName); // 仓库对象
  438. let request = objectStore.get(key);
  439. request.onerror = function (event) {
  440. connect('add');
  441. };
  442. request.onsuccess = function (event) {
  443. console.log('主键查询结果: ', request.result);
  444. if (request.result) {
  445. socketURL = request.result.socketURL;
  446. cUrl = request.result.cUrl;
  447. cardToken = request.result.cardToken;
  448. resolvingPower = request.result.resolvingPower;
  449. window.currentPhoneSize = {
  450. width: request.result.width,
  451. height: request.result.height,
  452. dpi: request.result.dpi,
  453. };
  454. doConnectBusiness();
  455. doConnectDirectives();
  456. } else {
  457. connect('add');
  458. }
  459. };
  460. }
  461. // 根据id修改数
  462. function updateDB(db, storeName, data) {
  463. let request = db
  464. .transaction([storeName], 'readwrite') // 事务对象
  465. .objectStore(storeName) // 仓库对象
  466. .put(data);
  467. request.onsuccess = function () {
  468. console.log('数据更新成功');
  469. };
  470. request.onerror = function () {
  471. console.log('数据更新失败');
  472. };
  473. }
  474. // 根据id删除数据
  475. function deleteDB(db, storeName, id) {
  476. let request = db
  477. .transaction([storeName], 'readwrite')
  478. .objectStore(storeName)
  479. .delete(id);
  480. request.onsuccess = function () {
  481. console.log('数据删除成功');
  482. };
  483. request.onerror = function () {
  484. console.log('数据删除失败');
  485. };
  486. }
  487. // 由于打开indexDB是异步的加个定时器避免 db对象还没获取到值导致 报错
  488. setTimeout(() => {
  489. getDataByKey(db, storeName, userCardId);
  490. }, 1000);
  491. var timerInterval = null,
  492. timeInterval = 0;
  493. function connect(type) {
  494. $.ajax({
  495. url: baseUrl + '/api/resources/user/cloud/connect',
  496. type: 'post',
  497. data: JSON.stringify({
  498. userCardId: Number(userCardId),
  499. }),
  500. headers: {
  501. 'content-Type': 'application/json',
  502. Authorization: token,
  503. },
  504. dataType: 'json',
  505. async: false,
  506. success: function (res) {
  507. if (res.status === 0) {
  508. // getResidueTime()
  509. // if(connectStatus==1) {
  510. // getResidueTime();
  511. // }
  512. if (timerInterval) {
  513. timerInterval = clearTimeout();
  514. }
  515. if (res.data.internetHttps) {
  516. socketURL =
  517. 'wss://' +
  518. res.data.internetHttps +
  519. '/plugflow?cardIp=' +
  520. res.data.localIp +
  521. '&token=' +
  522. res.data.cardToken +
  523. '&type=business';
  524. cUrl =
  525. 'wss://' +
  526. res.data.internetHttps +
  527. '/businessChannel?cardIp=' +
  528. res.data.localIp +
  529. '&token=' +
  530. res.data.cardToken +
  531. '&type=directives';
  532. cardToken = res.data.cardToken;
  533. resolvingPower = res.data.resolvingPower;
  534. doConnectBusiness(res);
  535. doConnectDirectives();
  536. if (type === 'add') {
  537. addData(db, storeName, {
  538. id: userCardId,
  539. socketURL: socketURL,
  540. cUrl: cUrl,
  541. cardToken: res.data.cardToken,
  542. resolvingPower: res.data.resolvingPower,
  543. width: res.data.width,
  544. height: res.data.high,
  545. dpi: res.data.dpi,
  546. });
  547. } else {
  548. updateDB(db, storeName, {
  549. id: userCardId,
  550. socketURL: socketURL,
  551. cUrl: cUrl,
  552. cardToken: res.data.cardToken,
  553. resolvingPower: res.data.resolvingPower,
  554. width: res.data.width,
  555. height: res.data.high,
  556. dpi: res.data.dpi,
  557. });
  558. }
  559. const data = window.phoneSizeList.find(function (v) {
  560. return (
  561. v.width === res.data.width &&
  562. v.height === res.data.height &&
  563. v.dpi === res.data.dpi
  564. );
  565. });
  566. window.currentPhoneSize = data || {
  567. width: res.data.width,
  568. height: res.data.height,
  569. dpi: res.data.dpi,
  570. };
  571. } else {
  572. $.toast('网络异常,请稍后重试', 'text');
  573. setTimeout(() => {
  574. clearInterval(intervaler);
  575. quit();
  576. }, 3000);
  577. }
  578. return;
  579. }
  580. if (res.status === 5200) {
  581. if (timeInterval > 7) {
  582. $.toast('网络异常,请稍后重试', 'text');
  583. timerInterval = clearTimeout();
  584. setTimeout(() => {
  585. quit();
  586. }, 3000);
  587. return;
  588. }
  589. timerInterval = setTimeout(() => {
  590. connect(type);
  591. timeInterval += 1;
  592. }, 3000);
  593. return;
  594. }
  595. if (res.status === 5220) {
  596. $.toast('云手机正在一键修复中', 'text');
  597. setTimeout(() => {
  598. quit();
  599. }, 3000);
  600. return;
  601. }
  602. if (res.status === 5203) {
  603. $.toast('正在排队中,请稍等', 'text');
  604. setTimeout(() => {
  605. quit();
  606. }, 3000);
  607. return;
  608. }
  609. if (res.status === 5204) {
  610. $.toast('云机异常,正在为你重新分配云机', 'text');
  611. setTimeout(() => {
  612. quit();
  613. }, 3000);
  614. return;
  615. }
  616. $('#countView').hide();
  617. $('.countdown-wrap').hide();
  618. //downline();
  619. $.toast('画面异常,请重新进入', 'text');
  620. setTimeout(() => {
  621. quit();
  622. }, 3000);
  623. },
  624. });
  625. }
  626. initAD();
  627. var isShowCountdown = +parameters['isShowCountdown'], isShowRule = +parameters['isShowRule'];
  628. if (isTips) {
  629. $.alert({
  630. title: '提示',
  631. text: '开始使用云手机',
  632. onOK,
  633. });
  634. } else {
  635. onOK()
  636. }
  637. function onOK() {
  638. isAudioPlay = true;
  639. if (isShowCountdown) {
  640. $('#countView').eq(0).show();
  641. }
  642. if (isShowRule) {
  643. $('.countdown-wrap').eq(0).show();
  644. }
  645. //getResidueTime();
  646. }
  647. //云机倒计时
  648. let validTime = parameters['validTime'] || 10000;
  649. if (validTime > 32000) {
  650. validTime = 32000;
  651. }
  652. let detailTime = validTime * 60 * 1000;
  653. setTimeout(() => {
  654. $('.bug-title').eq(0).text('尊敬的用户您的云手机试用时间已到期');
  655. getDate = true;
  656. $('.buy-phone-wrap').eq(0).show();
  657. }, detailTime);
  658. var orientation = 0; //0 竖屏,1横屏
  659. function array_unique(arr) {
  660. return arr.filter(function (e, i) {
  661. return arr.indexOf(e) === i;
  662. });
  663. }
  664. var cutList = [];
  665. let timer,
  666. isFlag = true;
  667. const shearTemplate = doT.template(
  668. $('#template-shear').html().replace(/&amp;/g, '&'),
  669. );
  670. function updateShearHtml(list) {
  671. $('.box-shear-plate').html(shearTemplate(list));
  672. }
  673. // 对字符串进行html转义
  674. function encodeHtml(content) {
  675. return [
  676. ['<', '&lt;'],
  677. ['>', '&gt;'],
  678. ['&', '&amp;'],
  679. ['"', '&quot;'],
  680. ].reduce(function (previousValue, currentValue) {
  681. return previousValue.replace(
  682. new RegExp(currentValue[0], 'g'),
  683. currentValue[1],
  684. );
  685. }, content);
  686. }
  687. $('.box-shear-plate').on('click', '.slide-content', function (e) {
  688. handleCopy(e.currentTarget.dataset.content);
  689. });
  690. $('.box-shear-plate').on('click', '.btn-clear', function (e) {
  691. handleClear();
  692. });
  693. $('.box-shear-plate').on('click', '.slide-content-button', function (e) {
  694. handleDelete(e.currentTarget.dataset.id);
  695. });
  696. function showShearPlate(type) {
  697. if (!isControl) {
  698. return;
  699. }
  700. stopManyClick(function () {
  701. new Promise((resolve, reject) => {
  702. if (window.navigator.clipboard) {
  703. window.navigator.clipboard
  704. .readText()
  705. .then(
  706. function (content) {
  707. return $.ajax({
  708. url: baseUrl + '/api/public/v5/shear/content',
  709. type: 'post',
  710. dataType: 'json',
  711. data: JSON.stringify({
  712. content: content,
  713. }),
  714. headers: {
  715. 'content-Type': 'application/json',
  716. Authorization: token,
  717. },
  718. });
  719. },
  720. function (err) {
  721. if (type === 'clear') {
  722. return;
  723. }
  724. $.toast('读取剪贴板失败', 'text');
  725. },
  726. )
  727. .finally(resolve);
  728. } else {
  729. resolve();
  730. }
  731. }).then(function () {
  732. $('.box-shear-plate').empty();
  733. return $.ajax({
  734. url: baseUrl + '/api/public/v5/shear/content',
  735. headers: {
  736. Authorization: token,
  737. },
  738. type: 'get',
  739. dataType: 'json',
  740. success: function (res) {
  741. updateShearHtml(res.status === 0 ? res.data : []);
  742. $('.control-right-img').attr({
  743. 'data-id': '1',
  744. });
  745. $('.leftmains').css({
  746. right: '-4rem',
  747. });
  748. $('.mask').show();
  749. initSlider();
  750. },
  751. });
  752. });
  753. });
  754. }
  755. //防止提示一秒内重复显示
  756. function stopManyClick(fn) {
  757. if (isFlag) {
  758. fn();
  759. }
  760. isFlag = false;
  761. if (timer) {
  762. clearTimeout(timer);
  763. }
  764. timer = setTimeout(() => {
  765. isFlag = true;
  766. }, 1500);
  767. }
  768. // 清空剪贴板
  769. function handleClear() {
  770. $.confirm('确定清空剪贴板?', function () {
  771. $.ajax({
  772. url:
  773. baseUrl +
  774. '/api/public/v5/shear/content' +
  775. Qs.stringify(
  776. {
  777. ids: Array.from($('.slide-wrapper')).map((v) => v.dataset.id),
  778. },
  779. { arrayFormat: 'repeat', addQueryPrefix: true },
  780. ),
  781. headers: {
  782. Authorization: token,
  783. },
  784. type: 'DELETE',
  785. dataType: 'json',
  786. success: function (res) {
  787. if (res.status === 0) {
  788. showShearPlate('clear');
  789. } else {
  790. $.toast(res.msg, 'text');
  791. }
  792. },
  793. });
  794. });
  795. }
  796. function handleCopy(content) {
  797. var cutting = {
  798. type: 'cutting',
  799. data: {
  800. str: content,
  801. },
  802. };
  803. wsss.send(JSON.stringify(cutting));
  804. }
  805. // 删除剪贴板
  806. function handleDelete(id) {
  807. $.ajax({
  808. url: baseUrl + '/api/public/v5/shear/content?ids=' + id,
  809. headers: {
  810. Authorization: token,
  811. },
  812. type: 'DELETE',
  813. dataType: 'json',
  814. success: function (res) {
  815. if (res.status === 0) {
  816. showShearPlate();
  817. } else {
  818. $.toast(res.msg, 'text');
  819. }
  820. },
  821. });
  822. }
  823. function initSlider() {
  824. //手指滑动多少距离就认为是滑成功
  825. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  826. var diffXDistance = 50;
  827. //当前滑动的对象
  828. var currentObject;
  829. //上一次滑动的对象
  830. var lastObject;
  831. //是否可以左右滑动,在上下滑的时候禁止左右滑
  832. var canSlide = true;
  833. //用于记录按下的点
  834. var startPoint;
  835. $('.slide-content').css({
  836. width: $('.slide-wrapper').width(),
  837. });
  838. document.body.removeEventListener(
  839. 'touchmove',
  840. function (e) {
  841. e.preventDefault();
  842. },
  843. {
  844. passive: false,
  845. },
  846. );
  847. $('.slide-scroll')
  848. .css({
  849. width:
  850. $('.slide-wrapper').width() + $('.slide-content-button').width(),
  851. })
  852. .on('touchstart', function (e) {
  853. currentObject = this;
  854. startPoint = {
  855. x: e.originalEvent.changedTouches[0].pageX,
  856. y: e.originalEvent.changedTouches[0].pageY,
  857. };
  858. })
  859. .on('touchmove', function (e) {
  860. //如果是左右滑动,就禁止上下的滑动
  861. //如果是上下的滑动,就禁止左右滑动
  862. if (
  863. Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) >
  864. Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)
  865. ) {
  866. event.preventDefault();
  867. } else {
  868. canSlide = false;
  869. }
  870. })
  871. .on('touchend', function (e) {
  872. //如果是上下滑动,这里就直接返回了
  873. if (!canSlide) {
  874. canSlide = true;
  875. return true;
  876. }
  877. //点击除当前左滑对象之外的任意其他位置
  878. if (lastObject && currentObject != lastObject) {
  879. //右滑→
  880. $(lastObject).removeClass('animate-slide');
  881. //清空上一个左滑的对象
  882. lastObject = undefined;
  883. }
  884. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  885. if (diffX < -diffXDistance) {
  886. //左滑←
  887. $(currentObject).addClass('animate-slide');
  888. if (lastObject && lastObject != currentObject) {
  889. //右滑→
  890. $(lastObject).removeClass('animate-slide');
  891. }
  892. //记录上一个左滑的对象
  893. lastObject = currentObject;
  894. } else if (diffX >= diffXDistance) {
  895. if (currentObject == lastObject) {
  896. //右滑→
  897. $(currentObject).removeClass('animate-slide');
  898. //清空上一个左滑的对象
  899. lastObject = undefined;
  900. }
  901. }
  902. });
  903. }
  904. $('#wine').on('click', function (e) {
  905. console.log('🚀 ~ file: WXdraw.js ~ line 4 ~ e', e);
  906. $('.control-right-img').attr({
  907. 'data-id': '1',
  908. });
  909. $('.leftmains').css({
  910. right: '-4rem',
  911. });
  912. });
  913. var btnMuted = document.querySelector('#btnMuted');
  914. btnMuted &&
  915. (function () {
  916. var setHistory = function (left, top) {
  917. try {
  918. localStorage.setItem(
  919. 'muted-btn-loc',
  920. JSON.stringify({
  921. left: left,
  922. top: top,
  923. }),
  924. );
  925. } catch (ex) { }
  926. };
  927. var getHistory = function () {
  928. try {
  929. var value = localStorage.getItem('muted-btn-loc');
  930. if (!value) return null;
  931. value = JSON.parse(value);
  932. if (!value) return null;
  933. return value;
  934. } catch (ex) {
  935. return null;
  936. }
  937. };
  938. var fixLoc = function (loc) {
  939. var rect = btnMuted.getBoundingClientRect();
  940. rect = {
  941. top: rect.top,
  942. left: rect.left,
  943. width: rect.width,
  944. height: rect.height,
  945. }; // 部分低版本浏览器,该属性为只读
  946. if (loc) {
  947. rect.left = loc.left;
  948. rect.top = loc.top;
  949. }
  950. var minX = 0;
  951. var minY = 0;
  952. var docRect = document.documentElement.getBoundingClientRect();
  953. var maxY = docRect.height - rect.height;
  954. var maxX = docRect.width - rect.width;
  955. var left = rect.left;
  956. var top = rect.top;
  957. left = Math.min(left, maxX);
  958. left = Math.max(left, minX);
  959. top = Math.min(top, maxY);
  960. top = Math.max(top, minY);
  961. if (loc || top !== rect.top || left !== rect.left) {
  962. btnMuted.style.cssText +=
  963. 'left:' + left + 'px;top:' + top + 'px;';
  964. }
  965. };
  966. window.addEventListener('resize', function () {
  967. fixLoc();
  968. });
  969. var touchPoint = {
  970. pageY: 0,
  971. pageX: 0,
  972. };
  973. var currentLoc = {
  974. top: 0,
  975. left: 0,
  976. curTop: 0,
  977. curLeft: 0,
  978. };
  979. var toMove = false;
  980. var touchmove = function (e) {
  981. e.preventDefault();
  982. var point = e.changedTouches[0];
  983. var top = -touchPoint.pageY + point.pageY;
  984. var left = -touchPoint.pageX + point.pageX;
  985. if (toMove) {
  986. top += currentLoc.top;
  987. left += currentLoc.left;
  988. currentLoc.curLeft = left;
  989. currentLoc.curTop = top;
  990. btnMuted.style.cssText +=
  991. 'left:' + left + 'px;top:' + top + 'px;';
  992. } else {
  993. if (Math.abs(top) >= 5 || Math.abs(left) >= 5) {
  994. toMove = true;
  995. }
  996. }
  997. };
  998. var touchend = function () {
  999. window.removeEventListener('touchmove', touchmove, {
  1000. passive: false,
  1001. });
  1002. window.removeEventListener('touchend', touchend, {
  1003. passive: false,
  1004. });
  1005. if (toMove) {
  1006. setHistory(currentLoc.curLeft, currentLoc.curTop);
  1007. fixLoc();
  1008. } else {
  1009. //按点击处理
  1010. var set = $('.control-right-img').attr('data-id');
  1011. if (set == '1') {
  1012. $('.control-right-img').attr({
  1013. 'data-id': '2',
  1014. });
  1015. $('.leftmains').css({
  1016. right: '0rem',
  1017. });
  1018. } else {
  1019. $('.control-right-img').attr({
  1020. 'data-id': '1',
  1021. });
  1022. $('.leftmains').css({
  1023. right: '-4rem',
  1024. });
  1025. }
  1026. }
  1027. };
  1028. btnMuted.addEventListener(
  1029. 'touchstart',
  1030. function (e) {
  1031. e.preventDefault();
  1032. toMove = false;
  1033. var point = e.changedTouches[0];
  1034. touchPoint.pageX = point.pageX;
  1035. touchPoint.pageY = point.pageY;
  1036. var rect = e.target.getBoundingClientRect();
  1037. currentLoc.top = rect.top;
  1038. currentLoc.left = rect.left;
  1039. window.addEventListener('touchmove', touchmove, {
  1040. passive: false,
  1041. });
  1042. window.addEventListener('touchend', touchend, {
  1043. passive: false,
  1044. });
  1045. },
  1046. {
  1047. passive: false,
  1048. },
  1049. );
  1050. var history = getHistory();
  1051. if (history) {
  1052. fixLoc(history);
  1053. }
  1054. btnMuted.classList.remove('hide');
  1055. })();
  1056. function handleClose() {
  1057. $('.mask').hide();
  1058. }
  1059. var decodeCount = 1;
  1060. var isFinish = false;
  1061. var player = new PCMPlayer({
  1062. encoding: '16bitInt',
  1063. channels: 2,
  1064. sampleRate: 44100,
  1065. flushingTime: 22,
  1066. debug: false,
  1067. });
  1068. Module = {};
  1069. Module.onRuntimeInitialized = function () {
  1070. isFinish = true;
  1071. };
  1072. function decodeAAC(data) {
  1073. var retPtr = Module._malloc(4 * 5 * 1024); //接收的数据
  1074. var inputPtr = Module._malloc(4 * data.length); //输入数据
  1075. for (var i = 0; i < data.length; i++) {
  1076. Module.HEAPU8[inputPtr + i] = data[i]; //转换为堆数据
  1077. }
  1078. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  1079. if (pcmLen >= 0) {
  1080. var pcmData = new Uint8Array(pcmLen);
  1081. for (var i = 0; i < pcmLen; i++) {
  1082. pcmData[i] = Module.HEAPU8[retPtr + i];
  1083. }
  1084. player.feed(pcmData);
  1085. }
  1086. decodeCount++;
  1087. Module._free(inputPtr);
  1088. Module._free(retPtr);
  1089. }
  1090. var decodeWoker = new Worker('decoder.js');
  1091. var myVideo = document.getElementById('playCanvas');
  1092. var logicWidth = 720;
  1093. var logicHeight = 1280;
  1094. decodeWoker.onmessage = function (event) {
  1095. var objData = event.data;
  1096. // console.log("🚀 ~ file: WXtrialInterface.html ~ line 806 ~ objData", objData)
  1097. switch (objData.cmd) {
  1098. case 0:
  1099. break;
  1100. case 1:
  1101. // console.log(objData);
  1102. if (logicWidth != objData.width || logicHeight != objData.height) {
  1103. logicWidth = objData.width;
  1104. logicHeight = objData.height;
  1105. }
  1106. // logicWidth = 375
  1107. // logicHeight = 812
  1108. webglPlayer.renderFrame(
  1109. objData.data,
  1110. logicWidth,
  1111. logicHeight,
  1112. logicWidth * logicHeight,
  1113. (logicWidth / 2) * (logicHeight / 2),
  1114. );
  1115. if (getResidueTimeBool) {
  1116. // 如果是计时卡的话就上报
  1117. getResidueTime()
  1118. getResidueTimeBool = false
  1119. }
  1120. $('.weui-mask_transparent').hide();
  1121. $('.weui-toast').hide();
  1122. $('.loading').hide();
  1123. break;
  1124. case 5:
  1125. var buffer = RequestIFrame();
  1126. webSocketWorker.postMessage(buffer);
  1127. }
  1128. };
  1129. var isFinish = false;
  1130. var webglPlayer = new WebGLPlayer(myVideo, {
  1131. preserveDrawingBuffer: false,
  1132. });
  1133. function GetRequest() {
  1134. var url = location.search; // 获取url中"?"符后的字串
  1135. var obj = new Object();
  1136. if (url.indexOf('?') != -1) {
  1137. var str = url.substr(1);
  1138. strs = str.split('&');
  1139. for (var i = 0; i < strs.length; i++) {
  1140. obj[strs[i].split('=')[0]] = strs[i].split('=')[1];
  1141. }
  1142. }
  1143. return obj;
  1144. }
  1145. let extranetIp, extranetPort, connectClearSetInterval, numberOfTimes = 1;
  1146. function doConnectBusiness(res) {
  1147. webSocketWorker = new Worker(
  1148. 'websocket.js?socketURL=' +
  1149. encodeURIComponent(socketURL) +
  1150. '&cardToken=' +
  1151. encodeURIComponent(cardToken),
  1152. );
  1153. window.webSocketWorker = webSocketWorker;
  1154. webSocketWorker.onmessage = function (event) {
  1155. var input = event.data;
  1156. if (input[0] == 0xff && isAudioPlay) {
  1157. decodeAAC(input);
  1158. }
  1159. if (
  1160. input[0] == 0 &&
  1161. input[1] == 0 &&
  1162. input[2] == 0 &&
  1163. input[3] == 1
  1164. ) {
  1165. var cmd = {
  1166. type: 'rawData',
  1167. data: event.data,
  1168. };
  1169. decodeWoker.postMessage(cmd);
  1170. }
  1171. if (input[0] == 0x68) {
  1172. if (input[23] == 0x5c) {
  1173. if (CheckVerifyCode(input)) {
  1174. webSocketWorker.postMessage(ConfigChannel('RK3923C1201900139'));
  1175. var checkBuffer = GetScreenState();
  1176. webSocketWorker.postMessage(checkBuffer);
  1177. } else {
  1178. // connect('update');
  1179. clearInterval(connectClearSetInterval)
  1180. connectClearSetInterval = setInterval(() => {
  1181. if (numberOfTimes >= 6) {
  1182. quit();
  1183. clearInterval(connectClearSetInterval)
  1184. return
  1185. }
  1186. numberOfTimes++
  1187. wsss && wsss.close();
  1188. webSocketWorker && webSocketWorker.postMessage('endRequest');
  1189. decodeWoker && decodeWoker.postMessage('close');
  1190. decodeWoker && decodeWoker.terminate();
  1191. webSocketWorker && webSocketWorker.postMessage('close');
  1192. setTimeout(() => {
  1193. connect('update');
  1194. })
  1195. })
  1196. }
  1197. }
  1198. if (input[23] == 0x05) {
  1199. //横竖屏标识
  1200. if (input[28] == 0x01 && input[29] == 0x01) {
  1201. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  1202. if (state == 1) {
  1203. console.log('安卓卡此时竖屏');
  1204. //竖屏处理
  1205. resolving = 1;
  1206. // $('#playCanvas').removeClass('horizontal').addClass('vertical');
  1207. } else {
  1208. console.log('安卓卡此时横屏');
  1209. //横屏处理
  1210. resolving = 0;
  1211. // $('#playCanvas').removeClass('vertical').addClass('horizontal');
  1212. }
  1213. }
  1214. // window.phoneSizeList = window.phoneSizeListBack.map(function (
  1215. // item,
  1216. // ) {
  1217. // return resolving
  1218. // ? item
  1219. // : Object.assign({}, item, {
  1220. // width: item.height,
  1221. // height: item.width,
  1222. // });
  1223. // });
  1224. // wsss.send(
  1225. // JSON.stringify({
  1226. // type: 'getPhoneSize',
  1227. // }),
  1228. // );
  1229. // 横竖屏变更时获取分辨率要延迟,不然会获取到变更前的分辨率
  1230. // setTimeout(function () {
  1231. // wsss.send(
  1232. // JSON.stringify({
  1233. // type: 'getPhoneSize',
  1234. // }),
  1235. // );
  1236. // }, 500);
  1237. }
  1238. if (input[23] == 0x0b) {
  1239. console.log('多端登陆');
  1240. }
  1241. }
  1242. if (event.data === 'close') {
  1243. $('#countView').hide();
  1244. $('.countdown-wrap').hide();
  1245. downline();
  1246. $.toast('画面异常,请重新进入', 'text');
  1247. setTimeout(() => {
  1248. decodeWoker.postMessage('close');
  1249. decodeWoker.terminate();
  1250. quit();
  1251. }, 3000);
  1252. }
  1253. };
  1254. }
  1255. // 激活码广告相关配置
  1256. function getConfigByPhoneType() {
  1257. return new Promise((resolve, reject) => {
  1258. $.ajax({
  1259. url: baseUrl + '/api/pay/v5/trialCodeConfig/getConfigByPhoneType',
  1260. headers: {
  1261. Authorization: token,
  1262. },
  1263. data: {
  1264. userCardId: userCardId,
  1265. phoneType: mealType,
  1266. },
  1267. type: 'get',
  1268. dataType: 'json',
  1269. success: function (res) {
  1270. let obj = res.data;
  1271. if (res.status === 0) {
  1272. resolve(obj);
  1273. } else {
  1274. $.toast(res.msg, 'text');
  1275. }
  1276. },
  1277. });
  1278. });
  1279. }
  1280. //列表
  1281. function getSetmealList() {
  1282. return new Promise((resolve, reject) => {
  1283. $.ajax({
  1284. url: baseUrl + '/api/resources/v4/freetrial/setmeal/list',
  1285. headers: {
  1286. Authorization: token,
  1287. },
  1288. type: 'get',
  1289. dataType: 'json',
  1290. success: function (res) {
  1291. if (res.status === 0) {
  1292. let list = res.data;
  1293. list.map((item) => {
  1294. if (item.phoneType === mealType) {
  1295. resolve(item);
  1296. }
  1297. });
  1298. } else {
  1299. $.toast(res.msg, 'text');
  1300. }
  1301. },
  1302. });
  1303. });
  1304. }
  1305. //广告信息
  1306. var adData = null; // 广告数据
  1307. var adLastTime = 0; // 广告时间
  1308. var intervalTime = 0; // 间隔时间
  1309. // let adType = 0;
  1310. console.log(
  1311. '🚀 ~ file: WXtrialInterface.html ~ line 973 ~ sourceType',
  1312. sourceType,
  1313. );
  1314. // 拉取广告数据
  1315. function getAD() {
  1316. return $.ajax({
  1317. url: baseUrl + '/api/public/v5/advertising/getAdInfoByAdPlace',
  1318. headers: {
  1319. Authorization: token,
  1320. },
  1321. data: JSON.stringify({
  1322. adPlace: adType,
  1323. os: 0,
  1324. }),
  1325. type: 'POST',
  1326. dataType: 'json',
  1327. contentType: 'application/json;charset=UTF-8',
  1328. }).then(function (res) {
  1329. if (res.status === 0) {
  1330. var list = res.data.filter(
  1331. (v) => v.adType === 1 && !!v.adVideoBase.videoUrl,
  1332. );
  1333. adData = list[Math.floor(Math.random() * list.length)];
  1334. console.log(
  1335. '🚀 ~ file: WXtrialInterface.html ~ line 990 ~ getAD ~ adData',
  1336. adData,
  1337. );
  1338. return adData;
  1339. } else {
  1340. return Promise.reject(new Error(res.msg));
  1341. }
  1342. });
  1343. }
  1344. // 播放广告
  1345. function playAD() {
  1346. var nowTime = Date.now();
  1347. if (
  1348. adData &&
  1349. $('.try-use-wrap').eq(0).is(':hidden') &&
  1350. nowTime > adLastTime + intervalTime
  1351. ) {
  1352. $('#source').attr('src', adData.adVideoBase.videoUrl);
  1353. $('.try-use-wrap').eq(0).show();
  1354. $('#source')[0].play();
  1355. videoTime = adData.forcedTime;
  1356. adData = null;
  1357. adLastTime = nowTime;
  1358. videoTimer = setInterval(() => {
  1359. if (videoTime > 0) {
  1360. videoTime--;
  1361. $('.time-node')
  1362. .eq(0)
  1363. .text(videoTime + 's');
  1364. } else {
  1365. clearInterval(videoTimer);
  1366. $('.time-node').eq(0).text('');
  1367. }
  1368. }, 1000);
  1369. if (intervalTime > 0) {
  1370. // 间隔广告拉取下一次广告数据
  1371. adType = 16;
  1372. getAD();
  1373. }
  1374. if (adType === 16 && sourceType == 1) {
  1375. // 间隔广告和试用才上报
  1376. report(0);
  1377. }
  1378. }
  1379. }
  1380. var residueTimer = null;
  1381. // 获取云机剩余时长
  1382. function getResidueTime() {
  1383. clearInterval(residueTimer);
  1384. if (![1, 2, 3].includes(userCardType)) {
  1385. return;
  1386. }
  1387. return $.ajax({
  1388. url:
  1389. baseUrl +
  1390. `/api/resources/yearMember/getResidueTime?userCardId=${userCardId}`,
  1391. headers: {
  1392. Authorization: token,
  1393. },
  1394. type: 'get',
  1395. dataType: 'json',
  1396. contentType: 'application/json;charset=UTF-8',
  1397. }).then(function (res) {
  1398. if (res.status === 0) {
  1399. let time = res.data;
  1400. startTime();
  1401. residueTimer = setInterval(() => {
  1402. if (time > 0) {
  1403. time--;
  1404. $('.countdown-time').text(residueTimeStamp(time));
  1405. } else {
  1406. clearInterval(residueTimer);
  1407. downline();
  1408. }
  1409. }, 1000);
  1410. } else {
  1411. return Promise.reject(new Error(res.msg));
  1412. }
  1413. });
  1414. }
  1415. // 客户端成功进入云手机后调用
  1416. function startTime() {
  1417. if (![1, 2, 3].includes(userCardType)) {
  1418. return;
  1419. }
  1420. return $.ajax({
  1421. url:
  1422. baseUrl +
  1423. `/api/resources/yearMember/startTime?userCardId=${userCardId}`,
  1424. headers: {
  1425. Authorization: token,
  1426. },
  1427. type: 'get',
  1428. dataType: 'json',
  1429. contentType: 'application/json;charset=UTF-8',
  1430. }).then(function (res) { });
  1431. }
  1432. // 秒转化为时分秒
  1433. function getResultTime(time) {
  1434. let theTime = parseInt(time); // 秒
  1435. let theTime1 = 0; // 分
  1436. let theTime2 = 0; // 小时
  1437. if (theTime > 60) {
  1438. theTime1 = parseInt(theTime / 60);
  1439. theTime = parseInt(theTime % 60);
  1440. if (theTime1 > 60) {
  1441. theTime2 = parseInt(theTime1 / 60);
  1442. theTime1 = parseInt(theTime1 % 60);
  1443. }
  1444. }
  1445. let result = '' + parseInt(theTime);
  1446. if (theTime1 > 0) {
  1447. result = '' + parseInt(theTime1) + ':' + result;
  1448. }
  1449. if (theTime2 > 0) {
  1450. result = '' + parseInt(theTime2) + ':' + result;
  1451. }
  1452. return result;
  1453. }
  1454. // 推荐列表
  1455. function getRecommend() {
  1456. return $.ajax({
  1457. url:
  1458. baseUrl +
  1459. `/api/public/v1/market/get/recommend?userCardId=${userCardId}`,
  1460. headers: {
  1461. Authorization: token,
  1462. },
  1463. type: 'get',
  1464. dataType: 'json',
  1465. contentType: 'application/json;charset=UTF-8',
  1466. }).then(function (res) {
  1467. if (res.status === 0) {
  1468. $('.apply-wrap').eq(0).show();
  1469. let list = res.data;
  1470. let result = '';
  1471. list.map((item) => {
  1472. item.installNum = `有${item.installNum}人下载`;
  1473. result += $('#apply')
  1474. .text()
  1475. .replace(/{{(.*?)}}/g, function (node, key) {
  1476. return item[key];
  1477. });
  1478. });
  1479. $('.apply-list').eq(0).append(result);
  1480. } else {
  1481. return Promise.reject(new Error(res.msg));
  1482. }
  1483. });
  1484. }
  1485. //点击了换一批
  1486. $('.apply-list-change')[0].addEventListener('click', () => {
  1487. $('.apply-list').eq(0).empty();
  1488. getRecommend();
  1489. });
  1490. //点击了关闭按钮
  1491. $('.apply-close')[0].addEventListener('click', () => {
  1492. localStorage.setItem('isShowRecommend', true);
  1493. $('.apply-wrap').eq(0).hide();
  1494. });
  1495. // 点击下载按钮
  1496. $('.apply-wrap')[0].addEventListener('click', (e) => {
  1497. let id = e.target.dataset.id;
  1498. let downloadUrl = e.target.dataset.url;
  1499. let className = e.target.className;
  1500. if (className === 'apply-down-btn') {
  1501. var pings2 = {
  1502. type: 'downAndInstallApk',
  1503. data: {
  1504. apkUrl: downloadUrl,
  1505. taskUid: id,
  1506. },
  1507. };
  1508. wsss.send(JSON.stringify(pings2));
  1509. }
  1510. });
  1511. // 点击了我知道了
  1512. $('.countdown-btn')[0].addEventListener('click', () => {
  1513. $('.countdown-wrap').eq(0).hide();
  1514. getRecommend();
  1515. });
  1516. // 点击了续时长
  1517. $('.time-lang-btn')[0].addEventListener('click', () => {
  1518. $('.time-lang-wrap').eq(0).hide();
  1519. if (window.__wxjs_environment === 'miniprogram') {
  1520. wx.miniProgram.navigateTo({
  1521. url: `/packageA/order/renew/index?record=` + userCardId,
  1522. });
  1523. } else {
  1524. uni.webView.navigateTo({
  1525. url: '/pages/order/renew?record=' + userCardId,
  1526. });
  1527. }
  1528. });
  1529. /**
  1530. * 初始化广告
  1531. * 因移动端video无法自动播放,play()方法不能异步调用。
  1532. * 解决方案,初始化时预先请求广告数据,在用户对云手机touchmove事件中去播放广告并请求下一次广告数据。
  1533. */
  1534. function initAD() {
  1535. console.log(
  1536. '🚀 ~ file: WXtrialInterface.html ~ line 1052 ~ initAD ~ sourceType',
  1537. sourceType,
  1538. );
  1539. (function () {
  1540. switch (sourceType) {
  1541. case 1: {
  1542. return getSetmealList().then(function (res) {
  1543. intervalTime =
  1544. res.intervalSwitch === 1
  1545. ? res.intervalAdvertDuration * 1000 * 60
  1546. : 0;
  1547. if (res.pushFlowAdvert === 1) {
  1548. adType = 15;
  1549. adTime = 0;
  1550. } else if (intervalTime > 0) {
  1551. adType = 16;
  1552. adTime = date.now();
  1553. }
  1554. });
  1555. }
  1556. case 2: {
  1557. return getConfigByPhoneType().then(function (res) {
  1558. if (res.isDisconnectionTime === 1) {
  1559. var time = res.disconnectionTime * 60 * 1000;
  1560. setTimeout(() => {
  1561. disconnectionFlag = true;
  1562. $('.buy-phone-wrap').eq(0).show();
  1563. }, time);
  1564. }
  1565. intervalTime =
  1566. res.isIntervalPlayAd === 1
  1567. ? res.intervalPlayAdTime * 1000 * 60
  1568. : 0;
  1569. if (res.isShowAd === 1) {
  1570. adType = 15;
  1571. adTime = 0;
  1572. } else if (intervalTime > 0) {
  1573. adType = 16;
  1574. adTime = date.now();
  1575. }
  1576. });
  1577. }
  1578. default: {
  1579. return Promise.reject();
  1580. }
  1581. }
  1582. })().then(function () {
  1583. console.log(adType);
  1584. this.$('#playCanvas').on('touchstart', playAD);
  1585. // this.$('#playCanvas').on('touchmove', playAD);
  1586. getAD();
  1587. });
  1588. }
  1589. // 观看广告次数上报1
  1590. function reportFrequency() {
  1591. $.ajax({
  1592. url: baseUrl + '/api/resoures/v1/trial/reportFrequency/' + userCardId,
  1593. headers: {
  1594. Authorization: token,
  1595. },
  1596. type: 'post',
  1597. contentType: 'application/json',
  1598. dataType: 'json',
  1599. success: function (res) { },
  1600. });
  1601. }
  1602. //间隔广告上报
  1603. function report(type) {
  1604. $.ajax({
  1605. url: baseUrl + '/api/resources/v1/trial/report',
  1606. headers: {
  1607. Authorization: token,
  1608. },
  1609. data: JSON.stringify({
  1610. userCardId: userCardId,
  1611. reportType: type,
  1612. }),
  1613. type: 'POST',
  1614. dataType: 'json',
  1615. contentType: 'application/json;charset=UTF-8',
  1616. success: function (res) { },
  1617. });
  1618. }
  1619. //关闭广告
  1620. $('.time-close-wrap')[0].addEventListener('click', () => {
  1621. if (videoTime == 0) {
  1622. reportFrequency();
  1623. }
  1624. $('.buy-phone-wrap').eq(0).show();
  1625. });
  1626. // 点击取消
  1627. $('.cannel-btn')[0].addEventListener('click', () => {
  1628. $('.buy-phone-wrap').eq(0).hide();
  1629. if (disconnectionFlag || getDate) {
  1630. //设置了断线时间,取消直接退出
  1631. systemBuriedPoint('激活码-断线-取消');
  1632. quit();
  1633. return;
  1634. }
  1635. let pointName = '';
  1636. if (sourceType == 1) {
  1637. pointName =
  1638. videoTime == 0 ? '免费试用-关闭-取消' : '免费试用-强制关闭-取消';
  1639. } else {
  1640. pointName =
  1641. videoTime == 0 ? '激活码-关闭-取消' : '激活码-强制关闭-取消';
  1642. }
  1643. systemBuriedPoint(pointName);
  1644. if (videoTime == 0) {
  1645. if (adType === 16 && sourceType == 1) {
  1646. report(1);
  1647. }
  1648. $('.try-use-wrap').eq(0).hide();
  1649. $('#source')[0].pause();
  1650. return;
  1651. }
  1652. $('.look-wrap').eq(0).show();
  1653. });
  1654. // 点击去购买
  1655. $('.go-bug')[0].addEventListener('click', () => {
  1656. let pointName = '';
  1657. if (disconnectionFlag) {
  1658. pointName = '激活码-断线-去购买';
  1659. } else if (sourceType == 1) {
  1660. pointName =
  1661. videoTime == 0
  1662. ? '免费试用-关闭-去购买'
  1663. : '免费试用-强制关闭-去购买';
  1664. } else {
  1665. pointName =
  1666. videoTime == 0 ? '激活码-关闭-去购买' : '激活码-强制关闭-去购买';
  1667. }
  1668. systemBuriedPoint(pointName);
  1669. if (getDate) {
  1670. if (window.__wxjs_environment === 'miniprogram') {
  1671. wx.miniProgram.navigateTo({
  1672. url: '/packageA/order/buy/index?buyType=试用界面购买',
  1673. });
  1674. } else {
  1675. if (userCardType === 1) {
  1676. uni.webView.navigateTo({
  1677. url: '/pages/order/renewTime',
  1678. });
  1679. } else {
  1680. uni.webView.navigateTo({
  1681. url: '/pages/order/order',
  1682. });
  1683. }
  1684. }
  1685. } else {
  1686. if (window.__wxjs_environment === 'miniprogram') {
  1687. wx.miniProgram.navigateTo({
  1688. url:
  1689. `/packageA/order/renew/index?buyType=${sourceType == 1
  1690. ? '试用弹窗购买按钮进入-普通试用'
  1691. : '试用弹窗购买按钮进入-激活码试用'
  1692. }&record=` + userCardId,
  1693. });
  1694. } else {
  1695. if (userCardType === 1) {
  1696. uni.webView.navigateTo({
  1697. url: '/pages/order/renewTime',
  1698. });
  1699. } else {
  1700. uni.webView.navigateTo({
  1701. url: '/pages/order/order',
  1702. });
  1703. }
  1704. }
  1705. }
  1706. });
  1707. window.onbeforeunload = function () {
  1708. wsss.close();
  1709. decodeWoker.postMessage('close');
  1710. decodeWoker.terminate();
  1711. };
  1712. // 埋点
  1713. function systemBuriedPoint(pointName) {
  1714. $.ajax({
  1715. url: baseUrl + '/api/public/v1/systemBuriedPoint/stat',
  1716. headers: {
  1717. Authorization: token,
  1718. },
  1719. type: 'post',
  1720. data: JSON.stringify({
  1721. pointName: pointName,
  1722. }),
  1723. contentType: 'application/json',
  1724. dataType: 'json',
  1725. success: function (res) { },
  1726. });
  1727. }
  1728. // 避免重复退出的字段
  1729. let quitBool = true
  1730. function quit() {
  1731. // 退出云机页时,把所有链接都关闭掉
  1732. wsss && wsss.close();
  1733. decodeWoker && decodeWoker.postMessage('close');
  1734. decodeWoker && decodeWoker.terminate();
  1735. // 如果是指令请求失败或者直接退出,都要发送消息给视频流js文件,告知视频流请求失败情况不再做退出操作
  1736. webSocketWorker && webSocketWorker.postMessage('endRequest');
  1737. webSocketWorker && webSocketWorker.postMessage('close');
  1738. if (!quitBool) {
  1739. return
  1740. }
  1741. quitBool = false
  1742. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  1743. tt.miniProgram.switchTab({
  1744. url: '/pages/home/home',
  1745. });
  1746. } else {
  1747. // uni.webView.navigateBack({
  1748. // delta: 1,
  1749. // });
  1750. // parent.postMessage(
  1751. // {
  1752. // type: 'exit',
  1753. // },
  1754. // '*',
  1755. // );
  1756. uni.reLaunch({
  1757. url: '/pages/index/index'
  1758. });
  1759. }
  1760. }
  1761. function updatePhoneSizeListHtml() {
  1762. const templatePhoneSizeItem = doT.template(
  1763. $('#template-phone-size-item').html().replace(/&amp;/g, '&'),
  1764. );
  1765. // console.log({
  1766. // list: window.phoneSizeList,
  1767. // active: window.activePhoneSize,
  1768. // resolving,
  1769. // });
  1770. const phoneSizeListItemsHtml = templatePhoneSizeItem({
  1771. list: window.phoneSizeList,
  1772. active: window.activePhoneSize,
  1773. resolving,
  1774. });
  1775. $('#phone-size-list').html(phoneSizeListItemsHtml);
  1776. }
  1777. $('#open-set-phone-size-dialog-btn').on('click', async function (e) {
  1778. !window.phoneSizeList.length && (await getPhoneSizeList());
  1779. window.activePhoneSize = window.currentPhoneSize;
  1780. updatePhoneSizeListHtml();
  1781. $('#set-phone-size-dialog').addClass('show');
  1782. $('.control-right-img').attr({
  1783. 'data-id': '1',
  1784. });
  1785. $('.leftmains').css({
  1786. right: '-4rem',
  1787. });
  1788. });
  1789. // $('#set-phone-size-dialog').addClass('show');
  1790. $('.dialog .dialog-mask')
  1791. .add('.dialog .dialog-btn.cancel')
  1792. .on('click', function (e) {
  1793. $(e.currentTarget).parents('.dialog').removeClass('show');
  1794. });
  1795. // 分辨率列表
  1796. window.phoneSizeList = [];
  1797. // 当前生效的分辨率
  1798. // 选中的分辨率
  1799. // window.activePhoneSize = window.currentPhoneSize;
  1800. async function getPhoneSizeList() {
  1801. const response = await $.ajax({
  1802. url:
  1803. baseUrl + '/api/resources/v5/machine/resolution/getResolvingPower',
  1804. headers: {
  1805. Authorization: token,
  1806. },
  1807. type: 'get',
  1808. dataType: 'json',
  1809. data: {
  1810. userCardId,
  1811. },
  1812. });
  1813. const phoneSizeList = response.data.map(function (v) {
  1814. return {
  1815. id: v.id,
  1816. dpi: v.dpi,
  1817. width: v.width,
  1818. height: v.high,
  1819. };
  1820. });
  1821. window.phoneSizeList = phoneSizeList;
  1822. // 关联上当前云机分辨率
  1823. const currentPhoneSize = phoneSizeList.find(function (v) {
  1824. return (
  1825. window.currentPhoneSize &&
  1826. v.width === window.currentPhoneSize.width &&
  1827. v.height === window.currentPhoneSize.height &&
  1828. v.dpi === window.currentPhoneSize.dpi
  1829. );
  1830. });
  1831. window.currentPhoneSize = currentPhoneSize || window.currentPhoneSize;
  1832. }
  1833. /*
  1834. getPhoneSizeList().then(function (phoneSizeList) {
  1835. window.phoneSizeList = phoneSizeList;
  1836. // window.phoneSizeListBack = phoneSizeList; // 备份下数据,用户横竖切换时。
  1837. const currentPhoneSize = window.phoneSizeList.find(function (v) {
  1838. return (
  1839. window.currentPhoneSize &&
  1840. v.width === window.currentPhoneSize.width &&
  1841. v.height === window.currentPhoneSize.height &&
  1842. v.dpi === window.currentPhoneSize.dpi
  1843. );
  1844. });
  1845. window.currentPhoneSize = currentPhoneSize || window.currentPhoneSize;
  1846. // return updatePhoneSizeListHtml();
  1847. });
  1848. */
  1849. // const phoneSizeListSwiper = new Swiper('#phone-size-list-swiper', {
  1850. // direction: 'vertical',
  1851. // slidesPerView: 'auto',
  1852. // loop: false,
  1853. // centeredSlides: true,
  1854. // });
  1855. let lastSetPhone = 0;
  1856. function setPhoneSize(config) {
  1857. if (config.id === currentPhoneSize.id) {
  1858. return;
  1859. }
  1860. if (Date.now() <= lastSetPhone + 1000 * 5) {
  1861. throw new Error('请勿频繁操作');
  1862. }
  1863. lastSetPhone = Date.now();
  1864. // config = Object.assign({}, config, {
  1865. // width: config.width,
  1866. // height: config.height,
  1867. // });
  1868. // 修改云机分辨率
  1869. wsss.send(
  1870. JSON.stringify({
  1871. type: 'setPhoneSize',
  1872. data: {
  1873. id: config.id,
  1874. width: config.width,
  1875. height: config.height,
  1876. dpi: config.dpi,
  1877. },
  1878. }),
  1879. );
  1880. // XXX: 去除了,改为中台发送
  1881. // 通知其他在线端
  1882. // wsss.send(
  1883. // JSON.stringify({
  1884. // type: 'forwardMsg',
  1885. // data: {
  1886. // code: 'phoneSizeChange',pause
  1887. // id: config.id,
  1888. // width: config.width,
  1889. // height: config.height,
  1890. // dpi: config.dpi,
  1891. // desc: '分辨率修改', // 可选
  1892. // },
  1893. // }),
  1894. // );
  1895. // 上报分辨率
  1896. window.currentPhoneSize = config;
  1897. }
  1898. // wsss.addEventListener('message', function (event) {
  1899. // console.log(
  1900. // '🚀 ~ file: WXtrialInterface.html ~ line 1476 ~ event',
  1901. // event,
  1902. // );
  1903. // });
  1904. $('#phone-size-list').on('click', '.phone-size-item', function (e) {
  1905. const data = $(e.currentTarget).data();
  1906. // console.log(
  1907. // '🚀 ~ file: WXtrialInterface.html ~ line 1494 ~ data',
  1908. // data,
  1909. // );
  1910. window.activePhoneSize = data;
  1911. updatePhoneSizeListHtml();
  1912. // setPhoneSize(data.width, data.height);
  1913. });
  1914. $('#set-phone-size-dialog .dialog-btn.confirm').on('click', function (e) {
  1915. try {
  1916. setPhoneSize(window.activePhoneSize);
  1917. $('#set-phone-size-dialog').removeClass('show');
  1918. } catch (error) {
  1919. $.toast(error.message, 'text');
  1920. }
  1921. });
  1922. </script>
  1923. <script type="text/javascript" src="WXdraw.js"></script>
  1924. <script type="text/javascript" src="aac.js"></script>
  1925. <script type="text/javascript" src="./timer.js"></script>
  1926. </body>
  1927. </html>