PHP Classes

File: web/SSO/modules/discopower/www/js/jquery.livesearch.js

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/discopower/www/js/jquery.livesearch.js   Download  
File: web/SSO/modules/discopower/www/js/jquery.livesearch.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 732 bytes
 

Contents

Class file image Download
jQuery.fn.liveUpdate = function(list){ list = jQuery(list); if ( list.length ) { var rows = list.children('a'), cache = rows.map(function(){ return jQuery(this).text().toLowerCase(); }); this .keyup(filter).keyup() .parents('form').submit(function(){ return false; }); } return this; function filter(){ var term = jQuery.trim( jQuery(this).val().toLowerCase() ), scores = []; if ( !term ) { rows.show(); } else { rows.hide(); cache.each(function(i){ var score = this.score(term); if (score > 0) { scores.push([score, i]); } }); jQuery.each(scores.sort(function(a, b){return b[0] - a[0];}), function(){ jQuery(rows[ this[1] ]).show(); }); } } };