From 957281659ee81f25c6d92ddc97288283b458efd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 15 Oct 2010 17:25:36 +0200 Subject: [PATCH] Use JavaScript to improve the UI. --- src/main/resources/static/css/sone.css | 4 ++++ src/main/resources/static/javascript/sone.js | 18 ++++++++++++++++++ src/main/resources/templates/index.html | 12 +++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/static/javascript/sone.js diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index 35fd2e7..4b9928d 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -19,3 +19,7 @@ #sone .post .text { display: inline; } + +#sone input.createpost.default { + color: #888; +} diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js new file mode 100644 index 0000000..44cff7c --- /dev/null +++ b/src/main/resources/static/javascript/sone.js @@ -0,0 +1,18 @@ +/* Sone JavaScript functions. */ + +function registerInputTextareaSwap(inputSelector, defaultText) { + $(inputSelector).focus(function() { + if ($(this).val() == defaultText) { + $(this).val("").removeClass("default"); + } + }).blur(function() { + if ($(this).val() == "") { + $(this).val(defaultText).addClass("default"); + } + }).addClass("default").val(defaultText); + $($(inputSelector).get(0).form).submit(function() { + if ($(inputSelector).hasClass("default")) { + $(inputSelector).val(""); + } + }); +} diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index f72ceb0..9046406 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -1,12 +1,22 @@
+ + + + +

<%= Page.Index.Page.Title|l10n|insert needle="{sone}" key=currentSone.name|html>

- +
-- 2.7.4