⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layout-debug.js

📁 很棒的在线教学系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
                    h: 0,                    w: 0                }            };                        LayoutUnit.superclass.init.call(this, p_oElement, p_oAttributes);            this.browser = this.get('parent').browser;                        var id = p_oElement;            if (!Lang.isString(id)) {                id = Dom.generateId(id);            }            LayoutUnit._instances[id] = this;            this.setStyle('position', 'absolute');            this.addClass('yui-layout-unit');            this.addClass('yui-layout-unit-' + this.get('position'));            var header = this.getElementsByClassName('yui-layout-hd', 'div')[0];            if (header) {                this.header = header;            }            var body = this.getElementsByClassName('yui-layout-bd', 'div')[0];            if (body) {                this.body = body;            }            var footer = this.getElementsByClassName('yui-layout-ft', 'div')[0];            if (footer) {                this.footer = footer;            }            this.on('contentChange', this.resize, this, true);            this._lastScrollTop = 0;            this.set('animate', this.get('animate'));        },        /**        * @private        * @method initAttributes        * @description Processes the config        */                initAttributes: function(attr) {            LayoutUnit.superclass.initAttributes.call(this, attr);            /**            * @private            * @attribute wrap            * @description A reference to the wrap element            * @type HTMLElement            */            this.setAttributeConfig('wrap', {                value: attr.wrap || null,                method: function(w) {                    if (w) {                        var id = Dom.generateId(w);                        LayoutUnit._instances[id] = this;                    }                }            });            /**            * @attribute grids            * @description Set this option to true if you want the LayoutUnit to fix the first layer of YUI CSS Grids (margins)            * @type Boolean            */            this.setAttributeConfig('grids', {                value: attr.grids || false            });            /**            * @private            * @attribute top            * @description The current top positioning of the Unit            * @type Number            */            this.setAttributeConfig('top', {                value: attr.top || 0,                validator: Lang.isNumber,                method: function(t) {                    if (!this._collapsing) {                        this.setStyle('top', t + 'px');                    }                }            });            /**            * @private            * @attribute left            * @description The current left position of the Unit            * @type Number            */            this.setAttributeConfig('left', {                value: attr.left || 0,                validator: Lang.isNumber,                method: function(l) {                    if (!this._collapsing) {                        this.setStyle('left', l + 'px');                    }                }            });            /**            * @attribute minWidth            * @description The minWidth parameter passed to the Resize Utility            * @type Number            */            this.setAttributeConfig('minWidth', {                value: attr.minWidth || false,                validator: YAHOO.lang.isNumber            });            /**            * @attribute maxWidth            * @description The maxWidth parameter passed to the Resize Utility            * @type Number            */            this.setAttributeConfig('maxWidth', {                value: attr.maxWidth || false,                validator: YAHOO.lang.isNumber            });            /**            * @attribute minHeight            * @description The minHeight parameter passed to the Resize Utility            * @type Number            */            this.setAttributeConfig('minHeight', {                value: attr.minHeight || false,                validator: YAHOO.lang.isNumber            });            /**            * @attribute maxHeight            * @description The maxHeight parameter passed to the Resize Utility            * @type Number            */            this.setAttributeConfig('maxHeight', {                value: attr.maxHeight || false,                validator: YAHOO.lang.isNumber            });            /**            * @attribute height            * @description The height of the Unit            * @type Number            */            this.setAttributeConfig('height', {                value: attr.height,                validator: Lang.isNumber,                method: function(h) {                    if (!this._collapsing) {                        this.setStyle('height', h + 'px');                    }                }            });            /**            * @attribute width            * @description The width of the Unit            * @type Number            */            this.setAttributeConfig('width', {                value: attr.width,                validator: Lang.isNumber,                method: function(w) {                    if (!this._collapsing) {                        this.setStyle('width', w + 'px');                    }                }            });            /**            * @attribute zIndex            * @description The CSS zIndex to give to the unit, so you can have overlapping elements such as menus in a unit.            * @type {Number}            */            this.setAttributeConfig('zIndex', {                value: attr.zIndex || false,                method: function(z) {                    this.setStyle('zIndex', z);                }            });            /**            * @attribute position            * @description The position (top, right, bottom, left or center) of the Unit in the Layout            * @type {String}            */            this.setAttributeConfig('position', {                value: attr.position            });            /**            * @attribute gutter            * @description The gutter that we should apply to the parent Layout around this Unit. Supports standard CSS markup: (2 4 0 5) or (2) or (2 5)            * @type String            */            this.setAttributeConfig('gutter', {                value: attr.gutter || 0,                validator: YAHOO.lang.isString,                method: function(gutter) {                    var p = gutter.split(' ');                    if (p.length) {                        this._gutter.top = parseInt(p[0], 10);                        if (p[1]) {                            this._gutter.right = parseInt(p[1], 10);                        } else {                            this._gutter.right = this._gutter.top;                        }                        if (p[2]) {                            this._gutter.bottom = parseInt(p[2], 10);                        } else {                            this._gutter.bottom = this._gutter.top;                        }                        if (p[3]) {                            this._gutter.left = parseInt(p[3], 10);                        } else if (p[1]) {                            this._gutter.left = this._gutter.right;                        } else {                            this._gutter.left = this._gutter.top;                        }                    }                }            });            /**            * @attribute parent            * @description The parent Layout that we are assigned to            * @type {Object} YAHOO.widget.Layout            */            this.setAttributeConfig('parent', {                writeOnce: true,                value: attr.parent || false,                method: function(p) {                    if (p) {                        p.on('resize', this.resize, this, true);                    }                }            });            /**            * @attribute collapseSize            * @description The pixel size of the Clip that we will collapse to            * @type Number            */            this.setAttributeConfig('collapseSize', {                value: attr.collapseSize || 25,                validator: YAHOO.lang.isNumber            });            /**            * @attribute duration            * @description The duration to give the Animation Utility when animating the opening and closing of Units            */            this.setAttributeConfig('duration', {                value: attr.duration || 0.5            });            /**            * @attribute easing            * @description The Animation Easing to apply to the Animation instance for this unit.            */            this.setAttributeConfig('easing', {                value: attr.easing || ((YAHOO.util && YAHOO.util.Easing) ? YAHOO.util.Easing.BounceIn : 'false')            });            /**            * @attribute animate            * @description Use animation to collapse/expand the unit            * @type Boolean            */            this.setAttributeConfig('animate', {                value: ((attr.animate === false) ? false : true),                validator: function() {                    var anim = false;                    if (YAHOO.util.Anim) {                        anim = true;                    }                    return anim;                },                method: function(anim) {                    if (anim) {                        this._anim = new YAHOO.util.Anim(this.get('element'), {}, this.get('duration'), this.get('easing'));                    } else {                        this._anim = false;                    }                }            });            /**            * @attribute header            * @description The text to use as the Header of the Unit            */            this.setAttributeConfig('header', {                value: attr.header || false,                method: function(txt) {                    if (txt === false) {                        //Remove the footer                        if (this.header) {                            Dom.addClass(this.body, 'yui-layout-bd-nohd');                            this.header.parentNode.removeChild(this.header);                            this.header = null;                        }                    } else {                        if (!this.header) {                            var header = this.getElementsByClassName('yui-layout-hd', 'div')[0];                            if (!header) {                                header = this._createHeader();                            }                            this.header = header;                        }                        var h = this.header.getElementsByTagName('h2')[0];                        if (!h) {                            h = document.createElement('h2');                            this.header.appendChild(h);                        }                        h.innerHTML = txt;                        if (this.body) {                            Dom.removeClass(this.body, 'yui-layout-bd-nohd');                        }                    }                    this.fireEvent('contentChange', { target: 'header' });                }            });            /**            * @attribute proxy            * @description Use the proxy config setting for the Resize Utility            * @type Boolean            */            this.setAttributeConfig('proxy', {                writeOnce: true,                value: ((attr.proxy === false) ? false : true)            });            /**            * @attribute body            * @description The content for the body. If we find an element in the page with an id that matches the passed option we will move that element into the body of this unit.            */            this.setAttributeConfig('body', {                value: attr.body || false,                method: function(content) {                    if (!this.body) {                        var body = this.getElementsByClassName('yui-layout-bd', 'div')[0];                        if (body) {                            this.body = body;                        } else {                            body = document.createElement('div');                            body.className = 'yui-layout-bd';                            this.body = body;                            this.get('wrap').appendChild(body);                        }                    }                    if (!this.header) {                        Dom.addClass(this.body, 'yui-layout-bd-nohd');                    }                    Dom.addClass(this.body, 'yui-layout-bd-noft');                    var el = null;                    if (Lang.isString(content)) {                        el = Dom.get(content);                    } else if (content && content.tagName) {                        el = content;                    }                    if (el

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -