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