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

📄 container-debug.js

📁 国外的人才求职招聘最新版
💻 JS
📖 第 1 页 / 共 5 页
字号:
        */        init: function (el, userConfig) {                    var elId, i, child;                    this.initEvents();                    this.beforeInitEvent.fire(Module);                    /**            * The Module's Config object used for monitoring             * configuration properties.            * @property cfg            * @type YAHOO.util.Config            */            this.cfg = new Config(this);                    if (this.isSecure) {                this.imageRoot = Module.IMG_ROOT_SSL;            }                    if (typeof el == "string") {                elId = el;                        el = document.getElementById(el);                if (! el) {                    el = (createModuleTemplate()).cloneNode(false);                    el.id = elId;                }            }                    this.element = el;                    if (el.id) {                this.id = el.id;            }                    child = this.element.firstChild;                        if (child) {                do {                    switch (child.className) {                        case Module.CSS_HEADER:                            this.header = child;                            break;                        case Module.CSS_BODY:                            this.body = child;                            break;                        case Module.CSS_FOOTER:                            this.footer = child;                            break;                        }                                    } while ((child = child.nextSibling));                        }                    this.initDefaultConfig();                    Dom.addClass(this.element, Module.CSS_MODULE);                    if (userConfig) {                this.cfg.applyConfig(userConfig, true);            }                    /*                Subscribe to the fireQueue() method of Config so that any                 queued configuration changes are excecuted upon render of                 the Module            */                         if (!Config.alreadySubscribed(this.renderEvent,                 this.cfg.fireQueue, this.cfg)) {                this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);            }                    this.initEvent.fire(Module);        },                /**        * Initialized an empty IFRAME that is placed out of the visible area         * that can be used to detect text resize.        * @method initResizeMonitor        */        initResizeMonitor: function () {                    var oDoc,                 oIFrame,                 sHTML;                    function fireTextResize() {                        Module.textResizeEvent.fire();                    }                    if (!YAHOO.env.ua.opera) {                        oIFrame = Dom.get("_yuiResizeMonitor");                        if (!oIFrame) {                            oIFrame = document.createElement("iframe");                            if (this.isSecure && Module.RESIZE_MONITOR_SECURE_URL &&                         YAHOO.env.ua.ie) {                            oIFrame.src = Module.RESIZE_MONITOR_SECURE_URL;                        }                    /*                        Need to set "src" attribute of the iframe to                         prevent the browser from reporting duplicate                         cookies. (See SourceForge bug #1721755)                    */                            if (YAHOO.env.ua.gecko) {                        sHTML = "<html><head><script " +                                "type=\"text/javascript\">" +                                 "window.onresize=function(){window.parent." +                                "YAHOO.widget.Module.textResizeEvent." +                                "fire();};window.parent.YAHOO.widget.Module." +                                "textResizeEvent.fire();</script></head>" +                                 "<body></body></html>";                        oIFrame.src = "data:text/html;charset=utf-8," +                             encodeURIComponent(sHTML);                    }                    oIFrame.id = "_yuiResizeMonitor";                                        /*                        Need to set "position" property before inserting the                         iframe into the document or Safari's status bar will                         forever indicate the iframe is loading                         (See SourceForge bug #1723064)                    */                                        oIFrame.style.position = "absolute";                    oIFrame.style.visibility = "hidden";                            document.body.appendChild(oIFrame);                            oIFrame.style.width = "10em";                    oIFrame.style.height = "10em";                    oIFrame.style.top = (-1 * oIFrame.offsetHeight) + "px";                    oIFrame.style.left = (-1 * oIFrame.offsetWidth) + "px";                    oIFrame.style.borderWidth = "0";                    oIFrame.style.visibility = "visible";                            if (YAHOO.env.ua.webkit) {                                oDoc = oIFrame.contentWindow.document;                                oDoc.open();                        oDoc.close();                            }                }                        if (oIFrame && oIFrame.contentWindow) {                    Module.textResizeEvent.subscribe(this.onDomResize,                         this, true);                            if (!Module.textResizeInitialized) {                        if (!Event.on(oIFrame.contentWindow, "resize",                             fireTextResize)) {                            /*                                 This will fail in IE if document.domain has                                  changed, so we must change the listener to                                  use the oIFrame element instead                            */                            Event.on(oIFrame, "resize", fireTextResize);                        }                        Module.textResizeInitialized = true;                    }                    this.resizeMonitor = oIFrame;                }                    }                },                /**        * Event handler fired when the resize monitor element is resized.        * @method onDomResize        * @param {DOMEvent} e The DOM resize event        * @param {Object} obj The scope object passed to the handler        */        onDomResize: function (e, obj) {                    var nLeft = -1 * this.resizeMonitor.offsetWidth,                nTop = -1 * this.resizeMonitor.offsetHeight;                    this.resizeMonitor.style.top = nTop + "px";            this.resizeMonitor.style.left =  nLeft + "px";                },                /**        * Sets the Module's header content to the HTML specified, or appends         * the passed element to the header. If no header is present, one will         * be automatically created.        * @method setHeader        * @param {String} headerContent The HTML used to set the header         * <em>OR</em>        * @param {HTMLElement} headerContent The HTMLElement to append to         * the header        */        setHeader: function (headerContent) {            var oHeader = this.header || (this.header = createHeader());                    if (typeof headerContent == "string") {                oHeader.innerHTML = headerContent;            } else {                oHeader.innerHTML = "";                oHeader.appendChild(headerContent);            }                    this.changeHeaderEvent.fire(headerContent);            this.changeContentEvent.fire();        },                /**        * Appends the passed element to the header. If no header is present,         * one will be automatically created.        * @method appendToHeader        * @param {HTMLElement} element The element to append to the header        */        appendToHeader: function (element) {            var oHeader = this.header || (this.header = createHeader());                    oHeader.appendChild(element);            this.changeHeaderEvent.fire(element);            this.changeContentEvent.fire();        },                /**        * Sets the Module's body content to the HTML specified, or appends the        * passed element to the body. If no body is present, one will be         * automatically created.        * @method setBody        * @param {String} bodyContent The HTML used to set the body <em>OR</em>        * @param {HTMLElement} bodyContent The HTMLElement to append to the body        */        setBody: function (bodyContent) {            var oBody = this.body || (this.body = createBody());                    if (typeof bodyContent == "string") {                oBody.innerHTML = bodyContent;            } else {                oBody.innerHTML = "";                oBody.appendChild(bodyContent);            }                    this.changeBodyEvent.fire(bodyContent);            this.changeContentEvent.fire();        },                /**        * Appends the passed element to the body. If no body is present, one         * will be automatically created.        * @method appendToBody        * @param {HTMLElement} element The element to append to the body        */        appendToBody: function (element) {            var oBody = this.body || (this.body = createBody());                    oBody.appendChild(element);            this.changeBodyEvent.fire(element);            this.changeContentEvent.fire();        },                /**        * Sets the Module's footer content to the HTML specified, or appends         * the passed element to the footer. If no footer is present, one will         * be automatically created.        * @method setFooter        * @param {String} footerContent The HTML used to set the footer         * <em>OR</em>        * @param {HTMLElement} footerContent The HTMLElement to append to         * the footer        */        setFooter: function (footerContent) {            var oFooter = this.footer || (this.footer = createFooter());                    if (typeof footerContent == "string") {                oFooter.innerHTML = footerContent;            } else {                oFooter.innerHTML = "";                oFooter.appendChild(footerContent);            }                    this.changeFooterEvent.fire(footerContent);            this.changeContentEvent.fire();        },                /**        * Appends the passed element to the footer. If no footer is present,         * one will be automatically created.        * @method appendToFooter        * @param {HTMLElement} element The element to append to the footer        */        appendToFooter: function (element) {            var oFooter = this.footer || (this.footer = createFooter());                    oFooter.appendChild(element);            this.changeFooterEvent.fire(element);            this.changeContentEvent.fire();        },                /**        * Renders the Module by inserting the elements that are not already         * in the main Module into their correct places. Optionally appends         * the Module to the specified node prior to the render's execution.         * NOTE: For Modules without existing markup, the appendToNode argument         * is REQUIRED. If this argument is ommitted and the current element is         * not present in the document, the function will return false,         * indicating that the render was a failure.        * @method render        * @param {String} appendToNode The element id to which the Module         * should be appended to prior to rendering <em>OR</em>        * @param {HTMLElement} appendToNode The element to which the Module         * should be appended to prior to rendering        * @param {HTMLElement} moduleElement OPTIONAL. The element that         * represents the actual Standard Module container.        * @return {Boolean} Success or failure of the render        */        render: function (appendToNode, moduleElement) {                    var me = this,                firstChild;                    function appendTo(element) {                if (typeof element == "string") {                    element = document.getElementById(element);                }                        if (element) {                    element.appendChild(me.element);                    me.appendEvent.fire();                }            }                    this.beforeRenderEvent.fire();                    if (! moduleElement) {                moduleElement = this.element;            }                    if (appendToNode) {                appendTo(appendToNode);            } else {                 /*                     No node was passed in. If the element is not already in                      the Dom, this fails                */                if (! Dom.inDocument(this.element)) {                    YAHOO.log("Render failed. Must specify appendTo node if " +                         " Module isn't already in the DOM.", "error");                    return false;                }

⌨️ 快捷键说明

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