Floodlight.php
author Dan
Fri, 29 May 2009 14:35:29 -0400
changeset 2 8d081d3128a2
parent 1 c9c49ce179e9
child 3 45a2d33c0d1b
permissions -rw-r--r--
Some improvements for 1.1.6 compatibility
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     1
<?php
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     2
/**!info**
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     3
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     4
  "Plugin Name"  : "Floodlight",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     5
  "Plugin URI"   : "http://enanocms.org/plugin/floodlight",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     6
  "Description"  : "A much broader search than Spotlight. Adds auto-completion to the Search sidebar block.",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     7
  "Author"       : "Dan Fuhry",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     8
  "Version"      : "1.1.5",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
     9
  "Author URI"   : "http://enanocms.org/"
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    10
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    11
**!*/
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    12
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    13
$plugins->attachHook('sidebar_fetch_return', 'floodlight_inject_searchflags($return);');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    14
$plugins->attachHook('autofill_json_request', 'floodlight_perform_search($dataset);');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    15
$plugins->attachHook('session_started', 'floodlight_add_js_page();');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    16
$plugins->attachHook('common_post', 'floodlight_intercept_search();');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    17
$plugins->attachHook('compile_template', 'floodlight_add_js();');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    18
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    19
function floodlight_inject_searchflags(&$return)
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    20
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    21
  if ( strstr($return[0], '<input name="q"') )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    22
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    23
    $hackme =& $return[0];
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    24
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    25
  else if ( strstr($return[1], '<input name="q"') )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    26
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    27
    $hackme =& $return[1];
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    28
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    29
  else
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    30
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    31
    return;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    32
  }
2
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
    33
  $hackme = str_replace('<input name="q"', '<input name="q" autocomplete="off" onkeyup="this.setAttribute(\'autocomplete\', \'off\'); this.onkeyup = null; this.className = \'autofill floodlight\'; autofill_init_element(this, {});"', $hackme);
