Minor change to JS code: runs as soon as available, not onload anymore
authorDan
Sun, 21 Dec 2008 23:19:03 -0500
changeset 1 c9c49ce179e9
parent 0 4d19ad17b07c
child 2 8d081d3128a2
Minor change to JS code: runs as soon as available, not onload anymore
Floodlight.php
--- a/Floodlight.php	Sun Dec 21 23:10:15 2008 -0500
+++ b/Floodlight.php	Sun Dec 21 23:19:03 2008 -0500
@@ -98,34 +98,31 @@
   $aggressive_optimize_html = false;
   
   echo <<<EOF
-addOnloadHook(function()
-{
-  var autofill_schemas = window.autofill_schemas || {};
-  autofill_schemas.floodlight = {
-    init: function(element, fillclass, params)
-    {
-      params = params || {};
-      $(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=' + fillclass) + '&userinput=', {
-          minChars: 3,
-          formatItem: function(row, _, __)
-          {
-            var type = ( typeof(row.type) == 'string' ) ? row.type : '';
-            var html = '<big>' + row.title + '</big> <small>' + type + '</small>';
-            html += '<br /><small>' + \$lang.get('floodlight_lbl_score') + row.score + '% | ' + row.size + '</small>';
-            return html;
-          },
-          tableHeader: '<tr><th>' + \$lang.get('floodlight_table_heading') + '</th></tr>',
-          showWhenNoResults: true,
-          onItemSelect: function(li)
-          {
-            window.location = makeUrl(li.selectValue.replace(/^go:/, ''));
-          },
-          width: 300,
-          noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + \$lang.get('floodlight_msg_no_results') + '</td></tr>',
-      });
-    }
-  };
-});
+var autofill_schemas = window.autofill_schemas || {};
+autofill_schemas.floodlight = {
+  init: function(element, fillclass, params)
+  {
+    params = params || {};
+    $(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=' + fillclass) + '&userinput=', {
+        minChars: 3,
+        formatItem: function(row, _, __)
+        {
+          var type = ( typeof(row.type) == 'string' ) ? row.type : '';
+          var html = '<big>' + row.title + '</big> <small>' + type + '</small>';
+          html += '<br /><small>' + \$lang.get('floodlight_lbl_score') + row.score + '% | ' + row.size + '</small>';
+          return html;
+        },
+        tableHeader: '<tr><th>' + \$lang.get('floodlight_table_heading') + '</th></tr>',
+        showWhenNoResults: true,
+        onItemSelect: function(li)
+        {
+          window.location = makeUrl(li.selectValue.replace(/^go:/, ''));
+        },
+        width: 300,
+        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + \$lang.get('floodlight_msg_no_results') + '</td></tr>',
+    });
+  }
+};
 EOF;
 }