future package change: adjust behavior of date field, #20687
[freeside.git] / httemplate / elements / onload.js
diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js
new file mode 100644 (file)
index 0000000..bfa7eef
--- /dev/null
@@ -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 %>
+  };
+})();