/usr/share/javascript/yui3/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold.js is in libjs-yui3-full 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('autocomplete-highlighters-accentfold', function(Y) {
/**
Provides pre-built accent-folding result highlighters for AutoComplete.
These highlighters are similar to the ones provided by the `autocomplete-
highlighters` module, but use accent-aware comparisons. For example, "resume"
and "résumé" will be considered equal when using the accent-folding
highlighters.
@module autocomplete
@submodule autocomplete-highlighters-accentfold
**/
/**
@class AutoCompleteHighlighters
@static
**/
var Highlight = Y.Highlight,
YArray = Y.Array;
Y.mix(Y.namespace('AutoCompleteHighlighters'), {
/**
Accent-folding version of `charMatch()`.
@method charMatchFold
@param {String} query Query to match
@param {Array} results Results to highlight
@return {Array} Highlighted results
@static
**/
charMatchFold: function (query, results) {
var queryChars = YArray.unique(query.split(''));
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, queryChars);
});
},
/**
Accent-folding version of `phraseMatch()`.
@method phraseMatchFold
@param {String} query Query to match
@param {Array} results Results to highlight
@return {Array} Highlighted results
@static
**/
phraseMatchFold: function (query, results) {
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, [query]);
});
},
/**
Accent-folding version of `startsWith()`.
@method startsWithFold
@param {String} query Query to match
@param {Array} results Results to highlight
@return {Array} Highlighted results
@static
**/
startsWithFold: function (query, results) {
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, [query], {
startsWith: true
});
});
},
/**
Accent-folding version of `subWordMatch()`.
@method subWordMatchFold
@param {String} query Query to match
@param {Array} results Results to highlight
@return {Array} Highlighted results
@static
**/
subWordMatchFold: function (query, results) {
var queryWords = Y.Text.WordBreak.getUniqueWords(query);
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, queryWords);
});
},
/**
Accent-folding version of `wordMatch()`.
@method wordMatchFold
@param {String} query Query to match
@param {Array} results Results to highlight
@return {Array} Highlighted results
@static
**/
wordMatchFold: function (query, results) {
return YArray.map(results, function (result) {
return Highlight.wordsFold(result.text, query);
});
}
});
}, '3.5.1' ,{requires:['array-extras', 'highlight-accentfold']});
|