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

📄 hostenv_adobesvg.js

📁 一个简单的AJAX图书展示平台
💻 JS
📖 第 1 页 / 共 2 页
字号:
/*	Copyright (c) 2004-2006, The Dojo Foundation	All Rights Reserved.	Licensed under the Academic Free License version 2.1 or above OR the	modified BSD license. For more information on Dojo licensing, see:		http://dojotoolkit.org/community/licensing.shtml*//* * Adobe SVG Viewer host environment */if(typeof window == 'undefined'){	dojo.raise("attempt to use adobe svg hostenv when no window object");}with(dojo.render){	name = navigator.appName;	ver = parseFloat(navigator.appVersion, 10);	switch(navigator.platform){		case "MacOS":			os.osx =  true;			break;		case "Linux":			os.linux =  true;			break;		case "Windows":			os.win =  true;			break;		default:			os.linux = true;			break;	};	svg.capable = true;	svg.support.builtin = true;	svg.adobe = true;};// browserEval("alert(window.location);");dojo.hostenv.println = function(s){	try{    // FIXME: this may not work with adobe's viewer, as we may first need a 		// reference to the svgDocument		// FIXME: need a way to determine where to position the text for this    var ti = document.createElement("text");    ti.setAttribute("x","50");		var yPos = 25 + 15*document.getElementsByTagName("text").length;    ti.setAttribute("y",yPos);		var tn = document.createTextNode(s);		ti.appendChild(tn);		document.documentElement.appendChild(ti);	}catch(e){	}}dojo.debug = function() {	if (!djConfig.isDebug) { return; }	var args = arguments;	if(typeof dojo.hostenv.println != 'function'){		dojo.raise("attempt to call dojo.debug when there is no dojo.hostenv println implementation (yet?)");	}	var isJUM = dj_global["jum"];	var s = isJUM ? "": "DEBUG: ";	for(var i=0;i<args.length;++i){ s += args[i]; }	if(isJUM){ // this seems to be the only way to get JUM to "play nice"		jum.debug(s);	}else{		dojo.hostenv.println(s);	}}dojo.hostenv.startPackage("dojo.hostenv");dojo.hostenv.name_ = 'adobesvg';dojo.hostenv.anonCtr = 0;dojo.hostenv.anon = {};dojo.hostenv.nameAnonFunc = function(anonFuncPtr, namespaceObj){	var ret = "_"+this.anonCtr++;	var nso = (namespaceObj || this.anon);	while(typeof nso[ret] != "undefined"){		ret = "_"+this.anonCtr++;	}	nso[ret] = anonFuncPtr;	return ret;}dojo.hostenv.modulesLoadedFired = false;dojo.hostenv.modulesLoadedListeners = [];dojo.hostenv.getTextStack = [];dojo.hostenv.loadUriStack = [];dojo.hostenv.loadedUris = [];dojo.hostenv.modulesLoaded = function(){	if(this.modulesLoadedFired){ return; }	if((this.loadUriStack.length==0)&&(this.getTextStack.length==0)){		if(this.inFlightCount > 0){ 			dojo.debug("couldn't initialize, there are files still in flight");			return;		}		this.modulesLoadedFired = true;		var mll = this.modulesLoadedListeners;		for(var x=0; x<mll.length; x++){			mll[x]();		}	}}dojo.hostenv.getNewAnonFunc = function(){	var ret = "_"+this.anonCtr++;	while(typeof this.anon[ret] != "undefined"){		ret = "_"+this.anonCtr++;	}	// this.anon[ret] = function(){};	eval("dojo.nostenv.anon."+ret+" = function(){};");	return [ret, this.anon[ret]];}dojo.hostenv.displayStack = function(){	var oa = [];	var stack = this.loadUriStack;	for(var x=0; x<stack.length; x++){		oa.unshift([stack[x][0], (typeof stack[x][2])]);	}	dojo.debug("<pre>"+oa.join("\n")+"</pre>");}dojo.hostenv.unwindUriStack = function(){	var stack = this.loadUriStack;	for(var x in dojo.hostenv.loadedUris){		for(var y=stack.length-1; y>=0; y--){			if(stack[y][0]==x){				stack.splice(y, 1);			}		}	}	var next = stack.pop();	if((!next)&&(stack.length==0)){ 		return;	}	for(var x=0; x<stack.length; x++){		if((stack[x][0]==next[0])&&(stack[x][2])){			next[2] == stack[x][2]		}	}	var last = next;	while(dojo.hostenv.loadedUris[next[0]]){		last = next;		next = stack.pop();	}	while(typeof next[2] == "string"){ // unwind as far as we can		try{			// dojo.debug("<pre><![CDATA["+next[2]+"]]></pre>");			dj_eval(next[2]);			next[1](true);		}catch(e){			dojo.debug("we got an error when loading "+next[0]);			dojo.debug("error: "+e);			// for(var x in e){ alert(x+" "+e[x]); }		}		dojo.hostenv.loadedUris[next[0]] = true;		dojo.hostenv.loadedUris.push(next[0]);		last = next;		next = stack.pop();		if((!next)&&(stack.length==0)){ break; }		while(dojo.hostenv.loadedUris[next[0]]){			last = next;			next = stack.pop();		}	}	if(next){		stack.push(next);		dojo.debug("### CHOKED ON: "+next[0]);	}}/** * Reads the contents of the URI, and evaluates the contents. * Returns true if it succeeded. Returns false if the URI reading failed. Throws if the evaluation throws. * The result of the eval is not available to the caller. */dojo.hostenv.loadUri = function(uri, cb){	if(dojo.hostenv.loadedUris[uri]){		return;	}	var stack = this.loadUriStack;	stack.push([uri, cb, null]);	var tcb = function(contents){		// gratuitous hack for Adobe SVG 3, what a fucking POS		if(contents.content){			contents = contents.content;		}		// stack management		var next = stack.pop();		if((!next)&&(stack.length==0)){ 			dojo.hostenv.modulesLoaded();			return;		}		if(typeof contents == "string"){			stack.push(next);			for(var x=0; x<stack.length; x++){				if(stack[x][0]==uri){					stack[x][2] = contents;				}			}			next = stack.pop();		}		if(dojo.hostenv.loadedUris[next[0]]){ 			// dojo.debug("WE ALREADY HAD: "+next[0]);			dojo.hostenv.unwindUriStack();			return;		}		// push back onto stack		stack.push(next);		if(next[0]!=uri){			//  and then unwind as far as we can			if(typeof next[2] == "string"){				dojo.hostenv.unwindUriStack();			}		}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);}/** * Reads the contents of the URI, and evaluates the contents. * Returns true if it succeeded. Returns false if the URI reading failed. Throws if the evaluation throws. * The result of the eval is not available to the caller. */dojo.hostenv.loadUri = function(uri, cb){	if(dojo.hostenv.loadedUris[uri]){		return;	}	var stack = this.loadUriStack;	stack.push([uri, cb, null]);	var tcb = function(contents){		// gratuitous hack for Adobe SVG 3, what a fucking POS		if(contents.content){			contents = contents.content;		}		// stack management		var next = stack.pop();		if((!next)&&(stack.length==0)){ 			dojo.hostenv.modulesLoaded();			return;		}		if(typeof contents == "string"){			stack.push(next);			for(var x=0; x<stack.length; x++){				if(stack[x][0]==uri){					stack[x][2] = contents;				}			}			next = stack.pop();		}		if(dojo.hostenv.loadedUris[next[0]]){ 			// dojo.debug("WE ALREADY HAD: "+next[0]);			dojo.hostenv.unwindUriStack();			return;		}		// push back onto stack		stack.push(next);		if(next[0]!=uri){			//  and then unwind as far as we can			if(typeof next[2] == "string"){				dojo.hostenv.unwindUriStack();			}

⌨️ 快捷键说明

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