From: David ‘Bombe’ Roden Date: Fri, 15 Oct 2010 15:25:36 +0000 (+0200) Subject: Use JavaScript to improve the UI. X-Git-Tag: 0.1-RC1~326 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=957281659ee81f25c6d92ddc97288283b458efd3 Use JavaScript to improve the UI. --- 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>

- +