0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    34
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    35
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    36
function floodlight_perform_search(&$dataset)
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    37
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    38
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    39
  if ( $_GET['type'] == 'floodlight' )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    40
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    41
    $results = perform_search($_GET['userinput'], $warnings, false, $word_list);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    42
    if ( count($results) > 5 )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    43
    {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    44
      $results = array_slice($results, 0, 5);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    45
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    46
    foreach ( $results as $result )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    47
    {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    48
      $dataset[] = array(
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    49
          0 => "go:{$paths->nslist[$result['namespace']]}{$result['page_id']}",
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    50
          'title' => str_replace(array('<highlight>', '</highlight>'), array('<b>', '</b>'), $result['page_name']),
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    51
          'score' => $result['score'],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    52
          'type' => $result['page_note'],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    53
          'size' => $result['page_length'],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    54
        );
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    55
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    56
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    57
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    58
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    59
function floodlight_add_js_page()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    60
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    61
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    62
  $paths->add_page(array(
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    63
      'name' => 'Floodlight Javascript',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    64
      'urlname' => 'FloodlightJS',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    65
      'namespace' => 'Special',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    66
      'visible' => 0,
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    67
      'protected' => 0,
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    68
      'comments_on' => 0,
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    69
      'special' => 0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    70
    ));
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    71
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    72
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    73
function floodlight_intercept_search()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    74
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    75
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    76
  if ( $paths->page_id == 'Search' && $paths->namespace == 'Special' )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    77
  {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    78
    if ( isset($_GET['q']) && preg_match('/^go:/', $_GET['q']) )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    79
    {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    80
      redirect(makeUrl(preg_replace('/^go:/', '', $_GET['q'])), '', '', 0);
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    81
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    82
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    83
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    84
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    85
function floodlight_add_js()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    86
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    87
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    88
  $template->add_header('<script type="text/javascript" src="' . makeUrlNS('Special', 'FloodlightJS', false, true) . '"></script>');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    89
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    90
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    91
function page_Special_FloodlightJS()
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    92
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    93
  global $db, $session, $paths, $template, $plugins; // Common objects
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    94
  header('Content-type: text/javascript');
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    95
  header('ETag: ' . sha1(__FILE__));
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    96
  
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    97
  global $aggressive_optimize_html;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    98
  $aggressive_optimize_html = false;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
    99
  
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   100
  echo <<<EOF
1
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   101
var autofill_schemas = window.autofill_schemas || {};
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   102
autofill_schemas.floodlight = {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   103
  init: function(element, fillclass, params)
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   104
  {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   105
    params = params || {};
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   106
    $(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=' + fillclass) + '&userinput=', {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   107
        minChars: 3,
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   108
        formatItem: function(row, _, __)
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   109
        {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   110
          var type = ( typeof(row.type) == 'string' ) ? row.type : '';
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   111
          var html = '<big>' + row.title + '</big> <small>' + type + '</small>';
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   112
          html += '<br /><small>' + \$lang.get('floodlight_lbl_score') + row.score + '% | ' + row.size + '</small>';
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   113
          return html;
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   114
        },
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   115
        tableHeader: '<tr><th>' + \$lang.get('floodlight_table_heading') + '</th></tr>',
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   116
        showWhenNoResults: true,
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   117
        onItemSelect: function(li)
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   118
        {
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   119
          window.location = makeUrl(li.selectValue.replace(/^go:/, ''));
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   120
        },
2
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   121
        width: 180,
1
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   122
        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + \$lang.get('floodlight_msg_no_results') + '</td></tr>',
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   123
    });
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   124
  }
c9c49ce179e9 Minor change to JS code: runs as soon as available, not onload anymore
Dan
parents: 0
diff changeset
   125
};
2
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   126
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   127
function AutofillFloodlight(el, p)
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   128
{
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   129
  p = p || {};
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   130
  var cn_append = ( el.className ) ? ' ' + el.className : '';
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   131
  el.className = 'autofill floodlight' + cn_append;
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   132
  el.onkeyup = null;
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   133
  autofill_init_element(el, p);
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   134
}
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   135
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   136
addOnloadHook(function()
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   137
  {
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   138
    if ( document.forms[0] && document.forms[0].q )
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   139
    {
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   140
      document.forms[0].q.onkeyup = function() {
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   141
        new AutofillFloodlight(this);
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   142
      };
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   143
    }
8d081d3128a2 Some improvements for 1.1.6 compatibility
Dan
parents: 1
diff changeset
   144
  });
0
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   145
EOF;
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   146
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   147
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   148
/**!language**
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   149
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   150
The following text up to the closing comment tag is JSON language data.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   151
It is not PHP code but your editor or IDE may highlight it as such. This
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   152
data is imported when the plugin is loaded for the first time; it provides
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   153
the strings displayed by this plugin's interface.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   154
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   155
You should copy and paste this block when you create your own plugins so
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   156
that these comments and the basic structure of the language data is
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   157
preserved. All language data is in the same format as the Enano core
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   158
language files in the /language/* directories. See the Enano Localization
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   159
Guide and Enano API Documentation for further information on the format of
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   160
language files.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   161
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   162
The exception in plugin language file format is that multiple languages
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   163
may be specified in the language block. This should be done by way of making
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   164
the top-level elements each a JSON language object, with elements named
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   165
according to the ISO-639-1 language they are representing. The path should be:
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   166
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   167
  root => language ID => categories array, ( strings object => category \
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   168
  objects => strings )
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   169
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   170
All text leading up to first curly brace is stripped by the parser; using
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   171
a code tag makes jEdit and other editors do automatic indentation and
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   172
syntax highlighting on the language data. The use of the code tag is not
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   173
necessary; it is only included as a tool for development.
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   174
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   175
<code>
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   176
{
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   177
  // english
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   178
  eng: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   179
    categories: [ 'meta', 'floodlight' ],
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   180
    strings: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   181
      meta: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   182
        floodlight: 'Floodlight plugin'
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   183
      },
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   184
      floodlight: {
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   185
        table_heading: 'Search results',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   186
        msg_no_results: 'No results',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   187
        lbl_score: 'Relevance: ',
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   188
      }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   189
    }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   190
  }
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   191
}
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   192
</code>
4d19ad17b07c First revision, seems working. Yes, using a className of "autofill floodlight" will give your theme/whatever support for this plugin.
Dan
parents:
diff changeset
   193
**!*/