add onload.js to 2.3 branch, for mac addresses, RT#27190, RT#26013
authorIvan Kohler <ivan@freeside.biz>
Thu, 23 Jan 2014 22:41:20 +0000 (14:41 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 23 Jan 2014 22:41:20 +0000 (14:41 -0800)
httemplate/elements/onload.js [new file with mode: 0644]

diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js
new file mode 100644 (file)
index 0000000..c7bbbb2
--- /dev/null
@@ -0,0 +1,23 @@
+<%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 myonload = function() {
+<% $m->content %>
+  }
+  if ( window.addEventListener ) {
+    window.addEventListener('load', myonload);
+  } else if ( window.attachEvent ) {
+    window.attachEvent('onload', myonload);
+  }
+})();