1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/twitter/src/main/webapp/pages/index.html Tue Aug 13 21:11:28 2013 +0200
1.3 @@ -0,0 +1,97 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!--
1.6 +
1.7 + The MIT License (MIT)
1.8 +
1.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.10 +
1.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
1.12 + of this software and associated documentation files (the "Software"), to deal
1.13 + in the Software without restriction, including without limitation the rights
1.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1.15 + copies of the Software, and to permit persons to whom the Software is
1.16 + furnished to do so, subject to the following conditions:
1.17 +
1.18 + The above copyright notice and this permission notice shall be included in
1.19 + all copies or substantial portions of the Software.
1.20 +
1.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1.27 + THE SOFTWARE.
1.28 +
1.29 +-->
1.30 +
1.31 +<!--
1.32 + Copied from knockout.js Twitter example:
1.33 + http://knockoutjs.com/examples/twitter.html
1.34 +-->
1.35 +
1.36 +<!DOCTYPE html>
1.37 +<html xmlns="http://www.w3.org/1999/xhtml">
1.38 + <head>
1.39 + <title>Html and Java Twitter</title>
1.40 + </head>
1.41 + <body>
1.42 + <link href='twitterExample.css' rel='Stylesheet' ></link>
1.43 +
1.44 + <style type='text/css'>
1.45 + .liveExample select { height: 1.7em; }
1.46 + .liveExample button { height: 2em; }
1.47 + </style>
1.48 +
1.49 +
1.50 + <h2>Bck2Brwsr's Twitter</h2>
1.51 +
1.52 + <p>
1.53 + This code is based on original <a href="http://knockoutjs.com/examples/twitter.html">knockout.js Twitter example</a> and
1.54 + uses almost unmodified HTML page. It just changes the model. It
1.55 + is written in Java language and it is executed using the HotSpot
1.56 + virtual machine. The Java source code has about 190 lines and is available
1.57 + <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>
1.58 + - in fact it may even be more dense than the original JavaScript model.
1.59 + </p>
1.60 +
1.61 + <div class='liveExample'>
1.62 + <div class='configuration'>
1.63 + <div class='listChooser'>
1.64 + <button data-bind='click: deleteList, enable: activeTweetersName'>Delete</button>
1.65 + <button data-bind='click: saveChanges, enable: hasUnsavedChanges'>Save</button>
1.66 + <select data-bind='options: savedLists, optionsValue: "name", value: activeTweetersName'> </select>
1.67 + </div>
1.68 +
1.69 + <p>Currently viewing <span data-bind='text: activeTweetersCount'> </span> user(s):</p>
1.70 + <div class='currentUsers' >
1.71 + <ul data-bind='foreach: activeTweeters'>
1.72 + <li>
1.73 + <button data-bind='click: $root.removeUser'>Remove</button>
1.74 + <div data-bind='text: $data'> </div>
1.75 + </li>
1.76 + </ul>
1.77 + </div>
1.78 +
1.79 + <form data-bind='submit: addUser'>
1.80 + <label>Add user:</label>
1.81 + <input data-bind='value: userNameToAdd, valueUpdate: "keyup", css: { invalid: !userNameToAddIsValid() }' />
1.82 + <button data-bind='enable: userNameToAddIsValid' type='submit'>Add</button>
1.83 + </form>
1.84 + </div>
1.85 + <div class='tweets'>
1.86 + <div class='loadingIndicator' data-bind="visible: loading">Loading...</div>
1.87 + <table data-bind='foreach: currentTweets' width='100%'>
1.88 + <tr>
1.89 + <td><img data-bind='attr: { src: profile_image_url }' /></td>
1.90 + <td>
1.91 + <a class='twitterUser' data-bind='attr: { href: userUrl }, text: from_user'> </a>
1.92 + <span data-bind='html: html'> </span>
1.93 + <div class='tweetInfo' data-bind='text: created_at'> </div>
1.94 + </td>
1.95 + </tr>
1.96 + </table>
1.97 + </div>
1.98 + </div>
1.99 + </body>
1.100 +</html>