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

📄 airintrospector.js

📁 ext-2.3.0
💻 JS
📖 第 1 页 / 共 5 页
字号:
            	if(isNode1Number){            		return -1;            	}            	if(isNode2Number){            		return 1;            	}            	if(node1[0].toLowerCase()==node2[0].toLowerCase())                   return 0;                if(node1[0].toLowerCase()<node2[0].toLowerCase())                   return -1;                return 1;            });			if(list.length){				var prefix = '';				for(var i=level;i>0;i--) prefix+='    ';				var l = list.length;				var strList = [];				if(parseArray)	strList.push(prefix+'[\r\n');				else			strList.push(prefix+'{\r\n');				for(var i=0;i<l;i++){					try{						var zl = (list[i][0]+'').length+1;						var miniPrefix = '';						for(var j=0;j<zl;j++) miniPrefix+=' ';						if(typeof list[i][1]=='function'){							strList.push(prefix+'  '+list[i][0]+'=[function]\r\n');						}else if(air.Introspector.isDateObject(list[i][1])){							strList.push(prefix+'  '+list[i][0]+'='+(new Date(list[i][1])+'').replace(/\n/g, '\r\n'+prefix+miniPrefix)+',\r\n');						}else{							strList.push(prefix+'  '+list[i][0]+'='+(list[i][1]+'').replace(/\n/g, '\r\n'+prefix+miniPrefix)+'\r\n');						}					}catch(e){						strList.push(prefix+'  '+list[i][0]+'='+e+'\r\n');					}					if(level<levels){						strList.push(air.Introspector.dump(list[i][1], levels, level+1));					}				}				if(parseArray)	strList.push(prefix+']\r\n');				else			strList.push(prefix+'}\r\n');				if(level){					return strList.join('');				}else{					return (strList.join(''));				}			}        }catch(e){            air.Introspector.Console.error(e);        } 		return '';	},    /**	*	---------------------------------------------------------------------------------------	*	@extracted This is extracted from spry framework and removed support for other browsers.	*	@description Finds the precise position of the dom element node	*/   		/**	*	@function camelize	*	@description 	*/		camelize : function(stringToCamelize)            {                if (stringToCamelize.indexOf('-') == -1){                    return stringToCamelize;                    }                var oStringList = stringToCamelize.split('-');                var isFirstEntry = true;                var camelizedString = '';                            for(var i=0; i < oStringList.length; i++)                {                    if(oStringList[i].length>0)                    {                        if(isFirstEntry)                        {                            camelizedString = oStringList[i];                            isFirstEntry = false;                        }                        else                        {                            var s = oStringList[i];                            camelizedString += s.charAt(0).toUpperCase() + s.substring(1);                        }                    }                }                            return camelizedString;            },	/**	*	@function getStyleProp	*	@description 	*/	getStyleProp : function(element, prop)            {                var value;                try                {                    if (element.style)                        value = element.style[air.Introspector.camelize(prop)];                                if (!value)                    {                        if (document.defaultView && document.defaultView.getComputedStyle)                        {                            var css = document.defaultView.getComputedStyle(element, null);                            value = css ? css.getPropertyValue(prop) : null;                        }                        else if (element.currentStyle)                         {                                value = element.currentStyle[air.Introspector.camelize(prop)];                        }                    }                }                catch (e) {}                            return value == 'auto' ? null : value;            },   	/**	*	@function getIntProp	*	@description 	*/	getIntProp : function(element, prop){                var a = parseInt(air.Introspector.getStyleProp(element, prop),10);                if (isNaN(a))                    return 0;                return a;            },	/**	*	@function getBorderBox	*	@description 	*/	getBorderBox : function (el, doc) {                doc = doc || document;                if (typeof(el) == 'string') {                    el = doc.getElementById(el);                }                            if (!el) {                    return false;                }                            if (el.parentNode === null || air.Introspector.getStyleProp(el, 'display') == 'none') {                    //element must be visible to have a box                    return false;                }                            var ret = {x:0, y:0, width:0, height:0};                var parent = null;                var box;            	var str = el.nodeName;			                ret.x = el.offsetLeft;                ret.y = el.offsetTop;                ret.width = el.offsetWidth;                ret.height = el.offsetHeight;				parent = el.offsetParent;                if (parent != el) {                    while (parent) {                        ret.x += parent.offsetLeft;                        ret.y += parent.offsetTop;						str+=':'+parent.nodeName;                        parent = parent.offsetParent;                    }                }                var blw = air.Introspector.getIntProp(el, "border-left-width");                var btw = air.Introspector.getIntProp(el, "border-top-width");                ret.x -= blw;                ret.y -= btw;                // opera & (safari absolute) incorrectly account for body offsetTop                switch (air.Introspector.getStyleProp(el, 'position')){ 					case 'absolute':                    	ret.y -= doc.body.offsetTop;						break;					case 'fixed':	                    ret.y += doc.body.scrollTop;	                    ret.x += doc.body.scrollLeft;						break;				};                                    if (el.parentNode)                    parent = el.parentNode;                else                    parent = null;                				if (parent!=null&&parent.nodeName){                    var cas = parent.nodeName.toUpperCase();                    while (parent && cas != 'HTML') {                        cas = parent.nodeName.toUpperCase();                        ret.x -= parent.scrollLeft;                        ret.y -= parent.scrollTop;                        if (parent.parentNode)                            parent = parent.parentNode;                        else                            parent = null;                    }                }/*				ret.y -= el.ownerDocument.body.scrollTop;				ret.x -= el.ownerDocument.body.scrollLeft;				*/                // adjust the margin                var gi = air.Introspector.getIntProp;                var btw = gi(el, "margin-top");                var blw = gi(el, "margin-left");                var bbw = gi(el, "margin-bottom");                var brw = gi(el, "margin-right");                ret.x -= blw;                ret.y -= btw;                ret.height += btw + bbw;                ret.width += blw + brw;			//	air.Introspector.Console.log(ret);                return ret;            },	/**	*	---------------------------------------------------------------------------------------	*/	/**	*	@function writeConfigFile	*	@description 	*/	writeConfigFile: function(config, fromRemoteSandbox){		if(isAppSandbox){			var file = runtime.flash.filesystem.File.applicationStorageDirectory.resolvePath('AIRIntrospector'+(fromRemoteSandbox?'Remote':'')+'.cfg');			var fs = new runtime.flash.filesystem.FileStream();			fs.open(file, runtime.flash.filesystem.FileMode.WRITE);			fs.writeObject(config);			fs.close();		}else{			if(typeof activeWindow=='undefined'){				air.Introspector.noBridge(function(){					parentSandboxBridge.air_Introspector_writeConfigFile(config);				});			}else{				activeWindow.setTimeout(function(){					activeWindow.air.Introspector.writeConfigFile(config);					}, 0);			}		}	},	/**	*	@function readConfigFile	*	@description 	*/	readConfigFile: function (fromRemoteSandbox, callback){		if(isAppSandbox){			var file = runtime.flash.filesystem.File.applicationStorageDirectory.resolvePath('AIRIntrospector'+(fromRemoteSandbox?'Remote':'')+'.cfg');			if(file.exists){				var fs = new runtime.flash.filesystem.FileStream();				fs.open(file, runtime.flash.filesystem.FileMode.READ);				var config = fs.readObject();				fs.close();				return config;			}		}else{			if(typeof activeWindow=='undefined'){				air.Introspector.noBridge(function(){					var config = parentSandboxBridge.air_Introspector_readConfigFile();					callback(config);				});							}else{				activeWindow.setTimeout(function(){					if(typeof activeWindow!='undefined'){						var config = activeWindow.air.Introspector.readConfigFile(true, function(config){							setTimeout(function(){ callback(config); });													});					}				});			}		}		return {};	},				/**	*	@function writeConsoleToClipboard	*	@description 	*/	writeConsoleToClipboard: function(str){		if(isAppSandbox){					runtime.flash.desktop.Clipboard.generalClipboard.clear();			runtime.flash.desktop.Clipboard.generalClipboard.setData(runtime.flash.desktop.ClipboardFormats.TEXT_FORMAT, 					str, false);				}else{			if(typeof activeWindow=='undefined'){				air.Introspector.noBridge(function(){					parentSandboxBridge.air_Introspector_writeConsoleToClipboard(str);				});							}else{				activeWindow.setTimeout(function(){					activeWindow.air.Introspector.writeConsoleToClipboard(str);				});			}		}	},		/**	*	@function writeConsoleToFile	*	@description 	*/	writeConsoleToFile: function(str){		if(isAppSandbox){					var file = runtime.flash.filesystem.File.desktopDirectory;			var self = this;			file.addEventListener(runtime.flash.events.Event.SELECT, function(evt){ 				var newFile = evt.target;  			    var stream = new runtime.flash.filesystem.FileStream();			        stream.open(newFile, runtime.flash.filesystem.FileMode.WRITE);			        stream.writeUTFBytes(str);			        stream.close();				});			file.browseForSave('Console dump file...');		}else{			if(typeof activeWindow=='undefined'){				air.Introspector.noBridge(function(){					parentSandboxBridge.air_Introspector_writeConsoleToFile(str);				});							}else{				activeWindow.setTimeout(function(){					activeWindow.air.Introspector.writeConsoleToFile(str);				});			}		}	},					/**	*	@function noBridge	*	@description Alerts the user that no parent sandbox bridge is installed 	*/	noBridge: function(callback){		try{			callback();			return;		}catch(e){			air.Introspector.bridgeCallbacks.push(callback);			air.Introspector.registerChildSandboxBridge();			setTimeout(function(){				throw { air_Introspector_setParentSandboxBridge: true, air_Introspector_version: air.Introspector.version , toString: function(){ return 'You need to include AIRIntrospector.js in your application sandbox.'; } };			}, 0);						}			},		/**	*	@function noChildBridge	*	@description Alerts the user that no child sandbox bridge is installed 	*/	noChildBridge: function(iframe){		if(!air.Introspector.secondBridgeTry){			var iframeStr = '';			if(typeof iframe!='undefined'){				iframeStr = " Check the following iframe [id: "+iframe.id+"]";			}			alert('Child sandbox bridge is not defined or has been rewritten. You need to include AIRIntrospector.js in child sandbox.'+iframeStr);						air.Introspector.secondBridgeTry = true;		}	},	});//-------------------------------------------------------------------------------------------------------------------------------------------------------air.Introspector.version = '1.5';})();air.Introspector.contentString = '<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DT

⌨️ 快捷键说明

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