]> git.wh0rd.org Git - tt-rss.git/blob - lib/dojo/gears.js.uncompressed.js
dojo: add some more controls to the layer
[tt-rss.git] / lib / dojo / gears.js.uncompressed.js
1 define("dojo/gears", ["./_base/lang", "./sniff"], function(lang, has){
2
3 // module:
4 //              dojo/gears
5
6 var gears = {
7         // summary:
8         //              TODOC
9 };
10 lang.setObject("dojo.gears", gears);
11
12 gears._gearsObject = function(){
13         // summary:
14         //              factory method to get a Google Gears plugin instance to
15         //              expose in the browser runtime environment, if present
16         var factory;
17
18         var gearsObj = lang.getObject("google.gears");
19         if(gearsObj){ return gearsObj; } // already defined elsewhere
20
21         if(typeof GearsFactory != "undefined"){ // Firefox
22                 factory = new GearsFactory();
23         }else{
24                 if(has("ie")){
25                         // IE
26                         try{
27                                 factory = new ActiveXObject("Gears.Factory");
28                         }catch(e){
29                                 // ok to squelch; there's no gears factory.  move on.
30                         }
31                 }else if(navigator.mimeTypes["application/x-googlegears"]){
32                         // Safari?
33                         factory = document.createElement("object");
34                         factory.setAttribute("type", "application/x-googlegears");
35                         factory.setAttribute("width", 0);
36                         factory.setAttribute("height", 0);
37                         factory.style.display = "none";
38                         document.documentElement.appendChild(factory);
39                 }
40         }
41
42         // still nothing?
43         if(!factory){ return null; }
44
45         // define the global objects now; don't overwrite them though if they
46         // were somehow set internally by the Gears plugin, which is on their
47         // dev roadmap for the future
48         lang.setObject("google.gears.factory", factory);
49         return lang.getObject("google.gears");
50 };
51
52
53 // see if we have Google Gears installed, and if
54 // so, make it available in the runtime environment
55 // and in the Google standard 'google.gears' global object
56 gears.available = (!!gears._gearsObject())||0;
57 /*=====
58  gears.available = {
59  // summary:
60  //             True if client is using Google Gears
61  };
62  =====*/
63
64 return gears;
65 });