~ubuntu-branches/ubuntu/precise/maas/precise-security

« back to all changes in this revision

Viewing changes to debian/extras/jslibs/yui/resize-proxy/resize-proxy-debug.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('resize-proxy', function(Y) {
 
8
 
 
9
var ACTIVE_HANDLE_NODE = 'activeHandleNode',
 
10
        CURSOR = 'cursor',
 
11
        DRAG_CURSOR = 'dragCursor',
 
12
        HOST = 'host',
 
13
        PARENT_NODE = 'parentNode',
 
14
        PROXY = 'proxy',
 
15
        PROXY_NODE = 'proxyNode',
 
16
        RESIZE = 'resize',
 
17
        RESIZE_PROXY = 'resize-proxy',
 
18
        WRAPPER = 'wrapper',
 
19
 
 
20
        getCN = Y.ClassNameManager.getClassName,
 
21
 
 
22
        CSS_RESIZE_PROXY = getCN(RESIZE, PROXY);
 
23
 
 
24
 
 
25
/**
 
26
Adds a `proxyNode` attribute and resizes it instead of the actual node. __very similar to DDProxy__
 
27
 
 
28
    var resize = new Y.Resize({
 
29
        //Selector of the node to resize
 
30
        node: '#demo'
 
31
    });
 
32
    resize.plug(Y.Plugin.ResizeProxy);
 
33
    
 
34
 
 
35
@class ResizeProxy
 
36
@module resize
 
37
@submodule resize-proxy
 
38
@constructor
 
39
@extends Plugin.Base
 
40
@namespace Plugin
 
41
*/
 
42
 
 
43
 
 
44
function ResizeProxy() {
 
45
        ResizeProxy.superclass.constructor.apply(this, arguments);
 
46
}
 
47
 
 
48
Y.mix(ResizeProxy, {
 
49
        NAME: RESIZE_PROXY,
 
50
 
 
51
        NS: PROXY,
 
52
 
 
53
        ATTRS: {
 
54
                /**
 
55
         * The Resize proxy element.
 
56
         *
 
57
         * @attribute proxyNode
 
58
         * @default Generated using an internal HTML markup
 
59
         * @type String|Node
 
60
         */
 
61
                proxyNode: {
 
62
                        setter: Y.one,
 
63
                        valueFn: function() {
 
64
                                return Y.Node.create(this.PROXY_TEMPLATE);
 
65
                        }
 
66
                }
 
67
        }
 
68
});
 
69
 
 
70
Y.extend(ResizeProxy, Y.Plugin.Base, {
 
71
        /**
 
72
     * Template used to create the resize proxy.
 
73
     *
 
74
     * @property PROXY_TEMPLATE
 
75
     * @type {String}
 
76
     */
 
77
        PROXY_TEMPLATE: '<div class="'+CSS_RESIZE_PROXY+'"></div>',
 
78
 
 
79
        initializer: function() {
 
80
                var instance = this;
 
81
 
 
82
                instance.afterHostEvent('resize:start', instance._afterResizeStart);
 
83
                instance.beforeHostMethod('_resize', instance._beforeHostResize);
 
84
                instance.afterHostMethod('_resizeEnd', instance._afterHostResizeEnd);
 
85
        },
 
86
 
 
87
        destructor: function() {
 
88
                var instance = this;
 
89
 
 
90
                instance.get(PROXY_NODE).remove(true);
 
91
        },
 
92
 
 
93
        _afterHostResizeEnd: function(event) {
 
94
                var instance = this,
 
95
                        drag = event.dragEvent.target;
 
96
 
 
97
                // reseting actXY from drag when drag end
 
98
                drag.actXY = [];
 
99
 
 
100
                // if proxy is true, hide it on resize end
 
101
                instance._syncProxyUI();
 
102
 
 
103
                instance.get(PROXY_NODE).hide();
 
104
        },
 
105
 
 
106
        _afterResizeStart: function(event) {
 
107
                var instance = this;
 
108
 
 
109
                instance._renderProxy();
 
110
        },
 
111
 
 
112
        _beforeHostResize: function(event) {
 
113
                var instance = this,
 
114
                        host = this.get(HOST);
 
115
 
 
116
                host._handleResizeAlignEvent(event.dragEvent);
 
117
 
 
118
                // if proxy is true _syncProxyUI instead of _syncUI
 
119
                instance._syncProxyUI();
 
120
 
 
121
                return new Y.Do.Prevent();
 
122
        },
 
123
 
 
124
    /**
 
125
      * Render the <a href="ResizeProxy.html#config_proxyNode">proxyNode</a> element and
 
126
      * make it sibling of the <a href="Resize.html#config_node">node</a>.
 
127
      *
 
128
      * @method _renderProxy
 
129
      * @protected
 
130
      */
 
131
        _renderProxy: function() {
 
132
                var instance = this,
 
133
                        host = this.get(HOST),
 
134
                        proxyNode = instance.get(PROXY_NODE);
 
135
 
 
136
                if (!proxyNode.inDoc()) {
 
137
                        host.get(WRAPPER).get(PARENT_NODE).append(
 
138
                                proxyNode.hide()
 
139
                        );
 
140
                }
 
141
        },
 
142
 
 
143
        /**
 
144
     * Sync the proxy UI with internal values from
 
145
     * <a href="ResizeProxy.html#property_info">info</a>.
 
146
     *
 
147
     * @method _syncProxyUI
 
148
     * @protected
 
149
     */
 
150
        _syncProxyUI: function() {
 
151
                var instance = this,
 
152
                        host = this.get(HOST),
 
153
                        info = host.info,
 
154
                        activeHandleNode = host.get(ACTIVE_HANDLE_NODE),
 
155
                        proxyNode = instance.get(PROXY_NODE),
 
156
                        cursor = activeHandleNode.getStyle(CURSOR);
 
157
 
 
158
                proxyNode.show().setStyle(CURSOR, cursor);
 
159
 
 
160
                host.delegate.dd.set(DRAG_CURSOR, cursor);
 
161
 
 
162
                proxyNode.sizeTo(info.offsetWidth, info.offsetHeight);
 
163
 
 
164
                proxyNode.setXY([ info.left, info.top ]);
 
165
        }
 
166
});
 
167
 
 
168
Y.namespace('Plugin');
 
169
Y.Plugin.ResizeProxy = ResizeProxy;
 
170
 
 
171
 
 
172
}, '3.5.1' ,{requires:['resize-base', 'plugin'], skinnable:false});