summaryrefslogtreecommitdiff
path: root/lib/htmloutputter.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2009-09-04 07:19:01 -0700
committerBrion Vibber <brion@pobox.com>2009-09-04 07:19:01 -0700
commitd635a0685df324d75e66d1f28dae4223c77a0875 (patch)
treeb19672b922b74760700a3882642cafae4190afdd /lib/htmloutputter.php
parentbeae3db41375879e725af053edf8041bbd76ac8c (diff)
parent5974871b7b00bd8e3f28dc5f5a9465a9eec0d3d3 (diff)
Merge branch '0.8.x' of git://gitorious.org/laconica/mainline into 0.9.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');
+ }
}