]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/gears.js
remove call-by-reference to comply with php 5.4
[tt-rss.git] / lib / dojo / gears.js
CommitLineData
2f01fe57 1/*
81bea17a 2 Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
2f01fe57
AD
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5*/
6
7
a089699c
AD
8if(!dojo._hasResource["dojo.gears"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
9dojo._hasResource["dojo.gears"] = true;
2f01fe57 10dojo.provide("dojo.gears");
a089699c 11
81bea17a
AD
12dojo.getObject("gears", true, dojo);
13
a089699c 14dojo.gears._gearsObject = function(){
81bea17a 15 // summary:
a089699c
AD
16 // factory method to get a Google Gears plugin instance to
17 // expose in the browser runtime environment, if present
18 var factory;
19 var results;
20
21 var gearsObj = dojo.getObject("google.gears");
22 if(gearsObj){ return gearsObj; } // already defined elsewhere
23
24 if(typeof GearsFactory != "undefined"){ // Firefox
25 factory = new GearsFactory();
26 }else{
27 if(dojo.isIE){
28 // IE
29 try{
30 factory = new ActiveXObject("Gears.Factory");
31 }catch(e){
32 // ok to squelch; there's no gears factory. move on.
33 }
34 }else if(navigator.mimeTypes["application/x-googlegears"]){
35 // Safari?
36 factory = document.createElement("object");
37 factory.setAttribute("type", "application/x-googlegears");
38 factory.setAttribute("width", 0);
39 factory.setAttribute("height", 0);
40 factory.style.display = "none";
41 document.documentElement.appendChild(factory);
42 }
43 }
44
45 // still nothing?
46 if(!factory){ return null; }
47
48 // define the global objects now; don't overwrite them though if they
49 // were somehow set internally by the Gears plugin, which is on their
50 // dev roadmap for the future
51 dojo.setObject("google.gears.factory", factory);
52 return dojo.getObject("google.gears");
2f01fe57 53};
a089699c
AD
54
55/*=====
56dojo.gears.available = {
57 // summary: True if client is using Google Gears
58};
59=====*/
60// see if we have Google Gears installed, and if
61// so, make it available in the runtime environment
62// and in the Google standard 'google.gears' global object
63dojo.gears.available = (!!dojo.gears._gearsObject())||0;
64
2f01fe57 65}