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

📄 container_core.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 5 页
字号:
                    for (s = 0; s < sLen; s++) {                        supercedesCheck = property.supercedes[s];                        qLen = this.eventQueue.length;                        for (q = 0; q < qLen; q++) {                            queueItemCheck = this.eventQueue[q];                            if (queueItemCheck) {                                queueItemCheckKey = queueItemCheck[0];                                queueItemCheckValue = queueItemCheck[1];                                if (queueItemCheckKey ==                                     supercedesCheck.toLowerCase() ) {                                    this.eventQueue.push([queueItemCheckKey,                                         queueItemCheckValue]);                                    this.eventQueue[q] = null;                                    break;                                }                            }                        }                    }                }                return true;            } else {                return false;            }        },                /**        * Fires the event for a property using the property's current value.        * @method refireEvent        * @param {String} key The name of the property        */        refireEvent: function (key) {                key = key.toLowerCase();                    var property = this.config[key];                if (property && property.event &&                     !Lang.isUndefined(property.value)) {                    if (this.queueInProgress) {                        this.queueProperty(key);                    } else {                        this.fireEvent(key, property.value);                    }                }        },                /**        * Applies a key-value Object literal to the configuration, replacing          * any existing values, and queueing the property events.        * Although the values will be set, fireQueue() must be called for their         * associated events to execute.        * @method applyConfig        * @param {Object} userConfig The configuration Object literal        * @param {Boolean} init  When set to true, the initialConfig will         * be set to the userConfig passed in, so that calling a reset will         * reset the properties to the passed values.        */        applyConfig: function (userConfig, init) {                    var sKey,                oConfig;            if (init) {                oConfig = {};                for (sKey in userConfig) {                    if (Lang.hasOwnProperty(userConfig, sKey)) {                        oConfig[sKey.toLowerCase()] = userConfig[sKey];                    }                }                this.initialConfig = oConfig;            }            for (sKey in userConfig) {                if (Lang.hasOwnProperty(userConfig, sKey)) {                    this.queueProperty(sKey, userConfig[sKey]);                }            }        },                /**        * Refires the events for all configuration properties using their         * current values.        * @method refresh        */        refresh: function () {            var prop;            for (prop in this.config) {                if (Lang.hasOwnProperty(this.config, prop)) {                    this.refireEvent(prop);                }            }        },                /**        * Fires the normalized list of queued property change events        * @method fireQueue        */        fireQueue: function () {                    var i,                 queueItem,                key,                value,                property;                    this.queueInProgress = true;            for (i = 0;i < this.eventQueue.length; i++) {                queueItem = this.eventQueue[i];                if (queueItem) {                            key = queueItem[0];                    value = queueItem[1];                    property = this.config[key];                    property.value = value;                    // Clear out queue entry, to avoid it being                     // re-added to the queue by any queueProperty/supercedes                    // calls which are invoked during fireEvent                    this.eventQueue[i] = null;                    this.fireEvent(key,value);                }            }                        this.queueInProgress = false;            this.eventQueue = [];        },                /**        * Subscribes an external handler to the change event for any         * given property.         * @method subscribeToConfigEvent        * @param {String} key The property name        * @param {Function} handler The handler function to use subscribe to         * the property's event        * @param {Object} obj The Object to use for scoping the event handler         * (see CustomEvent documentation)        * @param {Boolean} override Optional. If true, will override "this"          * within the handler to map to the scope Object passed into the method.        * @return {Boolean} True, if the subscription was successful,         * otherwise false.        */         subscribeToConfigEvent: function (key, handler, obj, override) {                var property = this.config[key.toLowerCase()];                if (property && property.event) {                if (!Config.alreadySubscribed(property.event, handler, obj)) {                    property.event.subscribe(handler, obj, override);                }                return true;            } else {                return false;            }            },                /**        * Unsubscribes an external handler from the change event for any         * given property.         * @method unsubscribeFromConfigEvent        * @param {String} key The property name        * @param {Function} handler The handler function to use subscribe to         * the property's event        * @param {Object} obj The Object to use for scoping the event         * handler (see CustomEvent documentation)        * @return {Boolean} True, if the unsubscription was successful,         * otherwise false.        */        unsubscribeFromConfigEvent: function (key, handler, obj) {            var property = this.config[key.toLowerCase()];            if (property && property.event) {                return property.event.unsubscribe(handler, obj);            } else {                return false;            }        },                /**        * Returns a string representation of the Config object        * @method toString        * @return {String} The Config object in string format.        */        toString: function () {            var output = "Config";            if (this.owner) {                output += " [" + this.owner.toString() + "]";            }            return output;        },                /**        * Returns a string representation of the Config object's current         * CustomEvent queue        * @method outputEventQueue        * @return {String} The string list of CustomEvents currently queued         * for execution        */        outputEventQueue: function () {            var output = "",                queueItem,                q,                nQueue = this.eventQueue.length;                          for (q = 0; q < nQueue; q++) {                queueItem = this.eventQueue[q];                if (queueItem) {                    output += queueItem[0] + "=" + queueItem[1] + ", ";                }            }            return output;        },        /**        * Sets all properties to null, unsubscribes all listeners from each         * property's change event and all listeners from the configChangedEvent.        * @method destroy        */        destroy: function () {            var oConfig = this.config,                sProperty,                oProperty;            for (sProperty in oConfig) {                            if (Lang.hasOwnProperty(oConfig, sProperty)) {                    oProperty = oConfig[sProperty];                    oProperty.event.unsubscribeAll();                    oProperty.event = null;                }                        }                        this.configChangedEvent.unsubscribeAll();                        this.configChangedEvent = null;            this.owner = null;            this.config = null;            this.initialConfig = null;            this.eventQueue = null;                }    };                /**    * Checks to determine if a particular function/Object pair are already     * subscribed to the specified CustomEvent    * @method YAHOO.util.Config.alreadySubscribed    * @static    * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check     * the subscriptions    * @param {Function} fn The function to look for in the subscribers list    * @param {Object} obj The execution scope Object for the subscription    * @return {Boolean} true, if the function/Object pair is already subscribed     * to the CustomEvent passed in    */    Config.alreadySubscribed = function (evt, fn, obj) {            var nSubscribers = evt.subscribers.length,            subsc,            i;        if (nSubscribers > 0) {            i = nSubscribers - 1;            do {                subsc = evt.subscribers[i];                if (subsc && subsc.obj == obj && subsc.fn == fn) {                    return true;                }            }            while (i--);        }        return false;    };    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);}());(function () {    /**    * The Container family of components is designed to enable developers to     * create different kinds of content-containing modules on the web. Module     * and Overlay are the most basic containers, and they can be used directly     * or extended to build custom containers. Also part of the Container family     * are four UI controls that extend Module and Overlay: Tooltip, Panel,     * Dialog, and SimpleDialog.    * @module container    * @title Container    * @requires yahoo, dom, event     * @optional dragdrop, animation, button    */        /**    * Module is a JavaScript representation of the Standard Module Format.     * Standard Module Format is a simple standard for markup containers where     * child nodes representing the header, body, and footer of the content are     * denoted using the CSS classes "hd", "bd", and "ft" respectively.     * Module is the base class for all other classes in the YUI     * Container package.    * @namespace YAHOO.widget    * @class Module    * @constructor    * @param {String} el The element ID representing the Module <em>OR</em>    * @param {HTMLElement} el The element representing the Module    * @param {Object} userConfig The configuration Object literal containing     * the configuration that should be set for this module. See configuration     * documentation for more details.    */    YAHOO.widget.Module = function (el, userConfig) {        if (el) {            this.init(el, userConfig);        } else {        }    };    var Dom = YAHOO.util.Dom,        Config = YAHOO.util.Config,        Event = YAHOO.util.Event,        CustomEvent = YAHOO.util.CustomEvent,        Module = YAHOO.widget.Module,        m_oModuleTemplate,        m_oHeaderTemplate,        m_oBodyTemplate,        m_oFooterTemplate,        /**        * Constant representing the name of the Module's events        * @property EVENT_TYPES        * @private        * @final        * @type Object        */        EVENT_TYPES = {            "BEFORE_INIT": "beforeInit",            "INIT": "init",            "APPEND": "append",            "BEFORE_RENDER": "beforeRender",            "RENDER": "render",            "CHANGE_HEADER": "changeHeader",            "CHANGE_BODY": "changeBody",            "CHANGE_FOOTER": "changeFooter",            "CHANGE_CONTENT": "changeContent",            "DESTORY": "destroy",            "BEFORE_SHOW": "beforeShow",            "SHOW": "show",            "BEFORE_HIDE": "beforeHide",            "HIDE": "hide"        },                    /**

⌨️ 快捷键说明

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