Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 2b3d59c7c229dd995a05a8167d52d2b25787af6b @bdainton committed Aug 23, 2009
Showing with 133 additions and 0 deletions.
  1. +12 −0 app.yaml
  2. +81 −0 index.html
  3. +11 −0 index.yaml
  4. +29 −0 javascripts/counter.js
12 app.yaml
@@ -0,0 +1,12 @@
+application: 140box
+version: 1
+runtime: python
+api_version: 1
+
+handlers:
+- url: /javascripts
+ static_dir: javascripts
+
+- url: /
+ static_files: index.html
+ upload: index.html
81 index.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <title>140box | for drafting a tweet</title>
+ <style type="text/css" media="screen">
+
+ html,body { margin: 0; padding: 0; }
+ body {
+ background-color: #eee;
+ font-family:'Georgia','Serif';
+ font-size: 1.2em;
+ color: #333;
+ }
+ #page { width: 400px; margin: 0 auto; }
+ h1 { text-align: left; margin: 0; padding: 0; opacity: 0.7;}
+ a { color: #2277BB;}
+ #count { color: #2277BB;
+ margin: 0;
+ padding: 0;
+ font-size: 6em;
+ line-height: .8em;
+ float: left;}
+ #count.negative { color: #800;}
+ textarea { width: 100%;
+ font-family:'Georgia','Serif';
+ font-size: 1.2em;;}
+ .tagline { font-size: 0.5em;
+ color: #778899;
+ font-weight: normal;
+ font-style: italic;
+ display: block;}
+ #box { padding: 20px 0px 0px 8px;}
+ #footer { margin-top: 80px; text-align: center; font-size: 0.7em;}
+ #save { float: right; margin: 8px; text-align: center; width: 60px;}
+ #drafts ul { clear: both;
+ margin: 40px 0px 0px 0px;
+ padding: 0;
+ text-align: left;
+ list-style: none;}
+ #drafts li { font-size: 0.8em; padding: 10px; border-bottom: 1px dashed #778899;}
+ #drafts li a { color: #333; text-decoration: none;}
+ #drafts li a:hover { text-decoration: underline;}
+ </style>
+ </head>
+ <body>
+ <div id="page">
+
+ <div id="header">
+ <h1 id='count'>140</h1>
+ <h1 id='box'>
+ box<span class='tagline'>for drafting a tweet<span>
+ </h1>
+ <form action="" method=post>
+ <textarea id="tweetbox" name="tweet" cols=60 rows=6></textarea>
+ <input type='submit' id='save' value='ok'>
+ </form>
+ </div>
+
+ <div id='drafts'>
+ <ul>
+ </ul>
+ </div>
+
+ <div id="footer">
+ <p>
+ a mini-app from<br><a href='http://twitter.com/bdainton'>@bdainton</a>
+ and <a href='http://twitter.com/djohnsonjr'>@djohnsonjr</a>
+ </p>
+ </div>
+ </div>
+ <script src="http://www.google.com/jsapi"></script>
+ <script>
+ // Load jQuery
+ google.load("jquery", "1.3.2");
+ google.load("jqueryui", "1.7.2");
+ </script>
+ <script type="text/javascript" src="javascripts/counter.js"></script>
+ </body>
+</html>
11 index.yaml
@@ -0,0 +1,11 @@
+indexes:
+
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run. If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED"). If you want to manage some indexes
+# manually, move them above the marker line. The index.yaml file is
+# automatically uploaded to the admin console when you next deploy
+# your application using appcfg.py.
29 javascripts/counter.js
@@ -0,0 +1,29 @@
+
+$(document).ready( function() {
+ $('#tweetbox').keyup(function(){ update_character_count($(this)); });
+ update_character_count($('#tweetbox'));
+
+ $('#save').click(function() {
+ count = $('#count').text();
+ tweet = $('#tweetbox').val();
+ $('#drafts ul').prepend("<li><a href='#'>" + tweet + "</a></li>");
+ return false;
+ });
+
+ $('li a').live('click', function() {
+ $('#tweetbox').val($(this).text());
+ update_character_count($('#tweetbox'));
+ return false;
+ });
+});
+
+function update_character_count(clicked) {
+ var length = clicked.val().length;
+ count = 140 - length;
+ if (count < 0) {
+ $('#count').addClass('negative');
+ } else {
+ $('#count').removeClass('negative');
+ }
+ $('#count').html(count);
+}

0 comments on commit 2b3d59c

Please sign in to comment.
Something went wrong with that request. Please try again.