twitter/src/main/resources/org/apidesign/html/demo/twitter/index.html
author Jaroslav Tulach <jtulach@netbeans.org>
Thu, 20 Jun 2013 13:18:10 +0200
branchclassloader
changeset 36 7ff8ac49cd8c
parent 20 c71dff3a524c
child 37 4a36b310c6da
permissions -rw-r--r--
Rewriting to be Grizzly independent and also ajusting to Twitter's removal of 1.0 APIs
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3 
     4     The MIT License (MIT)
     5 
     6     Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     7 
     8     Permission is hereby granted, free of charge, to any person obtaining a copy
     9     of this software and associated documentation files (the "Software"), to deal
    10     in the Software without restriction, including without limitation the rights
    11     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    12     copies of the Software, and to permit persons to whom the Software is
    13     furnished to do so, subject to the following conditions:
    14 
    15     The above copyright notice and this permission notice shall be included in
    16     all copies or substantial portions of the Software.
    17 
    18     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    19     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    20     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    21     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    22     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    23     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    24     THE SOFTWARE.
    25 
    26 -->
    27 
    28 <!--
    29     Copied from knockout.js Twitter example:
    30     http://knockoutjs.com/examples/twitter.html
    31 -->
    32 
    33 <!DOCTYPE html>
    34 <html xmlns="http://www.w3.org/1999/xhtml">
    35     <head>
    36         <title>Bck2Brwsr's Twitter</title>
    37     </head>
    38     <body>
    39         <link href='twitterExample.css' rel='Stylesheet' ></link>
    40         
    41         <style type='text/css'>
    42            .liveExample select { height: 1.7em; }
    43            .liveExample button { height: 2em; }
    44         </style>
    45         
    46         
    47         <h2>Bck2Brwsr's Twitter</h2>
    48         
    49         <p>
    50         This code is based on original <a href="http://knockoutjs.com/examples/twitter.html">knockout.js Twitter example</a> and
    51         uses almost unmodified HTML page. It just changes the model. It 
    52         is written in Java language and it is executed using <a href="http://bck2brwsr.apidesign.org">Bck2Brwsr</a>
    53         virtual machine. The Java source code has about 190 lines and is available 
    54         <a href="http://source.apidesign.org/hg/bck2brwsr/file/7fc6b7e9c982/javaquery/demo-twitter/src/main/java/org/apidesign/bck2brwsr/demo/twitter/TwitterClient.java">here</a>
    55         - in fact it may even be more dense than the original JavaScript model.
    56         </p>
    57         
    58         <div class='liveExample'>
    59             <div class='configuration'>
    60                 <div class='listChooser'>
    61                     <button data-bind='click: deleteList, enable: activeTweetersName'>Delete</button>
    62                     <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button> 
    63                     <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
    64                 </div>
    65 
    66                 <p>Currently viewing <span data-bind='text: activeTweetersCount'> </span> user(s):</p>
    67                 <div class='currentUsers' >
    68                     <ul data-bind='foreach: activeTweeters'>
    69                         <li>
    70                             <button data-bind='click: $root.removeUser'>Remove</button>
    71                             <div data-bind='text: $data'> </div>
    72                         </li>
    73                     </ul>
    74                 </div>
    75 
    76                 <form data-bind='submit: addUser'>
    77                     <label>Add user:</label>
    78                     <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
    79                     <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
    80                 </form>
    81             </div>
    82             <div class='tweets'>
    83                 <div class='loadingIndicator' data-bind="visible: loading">Loading...</div>
    84                 <table data-bind='foreach: currentTweets' width='100%'>
    85                     <tr>
    86                         <td><img data-bind='attr: { src: imageUrl }' /></td>
    87                         <td>
    88                             <a class='twitterUser' data-bind='attr: { href: userUrl }, text: from_user'> </a>
    89                             <span data-bind='html: html'> </span>
    90                             <div class='tweetInfo' data-bind='text: created_at'> </div>
    91                         </td>
    92                     </tr>
    93                 </table>
    94             </div>
    95         </div>
    96     </body>
    97 </html>