index.html 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 src="https://cdn.bootcss.com/tinymce/4.7.13/tinymce.min.js"></script>
  20. <script>
  21. ; /(iPhone|iPad|iPhone OS|Phone|iPod|iOS|Android)/i.test(navigator.userAgent) &&
  22. ((head = document.getElementsByTagName('head')),
  23. (viewport = document.createElement('meta')),
  24. (viewport.name = 'viewport'),
  25. (viewport.content =
  26. 'target-densitydpi=device-dpi, width=375px, user-scalable=no'),
  27. head.length > 0 && head[head.length - 1].appendChild(viewport))
  28. </script>
  29. <script>
  30. function showToast(msg, duration) {
  31. duration = isNaN(duration) ? 3000 : duration;
  32. var m = document.createElement('div');
  33. m.innerHTML = msg;
  34. 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;";
  35. document.body.appendChild(m);
  36. setTimeout(function () {
  37. var d = 0.5;
  38. m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
  39. m.style.opacity = '0';
  40. setTimeout(function () { document.body.removeChild(m) }, d * 1000);
  41. }, duration);
  42. }
  43. document.addEventListener('plusready', function () {
  44. var webview = plus.webview.currentWebview();
  45. plus.navigator.setStatusBarBackground('#65d1a3');//设置顶部颜色
  46. plus.key.addEventListener('backbutton', function () {
  47. webview.canBack(function (e) {
  48. if (e.canBack) {
  49. webview.back(-1);
  50. } else {
  51. //webview.close(); //hide,quit
  52. //plus.runtime.quit();
  53. //首页返回键处理
  54. //处理逻辑:1秒内,连续两次按返回键,则退出应用;
  55. var first = null;
  56. plus.key.addEventListener('backbutton', function () {
  57. //首次按键,提示‘再按一次退出应用’
  58. if (!first) {
  59. first = new Date().getTime();
  60. // console.log('再按一次退出应用');
  61. showToast("再点击一次,退出程序", 1500);
  62. setTimeout(function () {
  63. first = null;
  64. }, 1000);
  65. } else {
  66. if (new Date().getTime() - first < 1500) {
  67. plus.runtime.quit();
  68. }
  69. }
  70. }, false);
  71. }
  72. })
  73. });
  74. console.log(plus.display.resolutionHeight)
  75. });
  76. //定时器 异步运行
  77. function hello() {
  78. console.log("hello");
  79. }
  80. //使用方法名字执行方法
  81. var t1 = window.setTimeout(hello, 1000);
  82. var t2 = window.setTimeout("hello()", 3000);//使用字符串执行方法
  83. window.clearTimeout(t1);//去掉定时器
  84. </script>
  85. </body>
  86. </html>