summaryrefslogtreecommitdiff
path: root/lib/htmloutputter.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2009-10-12 21:01:34 +0000
committerBrion Vibber <brion@pobox.com>2009-10-12 21:01:34 +0000
commit18df82ba2302d5b72bc42f4d3296d6fff7d16341 (patch)
treece2f955ff860b8d7355d64391d68a0f955067ec9 /lib/htmloutputter.php
parent131292472c4bca7e99ee821ae62853f36f4c7bef (diff)
parent2b6dfbdf2b9df0992018f8df1f54b4cf16185599 (diff)
Merge branch '0.8.x' of git://gitorious.org/~brion/statusnet/brion-fixes into 0.8.x
Diffstat (limited to 'lib/htmloutputter.php')
-rw-r--r--lib/htmloutputter.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index 8ad7dc20f..aa01f6b1d 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -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');
+ }
}