預約系統 IOS / Android Windows

index1.html 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <html>
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  4. <meta name="description" content="">
  5. <meta name="author" content="">
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <script src="js/teacrypt.js" type="text/javascript"></script>
  8. <script src="js/mqttws31.min.js" type="text/javascript"></script>
  9. <script src="js/jquery-3.5.1.min.js"></script>
  10. <script type="text/javascript">
  11. window.addEventListener( "pageshow",function ( event ) {
  12. var historyTraversal = event.persisted ||
  13. ( typeof window.performance != "undefined" &&
  14. window.performance.navigation.type === 2 );
  15. if ( historyTraversal ) {
  16. // Handle page restore.
  17. window.location.reload();
  18. }
  19. });
  20. </script>
  21. <script type="text/javascript">
  22. var CID = '';
  23. var ID = '';
  24. var PW = '';
  25. var TYPE = '';
  26. var client;
  27. var isconn=false;
  28. var vmqtt='';
  29. var SN='';
  30. var SubID='';
  31. var myclientid='';
  32. var callist = '';
  33. var isget = false;
  34. var webSocket;
  35. var isget2=false;
  36. var vsn='';
  37. //var vii=1;
  38. function init()
  39. {
  40. try
  41. {
  42. //alert('test version 2023-5-17 001 ');
  43. //updateOutput('init');
  44. CID = getUrlParameter('CID');
  45. ID = getUrlParameter('ID');
  46. PW= getUrlParameter('PW');
  47. //TYPE= getUrlParameter('TYPE');
  48. TYPE= 'PC';
  49. SN = getUrlParameter('SN');
  50. vmqtt = getUrlParameter('MQTT');
  51. SubID = getUrlParameter('SubID');
  52. //alert(SubID);
  53. /*
  54. CID = '886999000230';
  55. ID = '00000000';
  56. PW= 'CMM87krWqj8Ltt00';
  57. TYPE='IOS';
  58. SN='2501100080027';
  59. MQTT='aws.gigatech.tw';
  60. */
  61. // updateOutput('CID='+CID);
  62. // updateOutput('ID='+ID);
  63. // updateOutput('PW='+PW);
  64. //updateOutput('TYPE='+TYPE);
  65. if (TYPE=='ANDROID')
  66. {
  67. connect();
  68. }
  69. if (TYPE=='IOS')
  70. {
  71. var vivi = 0;
  72. var intervalID = setInterval(() => {
  73. if (isget)
  74. {
  75. // break;
  76. }
  77. else
  78. {
  79. if (vivi>5)
  80. {
  81. clearInterval(intervalID);
  82. alert('連線異常');
  83. }
  84. else
  85. {
  86. vivi++;
  87. getdoorlist() ;
  88. }
  89. // vii++;
  90. }
  91. }, 400);
  92. }
  93. if (TYPE=='PC')
  94. {
  95. var vivi = 0;
  96. var intervalID = setInterval(() => {
  97. if (isget)
  98. {
  99. // break;
  100. }
  101. else
  102. {
  103. if (vivi>5)
  104. {
  105. clearInterval(intervalID);
  106. alert('連線異常');
  107. }
  108. else
  109. {
  110. vivi++;
  111. if (isconn)
  112. {
  113. getdoorlist() ;
  114. }
  115. }
  116. // vii++;
  117. }
  118. }, 400);
  119. }
  120. //myclientid="Giga8869990002301";
  121. //myclientid="Giga"+CID+"1";
  122. //myclientid="Giga"+CID+"1-"+ parseInt(Math.random() * 100000000, 10);
  123. myclientid="GigaPC"+CID+"1-"+ SubID;
  124. //client = new Paho.MQTT.Client(vmqtt, Number(8083), myclientid);
  125. //client = new Paho.MQTT.Client("intercom.nxt.tw", Number(1883), myclientid);
  126. client = new Paho.MQTT.Client(vmqtt, Number(8083), myclientid);
  127. //client = new Paho.MQTT.Client("aws.gigatech.tw", Number(8083), myclientid);
  128. client.onMessageArrived = onMessageArrived;
  129. client.onConnectionLost = onConnectionLost;
  130. client.connect( {onSuccess: onConnect, onFailure : onFailedConnect,timeout: 6,keepAliveInterval: 30});
  131. // client.connect( {onSuccess: onConnect, onFailure : onFailedConnect,timeout: 6,keepAliveInterval: 30});
  132. }
  133. catch(e)
  134. {
  135. alert(e);
  136. }
  137. }
  138. function onConnectionLost(message)
  139. {
  140. updateOutput('onConnectionLost');
  141. alert('連線失敗或重複登入,將返回登入畫面');
  142. document.location = "index.html?TYPE=PC&ID=00000000";
  143. //client.connect( {onSuccess: onConnect, onFailure : onFailedConnect,timeout: 6,keepAliveInterval: 30});
  144. //client.connect( {onSuccess: onConnect, onFailure : onFailedConnect});
  145. }
  146. function onMessageArrived(message)
  147. {
  148. var errda = message.payloadString;
  149. //console.log(errda);
  150. //isget=true;
  151. isget2=true;
  152. var vobj = JSON.parse( errda);
  153. var jsonString = "{\"action\":\"decode\", \"serial\":\"002\",\"data\":\""+vobj.data+"\"}";
  154. // updateOutput('onMessageArrived');
  155. // updateOutput('----------------------------------------------');
  156. // updateOutput(jsonString);
  157. vsn='002';
  158. /// "WebToApp". 為我們和前端開發人員的約定
  159. if (TYPE=='IOS')
  160. {
  161. window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
  162. }
  163. if (TYPE=='ANDROID')
  164. {
  165. webSocket.send(jsonString);
  166. }
  167. if (TYPE=='PC')
  168. {
  169. selfendecode(vobj.data);
  170. }
  171. }
  172. function onFailedConnect()
  173. {
  174. //alert('連線異常');
  175. updateOutput('onFailedConnect');
  176. }
  177. function onConnect()
  178. {
  179. //client.subscribe('Reserve8869990002301');
  180. client.subscribe('ReservePC'+CID+'1-'+SubID);
  181. //updateOutput('onConnect');
  182. // alert('onConnect');
  183. isconn=true;
  184. }
  185. </script>
  186. <title>預約 QR Code</title>
  187. <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  188. </head>
  189. <body class="text-center" onload="init()">
  190. <div id="cardadmin" class="card" style="width: 480px ;box-shadow: 0px 0px 1px 1px rgba(0,0,0,0.1);margin: 21px auto;background-color:#FFFFFF;">
  191. <table style="width: 100%">
  192. <tbody>
  193. <tr>
  194. <td style="width: 33.3%"><button type="button" style="border-color: #dcdcdc;border-width: 0px;border-color: #dcdcdc;border-width: 0px;margin: 0px 0px 0px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px;width: 110px; height: 60px; background-color: transparent;width:100%;" onclick="btback()"><img src="image/arrowiosback.png" width="40" height="40" style=" margin: -8px 0px 0px -120px ;" alt=""/></button></td><td style="width: 33.3%"><button type="button" style="border-color: #dcdcdc;border-width: 1px;border-color: #dcdcdc;border-width: 1px;margin: 0px 0px 0px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px;width: 110px; height: 60px; background-color: #cce8fc;width:100%;" hidden onclick="pcbtnSaveTmp()"'+
  195. '>複製</button> </td><td style="width: 33.3%"><button type="button" style="border-color: #dcdcdc;border-width: 1px;border-color: #dcdcdc;border-width: 1px;margin: 0px 0px 0px 0px;color:#FFFFFF;font-family: Roboto_Light; font-size: 24px;width: 110px; height: 60px; background-color: #64c800;width:100%;" hidden onclick="pcbtnSaveqr()">下載</button></td>
  196. </tbody>
  197. </table>
  198. <div style="margin: 0 0 0 0;background-color:#dcdcdc;" ><div style="margin: 10px 35px 10px 10px;" ><img src="image/qttitle.png" width="40" height="40" ><button id="btn100" style="outline:none;line-height:40px;vertical-align: middle; text-align: left;width:80%;border:0px white none;background-color:#dcdcdc;font-family:Roboto_Light;font-size:24px;color:#646464;height:42px;">預約 QR Code</button></div></div>
  199. <div style="width: 100%;">
  200. <button id="addneworder" style="border-color: #dcdcdc;border-width: 1px;width: 95%;
  201. height: 56px;
  202. margin: 10px 0px 10px 0px ;
  203. padding: 11px 0 22px;
  204. border-radius: 3px;
  205. font-family:Roboto_Light;font-size:24px;color:#646464;
  206. background-color: #e6e6e6;" onclick="Addpay99()" hidden>
  207. 電腦密碼設定 <img src="image/TwoPerson.png" width="40" height="40" style=" margin: -8px 0px 0px 10px ;" alt=""/></button></div>
  208. <div id="doorlist" >
  209. </div>
  210. </div>
  211. <div>
  212. </div>
  213. <div>
  214. <div id="output" style="display:none">
  215. <h2>Output</h2>
  216. </div>
  217. <script type="text/javascript">
  218. function btback()
  219. {
  220. document.location = "index.html?TYPE=PC&ID=00000000";
  221. }
  222. function Addpay99()
  223. {
  224. document.location = "index5.html?CID="+CID+"&PW="+PW+"&TYPE="+TYPE+"&SN="+SN+"&MQTT="+vmqtt+"&SubID="+SubID;
  225. }
  226. function getdoorlist()
  227. {
  228. var vt=new Date().format("yyyy/MM/dd_HH:mm:ss")
  229. //var edata ="{\"action\":\"mqttqueryCallList\",\"data\":{\"Command\":\"PassWord=CMM87krWqj8Ltt00\",\"SerialNo\":\"Reserve8869990002301\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
  230. // var edata ="{\"action\":\"mqttqueryCallList\",\"data\":{\"Command\":\"PassWord=CMM87krWqj8Ltt00\",\"SerialNo\":\"Reserve"+CID+"1-"+SubID+"\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
  231. var edata ="{\"action\":\"mqttqueryCallList\",\"data\":{\"Command\":\"PassWord="+PW+"\",\"SerialNo\":\"ReservePC"+CID+"1-"+SubID+"\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
  232. var jsonString = "{\"action\":\"encode\", \"serial\":\"001\",\"data\":"+edata+"}";
  233. vsn='001';
  234. // updateOutput(jsonString);
  235. if (TYPE=='IOS')
  236. {
  237. window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
  238. }
  239. if (TYPE=='PC')
  240. {
  241. selfendecode(edata);
  242. }
  243. if (TYPE=='ANDROID')
  244. {
  245. webSocket.send(jsonString);
  246. /*
  247. isget=false;
  248. setTimeout(() => {
  249. if (isget)
  250. {
  251. }else
  252. {
  253. }
  254. }, 500);
  255. */
  256. }
  257. }
  258. </script>
  259. <script type="text/javascript">
  260. var input = document.getElementById("input")
  261. var output = document.getElementById("output");
  262. var vdata="";
  263. var isok=true;
  264. //var wsUrl = "ws://localhost:2980/";
  265. // var wsUrl = "ws://192.168.0.25:2980/";
  266. var wsUrl = "ws://127.0.0.1:2980/";
  267. function connect() {
  268. // open the connection if one does not exist
  269. if (webSocket !== undefined && webSocket.readyState !== WebSocket.CLOSED) {
  270. updateOutput('webSocket fail');
  271. return;
  272. }
  273. // updateOutput("Trying to establish a WebSocket connection to <code>" + wsUrl + "</code>");
  274. // Create a websocket
  275. webSocket = new WebSocket(wsUrl);
  276. webSocket.onopen = function(event) {
  277. // updateOutput("Connected!");
  278. // getdoorlist() ;
  279. //isget=false;
  280. var vivi = 0;
  281. var intervalID = setInterval(() => {
  282. if (isget)
  283. {
  284. // break;
  285. }
  286. else
  287. {
  288. if (vivi>15)
  289. {
  290. updateOutput('vivi 6');
  291. clearInterval(intervalID);
  292. alert('連線異常');
  293. }
  294. else
  295. {
  296. vivi++;
  297. updateOutput('call webSocket send msg');
  298. if (isconn)
  299. {
  300. getdoorlist() ;
  301. }
  302. }
  303. // vii++;
  304. }
  305. }, 400);
  306. };
  307. webSocket.onmessage = function(event)
  308. {
  309. updateOutput('webSocket return msg');
  310. // alert(event.data);
  311. if (vsn=='002')
  312. {
  313. var ress = event.data;
  314. //alert('ress='+ress);
  315. // ress=ress.replace(/[^a-z0-9\s]/gi, 'a').replace(/[_\s]/g, '-');
  316. // ress=ress+"}";
  317. // alert('webSocket finish');
  318. // alert('retry'+vii);
  319. // ress= ress.substring(1300,ress.length);
  320. //alert( ress.substring(1300,ress.length));
  321. // alert( event.data.trim().substring(1300,event.data.length) );
  322. callist.innerHTML ='';
  323. try
  324. {
  325. var vobj = JSON.parse(ress);
  326. callist = vobj.data.data.calllist;
  327. //alert(callist.length);
  328. for (i=0;i<callist.length;i++)
  329. {
  330. var kk = callist[i].split(';');
  331. var tttxt='';
  332. //alert(kk[0]);
  333. if (kk[4].length!=0)
  334. {
  335. // alert(kk[4]);
  336. tttxt=kk[4];
  337. }
  338. else
  339. {
  340. // alert(kk[0]);
  341. tttxt=kk[0];
  342. }
  343. if (kk[0].startsWith('000'))
  344. {
  345. }else
  346. {
  347. doorlist.innerHTML =doorlist.innerHTML+'<div style="margin: 10px 35px 0px -14px;"><button id="doorsin'+i+'" style="line-height:28px;vertical-align: middle; text-align: left;width:80%;border:0px white none;background-color:white;font-family:Roboto_Light;font-size:24px;outline:none;color:#646464;height:28px;" onclick="btnitemback2(\''+i+'\')">'+tttxt+'</button></div><br>';
  348. }
  349. //doorlist.innerHTML =doorlist.innerHTML+ '<div style="margin: 10px 35px 10px -18px;" ><button id="'+i+' style="line-height:40px;vertical-align: middle; text-align: left;width:80%;border:0px white none;background-color:white;font-family:Roboto_Light;font-size:24px;outline:none;color:#646464;height:42px;" onclick="btnGGTT('SingPush.html')">'+tttxt+'</button> </div>";
  350. }
  351. // var sevobj = JSON.parse( vobj);
  352. // alert( sevobj.data);
  353. }catch(e)
  354. {
  355. //alert(e);
  356. }
  357. }
  358. if (vsn=='001')
  359. {
  360. try
  361. {
  362. //alert( event.data );
  363. var ress = event.data;
  364. isget=true;
  365. var vobj = JSON.parse( ress);
  366. vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
  367. }catch(e)
  368. {
  369. alert(e);
  370. }
  371. // updateOutput('---------------------------');
  372. // updateOutput(vdata);
  373. updateOutput('mqtt send before');
  374. isget2=false;
  375. var payload =vdata;
  376. var message = new Paho.MQTT.Message(payload);
  377. // message.destinationName = '2501100080027' ;
  378. message.destinationName = SN ;
  379. message.qos = 2;
  380. message.retained = false;
  381. var vivi=0;
  382. var intervalID = setInterval(() => {
  383. if (isget2)
  384. {
  385. // break;
  386. }
  387. else
  388. {
  389. if (vivi>5)
  390. {
  391. clearInterval(intervalID);
  392. alert('連線異常');
  393. }
  394. else
  395. {
  396. vivi++;
  397. updateOutput('mqtt send');
  398. client.send(message);
  399. }
  400. // vii++;
  401. }
  402. }, 400);
  403. }
  404. // updateOutput('------------xxx------------');
  405. // updateOutput(event.data);
  406. };
  407. webSocket.onclose = function(event) {
  408. updateOutput("Connection Closed");
  409. // sendBtn.disabled = true;
  410. };
  411. }
  412. function AppToWeb(message) {
  413. if (vsn=='002')
  414. {
  415. var ress = message;
  416. // alert('ress='+ress);
  417. callist.innerHTML ='';
  418. try
  419. {
  420. var vobj = JSON.parse(ress);
  421. callist = vobj.data.data.calllist;
  422. for (i=0;i<callist.length;i++)
  423. {
  424. var kk = callist[i].split(';');
  425. var tttxt='';
  426. if (kk[4].length!=0)
  427. {
  428. tttxt=kk[4];
  429. }
  430. else
  431. {
  432. tttxt=kk[0];
  433. }
  434. if (kk[0].startsWith('000'))
  435. {
  436. }else
  437. {
  438. doorlist.innerHTML =doorlist.innerHTML+'<div style="margin: 10px 35px 0px -14px;"><button id="doorsin'+i+'" style="line-height:28px;vertical-align: middle; text-align: left;width:80%;border:0px white none;background-color:white;font-family:Roboto_Light;font-size:24px;outline:none;color:#646464;height:28px;" onclick="btnitemback2(\''+i+'\')">'+tttxt+'</button></div><br>';
  439. }
  440. }
  441. }catch(e)
  442. {
  443. alert(e);
  444. }
  445. }
  446. if (vsn=='001')
  447. {
  448. try
  449. {
  450. isget=true;
  451. var ress = message;
  452. var vobj = JSON.parse( ress);
  453. //alert('xx');
  454. vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
  455. }catch(e)
  456. {
  457. alert(e);
  458. }
  459. var payload =vdata;
  460. var message = new Paho.MQTT.Message(payload);
  461. // message.destinationName = '2501100080027' ;
  462. message.destinationName = SN ;
  463. message.qos = 2;
  464. message.retained = false;
  465. client.send(message);
  466. }
  467. return "Got it"
  468. }
  469. function selfendecode(message) {
  470. if (vsn=='002')
  471. {
  472. message = teaDecrypt(message,'75$095huOQ77kKv!');
  473. // alert(toUtf8(message));
  474. var ress = message;
  475. //alert(ress);
  476. callist.innerHTML ='';
  477. try
  478. {
  479. var vobj = JSON.parse(ress);
  480. callist = vobj.data.calllist;
  481. for (i=0;i<callist.length;i++)
  482. {
  483. var kk = callist[i].split(';');
  484. var tttxt='';
  485. if (kk[4].length!=0)
  486. {
  487. tttxt=kk[4];
  488. }
  489. else
  490. {
  491. tttxt=kk[0];
  492. }
  493. if (kk[0].startsWith('000'))
  494. {
  495. }else
  496. {
  497. // console.log(bytes);
  498. //alert(tttxt);
  499. doorlist.innerHTML =doorlist.innerHTML+'<div style="margin: 10px 35px 0px -14px;"><button id="doorsin'+i+'" style="line-height:28px;vertical-align: middle; text-align: left;width:80%;border:0px white none;background-color:white;font-family:Roboto_Light;font-size:24px;outline:none;color:#646464;height:28px;" onclick="btnitemback2(\''+i+'\')">'+tttxt+'</button></div><br>';
  500. }
  501. }
  502. }catch(e)
  503. {
  504. alert(e);
  505. }
  506. }
  507. if (vsn=='001')
  508. {
  509. try
  510. {
  511. var message111 = teaEncrypt(message,'75$095huOQ77kKv!');
  512. isget=true;
  513. vdata = "{\"encrypt\":\"1\",\"data\":\""+message111+"\"}";
  514. var payload =vdata;
  515. // alert(payload);
  516. var message9990 = new Paho.MQTT.Message(payload);
  517. // message.destinationName = '2501100080027' ;
  518. message9990.destinationName = SN ;
  519. message9990.qos = 2;
  520. message9990.retained = false;
  521. client.send(message9990);
  522. }catch(e)
  523. {
  524. alert(e);
  525. }
  526. }
  527. }
  528. function updateOutput(text) {
  529. output.innerHTML += "<br/>" + text;
  530. }
  531. </script>
  532. <script type="text/javascript">
  533. function btnitemback2(i)
  534. {
  535. var vk = callist[i].split(';');
  536. var tttxt='';
  537. // alert(callist[i]);
  538. if (vk[4].length!=0)
  539. {
  540. // alert(kk[4]);
  541. tttxt=vk[4];
  542. }
  543. else
  544. {
  545. // alert(kk[0]);
  546. tttxt=vk[0];
  547. }
  548. //alert(vk[0]+' '+vk[7]);
  549. document.location = "index2.html?KID="+vk[0]+"&name="+tttxt+"&CID="+CID+"&ID="+vk[0]+"&PW="+PW+"&TYPE="+TYPE+"&SN="+SN+"&MQTT="+vmqtt+"&SubID="+SubID;
  550. }
  551. </script>
  552. <script>
  553. var getUrlParameter = function getUrlParameter(sParam) {
  554. var sPageURL = decodeURIComponent(window.location.search.substring(1)),
  555. sURLVariables = sPageURL.split('&'),
  556. sParameterName,
  557. i;
  558. for (i = 0; i < sURLVariables.length; i++) {
  559. sParameterName = sURLVariables[i].split('=');
  560. if (sParameterName[0] === sParam) {
  561. return sParameterName[1] === undefined ? true : sParameterName[1];
  562. }
  563. }
  564. };
  565. Date.prototype.format = function (format) {
  566. //eg:format="yyyy-MM-dd hh:mm:ss";
  567. if (!format) {
  568. format = "yyyy-MM-dd hh:mm:ss";
  569. }
  570. var o = {
  571. "M+": this.getMonth() + 1, // month
  572. "d+": this.getDate(), // day
  573. "H+": this.getHours(), // hour
  574. "h+": this.getHours(), // hour
  575. "m+": this.getMinutes(), // minute
  576. "s+": this.getSeconds(), // second
  577. "q+": Math.floor((this.getMonth() + 3) / 3), // quarter
  578. "S": this.getMilliseconds()
  579. };
  580. if (/(y+)/.test(format)) {
  581. format = format.replace(RegExp.$1, (this.getFullYear() + "")
  582. .substr(4 - RegExp.$1.length));
  583. }
  584. for (var k in o) {
  585. if (new RegExp("(" + k + ")").test(format)) {
  586. format = format.replace(RegExp.$1, RegExp.$1.length == 1
  587. ? o[k]
  588. : ("00" + o[k]).substr(("" + o[k]).length));
  589. }
  590. }
  591. return format;
  592. };
  593. </script>
  594. <br>
  595. </body>
  596. </html>