minesweeper/src/main/webapp/pages/index.html
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 06 Nov 2014 21:58:57 +0100
changeset 228 fc2f72be9392
parent 223 4ee062b3f5ed
permissions -rw-r--r--
According to Hrebejk defining viewport prevents scaling and speeds up reaction to touches
     1 <!--
     2 
     3     The MIT License (MIT)
     4 
     5     Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6 
     7     Permission is hereby granted, free of charge, to any person obtaining a copy
     8     of this software and associated documentation files (the "Software"), to deal
     9     in the Software without restriction, including without limitation the rights
    10     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    11     copies of the Software, and to permit persons to whom the Software is
    12     furnished to do so, subject to the following conditions:
    13 
    14     The above copyright notice and this permission notice shall be included in
    15     all copies or substantial portions of the Software.
    16 
    17     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    18     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    19     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    20     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    21     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    22     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    23     THE SOFTWARE.
    24 
    25 -->
    26 <!DOCTYPE html>
    27 <html>
    28     <head>
    29         <title>Fair Minesweeper</title>
    30         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    31         <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/>
    32         <link href="bootstrap.css" rel="stylesheet">
    33         <link href="bootstrap-responsive.css" rel="stylesheet">
    34         <link href="mines.css" rel="stylesheet">
    35         <!-- Target tablets -->
    36         <link href="mines-tablet-large.css" 
    37               media="(min-width:640px), (min-height:660px)" 
    38               rel="stylesheet" />
    39         <link href="mines-tablet-small.css" 
    40               media="(min-width:510px) and (max-width:640px), (min-height:520px) and (max-height:660px)" 
    41               rel="stylesheet" />
    42         <!-- Target phones -->
    43         <link href="mines-phone-large.css" 
    44               media="(min-width:410px) and (max-width:510px), (min-height:400px) and (max-height:520px)" 
    45               rel="stylesheet" />
    46         <link href="mines-phone-small.css" 
    47               media="(min-width:300px) and (max-width:410px), (min-height:300px) and (max-height:400px)" 
    48               rel="stylesheet" />
    49         <link href="mines-phone-smaller.css" 
    50               media="(max-width:300px), (max-height:300px)" 
    51               rel="stylesheet" />
    52     </head>
    53     <body>
    54         <div class="navbar">
    55             <div class="navbar-inner">
    56                 <a id="apptitle" class="brand" href="#" data-bind="click: showHelp">
    57                     <img height="20" width="20" src="DukeSweeper.png">
    58                     <span class="hidden-phone">Minesweeper</span>
    59                 </a>
    60                 <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: false, click: normalGame">
    61                     <span>&#x21bb;</span>
    62                     <span class="info-text">New!</span>
    63                 </button>
    64                 <button class="hidden-phone btn btn-default navbar-btn" disabled="true" data-bind="disable: !gameInProgress(), click: giveUp ">
    65                     <span>&#x2717;</span>
    66                     <span>Show Mines!</span>
    67                 </button>
    68                 <button class="btn btn-default navbar-btn" disabled="true" data-bind="disable: !gameInProgress(), click: markMine">
    69                     <span>&#x26A0;</span>
    70                     <span class="info-text">Mark Mine!</span>
    71                 </button>
    72             </div>
    73         </div>
    74 
    75 
    76         <script type="text/html" id="field">
    77           <center>
    78               <table class="field" data-bind="css: gameStyle">
    79                 <tbody>
    80                     <!-- ko foreach: rows -->
    81                     <tr>
    82                         <!-- ko foreach: columns -->
    83                         <td data-bind="css: style, click: $parents[1].click" >
    84                             <div></div>
    85                         </td>
    86                         <!-- /ko -->
    87                     </tr>
    88                     <!-- /ko -->
    89                 </tbody>
    90             </table>
    91           </center>
    92         </script>
    93 
    94         <div data-bind="template: { name : 'field', if: fieldShowing }"></div>
    95         
    96         <div class="jumbotron control-label" data-bind="visible: !fieldShowing() ">
    97             <div class="container">
    98                 <h1>HTML/Java Technology Demo</h1>
    99 
   100                 <p>At first sight this is an old good <em>minesweeper</em>
   101                     game. At closer look, this is a demo of a revolutionary 
   102                     technology that allows you to use <strong>Java</strong>
   103                     to code your application logic and present it using
   104                     <strong>HTML</strong> on any device capable of rendering
   105                     modern <strong>HTML5</strong> browser.
   106                 </p>
   107                 <p><a class="btn btn-primary btn-lg" role="button" 
   108                       target="_blank" href="http://html.java.net"
   109                 >Visit Project Page!</a>
   110                 </p>
   111             </div>
   112         </div>
   113 
   114     <div class="container" data-bind="visible: !fieldShowing()">
   115       <div>
   116         <div class="col-md-4">
   117           <h2>Minesweeper</h2>
   118           <p>
   119               Discover ten square fields that contain a mine and
   120               mark them with a &#x26a0; sign.
   121               Touch a square to find out if there is
   122               a mine or not and
   123               how many mines are in the eight surrounding 
   124               ones. Avoid random play, the game 
   125               recognizes guessing and can re-arrange
   126               the mines. This game is <b>fair</b>!
   127           </p>
   128           <p><a class="btn btn-default" href="#" data-bind="click: normalGame"role="button">Play &raquo;</a></p>
   129         </div>
   130         <div class="col-md-4">
   131           <h2>Documentation</h2>
   132           <p>
   133               In case you want to write application like 
   134               this (e.g. use <strong>Java</strong> and <strong>HTML</strong>)
   135               you can learn more about the libraries that
   136               make that possible. Follow this link to
   137               our documentation.
   138           </p>
   139           <p><a class="btn btn-default"
   140                 target="_blank" href="http://bits.netbeans.org/html+java/"
   141                 role="button">Read more &raquo;</a></p>
   142        </div>
   143         <div class="col-md-4">
   144           <h2>Run in a Browser</h2>
   145           <p>
   146               While primarily this technology runs on a desktop
   147               or as a table or phone application, it is possible
   148               to execute the same unchanged code in a browser 
   149               as well. To do so, one needs a 
   150               <a href="http://bck2brwsr.apidesign.org">bck2brwsr</a>
   151               virtual machine.
   152           </p>
   153           <p><a class="btn btn-default"
   154                 target="_blank" href="http://xelfi.cz/minesweeper/bck2brwsr/"
   155                 role="button">Try it &raquo;</a></p>
   156        </div>
   157       </div>
   158     </div>
   159 <div class="container" data-bind="visible: !fieldShowing()">
   160   <div class="col-sm-6 col-md-4">
   161     <div class="thumbnail">
   162         <img src="android_logo.jpg" width="120" height="120" alt="Android">
   163       <div class="caption">
   164         <h3>DlvkBrwsr</h3>
   165         <p>
   166             This application has been packaged to run on your Android phone
   167             and is available on Google Play! In this mode it
   168             uses Dalvik virtual machine to execute Java code natively.
   169             It uses Android's WebView to display the UI and execute
   170             generated JavaScript. Both these components are
   171             bound together via <a href="http://wiki.apidesign.org/wiki/DlvkBrwsr">
   172             DlvkBrwsr</a>.
   173         </p>
   174         <p>
   175             <a href="https://play.google.com/store/apps/details?id=org.apidesign.demo.minesweeper"
   176                target="_blank"
   177                class="btn btn-primary" role="button"
   178                >Install &raquo;</a> 
   179         </p>
   180       </div>
   181     </div>
   182   </div>
   183   <div class="col-sm-6 col-md-4">
   184     <div class="thumbnail">
   185         <img src="ios_logo.jpg" width="120" height="120" alt="Android">
   186       <div class="caption">
   187         <h3>iBrwsr</h3>
   188         <p>
   189             This application has been packaged to run on your iPhone
   190             or iPad and made available on AppStore.
   191             In this mode it
   192             uses <a target="_blank" href="http://www.robovm.org">RoboVM</a> 
   193             virtual machine to execute Java code natively.
   194             It uses iOS WebView to display the UI and execute
   195             generated JavaScript. Both these components are
   196             bound together via <a target="_blank" 
   197             href="http://wiki.apidesign.org/wiki/IBrwsr">
   198             iBrwsr</a> library.
   199         </p>
   200         <p>
   201             <a href="https://itunes.apple.com/us/app/fair-minesweeper/id903688146"
   202                target="_blank"
   203                class="btn btn-primary" role="button"
   204                >Install &raquo;</a> 
   205         </p>
   206       </div>
   207     </div>
   208   </div>
   209   <div class="col-sm-6 col-md-4">
   210     <div class="thumbnail">
   211         <img src="netbeans_logo.jpg" width="120" height="120" alt="Android">
   212       <div class="caption">
   213         <h3>Develop Own App!</h3>
   214         <p>
   215             One can package this application as a 
   216             <a href="http://plugins.netbeans.org/plugin/53864/"
   217                target="_blank"
   218             >plugin for NetBeans</a> or
   219             use <a href="http://www.netbeans.org" target="_blank">
   220             NetBeans</a> IDE to create
   221             application like this yourself. Enjoy the
   222             power of <em>HTML</em> and <em>Java</em>.
   223             Write your applications once and deploy and display 
   224             them on any device!
   225         </p>
   226         <p>
   227             <a href="http://wiki.apidesign.org/wiki/DukeScriptInNetBeans"
   228                target="_blank"
   229                class="btn btn-primary" role="button"
   230                >Develop &raquo;</a> 
   231         </p>
   232       </div>
   233     </div>
   234   </div>
   235 </div>
   236         <!-- boot bck2brwsr -->
   237         <script type="text/javascript" src="bck2brwsr.js"></script>
   238         <script>
   239             if (!this.hasOwnProperty("main")) {
   240                 this.main = function() {
   241                     var vm = bck2brwsr('minesweeper.js');
   242                     var c = vm.loadClass('org.apidesign.demo.minesweeper.MinesModel');
   243                     c.invoke('main');
   244                 }
   245             }
   246             this.main();
   247         </script>
   248 
   249     </body>
   250 </html>