Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / gears.html
1 <html>\r
2 <head>\r
3   <title>The source code</title>\r
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
6 </head>\r
7 <body  onload="prettyPrint();">\r
8     <pre class="prettyprint lang-js">// Copyright 2007 Google Inc. All Rights Reserved.\r
9 //\r
10 // Sets up google.gears.*, which is *the only* supported way to access Gears.\r
11 //\r
12 // Circumvent this file at your own risk!\r
13 //\r
14 // In the future, Gears may automatically define google.gears.* without this\r
15 // file. Gears may use these objects to transparently fix bugs and compatibility\r
16 // issues. Applications that use the code below will continue to work seamlessly\r
17 // when that happens.\r
18 \r
19 (function() {\r
20   // We are already defined. Hooray!\r
21   if (window.google && google.gears) {\r
22     return;\r
23   }\r
24 \r
25   var factory = null;\r
26 \r
27   // Firefox\r
28   if (typeof GearsFactory != 'undefined') {\r
29     factory = new GearsFactory();\r
30   } else {\r
31     // IE\r
32     try {\r
33       factory = new ActiveXObject('Gears.Factory');\r
34     } catch (e) {\r
35       // Safari\r
36       if (navigator.mimeTypes["application/x-googlegears"]) {\r
37         factory = document.createElement("object");\r
38         factory.style.display = "none";\r
39         factory.width = 0;\r
40         factory.height = 0;\r
41         factory.type = "application/x-googlegears";\r
42         document.documentElement.appendChild(factory);\r
43       }\r
44     }\r
45   }\r
46 \r
47   // *Do not* define any objects if Gears is not installed. This mimics the\r
48   // behavior of Gears defining the objects in the future.\r
49   if (!factory) {\r
50     return;\r
51   }\r
52 \r
53   // Now set up the objects, being careful not to overwrite anything.\r
54   if (!window.google) {\r
55     window.google = {};\r
56   }\r
57 \r
58   if (!google.gears) {\r
59     google.gears = {factory: factory};\r
60   }\r
61 })();\r
62 \r
63 if (!window.google || !google.gears) {\r
64     location.href = "http://gears.google.com/?action=install&message=Google%20Gears%20is%20required%20for%20this%20application" +\r
65                 "&return="+window.location.href;\r
66 }</pre>    \r
67 </body>\r
68 </html>