zoukankan      html  css  js  c++  java
  • 1、内嵌web ,web内用api对象

    1、

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
        <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
        <title>云API</title>
        <link rel="stylesheet" type="text/css" href="./css/api.css"/>
        <link rel="stylesheet" type="text/css" href="./css/style.css"/>
    </head>
    <body>
      <header>
      </header>
    </body>
    <script type="text/javascript" src="script/api.js"></script>
    <script type="text/javascript">
        apiready = function () {
          var closeAPP = {
              count: 0,
              timer: null,
              time: 1500
          }
          api.addEventListener({
                name: 'keyback'
              }, function(ret, err) {
              closeAPP.count++;
              if(closeAPP.count >= 2){
                  api.closeWidget({
                      id: 'A6028342539653',
                      silent: true,
                      })
              }
              else{
                    /*api.toast({
                        msg: '再按一次退出应用',
                        duration: closeAPP.time,
                        location: 'bottom'
                    });*/
                    browser.historyBack(
                        function(ret, err) {
                            if (!ret.status) {
                                //api.closeWin();
                                //直接退出,不用closeWin() 这种强硬的方式
                            }
                        }
                    );
                }
                clearTimeout(closeAPP.timer);
                closeAPP.timer = setTimeout(function(){
                        closeAPP.count = 0;
                },closeAPP.time)
            });
            //双击退出APP
            $api.fixStatusBar( $api.dom('header') );
            api.setStatusBarStyle({
                style: 'dark',
                color: '#6ab494'
            });
            api.openWin({
                name: 'page1',
                url: 'http://suyijie.weiyouqq.com',
                pageParam: {
                    name: 'test'
                }
            });
            /*
            <!DOCTYPE HTML>
            <html>
            <head>
                <meta charset="utf-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title></title>
            </head>
            <body>
            <script>
                alert("我是正常的运行~!");
                apiready = function (){
                    //alert("我是内部运行~!");
                }
            </script>
            </body>
            </html>
            */
        }
      </script>
    </html>
  • 相关阅读:
    CodeForces Gym 100935G Board Game DFS
    CodeForces 493D Vasya and Chess 简单博弈
    CodeForces Gym 100935D Enormous Carpet 快速幂取模
    CodeForces Gym 100935E Pairs
    CodeForces Gym 100935C OCR (水
    CodeForces Gym 100935B Weird Cryptography
    HDU-敌兵布阵
    HDU-Minimum Inversion Number(最小逆序数)
    七月馒头
    非常可乐
  • 原文地址:https://www.cnblogs.com/fger/p/12407206.html
Copyright © 2011-2022 走看看