~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/shim-plugin/shim-plugin.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-15 18:14:08 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120315181408-zgl94hzo0x4n99an
Tags: 0.1+bzr295+dfsg-0ubuntu2
* debian/patches:
  - 01-fix-database-settings.patch: Update to set PSERV_URL.
  - 02-pserv-config.patch: Set port to 8001.
* debian/maas.postinst: Run maas-import-isos on install.
* debian/control: Depends on rabbitmq-server.

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('shim-plugin', function(Y) {
 
8
 
 
9
    /**
 
10
     * Provides shimming support for Node via a Plugin.
 
11
     * This fixes SELECT bleedthrough for IE6 & Mac scrollbars
 
12
     * @module shim-plugin
 
13
     */
 
14
 
 
15
    /**
 
16
     * Node plugin which can be used to add shim support.
 
17
     *
 
18
     * @class Plugin.Shim
 
19
     * @param {Object} User configuration object
 
20
     */
 
21
    function Shim(config) {
 
22
        this.init(config);
 
23
    }
 
24
 
 
25
    /**
 
26
     * Default class used to mark the shim element
 
27
     *
 
28
     * @property CLASS_NAME
 
29
     * @type String
 
30
     * @static
 
31
     * @default "yui-node-shim"
 
32
     */
 
33
    // TODO: use ClassNameManager
 
34
    Shim.CLASS_NAME = 'yui-node-shim';
 
35
 
 
36
    /**
 
37
     * Default markup template used to generate the shim element.
 
38
     * 
 
39
     * @property TEMPLATE
 
40
     * @type String
 
41
     * @static
 
42
     */
 
43
    Shim.TEMPLATE = '<iframe class="' + Shim.CLASS_NAME +
 
44
            '" frameborder="0" title="Node Stacking Shim"' +
 
45
            'src="javascript:false" tabindex="-1" role="presentation"' +
 
46
            'style="position:absolute; z-index:-1;"></iframe>';
 
47
 
 
48
    Shim.prototype = {
 
49
        init: function(config) {
 
50
            this._host = config.host;
 
51
            this.initEvents();
 
52
            this.insert();
 
53
            this.sync();
 
54
        },
 
55
 
 
56
        initEvents: function() {
 
57
            this._resizeHandle = this._host.on('resize', this.sync, this);
 
58
        },
 
59
        
 
60
        getShim: function() {
 
61
            return this._shim || (
 
62
                this._shim = Y.Node.create(
 
63
                    Shim.TEMPLATE,
 
64
                    this._host.get('ownerDocument')
 
65
                )
 
66
            );
 
67
        },
 
68
 
 
69
        insert: function() {
 
70
            var node = this._host;
 
71
            this._shim = node.insertBefore( this.getShim(),
 
72
                    node.get('firstChild'));
 
73
        },
 
74
 
 
75
        /**
 
76
         * Updates the size of the shim to fill its container
 
77
         * @method sync
 
78
         */
 
79
        sync: function() {
 
80
            var shim = this._shim,
 
81
                node = this._host;
 
82
 
 
83
            if (shim) {
 
84
                shim.setAttrs({
 
85
                    width: node.getStyle('width'),
 
86
                    height: node.getStyle('height')
 
87
                });
 
88
            }
 
89
        },
 
90
 
 
91
        /**
 
92
         * Removes the shim and destroys the plugin
 
93
         * @method destroy
 
94
         */
 
95
        destroy: function() {
 
96
            var shim = this._shim;
 
97
            if (shim) {
 
98
                shim.remove(true);
 
99
            }
 
100
 
 
101
            this._resizeHandle.detach();
 
102
        }
 
103
    };
 
104
 
 
105
    Shim.NAME = 'Shim';
 
106
    Shim.NS = 'shim';
 
107
 
 
108
    Y.namespace('Plugin');
 
109
    Y.Plugin.Shim = Shim;
 
110
 
 
111
 
 
112
}, '3.4.1' ,{requires:['node-style', 'node-pluginhost']});