~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: dcoles
  • Date: 2008-07-10 07:29:14 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:848
Dispatch: Added scripts_init feature which uses window.addEventListener(...) to 
allow more than one javascript startup script to be run when a page loads. This  
is the better way to go than using the less flexible window.onload() method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    for script in req.scripts:
78
78
        req.write('  <script type="text/javascript" src="%s"></script>\n'
79
79
            % cgi.escape(util.make_path(script)))
 
80
    req.write('  <script type="text/javascript">\n    /* Init Functions */\n')
 
81
    for init in req.scripts_init:
 
82
        req.write('    window.addEventListener("load", %s, false);\n'%init)
 
83
    req.write('  </script>\n')
80
84
 
81
85
    req.write("</head>\n\n")
82
86