~ubuntu-branches/ubuntu/precise/maas/precise-updates

« back to all changes in this revision

Viewing changes to debian/extras/jslibs/yui/queue-promote/queue-promote.js

Tags: 1.2+bzr1373+dfsg-0ubuntu1~12.04.4
* SECURITY UPDATE: failure to authenticate downloaded content (LP: #1039513)
  - debian/patches/CVE-2013-1058.patch: Authenticate downloaded files with
    GnuPG and MD5SUM files. Thanks to Julian Edwards.
  - CVE-2013-1058
* SECURITY UPDATE: configuration options may be loaded from current working
  directory (LP: #1158425)
  - debian/patches/CVE-2013-1057-1-2.patch: Do not load configuration
    options from the current working directory. Thanks to Julian Edwards.
  - CVE-2013-1057

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
YUI 3.5.1 (build 22)
 
3
Copyright 2012 Yahoo! Inc. All rights reserved.
 
4
Licensed under the BSD License.
 
5
http://yuilibrary.com/license/
 
6
*/
 
7
YUI.add('queue-promote', function(Y) {
 
8
 
 
9
/**
 
10
 * Adds methods promote, remove, and indexOf to Queue instances.
 
11
 *
 
12
 * @module queue-promote
 
13
 * @for Queue
 
14
 */
 
15
 
 
16
Y.mix(Y.Queue.prototype, {
 
17
    /**
 
18
     * Returns the current index in the queue of the specified item
 
19
     * 
 
20
     * @method indexOf
 
21
     * @param needle {MIXED} the item to search for
 
22
     * @return {Number} the index of the item or -1 if not found
 
23
     */
 
24
    indexOf : function (callback) {
 
25
        return Y.Array.indexOf(this._q, callback);
 
26
    },
 
27
 
 
28
    /**
 
29
     * Moves the referenced item to the head of the queue
 
30
     *
 
31
     * @method promote
 
32
     * @param item {MIXED} an item in the queue
 
33
     */
 
34
    promote : function (callback) {
 
35
        var index = this.indexOf(callback);
 
36
 
 
37
        if (index > -1) {
 
38
            this._q.unshift(this._q.splice(index,1)[0]);
 
39
        }
 
40
    },
 
41
 
 
42
    /**
 
43
     * Removes the referenced item from the queue
 
44
     *
 
45
     * @method remove
 
46
     * @param item {MIXED} an item in the queue
 
47
     */
 
48
    remove : function (callback) {
 
49
        var index = this.indexOf(callback);
 
50
 
 
51
        if (index > -1) {
 
52
            this._q.splice(index,1);
 
53
        }
 
54
    }
 
55
 
 
56
});
 
57
 
 
58
 
 
59
}, '3.5.1' ,{requires:['yui-base']});