]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/htmloutputter.php
Allow some punctuation instead of just spaces before @user, !group, and #tag
[quix0rs-gnu-social.git] / lib / htmloutputter.php
index 8ad7dc20fa3645e4e731387b96b8014614ba8643..aa01f6b1d9d268e5855864efe428027cf4aa5916 100644 (file)
@@ -412,4 +412,29 @@ class HTMLOutputter extends XMLOutputter
             $this->element('p', 'form_guide', $instructions);
         }
     }
+
+
+    /**
+    * Internal script to autofocus the given element on page onload.
+    *
+    * @param string $id element ID, must refer to an existing element
+    *
+    * @return void
+    *
+    */
+    function autofocus($id)
+    {
+        $this->elementStart('script', array('type' => 'text/javascript'));
+        $this->raw('
+        <!--
+        $(document).ready(function() {
+            var el = $("#' . $id . '");
+            if (el.length) {
+                el.focus();
+            }
+        });
+        -->
+        ');
+        $this->elementEnd('script');
+    }
 }