summaryrefslogtreecommitdiffstatshomepage
path: root/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
diff options
context:
space:
mode:
authorAndrew Nacin <nacin@git.wordpress.org>2013-08-07 05:25:25 +0000
committerAndrew Nacin <nacin@git.wordpress.org>2013-08-07 05:25:25 +0000
commitb43712e0f79a9f5bea52217e06155e2f471c490c (patch)
tree23d331e7b2f29689571f03cfa5f9b7b3b6cafab8 /src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
parent5bbd08e1d17079a2e852517351f7405884a156b3 (diff)
downloadwordpress-b43712e0f79a9f5bea52217e06155e2f471c490c.tar.gz
wordpress-b43712e0f79a9f5bea52217e06155e2f471c490c.zip
New develop.svn.wordpress.org repository based on the old core.svn repository.
* All WordPress files move to a src/ directory. * New task runner (Grunt), configured to copy a built WordPress to build/. * svn:ignore and .gitignore for Gruntfile.js, wp-config.php, and node.js. * Remove Akismet external from develop.svn. Still exists in core.svn. * Drop minified files from src/. The build process will now generate these. props koop. see #24976. and see http://wp.me/p2AvED-1AI. git-svn-id: https://develop.svn.wordpress.org/trunk@25001 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js')
-rw-r--r--src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js b/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
new file mode 100644
index 0000000000..cb7aa8043d
--- /dev/null
+++ b/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
@@ -0,0 +1,105 @@
+/*
+ SWFUpload.SWFObject Plugin
+
+ Summary:
+ This plugin uses SWFObject to embed SWFUpload dynamically in the page. SWFObject provides accurate Flash Player detection and DOM Ready loading.
+ This plugin replaces the Graceful Degradation plugin.
+
+ Features:
+ * swfupload_load_failed_hander event
+ * swfupload_pre_load_handler event
+ * minimum_flash_version setting (default: "9.0.28")
+ * SWFUpload.onload event for early loading
+
+ Usage:
+ Provide handlers and settings as needed. When using the SWFUpload.SWFObject plugin you should initialize SWFUploading
+ in SWFUpload.onload rather than in window.onload. When initialized this way SWFUpload can load earlier preventing the UI flicker
+ that was seen using the Graceful Degradation plugin.
+
+ <script type="text/javascript">
+ var swfu;
+ SWFUpload.onload = function () {
+ swfu = new SWFUpload({
+ minimum_flash_version: "9.0.28",
+ swfupload_pre_load_handler: swfuploadPreLoad,
+ swfupload_load_failed_handler: swfuploadLoadFailed
+ });
+ };
+ </script>
+
+ Notes:
+ You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8.
+ The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met. Other issues such as missing SWF files, browser bugs
+ or corrupt Flash Player installations will not trigger this event.
+ The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found. It does not wait for SWFUpload to load and can
+ be used to prepare the SWFUploadUI and hide alternate content.
+ swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser.
+ Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made.
+*/
+
+
+// SWFObject v2.1 must be loaded
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+ SWFUpload.onload = function () {};
+
+ swfobject.addDomLoadEvent(function () {
+ if (typeof(SWFUpload.onload) === "function") {
+ setTimeout(function(){SWFUpload.onload.call(window);}, 200);
+ }
+ });
+
+ SWFUpload.prototype.initSettings = (function (oldInitSettings) {
+ return function () {
+ if (typeof(oldInitSettings) === "function") {
+ oldInitSettings.call(this);
+ }
+
+ this.ensureDefault = function (settingName, defaultValue) {
+ this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
+ };
+
+ this.ensureDefault("minimum_flash_version", "9.0.28");
+ this.ensureDefault("swfupload_pre_load_handler", null);
+ this.ensureDefault("swfupload_load_failed_handler", null);
+
+ delete this.ensureDefault;
+
+ };
+ })(SWFUpload.prototype.initSettings);
+
+
+ SWFUpload.prototype.loadFlash = function (oldLoadFlash) {
+ return function () {
+ var hasFlash = swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version);
+
+ if (hasFlash) {
+ this.queueEvent("swfupload_pre_load_handler");
+ if (typeof(oldLoadFlash) === "function") {
+ oldLoadFlash.call(this);
+ }
+ } else {
+ this.queueEvent("swfupload_load_failed_handler");
+ }
+ };
+
+ }(SWFUpload.prototype.loadFlash);
+
+ SWFUpload.prototype.displayDebugInfo = function (oldDisplayDebugInfo) {
+ return function () {
+ if (typeof(oldDisplayDebugInfo) === "function") {
+ oldDisplayDebugInfo.call(this);
+ }
+
+ this.debug(
+ [
+ "SWFUpload.SWFObject Plugin settings:", "\n",
+ "\t", "minimum_flash_version: ", this.settings.minimum_flash_version, "\n",
+ "\t", "swfupload_pre_load_handler assigned: ", (typeof(this.settings.swfupload_pre_load_handler) === "function").toString(), "\n",
+ "\t", "swfupload_load_failed_handler assigned: ", (typeof(this.settings.swfupload_load_failed_handler) === "function").toString(), "\n",
+ ].join("")
+ );
+ };
+ }(SWFUpload.prototype.displayDebugInfo);
+}