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

📄 _base.js

📁 这是一个ajax的例子大家好好的看看就是一个鱼眼的效果
💻 JS
📖 第 1 页 / 共 2 页
字号:
				return "https";				break;			default:				return "http";				break;		}	},		write: function(/* Boolean? */ doExpressInstall){		// summary: Writes the Flash into the page.		// description:		//	This must be called before the page		//	is finished loading. 		// doExpressInstall: Boolean		//	Whether to write out Express Install		//	information. Optional value; defaults to false.				// determine our container div's styling		var containerStyle = "";		containerStyle += ("width: " + this.width + "px; ");		containerStyle += ("height: " + this.height + "px; ");		if(!this._visible){			containerStyle += "position: absolute; z-index: 10000; top: -1000px; left: -1000px; ";		}				// figure out the SWF file to get and how to write out the correct HTML		// for this Flash version		var objectHTML;		var swfloc = dojox.flash.url;		var swflocObject = swfloc;		var swflocEmbed = swfloc;		var dojoUrl = dojo.baseUrl;		if(doExpressInstall){			// the location to redirect to after installing			var redirectURL = escape(window.location);			document.title = document.title.slice(0, 47) + " - Flash Player Installation";			var docTitle = escape(document.title);			swflocObject += "?MMredirectURL=" + redirectURL			                + "&MMplayerType=ActiveX"			                + "&MMdoctitle=" + docTitle							+ "&baseUrl=" + escape(dojoUrl);			swflocEmbed += "?MMredirectURL=" + redirectURL 							+ "&MMplayerType=PlugIn"							+ "&baseUrl=" + escape(dojoUrl);		}else{		  // IE/Flash has an evil bug that shows up some time: if we load the		  // Flash and it isn't in the cache, ExternalInterface works fine --		  // however, the second time when its loaded from the cache a timing		  // bug can keep ExternalInterface from working. The trick below 		  // simply invalidates the Flash object in the cache all the time to		  // keep it loading fresh. -- Brad Neuberg		  swflocObject += "?cachebust=" + new Date().getTime();		}		if(swflocEmbed.indexOf("?") == -1){			swflocEmbed +=  '?baseUrl='+escape(dojoUrl);		}else{		  swflocEmbed +=  '&baseUrl='+escape(dojoUrl);		}		objectHTML =			'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '			  + 'codebase="'				+ this.protocol()				+ '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/'				+ 'swflash.cab#version=8,0,0,0"\n '			  + 'width="' + this.width + '"\n '			  + 'height="' + this.height + '"\n '			  + 'id="' + this.id + '"\n '			  + 'name="' + this.id + '"\n '			  + 'align="middle">\n '			  + '<param name="allowScriptAccess" value="sameDomain"></param>\n '			  + '<param name="movie" value="' + swflocObject + '"></param>\n '			  + '<param name="quality" value="high"></param>\n '			  + '<param name="bgcolor" value="#ffffff"></param>\n '			  + '<embed src="' + swflocEmbed + '" '			  	  + 'quality="high" '				  + 'bgcolor="#ffffff" '				  + 'width="' + this.width + '" '				  + 'height="' + this.height + '" '				  + 'id="' + this.id + 'Embed' + '" '				  + 'name="' + this.id + '" '				  + 'swLiveConnect="true" '				  + 'align="middle" '				  + 'allowScriptAccess="sameDomain" '				  + 'type="application/x-shockwave-flash" '				  + 'pluginspage="'				  + this.protocol()				  +'://www.macromedia.com/go/getflashplayer" '				  + '></embed>\n'			+ '</object>\n';							// using same mechanism on all browsers now to write out		// Flash object into page		// document.write no longer works correctly		// due to Eolas patent workaround in IE;		// nothing happens (i.e. object doesn't		// go into page if we use it)		dojo.connect(dojo, "loaded", dojo.hitch(this, function(){			var div = document.createElement("div");			div.setAttribute("id", this.id + "Container");			div.setAttribute("style", containerStyle);			div.innerHTML = objectHTML;				var body = document.getElementsByTagName("body");			if(!body || !body.length){				throw new Error("No body tag for this page");			}			body = body[0];			body.appendChild(div);		}));	},  		get: function(){ /* Object */		// summary: Gets the Flash object DOM node.		if(dojo.isIE || dojo.isSafari){			return document.getElementById(this.id);		}else{			// different IDs on OBJECT and EMBED tags or			// else Firefox will return wrong one and			// communication won't work; 			// also, document.getElementById() returns a			// plugin but ExternalInterface calls don't			// work on it so we have to use			// document[id] instead			return document[this.id + "Embed"];		}	},		setVisible: function(/* Boolean */ visible){	  //console.debug("setVisible, visible="+visible);				// summary: Sets the visibility of this Flash object.				var container = dojo.byId(this.id + "Container");		if(visible == true){		  container.style.position = "absolute"; // IE -- Brad Neuberg			container.style.visibility = "visible";		}else{			container.style.position = "absolute";			container.style.x = "-1000px";			container.style.y = "-1000px";			container.style.visibility = "hidden";		}	},		center: function(){		// summary: Centers the flash applet on the page.				var elementWidth = this.width;		var elementHeight = this.height;		var viewport = dijit.getViewport();		// compute the centered position    		var x = viewport.l + (viewport.w - elementWidth) / 2;		var y = viewport.t + (viewport.h - elementHeight) / 2; 				// set the centered position		var container = dojo.byId(this.id + "Container");		container.style.top = y + "px";		container.style.left = x + "px";	}};dojox.flash.Communicator = function(){	// summary:	//	A class that is used to communicate between Flash and JavaScript.	// description:	//	This class helps mediate Flash and JavaScript communication. Internally	//	it uses Flash 8's ExternalInterface API, but adds functionality to fix 	//	various encoding bugs that ExternalInterface has.}dojox.flash.Communicator.prototype = {	// Registers the existence of a Flash method that we can call with	// JavaScript, using Flash 8's ExternalInterface. 	_addExternalInterfaceCallback: function(methodName){		var wrapperCall = dojo.hitch(this, function(){			// some browsers don't like us changing values in the 'arguments' array, so			// make a fresh copy of it			var methodArgs = new Array(arguments.length);			for(var i = 0; i < arguments.length; i++){				methodArgs[i] = this._encodeData(arguments[i]);			}						var results = this._execFlash(methodName, methodArgs);			results = this._decodeData(results);						return results;		});				this[methodName] = wrapperCall;	},		// Encodes our data to get around ExternalInterface bugs that are still	// present even in Flash 9.	_encodeData: function(data){		if(!data || typeof data != "string"){			return data;		}				// double encode all entity values, or they will be mis-decoded		// by Flash when returned		var entityRE = /\&([^;]*)\;/g;		data = data.replace(entityRE, "&amp;$1;");		// entity encode XML-ish characters, or Flash's broken XML serializer		// breaks		data = data.replace(/</g, "&lt;");		data = data.replace(/>/g, "&gt;");		// transforming \ into \\ doesn't work; just use a custom encoding		data = data.replace("\\", "&custom_backslash;");		data = data.replace(/\0/g, "\\0"); // null character		data = data.replace(/\"/g, "&quot;");		return data;	},		// Decodes our data to get around ExternalInterface bugs that are still	// present even in Flash 9.	_decodeData: function(data){		// wierdly enough, Flash sometimes returns the result as an		// 'object' that is actually an array, rather than as a String;		// detect this by looking for a length property; for IE		// we also make sure that we aren't dealing with a typeof string		// since string objects have length property there		if(data && data.length && typeof data != "string"){			data = data[0];		}				if(!data || typeof data != "string"){			return data;		}			// certain XMLish characters break Flash's wire serialization for		// ExternalInterface; these are encoded on the 		// DojoExternalInterface side into a custom encoding, rather than		// the standard entity encoding, because otherwise we won't be able to		// differentiate between our own encoding and any entity characters		// that are being used in the string itself		data = data.replace(/\&custom_lt\;/g, "<");		data = data.replace(/\&custom_gt\;/g, ">");		data = data.replace(/\&custom_backslash\;/g, '\\');				// needed for IE; \0 is the NULL character		data = data.replace(/\\0/g, "\0");				return data;	},		// Executes a Flash method; called from the JavaScript wrapper proxy we	// create on dojox.flash.comm.	_execFlash: function(methodName, methodArgs){		var plugin = dojox.flash.obj.get();		methodArgs = (methodArgs) ? methodArgs : [];				// encode arguments that are strings		for(var i = 0; i < methodArgs; i++){			if(typeof methodArgs[i] == "string"){				methodArgs[i] = this._encodeData(methodArgs[i]);			}		}		// we use this gnarly hack below instead of 		// plugin[methodName] for two reasons:		// 1) plugin[methodName] has no call() method, which		// means we can't pass in multiple arguments dynamically		// to a Flash method -- we can only have one		// 2) On IE plugin[methodName] returns undefined -- 		// plugin[methodName] used to work on IE when we		// used document.write but doesn't now that		// we use dynamic DOM insertion of the Flash object		// -- Brad Neuberg		var flashExec = function(){ 			return eval(plugin.CallFunction(						 "<invoke name=\"" + methodName						+ "\" returntype=\"javascript\">" 						+ __flash__argumentsToXML(methodArgs, 0) 						+ "</invoke>")); 		};		var results = flashExec.call(methodArgs);				if(typeof results == "string"){			results = this._decodeData(results);		}					return results;	}}// FIXME: dojo.declare()-ify this// TODO: I did not test the Install code when I refactored Dojo Flash from 0.4 to // 1.0, so am not sure if it works. If Flash is not present I now prefer // that Gears is installed instead of Flash because GearsStorageProvider is// much easier to work with than Flash's hacky ExternalInteface. // -- Brad Neubergdojox.flash.Install = function(){	// summary: Helps install Flash plugin if needed.	// description:	//		Figures out the best way to automatically install the Flash plugin	//		for this browser and platform. Also determines if installation or	//		revving of the current plugin is needed on this platform.}dojox.flash.Install.prototype = {	needed: function(){ /* Boolean */		// summary:		//		Determines if installation or revving of the current plugin is		//		needed. 			// do we even have flash?		if(dojox.flash.info.capable == false){			return true;		}		// Must have ExternalInterface which came in Flash 8		if(!dojox.flash.info.isVersionOrAbove(8, 0, 0)){			return true;		}		// otherwise we don't need installation		return false;	},	install: function(){		// summary: Performs installation or revving of the Flash plugin.			// indicate that we are installing		dojox.flash.info.installing = true;		dojox.flash.installing();				if(dojox.flash.info.capable == false){ // we have no Flash at all			// write out a simple Flash object to force the browser to prompt			// the user to install things			var installObj = new dojox.flash.Embed(false);			installObj.write(); // write out HTML for Flash		}else if(dojox.flash.info.isVersionOrAbove(6, 0, 65)){ // Express Install			var installObj = new dojox.flash.Embed(false);			installObj.write(true); // write out HTML for Flash 8 version+			installObj.setVisible(true);			installObj.center();		}else{ // older Flash install than version 6r65			alert("This content requires a more recent version of the Macromedia "						+" Flash Player.");			window.location.href = + dojox.flash.Embed.protocol() +						"://www.macromedia.com/go/getflashplayer";		}	},		// Called when the Express Install is either finished, failed, or was	// rejected by the user.	_onInstallStatus: function(msg){		if (msg == "Download.Complete"){			// Installation is complete.			dojox.flash._initialize();		}else if(msg == "Download.Cancelled"){			alert("This content requires a more recent version of the Macromedia "						+" Flash Player.");			window.location.href = dojox.flash.Embed.protocol() +						"://www.macromedia.com/go/getflashplayer";		}else if (msg == "Download.Failed"){			// The end user failed to download the installer due to a network failure			alert("There was an error downloading the Flash Player update. "						+ "Please try again later, or visit macromedia.com to download "						+ "the latest version of the Flash plugin.");		}		}}// find out if Flash is installeddojox.flash.info = new dojox.flash.Info();// vim:ts=4:noet:tw=0:}

⌨️ 快捷键说明

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