]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/htmloutputter.php
Merge branch '0.9.x' into pluginize-twitter-bridge
[quix0rs-gnu-social.git] / lib / htmloutputter.php
index 1da8406f332b289fd3df736402afd97ccf34fcf9..aa01f6b1d9d268e5855864efe428027cf4aa5916 100644 (file)
@@ -28,7 +28,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -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');
+    }
 }