From: David ‘Bombe’ Roden Date: Wed, 20 Oct 2010 20:26:07 +0000 (+0200) Subject: Show multiline-capable input boxes on focus, single-line inputs on blur. X-Git-Tag: 0.1-RC1~140 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=3d9651b5ce6a935bd027c42e8c530f8d87921797;p=Sone.git Show multiline-capable input boxes on focus, single-line inputs on blur. --- diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index bd57f26..90c2183 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -1,9 +1,12 @@ /* Sone Main CSS File */ /* first, override some fproxy rules. */ -#sone .post .reply div,#sone .post .time,#sone .post .delete,#sone .post .show-reply-form - { - font-size: inherit; +#sone .post .reply div,#sone .post .time,#sone .post .delete,#sone .post .show-reply-form, input[type=text], textarea { + font: inherit; +} + +input[type=text], textarea { + font-size: 90%; } #sone form { @@ -64,10 +67,29 @@ } #sone #home-sone { + margin-top: 1ex; margin-left: 80px; padding-left: 1ex; } +#sone #update-status label { + display: none; +} + +#sone #update-status input[type=text] { + width: 45em; +} + +#sone #update-status textarea { + border: solid 1px #ccc; + width: 45em; + height: 4em; +} + +#sone #update-status button { + float: right; +} + #sone .nice-name { font-weight: bold; } @@ -185,8 +207,17 @@ padding: 0.5ex; } -#sone .post .create-reply.light button { - display: none; +#sone .post .create-reply input[type=text] { + width: 50em; +} + +#sone .post .create-reply textarea { + width: 50em; + height: 4em; +} + +#sone .post .create-reply button { + float: right; } #sone .sone { diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 502413a..66f12af 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -2,21 +2,25 @@ function registerInputTextareaSwap(inputSelector, defaultText) { $(inputSelector).each(function() { - $(this).focus(function() { - if ($(this).hasClass("default")) { - $(this).removeClass("default").val(""); - } - }).blur(function() { + textarea = $("").blur(function() { if ($(this).val() == "") { - $(this).val(defaultText).addClass("default"); - } - }).addClass("default").val(defaultText); - var inputField = $(this); - $(this.form).submit(function() { - if (inputField.hasClass("default")) { - inputField.val(""); + $(this).hide(); + $(this).data("inputField").show().removeAttr("disabled"); } - }); + }).hide().data("inputField", $(this)); + $(this).after(textarea); + (function(inputField, textarea) { + $(inputField).focus(function() { + $(this).hide().attr("disabled", "disabled"); + textarea.show().focus(); + }).addClass("default").val(defaultText); + $(inputField.form).submit(function() { + if (textarea.val() == "") { + return false; + } + $(inputField).val(textarea.val()); + }); + })(this, textarea); }); } diff --git a/src/main/resources/templates/include/updateStatus.html b/src/main/resources/templates/include/updateStatus.html index 63b4b8f..fba951d 100644 --- a/src/main/resources/templates/include/updateStatus.html +++ b/src/main/resources/templates/include/updateStatus.html @@ -1,9 +1,7 @@ -
-
- - - - - -
-
+
+ + + + + +