summaryrefslogtreecommitdiff
path: root/httemplate/elements/onload.js
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/elements/onload.js')
-rw-r--r--httemplate/elements/onload.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js
new file mode 100644
index 000000000..bfa7eef94
--- /dev/null
+++ b/httemplate/elements/onload.js
@@ -0,0 +1,22 @@
+<%doc>
+Filter component to attach a window.onload handler.
+
+Usage:
+ <script>
+ <&| elements/onload.js &>
+ if ( the_stars_are_right ) {
+ run_this_function();
+ }
+ </&>
+ </script>
+
+</%doc>
+(function() {
+ var tmp = window.onload;
+ window.onload = function() {
+ if (typeof(tmp)== 'function') {
+ tmp();
+ }
+<% $m->content %>
+ };
+})();