CoreFiles by mySites.guru
swfupload.graceful_degradation.js64 lines, 2,639 bytes, from wordpress-2.6.zip
Raw History Compare with 2.5.1
md5
57901feb399ab92498cbe8ef193bf832
sha1
e3d175591b5ed9152f5c9027d6c9d519db866f97
sha256
65d99135faebe22026828481ec1ab1d7f91855120c11f26fc3851b3415bce363
/* 
	SWFUpload Graceful Degradation Plug-in

	This plugin allows SWFUpload to display only if it is loaded successfully.  Otherwise a default form is left displayed.
	
	Usage:
	
	To use this plugin create two HTML containers. Each should have an ID defined.  One container should hold the SWFUpload UI.  The other should hold the degraded UI.
	
	The SWFUpload container should have its CSS "display" property set to "none".
	
	If SWFUpload loads successfully the SWFUpload container will be displayed ("display" set to "block") and the
	degraded container will be hidden ("display" set to "none").
	
	Use the settings "swfupload_element_id" and "degraded_element_id" to indicate your container IDs.  The default values are "swfupload_container" and "degraded_container".
	
*/

var SWFUpload;
if (typeof(SWFUpload) === "function") {
	SWFUpload.gracefulDegradation = {};
	SWFUpload.prototype.initSettings = function (old_initSettings) {
		return function (init_settings) {
			if (typeof(old_initSettings) === "function") {
				old_initSettings.call(this, init_settings);
			}
			
			this.addSetting("swfupload_element_id",		  		init_settings.swfupload_element_id,				"swfupload_container");
			this.addSetting("degraded_element_id",		  		init_settings.degraded_element_id,				"degraded_container");
			this.addSetting("user_swfUploadLoaded_handler",		init_settings.swfupload_loaded_handler,			SWFUpload.swfUploadLoaded);

			this.swfUploadLoaded_handler = SWFUpload.gracefulDegradation.swfUploadLoaded;
		};
	}(SWFUpload.prototype.initSettings);

	SWFUpload.gracefulDegradation.swfUploadLoaded = function () {
		var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
		try {
			if (uploadDegradeOptions.is_lighttpd_before_150) throw "Lighttpd versions earlier than 1.5.0 aren't supported!";
			swfupload_element_id = this.getSetting("swfupload_element_id");
			degraded_element_id = this.getSetting("degraded_element_id");
			
			// Show the UI container
			swfupload_container = document.getElementById(swfupload_element_id);
			if (swfupload_container !== null) {
				swfupload_container.style.display = "block";

				// Now take care of hiding the degraded UI
				degraded_container = document.getElementById(degraded_element_id);
				if (degraded_container !== null) {
					degraded_container.style.display = "none";
				}
			}
		} catch (ex) {
			this.debug(ex);
		}
		
		user_swfUploadLoaded_handler = this.getSetting("user_swfUploadLoaded_handler");
		if (typeof(user_swfUploadLoaded_handler) === "function") {
			user_swfUploadLoaded_handler.apply(this);
		}
	};

}

The same content is in 25 releases, WordPress 2.5-RC2 to 2.8-beta1. See them all, or every version of this file.