index.html 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->
  6. <title>discern</title>
  7. </head>
  8. <body>
  9. <div id="app"></div>
  10. <!-- built files will be auto injected -->
  11. <script src="https://unpkg.com/vue-baidu-map"></script>
  12. <!-- <script src="http://api.map.baidu.com/api?v=2.0&ak=fdc489725992ba738397be65dc657d9e"></script> -->
  13. <script src="./static/clipper.js"></script>
  14. <script src="http://api.map.baidu.com/api?v=1.0&type=webgl&ak=rQxHPQX1ua21rWnXzTbUh5KSSUbnefxR"></script>
  15. <script src="https://code.bdstatic.com/npm/mapvgl@1.0.0-beta.51/dist/mapvgl.min.js"></script>
  16. <script src="https://mapv.baidu.com/gl/examples/static/common.js"></script>
  17. <script src="http://mapv.baidu.com/build/mapv.min.js"></script>
  18. <script src="http://api.map.baidu.com/library.InfoBox/1.2/src/InfoBox_min.js"></script>
  19. <script>
  20. ; /(iPhone|iPad|iPhone OS|Phone|iPod|iOS|Android)/i.test(navigator.userAgent) &&
  21. ((head = document.getElementsByTagName('head')),
  22. (viewport = document.createElement('meta')),
  23. (viewport.name = 'viewport'),
  24. (viewport.content =
  25. 'target-densitydpi=device-dpi, width=375px, user-scalable=no'),
  26. head.length > 0 && head[head.length - 1].appendChild(viewport))
  27. </script>
  28. <script>
  29. function showToast(msg, duration) {
  30. duration = isNaN(duration) ? 3000 : duration;
  31. var m = document.createElement('div');
  32. m.innerHTML = msg;
  33. m.style.cssText = "width:35%; min-width:180px; background:#000; opacity:0.6; height:auto;min-height: 30px; color:#fff; line-height:30px; text-align:center; border-radius:15px; position:fixed; top:85%; left:25%; z-index:999999;";
  34. document.body.appendChild(m);
  35. setTimeout(function () {
  36. var d = 0.5;
  37. m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
  38. m.style.opacity = '0';
  39. setTimeout(function () { document.body.removeChild(m) }, d * 1000);
  40. }, duration);
  41. }
  42. document.addEventListener('plusready', function () {
  43. var webview = plus.webview.currentWebview();
  44. plus.navigator.setStatusBarBackground('#65d1a3');//设置顶部颜色
  45. plus.key.addEventListener('backbutton', function () {
  46. webview.canBack(function (e) {
  47. if (e.canBack) {
  48. webview.back(-1);
  49. } else {
  50. //webview.close(); //hide,quit
  51. //plus.runtime.quit();
  52. //首页返回键处理
  53. //处理逻辑:1秒内,连续两次按返回键,则退出应用;
  54. var first = null;
  55. plus.key.addEventListener('backbutton', function () {
  56. //首次按键,提示‘再按一次退出应用’
  57. if (!first) {
  58. first = new Date().getTime();
  59. // console.log('再按一次退出应用');
  60. showToast("再点击一次,退出程序", 1500);
  61. setTimeout(function () {
  62. first = null;
  63. }, 1000);
  64. } else {
  65. if (new Date().getTime() - first < 1500) {
  66. plus.runtime.quit();
  67. }
  68. }
  69. }, false);
  70. }
  71. })
  72. });
  73. console.log(plus.display.resolutionHeight)
  74. });
  75. //定时器 异步运行
  76. function hello() {
  77. console.log("hello");
  78. }
  79. //使用方法名字执行方法
  80. var t1 = window.setTimeout(hello, 1000);
  81. var t2 = window.setTimeout("hello()", 3000);//使用字符串执行方法
  82. window.clearTimeout(t1);//去掉定时器
  83. </script>
  84. </body>
  85. </html>