javaquery/demo-twitter/src/main/resources/org/apidesign/bck2brwsr/demo/twitter/index.html
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Mon, 08 Apr 2013 09:24:59 +0200
branchmodel
changeset 948 35f4f8af296c
parent 931 9a7df12648b9
child 949 3bd43aa6f08d
permissions -rw-r--r--
Able to display tweets (if --disable-web-security used). Needed to patch knockout to survive/ignore properties with dollar sign in them.
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3 
     4     Back 2 Browser Bytecode Translator
     5     Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6 
     7     This program is free software: you can redistribute it and/or modify
     8     it under the terms of the GNU General Public License as published by
     9     the Free Software Foundation, version 2 of the License.
    10 
    11     This program is distributed in the hope that it will be useful,
    12     but WITHOUT ANY WARRANTY; without even the implied warranty of
    13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14     GNU General Public License for more details.
    15 
    16     You should have received a copy of the GNU General Public License
    17     along with this program. Look for COPYING file in the top folder.
    18     If not, see http://opensource.org/licenses/GPL-2.0.
    19 
    20 -->
    21 
    22 <!--
    23     Copied from knockout.js Twitter example:
    24     http://knockoutjs.com/examples/twitter.html
    25 -->
    26 
    27 <!DOCTYPE html>
    28 <html xmlns="http://www.w3.org/1999/xhtml">
    29     <head>
    30         <title>Bck2Brwsr's Twitter</title>
    31     </head>
    32     <body>
    33         <link href='twitterExample.css' rel='Stylesheet' ></link>
    34         
    35         <script src='twitterApi.js' type='text/javascript'> </script>
    36         
    37         <style type='text/css'>
    38            .liveExample select { height: 1.7em; }
    39            .liveExample button { height: 2em; }
    40         </style>
    41         
    42         
    43         <h2>Bck2Brwsr's Twitter</h2>
    44         
    45         <p>
    46         This code based on original <a href="http://knockoutjs.com/examples/twitter.html">knockout.js Twitter example</a> and
    47         uses almost unmodified HTML code. It just changes the model. It 
    48         is written in Java language and it is executed using <a href="http://bck2brwsr.apidesign.org">Bck2Brwsr</a>
    49         virtual machine.
    50         </p>
    51         
    52         <div class='liveExample'>
    53             <div class='configuration'>
    54                 <div class='listChooser'>
    55                     <button data-bind='click: $root.refreshTweets'>Refresh</button>
    56                     <button data-bind='click: deleteList, enable: activeTweeters.name'>Delete</button>
    57                     <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button> 
    58                     <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
    59                 </div>
    60 
    61                 <p>Currently viewing <span data-bind='text: activeTweeters().userNames().length'> </span> user(s):</p>
    62                 <div class='currentUsers' data-bind='with: activeTweeters'>
    63                     <ul data-bind='foreach: userNames'>
    64                         <li>
    65                             <button data-bind='click: $root.removeUser'>Remove</button>
    66                             <div data-bind='text: $data'> </div>
    67                         </li>
    68                     </ul>
    69                 </div>
    70 
    71                 <form data-bind='submit: addUser'>
    72                     <label>Add user:</label>
    73                     <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
    74                     <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
    75                 </form>
    76             </div>
    77             <div class='tweets'>
    78                 <div class='loadingIndicator'>Loading...</div>
    79                 <table data-bind='foreach: currentTweets' width='100%'>
    80                     <tr>
    81                         <td><img data-bind='attr: { src: profile_image_url }' /></td>
    82                         <td>
    83                             <a href='http://twitter.com/${ from_user }' class='twitterUser' data-bind='attr: { href: "http://twitter.com/" + from_user }, text: from_user'> </a>
    84                             <span data-bind='text: text'> </span>
    85                             <div class='tweetInfo' data-bind='text: created_at'> </div>
    86                         </td>
    87                     </tr>
    88                 </table>
    89             </div>
    90         </div>
    91         
    92         <script src="bck2brwsr.js"></script>
    93         <script type="text/javascript">
    94             var vm = bck2brwsr('demo-twitter-0.6-SNAPSHOT.jar');
    95             vm.loadClass('org.apidesign.bck2brwsr.demo.twitter.TwitterClient');
    96         </script>
    97 
    98 
    99     </body>
   100 </html>