~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

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