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

📄 swfupload.js

📁 WordPress是一个Blog程序,用它你可以架设完全属于你自己的Blog. 而WordPress现在的应用又不仅仅只是在Blog方面,因为其强大的扩展性,部分网站甚至已经开始使用WordPress
💻 JS
📖 第 1 页 / 共 3 页
字号:
		// Make sure Flash is done before we try to remove it		this.stopUpload();				// Remove the SWFUpload DOM nodes		var movieElement = null;		try {			movieElement = this.getMovieElement();		} catch (ex) {		}				if (movieElement != undefined && movieElement.parentNode != undefined && typeof movieElement.parentNode.removeChild === "function") {			var container = movieElement.parentNode;			if (container != undefined) {				container.removeChild(movieElement);				if (container.parentNode != undefined && typeof container.parentNode.removeChild === "function") {					container.parentNode.removeChild(container);				}			}		}				// Destroy references		SWFUpload.instances[this.movieName] = null;		delete SWFUpload.instances[this.movieName];		delete this.movieElement;		delete this.settings;		delete this.customSettings;		delete this.eventQueue;		delete this.movieName;				delete window[this.movieName];				return true;	} catch (ex1) {		return false;	}};// Public: displayDebugInfo prints out settings and configuration// information about this SWFUpload instance.// This function (and any references to it) can be deleted when placing// SWFUpload in production.SWFUpload.prototype.displayDebugInfo = function () {	this.debug(		[			"---SWFUpload Instance Info---\n",			"Version: ", SWFUpload.version, "\n",			"Movie Name: ", this.movieName, "\n",			"Settings:\n",			"\t", "upload_url:               ", this.settings.upload_url, "\n",			"\t", "flash_url:                ", this.settings.flash_url, "\n",			"\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",			"\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",			"\t", "http_success:             ", this.settings.http_success.join(", "), "\n",			"\t", "file_post_name:           ", this.settings.file_post_name, "\n",			"\t", "post_params:              ", this.settings.post_params.toString(), "\n",			"\t", "file_types:               ", this.settings.file_types, "\n",			"\t", "file_types_description:   ", this.settings.file_types_description, "\n",			"\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",			"\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",			"\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",			"\t", "debug:                    ", this.settings.debug.toString(), "\n",			"\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",			"\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",			"\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",			"\t", "button_width:             ", this.settings.button_width.toString(), "\n",			"\t", "button_height:            ", this.settings.button_height.toString(), "\n",			"\t", "button_text:              ", this.settings.button_text.toString(), "\n",			"\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",			"\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",			"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",			"\t", "button_action:            ", this.settings.button_action.toString(), "\n",			"\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",			"\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",			"Event Handlers:\n",			"\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",			"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",			"\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",			"\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",			"\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",			"\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",			"\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",			"\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",			"\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",			"\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"		].join("")	);};/* Note: addSetting and getSetting are no longer used by SWFUpload but are included	the maintain v2 API compatibility*/// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.SWFUpload.prototype.addSetting = function (name, value, default_value) {    if (value == undefined) {        return (this.settings[name] = default_value);    } else {        return (this.settings[name] = value);	}};// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.SWFUpload.prototype.getSetting = function (name) {    if (this.settings[name] != undefined) {        return this.settings[name];	}    return "";};// Private: callFlash handles function calls made to the Flash element.// Calls are made with a setTimeout for some functions to work around// bugs in the ExternalInterface library.SWFUpload.prototype.callFlash = function (functionName, argumentArray) {	argumentArray = argumentArray || [];		var movieElement = this.getMovieElement();	var returnValue;	if (typeof movieElement[functionName] === "function") {		// We have to go through all this if/else stuff because the Flash functions don't have apply() and only accept the exact number of arguments.		if (argumentArray.length === 0) {			returnValue = movieElement[functionName]();		} else if (argumentArray.length === 1) {			returnValue = movieElement[functionName](argumentArray[0]);		} else if (argumentArray.length === 2) {			returnValue = movieElement[functionName](argumentArray[0], argumentArray[1]);		} else if (argumentArray.length === 3) {			returnValue = movieElement[functionName](argumentArray[0], argumentArray[1], argumentArray[2]);		} else {			throw "Too many arguments";		}				// Unescape file post param values		if (returnValue != undefined && typeof returnValue.post === "object") {			returnValue = this.unescapeFilePostParams(returnValue);		}				return returnValue;	} else {		throw "Invalid function name: " + functionName;	}};/* *****************************	-- Flash control methods --	Your UI should use these	to operate SWFUpload   ***************************** */// Public: selectFile causes a File Selection Dialog window to appear.  This// dialog only allows 1 file to be selected. WARNING: this function does not work in Flash Player 10SWFUpload.prototype.selectFile = function () {	this.callFlash("SelectFile");};// Public: selectFiles causes a File Selection Dialog window to appear/ This// dialog allows the user to select any number of files// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.// If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around// for this bug.  WARNING: this function does not work in Flash Player 10SWFUpload.prototype.selectFiles = function () {	this.callFlash("SelectFiles");};// Public: startUpload starts uploading the first file in the queue unless// the optional parameter 'fileID' specifies the ID SWFUpload.prototype.startUpload = function (fileID) {	this.callFlash("StartUpload", [fileID]);};// Public: cancelUpload cancels any queued file.  The fileID parameter may be the file ID or index.// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {	if (triggerErrorEvent !== false) {		triggerErrorEvent = true;	}	this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);};// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.// If nothing is currently uploading then nothing happens.SWFUpload.prototype.stopUpload = function () {	this.callFlash("StopUpload");};/* ************************ * Settings methods *   These methods change the SWFUpload settings. *   SWFUpload settings should not be changed directly on the settings object *   since many of the settings need to be passed to Flash in order to take *   effect. * *********************** */// Public: getStats gets the file statistics object.SWFUpload.prototype.getStats = function () {	return this.callFlash("GetStats");};// Public: setStats changes the SWFUpload statistics.  You shouldn't need to // change the statistics but you can.  Changing the statistics does not// affect SWFUpload accept for the successful_uploads count which is used// by the upload_limit setting to determine how many files the user may upload.SWFUpload.prototype.setStats = function (statsObject) {	this.callFlash("SetStats", [statsObject]);};// Public: getFile retrieves a File object by ID or Index.  If the file is// not found then 'null' is returned.SWFUpload.prototype.getFile = function (fileID) {	if (typeof(fileID) === "number") {		return this.callFlash("GetFileByIndex", [fileID]);	} else {		return this.callFlash("GetFile", [fileID]);	}};// Public: addFileParam sets a name/value pair that will be posted with the// file specified by the Files ID.  If the name already exists then the// exiting value will be overwritten.SWFUpload.prototype.addFileParam = function (fileID, name, value) {	return this.callFlash("AddFileParam", [fileID, name, value]);};// Public: removeFileParam removes a previously set (by addFileParam) name/value// pair from the specified file.SWFUpload.prototype.removeFileParam = function (fileID, name) {	this.callFlash("RemoveFileParam", [fileID, name]);};// Public: setUploadUrl changes the upload_url setting.SWFUpload.prototype.setUploadURL = function (url) {	this.settings.upload_url = url.toString();	this.callFlash("SetUploadURL", [url]);};// Public: setPostParams changes the post_params settingSWFUpload.prototype.setPostParams = function (paramsObject) {	this.settings.post_params = paramsObject;	this.callFlash("SetPostParams", [paramsObject]);};// Public: addPostParam adds post name/value pair.  Each name can have only one value.SWFUpload.prototype.addPostParam = function (name, value) {	this.settings.post_params[name] = value;	this.callFlash("SetPostParams", [this.settings.post_params]);};// Public: removePostParam deletes post name/value pair.SWFUpload.prototype.removePostParam = function (name) {	delete this.settings.post_params[name];	this.callFlash("SetPostParams", [this.settings.post_params]);};// Public: setFileTypes changes the file_types setting and the file_types_description settingSWFUpload.prototype.setFileTypes = function (types, description) {	this.settings.file_types = types;	this.settings.file_types_description = description;	this.callFlash("SetFileTypes", [types, description]);};// Public: setFileSizeLimit changes the file_size_limit settingSWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {	this.settings.file_size_limit = fileSizeLimit;	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);};// Public: setFileUploadLimit changes the file_upload_limit settingSWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {	this.settings.file_upload_limit = fileUploadLimit;	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);};// Public: setFileQueueLimit changes the file_queue_limit settingSWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {	this.settings.file_queue_limit = fileQueueLimit;	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);};// Public: setFilePostName changes the file_post_name settingSWFUpload.prototype.setFilePostName = function (filePostName) {	this.settings.file_post_name = filePostName;	this.callFlash("SetFilePostName", [filePostName]);};// Public: setUseQueryString changes the use_query_string settingSWFUpload.prototype.setUseQueryString = function (useQueryString) {	this.settings.use_query_string = useQueryString;	this.callFlash("SetUseQueryString", [useQueryString]);};// Public: setRequeueOnError changes the requeue_on_error settingSWFUpload.prototype.setRequeueOnError = function (requeueOnError) {	this.settings.requeue_on_error = requeueOnError;	this.callFlash("SetRequeueOnError", [requeueOnError]);};// Public: setHTTPSuccess changes the http_success settingSWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {	if (typeof http_status_codes === "string") {		http_status_codes = http_status_codes.replace(" ", "").split(",");	}

⌨️ 快捷键说明

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