/[drupal]/contributions/modules/livesearch/livesearch.js
ViewVC logotype

Diff of /contributions/modules/livesearch/livesearch.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15, Sat Jul 21 05:07:00 2007 UTC revision 1.16, Sun Jan 20 19:49:54 2008 UTC
# Line 1  Line 1 
1  // $Id: livesearch.js,v 1.14 2007/05/09 05:26:42 kourge Exp $  // $Id: livesearch.js,v 1.15 2007/07/21 05:07:00 kourge Exp $
2  if (Drupal.jsEnabled) { // global killswitch  if (Drupal.jsEnabled) { // global killswitch
3  (function($) { // Dollar namespace scoping  (function($) { // Dollar namespace scoping
4  Drupal.LiveSearch = {  Drupal.LiveSearch = {
# Line 72  Drupal.LiveSearch = { Line 72  Drupal.LiveSearch = {
72    }    }
73  };  };
74    
75  // This should be faster than 'document'.  $(document).ready(function() {
 $('input').ready(function() {  
76    var settings = Drupal.settings.liveSearch;    var settings = Drupal.settings.liveSearch;
77    // User permission killswitch    // User permission killswitch
78    if (!settings.searchAllowed) {return;}    if (!settings.searchAllowed) {return;}
79    var type = settings.targetSearchBox || 'theme';    var type = settings.targetSearchBox || 'auto';
   var searchForm = $('form#search-' + type + '-form');  
80    var searchBox = $('#edit-search-' + type + '-form-keys');    var searchBox = $('#edit-search-' + type + '-form-keys');
81      var searchForm = $('form#search-' + type + '-form');
82      if (type == 'auto') {
83        searchBox = $('#edit-search-block-form-keys, #edit-search-theme-form-keys, #search-box, #searchbox');
84        if (searchBox.length == 0) {return;}
85        searchBox = $(searchBox[0]);
86        searchForm = $(searchBox).parents('form');
87      }
88    var localizedTerm;    var localizedTerm;
89    
90    // Search box killswitch, in case a search block is optionally visible.    // Search box killswitch, in case a search block is optionally visible.
# Line 115  $('input').ready(function() { Line 120  $('input').ready(function() {
120        }        }
121      });      });
122    }    }
123    
124    searchBox.    searchBox.
125      addClass('form-autocomplete').      addClass('form-autocomplete').
126      keyup(Drupal.LiveSearch.eventListener).      keyup(Drupal.LiveSearch.eventListener).

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.2