Add name of input field to JavaScript function.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 21 Oct 2010 08:44:49 +0000 (10:44 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 21 Oct 2010 08:44:49 +0000 (10:44 +0200)
src/main/resources/static/javascript/sone.js
src/main/resources/templates/include/head.html
src/main/resources/templates/index.html
src/main/resources/templates/knownSones.html

index 66f12af..ab16ba3 100644 (file)
@@ -1,8 +1,8 @@
 /* Sone JavaScript functions. */
 
-function registerInputTextareaSwap(inputSelector, defaultText) {
+function registerInputTextareaSwap(inputSelector, defaultText, inputFieldName) {
        $(inputSelector).each(function() {
-               textarea = $("<textarea name=\"text\"></textarea>").blur(function() {
+               textarea = $("<textarea name=\"" + inputFieldName + "\"></textarea>").blur(function() {
                        if ($(this).val() == "") {
                                $(this).hide();
                                $(this).data("inputField").show().removeAttr("disabled");
index 0f400a9..6cd2cbc 100644 (file)
@@ -5,7 +5,7 @@
 
        <script language="javascript">
                $(document).ready(function() {
-                       registerInputTextareaSwap("#sone #update-status .status-input", "What are you doing?");
+                       registerInputTextareaSwap("#sone #update-status .status-input", "What are you doing?", "text");
                });
        </script>
 
index 122a487..5dcda5a 100644 (file)
@@ -3,7 +3,7 @@
        <script language="javascript">
                /* register input field/textarea swap. */
                $(document).ready(function() {
-                       registerInputTextareaSwap("#sone input.reply-input", "Write a Reply…");
+                       registerInputTextareaSwap("#sone input.reply-input", "Write a Reply…", "text");
                        addCommentLinks();
                });
        </script>
index eeda403..3f55a58 100644 (file)
@@ -2,7 +2,7 @@
 
        <script language="javascript">
                $(document).ready(function() {
-                       registerInputTextareaSwap("#add-sone input[name=request-uri]", "Sone Request Key");
+                       registerInputTextareaSwap("#add-sone input[name=request-uri]", "Sone Request Key", "request-uri");
                })
        </script>