summaryrefslogtreecommitdiff
path: root/lib/dojo/gears.js.uncompressed.js
diff options
context:
space:
mode:
authorRichard Beales <[email protected]>2013-03-18 07:32:01 +0000
committerRichard Beales <[email protected]>2013-03-18 07:32:01 +0000
commit7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch)
tree5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/gears.js.uncompressed.js
parent70db7424e7068701e60cc5bcdfe8f858be508179 (diff)
parentc670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/gears.js.uncompressed.js')
-rw-r--r--lib/dojo/gears.js.uncompressed.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/dojo/gears.js.uncompressed.js b/lib/dojo/gears.js.uncompressed.js
new file mode 100644
index 000000000..4507f05ca
--- /dev/null
+++ b/lib/dojo/gears.js.uncompressed.js
@@ -0,0 +1,65 @@
+define("dojo/gears", ["./_base/lang", "./sniff"], function(lang, has){
+
+// module:
+// dojo/gears
+
+var gears = {
+ // summary:
+ // TODOC
+};
+lang.setObject("dojo.gears", gears);
+
+gears._gearsObject = function(){
+ // summary:
+ // factory method to get a Google Gears plugin instance to
+ // expose in the browser runtime environment, if present
+ var factory;
+
+ var gearsObj = lang.getObject("google.gears");
+ if(gearsObj){ return gearsObj; } // already defined elsewhere
+
+ if(typeof GearsFactory != "undefined"){ // Firefox
+ factory = new GearsFactory();
+ }else{
+ if(has("ie")){
+ // IE
+ try{
+ factory = new ActiveXObject("Gears.Factory");
+ }catch(e){
+ // ok to squelch; there's no gears factory. move on.
+ }
+ }else if(navigator.mimeTypes["application/x-googlegears"]){
+ // Safari?
+ factory = document.createElement("object");
+ factory.setAttribute("type", "application/x-googlegears");
+ factory.setAttribute("width", 0);
+ factory.setAttribute("height", 0);
+ factory.style.display = "none";
+ document.documentElement.appendChild(factory);
+ }
+ }
+
+ // still nothing?
+ if(!factory){ return null; }
+
+ // define the global objects now; don't overwrite them though if they
+ // were somehow set internally by the Gears plugin, which is on their
+ // dev roadmap for the future
+ lang.setObject("google.gears.factory", factory);
+ return lang.getObject("google.gears");
+};
+
+
+// see if we have Google Gears installed, and if
+// so, make it available in the runtime environment
+// and in the Google standard 'google.gears' global object
+gears.available = (!!gears._gearsObject())||0;
+/*=====
+ gears.available = {
+ // summary:
+ // True if client is using Google Gears
+ };
+ =====*/
+
+return gears;
+});