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

📄 hostenv_adobesvg.js

📁 dojo与json创建无限级树的时候,当在父结点下添加了一个新结点,我怎么让父亲结点重新调用json加载一下子结点内容.
💻 JS
📖 第 1 页 / 共 2 页
字号:
		}else{			if(!contents){ 				next[1](false);			}else{				var deps = dojo.hostenv.getDepsForEval(next[2]);				if(deps.length>0){					eval(deps.join(";"));				}else{					dojo.hostenv.unwindUriStack();				}			}		}	}	this.getText(uri, tcb, true);}/*** loadModule("A.B") first checks to see if symbol A.B is defined. * If it is, it is simply returned (nothing to do).* If it is not defined, it will look for "A/B.js" in the script root directory, followed* by "A.js".* It throws if it cannot find a file to load, or if the symbol A.B is not defined after loading.* It returns the object A.B.** This does nothing about importing symbols into the current package.* It is presumed that the caller will take care of that. For example, to import* all symbols:**    with (dojo.hostenv.loadModule("A.B")) {*       ...*    }** And to import just the leaf symbol:**    var B = dojo.hostenv.loadModule("A.B");*    ...** dj_load is an alias for dojo.hostenv.loadModule*/dojo.hostenv.loadModule = function(modulename, exact_only, omit_module_check){	// alert("dojo.hostenv.loadModule('"+modulename+"');");	var module = this.findModule(modulename, 0);	if(module){		return module;	}	// dojo.debug("dojo.hostenv.loadModule('"+modulename+"');");	// protect against infinite recursion from mutual dependencies	if (typeof this.loading_modules_[modulename] !== 'undefined'){		// NOTE: this should never throw an exception!! "recursive" includes		// are normal in the course of app and module building, so blow out of		// it gracefully, but log it in debug mode		// dojo.raise("recursive attempt to load module '" + modulename + "'");		dojo.debug("recursive attempt to load module '" + modulename + "'");	}else{		this.addedToLoadingCount.push(modulename);	}	this.loading_modules_[modulename] = 1;	// convert periods to slashes	var relpath = modulename.replace(/\./g, '/') + '.js';	var syms = modulename.split(".");	var nsyms = modulename.split(".");	if(syms[0]=="dojo"){ // FIXME: need a smarter way to do this!		syms[0] = "src"; 	}	var last = syms.pop();	syms.push(last);	// figure out if we're looking for a full package, if so, we want to do	// things slightly diffrently	var _this = this;	var pfn = this.pkgFileName;	if(last=="*"){		modulename = (nsyms.slice(0, -1)).join('.');		var module = this.findModule(modulename, 0);		// dojo.debug("found: "+modulename+"="+module);		if(module){			_this.removedFromLoadingCount.push(modulename);			return module;		}		var nextTry = function(lastStatus){			if(lastStatus){ 				module = _this.findModule(modulename, false); // pass in false so we can give better error				if((!module)&&(syms[syms.length-1]!=pfn)){					dojo.raise("Module symbol '" + modulename + "' is not defined after loading '" + relpath + "'"); 				}				if(module){					_this.removedFromLoadingCount.push(modulename);					dojo.hostenv.modulesLoaded();					return;				}			}			syms.pop();			syms.push(pfn);			// dojo.debug("syms: "+syms);			relpath = syms.join("/") + '.js';			if(relpath.charAt(0)=="/"){				relpath = relpath.slice(1);			}			// dojo.debug("relpath: "+relpath);			_this.loadPath(relpath, ((!omit_module_check) ? modulename : null), nextTry);		}		nextTry();	}else{		relpath = syms.join("/") + '.js';		modulename = nsyms.join('.');		var nextTry = function(lastStatus){			// dojo.debug("lastStatus: "+lastStatus);			if(lastStatus){ 				// dojo.debug("inital relpath: "+relpath);				module = _this.findModule(modulename, false); // pass in false so we can give better error				// if(!module){				if((!module)&&(syms[syms.length-1]!=pfn)){					dojo.raise("Module symbol '" + modulename + "' is not defined after loading '" + relpath + "'"); 				}				if(module){					_this.removedFromLoadingCount.push(modulename);					dojo.hostenv.modulesLoaded();					return;				}			}			var setPKG = (syms[syms.length-1]==pfn) ? false : true;			syms.pop();			if(setPKG){				syms.push(pfn);			}			relpath = syms.join("/") + '.js';			if(relpath.charAt(0)=="/"){				relpath = relpath.slice(1);			}			// dojo.debug("relpath: "+relpath);			_this.loadPath(relpath, ((!omit_module_check) ? modulename : null), nextTry);		}		this.loadPath(relpath, ((!omit_module_check) ? modulename : null), nextTry);	}	return;}/** * Read the contents of the specified uri and return those contents. * * FIXME: Make sure this is consistent with other implementations of getText * @param uri A relative or absolute uri. If absolute, it still must be in the same "domain" as we are. * @param async_cb If not specified, returns false as synchronous is not * supported. If specified, load asynchronously, and use async_cb as the handler which receives the result of the request. * @param fail_ok Default false. If fail_ok and !async_cb and loading fails, return null instead of throwing. */ dojo.hostenv.async_cb = null;dojo.hostenv.unWindGetTextStack = function(){	if(dojo.hostenv.inFlightCount>0){		setTimeout("dojo.hostenv.unWindGetTextStack()", 100);		return;	}	// we serialize because this goddamned environment is too fucked up	// to know how to do anything else	dojo.hostenv.inFlightCount++;	var next = dojo.hostenv.getTextStack.pop();	if((!next)&&(dojo.hostenv.getTextStack.length==0)){ 		dojo.hostenv.inFlightCount--;		dojo.hostenv.async_cb = function(){};		return;	}	dojo.hostenv.async_cb = next[1];	// http = window.getURL(uri, dojo.hostenv.anon[cbn]);	window.getURL(next[0], function(result){ 		dojo.hostenv.inFlightCount--;		dojo.hostenv.async_cb(result.content);		dojo.hostenv.unWindGetTextStack();	});}dojo.hostenv.getText = function(uri, async_cb, fail_ok){	// dojo.debug("Calling getText()");	try{		if(async_cb){			dojo.hostenv.getTextStack.push([uri, async_cb, fail_ok]);			dojo.hostenv.unWindGetTextStack();		}else{			return dojo.raise("No synchronous XMLHTTP implementation available, for uri " + uri);		}	}catch(e){		return dojo.raise("No XMLHTTP implementation available, for uri " + uri);	}}/** * Makes an async post to the specified uri. * * FIXME: Not sure that we need this, but adding for completeness. * More details about the implementation of this are available at  * http://wiki.svg.org/index.php/PostUrl * @param uri A relative or absolute uri. If absolute, it still must be in the same "domain" as we are. * @param async_cb If not specified, returns false as synchronous is not * supported. If specified, load asynchronously, and use async_cb as the progress handler which takes the xmlhttp object as its argument. If async_cb, this function returns null. * @param text Data to post * @param fail_ok Default false. If fail_ok and !async_cb and loading fails, return null instead of throwing. * @param mime_type optional MIME type of the posted data (such as "text/plain") * @param encoding optional encoding for data. null, 'gzip' and 'deflate' are possible values. If browser does not support binary post this parameter is ignored. */ dojo.hostenv.postText = function(uri, async_cb, text, fail_ok, mime_type, encoding){	var http = null;		var async_callback = function(httpResponse){		if (!httpResponse.success) {			dojo.raise("Request for uri '" + uri + "' resulted in " + httpResponse.status);		}				if(!httpResponse.content) {			if (!fail_ok) dojo.raise("Request for uri '" + uri + "' resulted in no content");			return null;		}		// FIXME: wtf, I'm losing a reference to async_cb		async_cb(httpResponse.content);	}		try {		if(async_cb) {			http = window.postURL(uri, text, async_callback, mimeType, encoding);		} else {		return dojo.raise("No synchronous XMLHTTP post implementation available, for uri " + uri);		}	} catch(e) {		return dojo.raise("No XMLHTTP post implementation available, for uri " + uri);	}}/* * It turns out that if we check *right now*, as this script file is being loaded, * then the last script element in the window DOM is ourselves. * That is because any subsequent script elements haven't shown up in the document * object yet. */function dj_last_script_src() {	var scripts = window.document.getElementsByTagName('script');	if(scripts.length < 1){ 		dojo.raise("No script elements in window.document, so can't figure out my script src"); 	}	var li = scripts.length-1;	var xlinkNS = "http://www.w3.org/1999/xlink";	var src = null;	var script = null;	while(!src){		script = scripts.item(li);		src = script.getAttributeNS(xlinkNS,"href");		li--;		if(li<0){ break; }		// break;	}	if(!src){		dojo.raise("Last script element (out of " + scripts.length + ") has no src");	}	return src;}if(!dojo.hostenv["library_script_uri_"]){	dojo.hostenv.library_script_uri_ = dj_last_script_src();}// dojo.hostenv.loadUri = function(uri){	/* FIXME: adding a script element doesn't seem to be synchronous, and so	 * checking for namespace or object existance after loadUri using this	 * method will error out. Need to figure out some other way of handling	 * this!	 */	/*	var se = document.createElement("script");	se.src = uri;	var head = document.getElementsByTagName("head")[0];	head.appendChild(se);	// document.write("<script type='text/javascript' src='"+uri+"' />");	return 1;}*/

⌨️ 快捷键说明

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