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

📄 ext.js

📁 ajax框架extjs是一套完整的富客户端解决方案
💻 JS
📖 第 1 页 / 共 3 页
字号:
         * @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).         * @return {Object} A literal with members         */        urlDecode : function(string, overwrite){            if(!string || !string.length){                return {};            }            var obj = {};            var pairs = string.split('&');            var pair, name, value;            for(var i = 0, len = pairs.length; i < len; i++){                pair = pairs[i].split('=');                name = decodeURIComponent(pair[0]);                value = decodeURIComponent(pair[1]);                if(overwrite !== true){                    if(typeof obj[name] == "undefined"){                        obj[name] = value;                    }else if(typeof obj[name] == "string"){                        obj[name] = [obj[name]];                        obj[name].push(value);                    }else{                        obj[name].push(value);                    }                }else{                    obj[name] = value;                }            }            return obj;        },        /**         * Iterates an array calling the passed function with each item, stopping if your function returns false. If the         * passed array is not really an array, your function is called once with it.         * The supplied function is called with (Object item, Number index, Array allItems).         * @param {Array/NodeList/Mixed} array         * @param {Function} fn         * @param {Object} scope         */        each : function(array, fn, scope){            if(typeof array.length == "undefined" || typeof array == "string"){                array = [array];            }            for(var i = 0, len = array.length; i < len; i++){                if(fn.call(scope || array[i], array[i], i, array) === false){ return i; };            }        },        // deprecated        combine : function(){            var as = arguments, l = as.length, r = [];            for(var i = 0; i < l; i++){                var a = as[i];                if(Ext.isArray(a)){                    r = r.concat(a);                }else if(a.length !== undefined && !a.substr){                    r = r.concat(Array.prototype.slice.call(a, 0));                }else{                    r.push(a);                }            }            return r;        },        /**         * Escapes the passed string for use in a regular expression         * @param {String} str         * @return {String}         */        escapeRe : function(s) {            return s.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");        },        // internal        callback : function(cb, scope, args, delay){            if(typeof cb == "function"){                if(delay){                    cb.defer(delay, scope, args || []);                }else{                    cb.apply(scope, args || []);                }            }        },        /**         * Return the dom node for the passed string (id), dom node, or Ext.Element         * @param {Mixed} el         * @return HTMLElement         */        getDom : function(el){            if(!el || !document){                return null;            }            return el.dom ? el.dom : (typeof el == 'string' ? document.getElementById(el) : el);        },        /**        * Returns the current HTML document object as an {@link Ext.Element}.        * @return Ext.Element The document        */        getDoc : function(){            return Ext.get(document);        },        /**        * Returns the current document body as an {@link Ext.Element}.        * @return Ext.Element The document body        */        getBody : function(){            return Ext.get(document.body || document.documentElement);        },        /**        * Shorthand for {@link Ext.ComponentMgr#get}        * @param {String} id        * @return Ext.Component        */        getCmp : function(id){            return Ext.ComponentMgr.get(id);        },        /**         * Utility method for validating that a value is numeric, returning the specified default value if it is not.         * @param {Mixed} value Should be a number, but any type will be handled appropriately         * @param {Number} defaultValue The value to return if the original value is non-numeric         * @return {Number} Value, if numeric, else defaultValue         */        num : function(v, defaultValue){            if(typeof v != 'number'){                return defaultValue;            }            return v;        },        /**         * Attempts to destroy any objects passed to it by removing all event listeners, removing them from the         * DOM (if applicable) and calling their destroy functions (if available).  This method is primarily         * intended for arguments of type {@link Ext.Element} and {@link Ext.Component}, but any subclass of         * {@link Ext.util.Observable} can be passed in.  Any number of elements and/or components can be         * passed into this function in a single call as separate arguments.         * @param {Mixed} arg1 An {@link Ext.Element} or {@link Ext.Component} to destroy         * @param {Mixed} arg2 (optional)         * @param {Mixed} etc... (optional)         */        destroy : function(){            for(var i = 0, a = arguments, len = a.length; i < len; i++) {                var as = a[i];                if(as){		            if(typeof as.destroy == 'function'){		                as.destroy();		            }		            else if(as.dom){		                as.removeAllListeners();		                as.remove();		            }                }            }        },        /**         * Removes a DOM node from the document.  The body node will be ignored if passed in.         * @param {HTMLElement} node The node to remove         */        removeNode : isIE ? function(){            var d;            return function(n){                if(n && n.tagName != 'BODY'){                    d = d || document.createElement('div');                    d.appendChild(n);                    d.innerHTML = '';                }            }        }() : function(n){            if(n && n.parentNode && n.tagName != 'BODY'){                n.parentNode.removeChild(n);            }        },        // inpired by a similar function in mootools library        /**         * Returns the type of object that is passed in. If the object passed in is null or undefined it         * return false otherwise it returns one of the following values:<ul>         * <li><b>string</b>: If the object passed is a string</li>         * <li><b>number</b>: If the object passed is a number</li>         * <li><b>boolean</b>: If the object passed is a boolean value</li>         * <li><b>function</b>: If the object passed is a function reference</li>         * <li><b>object</b>: If the object passed is an object</li>         * <li><b>array</b>: If the object passed is an array</li>         * <li><b>regexp</b>: If the object passed is a regular expression</li>         * <li><b>element</b>: If the object passed is a DOM Element</li>         * <li><b>nodelist</b>: If the object passed is a DOM NodeList</li>         * <li><b>textnode</b>: If the object passed is a DOM text node and contains something other than whitespace</li>         * <li><b>whitespace</b>: If the object passed is a DOM text node and contains only whitespace</li>         * @param {Mixed} object         * @return {String}         */        type : function(o){            if(o === undefined || o === null){                return false;            }            if(o.htmlElement){                return 'element';            }            var t = typeof o;            if(t == 'object' && o.nodeName) {                switch(o.nodeType) {                    case 1: return 'element';                    case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';                }            }            if(t == 'object' || t == 'function') {                switch(o.constructor) {                    case Array: return 'array';                    case RegExp: return 'regexp';                }                if(typeof o.length == 'number' && typeof o.item == 'function') {                    return 'nodelist';                }            }            return t;        },        /**         * Returns true if the passed value is null, undefined or an empty string (optional).         * @param {Mixed} value The value to test         * @param {Boolean} allowBlank (optional) Pass true if an empty string is not considered empty         * @return {Boolean}         */        isEmpty : function(v, allowBlank){            return v === null || v === undefined || (!allowBlank ? v === '' : false);        },        value : function(v, defaultValue, allowBlank){            return Ext.isEmpty(v, allowBlank) ? defaultValue : v;        },        /**         * Returns true if the passed object is a JavaScript array, otherwise false.         * @param {Object} The object to test         * @return {Boolean}         */		isArray : function(v){			return v && typeof v.length == 'number' && typeof v.splice == 'function';		},		/**         * Returns true if the passed object is a JavaScript date object, otherwise false.         * @param {Object} The object to test         * @return {Boolean}         */		isDate : function(v){			return v && typeof v.getFullYear == 'function';		},        /**         * True if the detected browser is Opera.         * @type Boolean         */        isOpera : isOpera,        /**         * True if the detected browser is Safari.         * @type Boolean         */        isSafari : isSafari,        /**         * True if the detected browser is Safari 3.x.         * @type Boolean         */        isSafari3 : isSafari3,        /**         * True if the detected browser is Safari 2.x.         * @type Boolean         */        isSafari2 : isSafari && !isSafari3,        /**         * True if the detected browser is Internet Explorer.         * @type Boolean         */        isIE : isIE,        /**         * True if the detected browser is Internet Explorer 6.x.         * @type Boolean         */        isIE6 : isIE && !isIE7,        /**         * True if the detected browser is Internet Explorer 7.x.         * @type Boolean         */        isIE7 : isIE7,        /**         * True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).         * @type Boolean         */        isGecko : isGecko,        /**         * True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).         * @type Boolean         */        isGecko2 : isGecko && !isGecko3,        /**         * True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).         * @type Boolean         */        isGecko3 : isGecko3,        /**         * True if the detected browser is Internet Explorer running in non-strict mode.         * @type Boolean         */        isBorderBox : isBorderBox,        /**         * True if the detected platform is Linux.         * @type Boolean         */        isLinux : isLinux,        /**         * True if the detected platform is Windows.         * @type Boolean         */        isWindows : isWindows,        /**         * True if the detected platform is Mac OS.         * @type Boolean         */        isMac : isMac,        /**         * True if the detected platform is Adobe Air.         * @type Boolean         */        isAir : isAir,	    /**	     * By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash,	     * you may want to set this to true.	     * @type Boolean	     */        useShims : ((isIE && !isIE7) || (isMac && isGecko && !isGecko3))    });    // in intellij using keyword "namespace" causes parsing errors    Ext.ns = Ext.namespace;})();Ext.ns("Ext", "Ext.util", "Ext.grid", "Ext.dd", "Ext.tree", "Ext.data",                "Ext.form", "Ext.menu", "Ext.state", "Ext.lib", "Ext.layout", "Ext.app", "Ext.ux");

⌨️ 快捷键说明

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