OSDN Git Service

NP_DragAndDropUploader v1.2
[nucleus-jp/nucleus-plugins.git] / trunk / NP_DragAndDropUploader / draganddropuploader / js / gears_init.js
diff --git a/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js b/trunk/NP_DragAndDropUploader/draganddropuploader/js/gears_init.js
new file mode 100644 (file)
index 0000000..fe9a8bd
--- /dev/null
@@ -0,0 +1,86 @@
+// Copyright 2007, Google Inc.\r
+//\r
+// Redistribution and use in source and binary forms, with or without\r
+// modification, are permitted provided that the following conditions are met:\r
+//\r
+//  1. Redistributions of source code must retain the above copyright notice,\r
+//     this list of conditions and the following disclaimer.\r
+//  2. Redistributions in binary form must reproduce the above copyright notice,\r
+//     this list of conditions and the following disclaimer in the documentation\r
+//     and/or other materials provided with the distribution.\r
+//  3. Neither the name of Google Inc. nor the names of its contributors may be\r
+//     used to endorse or promote products derived from this software without\r
+//     specific prior written permission.\r
+//\r
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED\r
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\r
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+// Sets up google.gears.*, which is *the only* supported way to access Gears.\r
+//\r
+// Circumvent this file at your own risk!\r
+//\r
+// In the future, Gears may automatically define google.gears.* without this\r
+// file. Gears may use these objects to transparently fix bugs and compatibility\r
+// issues. Applications that use the code below will continue to work seamlessly\r
+// when that happens.\r
+\r
+(function() {\r
+  // We are already defined. Hooray!\r
+  if (window.google && google.gears) {\r
+    return;\r
+  }\r
+\r
+  var factory = null;\r
+\r
+  // Firefox\r
+  if (typeof GearsFactory != 'undefined') {\r
+    factory = new GearsFactory();\r
+  } else {\r
+    // IE\r
+    try {\r
+      factory = new ActiveXObject('Gears.Factory');\r
+      // privateSetGlobalObject is only required and supported on WinCE.\r
+      if (factory.getBuildInfo().indexOf('ie_mobile') != -1) {\r
+        factory.privateSetGlobalObject(this);\r
+      }\r
+    } catch (e) {\r
+      // Safari\r
+      if ((typeof navigator.mimeTypes != 'undefined')\r
+           && navigator.mimeTypes["application/x-googlegears"]) {\r
+        factory = document.createElement("object");\r
+        factory.style.display = "none";\r
+        factory.width = 0;\r
+        factory.height = 0;\r
+        factory.type = "application/x-googlegears";\r
+        document.documentElement.appendChild(factory);\r
+      }\r
+    }\r
+  }\r
+\r
+  // *Do not* define any objects if Gears is not installed. This mimics the\r
+  // behavior of Gears defining the objects in the future.\r
+  if (!factory) {\r
+    return;\r
+  }\r
+\r
+  // Now set up the objects, being careful not to overwrite anything.\r
+  //\r
+  // Note: In Internet Explorer for Windows Mobile, you can't add properties to\r
+  // the window object. However, global objects are automatically added as\r
+  // properties of the window object in all browsers.\r
+  if (!window.google) {\r
+    google = {};\r
+  }\r
+\r
+  if (!google.gears) {\r
+    google.gears = {factory: factory};\r
+  }\r
+})();\r