# HG changeset patch # User Adrien Di Mascio # Date 1226502460 -3600 # Node ID 9b7067bfaa153285cb664941581f9a9722b9c198 # Parent ef1c80154d6f1c59eb3912404c22a9c5d6397009 introduce html_headers.on_load() method as a shortcut for add_post_inline_script('''jQuery(document).ready(...''') diff -r ef1c80154d6f -r 9b7067bfaa15 common/utils.py --- 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