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

📄 event.js

📁 目录树,在脚本中可以直接调用后台java代码,动态加载数据至页面显示.
💻 JS
📖 第 1 页 / 共 5 页
字号:
                }                // onAvailable                var notAvail = [];                var executeItem = function (el, item) {                    var scope = el;                    if (item.override) {                        if (item.override === true) {                            scope = item.obj;                        } else {                            scope = item.override;                        }                    }                    item.fn.call(scope, item.obj);                };                var i,len,item,el;                // onAvailable                for (i=0,len=onAvailStack.length; i<len; ++i) {                    item = onAvailStack[i];                    if (item && !item.checkReady) {                        el = this.getEl(item.id);                        if (el) {                            executeItem(el, item);                            onAvailStack[i] = null;                        } else {                            notAvail.push(item);                        }                    }                }                // onContentReady                for (i=0,len=onAvailStack.length; i<len; ++i) {                    item = onAvailStack[i];                    if (item && item.checkReady) {                        el = this.getEl(item.id);                        if (el) {                            // The element is available, but not necessarily ready                            // @todo should we test parentNode.nextSibling?                            if (loadComplete || el.nextSibling) {                                executeItem(el, item);                                onAvailStack[i] = null;                            }                        } else {                            notAvail.push(item);                        }                    }                }                retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;                if (tryAgain) {                    // we may need to strip the nulled out items here                    this.startInterval();                } else {                    clearInterval(this._interval);                    this._interval = null;                }                this.locked = false;                return true;            },            /**             * Removes all listeners attached to the given element via addListener.             * Optionally, the node's children can also be purged.             * Optionally, you can specify a specific type of event to remove.             * @method purgeElement             * @param {HTMLElement} el the element to purge             * @param {boolean} recurse recursively purge this element's children             * as well.  Use with caution.             * @param {string} sType optional type of listener to purge. If             * left out, all listeners will be removed             * @static             */            purgeElement: function(el, recurse, sType) {                var elListeners = this.getListeners(el, sType);                if (elListeners) {                    for (var i=0,len=elListeners.length; i<len ; ++i) {                        var l = elListeners[i];                        // can't use the index on the changing collection                        this.removeListener(el, l.type, l.fn, l.index);                        //this.removeListener(el, l.type, l.fn);                    }                }                if (recurse && el && el.childNodes) {                    for (i=0,len=el.childNodes.length; i<len ; ++i) {                        this.purgeElement(el.childNodes[i], recurse, sType);                    }                }            },            /**             * Returns all listeners attached to the given element via addListener.             * Optionally, you can specify a specific type of event to return.             * @method getListeners             * @param el {HTMLElement} the element to inspect              * @param sType {string} optional type of listener to return. If             * left out, all listeners will be returned             * @return {Object} the listener. Contains the following fields:             * &nbsp;&nbsp;type:   (string)   the type of event             * &nbsp;&nbsp;fn:     (function) the callback supplied to addListener             * &nbsp;&nbsp;obj:    (object)   the custom object supplied to addListener             * &nbsp;&nbsp;adjust: (boolean)  whether or not to adjust the default scope             * &nbsp;&nbsp;index:  (int)      its position in the Event util listener cache             * @static             */                       getListeners: function(el, sType) {                var results=[], searchLists;                if (!sType) {                    searchLists = [listeners, unloadListeners];                } else if (sType == "unload") {                    searchLists = [unloadListeners];                } else {                    searchLists = [listeners];                }                for (var j=0;j<searchLists.length; ++j) {                    var searchList = searchLists[j];                    if (searchList && searchList.length > 0) {                        for (var i=0,len=searchList.length; i<len ; ++i) {                            var l = searchList[i];                            if ( l  && l[this.EL] === el &&                                     (!sType || sType === l[this.TYPE]) ) {                                results.push({                                    type:   l[this.TYPE],                                    fn:     l[this.FN],                                    obj:    l[this.OBJ],                                    adjust: l[this.ADJ_SCOPE],                                    index:  i                                });                            }                        }                    }                }                return (results.length) ? results : null;            },            /**             * Removes all listeners registered by pe.event.  Called              * automatically during the unload event.             * @method _unload             * @static             * @private             */            _unload: function(e) {                var EU = YAHOO.util.Event, i, j, l, len, index;                for (i=0,len=unloadListeners.length; i<len; ++i) {                    l = unloadListeners[i];                    if (l) {                        var scope = window;                        if (l[EU.ADJ_SCOPE]) {                            if (l[EU.ADJ_SCOPE] === true) {                                scope = l[EU.OBJ];                            } else {                                scope = l[EU.ADJ_SCOPE];                            }                        }                        l[EU.FN].call(scope, EU.getEvent(e), l[EU.OBJ] );                        unloadListeners[i] = null;                        l=null;                        scope=null;                    }                }                unloadListeners = null;                if (listeners && listeners.length > 0) {                    j = listeners.length;                    while (j) {                        index = j-1;                        l = listeners[index];                        if (l) {                            EU.removeListener(l[EU.EL], l[EU.TYPE], l[EU.FN], index);                        }                         j = j - 1;                    }                    l=null;                    EU.clearCache();                }                for (i=0,len=legacyEvents.length; i<len; ++i) {                    // dereference the element                    //delete legacyEvents[i][0];                    legacyEvents[i][0] = null;                    // delete the array item                    //delete legacyEvents[i];                    legacyEvents[i] = null;                }                legacyEvents = null;                EU._simpleRemove(window, "unload", EU._unload);            },            /**             * Returns scrollLeft             * @method _getScrollLeft             * @static             * @private             */            _getScrollLeft: function() {                return this._getScroll()[1];            },            /**             * Returns scrollTop             * @method _getScrollTop             * @static             * @private             */            _getScrollTop: function() {                return this._getScroll()[0];            },            /**             * Returns the scrollTop and scrollLeft.  Used to calculate the              * pageX and pageY in Internet Explorer             * @method _getScroll             * @static             * @private             */            _getScroll: function() {                var dd = document.documentElement, db = document.body;                if (dd && (dd.scrollTop || dd.scrollLeft)) {                    return [dd.scrollTop, dd.scrollLeft];                } else if (db) {                    return [db.scrollTop, db.scrollLeft];                } else {                    return [0, 0];                }            },                        /**             * Used by old versions of CustomEvent, restored for backwards             * compatibility             * @method regCE             * @private             * @static             * @deprecated still here for backwards compatibility             */            regCE: function() {                // does nothing            },            /**             * Adds a DOM event directly without the caching, cleanup, scope adj, etc             *             * @method _simpleAdd             * @param {HTMLElement} el      the element to bind the handler to             * @param {string}      sType   the type of event handler             * @param {function}    fn      the callback to invoke             * @param {boolen}      capture capture or bubble phase             * @static             * @private             */            _simpleAdd: function () {                if (window.addEventListener) {                    return function(el, sType, fn, capture) {                        el.addEventListener(sType, fn, (capture));                    };                } else if (window.attachEvent) {                    return function(el, sType, fn, capture) {                        el.attachEvent("on" + sType, fn);                    };                } else {                    return function(){};                }            }(),            /**             * Basic remove listener             *             * @method _simpleRemove             * @param {HTMLElement} el      the element to bind the handler to             * @param {string}      sType   the type of event handler             * @param {function}    fn      the callback to invoke             * @param {boolen}      capture capture or bubble phase             * @static             * @private             */            _simpleRemove: function() {                if (window.removeEventListener) {                    return function (el, sType, fn, capture) {                        el.removeEventListener(sType, fn, (capture));                    };                } else if (window.detachEvent) {                    return function (el, sType, fn) {                        el.detachEvent("on" + sType, fn);                    };                } else {                    return function(){};                }            }()        };    }();    (function() {        var EU = YAHOO.util.Event;        /**         * YAHOO.util.Event.on is an alias for addListener         * @method on         * @see addListener         * @static         */        EU.on = EU.addListener;        /////////////////////////////////////////////////////////////        // DOMReady        // based on work by: Dean Edwards/John Resig/Matthias Miller         // Internet Explorer: use the readyState of a defered script.        // This isolates what appears to be a safe moment to manipulate        // the DOM prior to when the document's readyState suggests        // it is safe to do so.        if (EU.isIE) {            // Process onAvailable/onContentReady items when when the             // DOM is ready.            YAHOO.util.Event.onDOMReady(                    YAHOO.util.Event._tryPreloadAttach,                    YAHOO.util.Event, true);            var el, d=document, b=d.body;            // If the library is being injected after window.onload, it            // is not safe to document.write the script tag.  Detecting            // this state doesn't appear possible, so we expect a flag            // in YAHOO_config to be set if the library is being injected.            if (("undefined" !== typeof YAHOO_config) && YAHOO_config.injecting) {                //var dr = d.readyState;                //if ("complete" === dr || "interactive" === dr) {                    //YAHOO.util.Event._ready();                    //YAHOO.util.Event._tryPreloadAttach();                //} else {                    el = document.createElement("script");                    var p=d.getElementsByTagName("head")[0] || b;                    p.insertBefore(el, p.firstChild);                //}            } else {    d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');                el=document.getElementById("_yui_eu_dr");            }                        if (el) {                el.onreadystatechange = function() {                    if ("complete" === this.readyState) {                        this.parentNode.removeChild(this);                        YAHOO.util.Event._ready();                    }                };            } else {    

⌨️ 快捷键说明

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