source: Dev/branches/rest-dojo-ui/client/dojo/gears.js @ 263

Last change on this file since 263 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

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