Skip to content

Instantly share code, notes, and snippets.

@filmaj
Created July 18, 2012 18:32
Show Gist options
  • Select an option

  • Save filmaj/3137938 to your computer and use it in GitHub Desktop.

Select an option

Save filmaj/3137938 to your computer and use it in GitHub Desktop.

Revisions

  1. @Trevoke Trevoke revised this gist Jul 18, 2012. 1 changed file with 19 additions and 17 deletions.
    36 changes: 19 additions & 17 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -10,27 +10,29 @@
    <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript">

    function onDeviceReady(){
    function onDeviceReady(){
    console.log("ON DEVICE READY");
    /*Back event handler for all pages navigation*/
    document.addEventListener('pageshow', function (e, data) {
    if ($.mobile.activePage.attr('id') == 'index') {
    document.addEventListener("backbutton", function () {
    setTimeout( function() {navigator.app.exitApp();}, 100 );
    }, true);
    }
    else{
    document.addEventListener("backbutton", function () {
    setTimeout( function() {$.mobile.changePage("#index");}, 100 );
    }, true);
    }
    });
    }
    if ($.mobile.activePage.attr('id') == 'index') {
    document.addEventListener("backbutton", function () {
    setTimeout( function() {navigator.app.exitApp();}, 100 );
    }, true);
    }
    else{
    document.addEventListener("backbutton", function () {
    setTimeout( function() {$.mobile.changePage("#index");}, 100 );
    }, true);
    }
    });
    }

    function onBodyLoad() {
    console.log("Normal javascript stuff");
    document.addEventListener("deviceready", onDeviceReady, false);
    }

    console.log("Normal javascript stuff");
    document.addEventListener("deviceready", onDeviceReady, false);

    }

    </script>

    @@ -62,4 +64,4 @@ <h1>Work with me here</h1>


    </body>
    </html>
    </html>
  2. @Trevoke Trevoke revised this gist Jul 18, 2012. 1 changed file with 6 additions and 8 deletions.
    14 changes: 6 additions & 8 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,6 @@
    <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript">

    function onBodyLoad() {

    function onDeviceReady(){
    console.log("ON DEVICE READY");
    /*Back event handler for all pages navigation*/
    @@ -27,12 +25,12 @@
    }, true);
    }
    });
    }
    }

    console.log("Normal javascript stuff");
    document.addEventListener("deviceready", onDeviceReady, false);

    }
    function onBodyLoad() {
    console.log("Normal javascript stuff");
    document.addEventListener("deviceready", onDeviceReady, false);
    }

    </script>

    @@ -64,4 +62,4 @@ <h1>Work with me here</h1>


    </body>
    </html>
    </html>
  3. @Trevoke Trevoke revised this gist Jul 18, 2012. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions error.log
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    07-18 14:21:39.333: WARN/System.err(1256): java.net.SocketException: Permission denied
    07-18 14:21:39.333: WARN/System.err(1256): at org.apache.harmony.luni.platform.OSNetworkSystem.createServerStreamSocketImpl(Native Method)
    07-18 14:21:39.353: WARN/System.err(1256): at org.apache.harmony.luni.platform.OSNetworkSystem.createServerStreamSocket(OSNetworkSystem.java:170)
    07-18 14:21:39.353: WARN/System.err(1256): at org.apache.harmony.luni.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:45)
    07-18 14:21:39.363: WARN/System.err(1256): at java.net.ServerSocket.<init>(ServerSocket.java:135)
    07-18 14:21:39.363: WARN/System.err(1256): at java.net.ServerSocket.<init>(ServerSocket.java:89)
    07-18 14:21:39.363: WARN/System.err(1256): at org.apache.cordova.CallbackServer.run(CallbackServer.java:205)
    07-18 14:21:39.363: WARN/System.err(1256): at java.lang.Thread.run(Thread.java:1096)
  4. @Trevoke Trevoke revised this gist Jul 18, 2012. 1 changed file with 36 additions and 34 deletions.
    70 changes: 36 additions & 34 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -10,56 +10,58 @@
    <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript">

    function onDeviceReady(){
    /*Back event handler for all pages navigation*/
    $(document).bind ('pageshow', function (e, data) {
    if ($.mobile.activePage.attr('id') == 'index') {
    document.addEventListener("backbutton", function () {
    setTimeout( function() {navigator.app.exitApp();}, 100 );
    }, true);
    }
    else{
    document.addEventListener("backbutton", function () {
    setTimeout( function() {$.mobile.changePage("#index");}, 100 );
    }, true);
    }
    });
    function onBodyLoad() {

    function onDeviceReady(){
    console.log("ON DEVICE READY");
    /*Back event handler for all pages navigation*/
    document.addEventListener('pageshow', function (e, data) {
    if ($.mobile.activePage.attr('id') == 'index') {
    document.addEventListener("backbutton", function () {
    setTimeout( function() {navigator.app.exitApp();}, 100 );
    }, true);
    }
    else{
    document.addEventListener("backbutton", function () {
    setTimeout( function() {$.mobile.changePage("#index");}, 100 );
    }, true);
    }
    });
    }

    }
    console.log("Normal javascript stuff");
    document.addEventListener("deviceready", onDeviceReady, false);

    $(document).ready( function() {
    document.addEventListener("deviceready", onDeviceReady, true);
    });
    }

    </script>
    </script>


    </head>
    </head>

    <body>
    <div id="index" data-role="page" data-theme="a">
    <div data-role="header">
    <h1>Work with me here</h1>
    </div>
    <body onload='onBodyLoad()'>
    <div id="index" data-role="page" data-theme="a">
    <div data-role="header">
    <h1>Work with me here</h1>
    </div>

    <div data-role="content">
    I am page 1.
    <a href="#char-1" data-role="button">Next</a>
    <div data-role="content">
    I am page 1.
    <a href="#char-1" data-role="button">Next</a>
    </div>
    </div>
    </div>

    <div id="char-1" data-role="page" data-theme="a">
    <div data-role="content">
    <div id="char-1" data-role="page" data-theme="a">
    <div data-role="content">
    HAHAHA!<br/>
    <a href="#char-2" data-role="button">Last</a>
    </div>
    </div>
    </div>

    <div id="char-2" data-role="page" data-theme="a">
    <div data-role="content">The buck stops here.</div>
    <div data-role="content">The buck stops here.</div>
    </div>


    </body>
    </body>
    </html>
  5. @Trevoke Trevoke revised this gist Jul 18, 2012. 1 changed file with 27 additions and 12 deletions.
    39 changes: 27 additions & 12 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -5,32 +5,40 @@
    <title>TestApp</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css"/>
    <script type="test/javascript" src='cordova-1.8.1.js'></script>
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript">

    function onBackButton() {
    console.log("OH SNAP");
    }
    function onDeviceReady() {
    $(document).bind('pageshow', function(e, data) {
    document.addEventListener('backbutton', onBackButton, true);
    function onDeviceReady(){
    /*Back event handler for all pages navigation*/
    $(document).bind ('pageshow', function (e, data) {
    if ($.mobile.activePage.attr('id') == 'index') {
    document.addEventListener("backbutton", function () {
    setTimeout( function() {navigator.app.exitApp();}, 100 );
    }, true);
    }
    else{
    document.addEventListener("backbutton", function () {
    setTimeout( function() {$.mobile.changePage("#index");}, 100 );
    }, true);
    }
    });
    }

    $(document).ready( function() {

    document.addEventListener("deviceready", onDeviceReady, false);
    }

    $(document).ready( function() {
    document.addEventListener("deviceready", onDeviceReady, true);
    });

    </script>
    <script type="test/javascript" src='cordova-1.8.1.js'></script>


    </head>

    <body>
    <div id="homepage" data-role="page" data-theme="a">
    <div id="index" data-role="page" data-theme="a">
    <div data-role="header">
    <h1>Work with me here</h1>
    </div>
    @@ -42,9 +50,16 @@ <h1>Work with me here</h1>
    </div>

    <div id="char-1" data-role="page" data-theme="a">
    <div data-role="content">HAHAHA!</div>
    <div data-role="content">
    HAHAHA!<br/>
    <a href="#char-2" data-role="button">Last</a>
    </div>
    </div>

    <div id="char-2" data-role="page" data-theme="a">
    <div data-role="content">The buck stops here.</div>
    </div>


    </body>
    </html>
  6. @Trevoke Trevoke revised this gist Jul 17, 2012. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -13,12 +13,15 @@
    console.log("OH SNAP");
    }
    function onDeviceReady() {
    $(document).on('pageshow', function(e, data) {
    $(document).bind('pageshow', function(e, data) {
    document.addEventListener('backbutton', onBackButton, true);
    });
    }

    document.addEventListener("deviceready", onDeviceReady, false);
    $(document).ready( function() {

    document.addEventListener("deviceready", onDeviceReady, false);
    });

    </script>
    <script type="test/javascript" src='cordova-1.8.1.js'></script>
  7. @Trevoke Trevoke created this gist Jul 17, 2012.
    47 changes: 47 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>TestApp</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css"/>
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript" src="jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript">

    function onBackButton() {
    console.log("OH SNAP");
    }
    function onDeviceReady() {
    $(document).on('pageshow', function(e, data) {
    document.addEventListener('backbutton', onBackButton, true);
    });
    }

    document.addEventListener("deviceready", onDeviceReady, false);

    </script>
    <script type="test/javascript" src='cordova-1.8.1.js'></script>


    </head>

    <body>
    <div id="homepage" data-role="page" data-theme="a">
    <div data-role="header">
    <h1>Work with me here</h1>
    </div>

    <div data-role="content">
    I am page 1.
    <a href="#char-1" data-role="button">Next</a>
    </div>
    </div>

    <div id="char-1" data-role="page" data-theme="a">
    <div data-role="content">HAHAHA!</div>
    </div>


    </body>
    </html>