PHP Classes

File: web/SSO/modules/discopower/www/js/suggest.js

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/modules/discopower/www/js/suggest.js   Download  
File: web/SSO/modules/discopower/www/js/suggest.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: 798 bytes
 

Contents

Class file image Download
var suggest_cache = new Array; String.prototype.score = function(abbreviation,offset) { if (suggest_cache['abv'] != abbreviation) { suggest_cache['abv'] = abbreviation; var words = abbreviation.split(/\s/); suggest_cache['len'] = words.length; suggest_cache.re = new Array; //words.each(); for ( var i=0; i<suggest_cache['len']; ++i ){ suggest_cache['re'][i] = new Array(); // /\b<x>/ doesn't work when <x> i a non-ascii - oddly enough \s does ... suggest_cache['re'][i]['initialword'] = new RegExp("^"+words[i], "i"); suggest_cache['re'][i]['word'] = new RegExp("\\s"+words[i], "i"); } } for ( var i=0; i<suggest_cache['len']; ++i ){ if (!(this.match(suggest_cache['re'][i]['initialword']) || this.match(suggest_cache['re'][i]['word']))) return 0; } return 1; }