introduce html_headers.on_load() method as a shortcut for add_post_inline_script('''jQuery(document).ready(...''')
--- a/common/utils.py Tue Nov 11 16:17:50 2008 -0800
+++ b/common/utils.py Wed Nov 12 16:07:40 2008 +0100
@@ -141,6 +141,12 @@
def add_post_inline_script(self, content):
self.post_inlined_scripts.append(content)
+
+ def add_onload(self, jscode):
+ self.add_post_inline_script(u"""jQuery(document).ready(function () {
+ %s
+ });""" % jscode)
+
def add_js(self, jsfile):
"""adds `jsfile` to the list of javascripts used in the webpage