Some JSlint-ing

This commit is contained in:
Sarven Capadisli 2010-01-16 19:42:32 +00:00
parent 414c80a18d
commit ab53a8704b

View File

@ -1,5 +1,5 @@
// A shim to implement the W3C Geolocation API Specification using Gears or the Ajax API // A shim to implement the W3C Geolocation API Specification using Gears or the Ajax API
if (typeof navigator.geolocation == "undefined" || navigator.geolocation.shim ) (function(){ if (typeof navigator.geolocation == "undefined" || navigator.geolocation.shim ) { (function(){
// -- BEGIN GEARS_INIT // -- BEGIN GEARS_INIT
(function() { (function() {
@ -23,8 +23,7 @@ if (typeof navigator.geolocation == "undefined" || navigator.geolocation.shim )
} }
} catch (e) { } catch (e) {
// Safari // Safari
if ((typeof navigator.mimeTypes != 'undefined') if ((typeof navigator.mimeTypes != 'undefined') && navigator.mimeTypes["application/x-googlegears"]) {
&& navigator.mimeTypes["application/x-googlegears"]) {
factory = document.createElement("object"); factory = document.createElement("object");
factory.style.display = "none"; factory.style.display = "none";
factory.width = 0; factory.width = 0;
@ -64,8 +63,8 @@ var GearsGeoLocation = (function() {
return function(position) { return function(position) {
callback(position); callback(position);
self.lastPosition = position; self.lastPosition = position;
} };
} };
// -- PUBLIC // -- PUBLIC
return { return {
@ -112,7 +111,7 @@ var AjaxGeoLocation = (function() {
var queue = []; var queue = [];
var addLocationQueue = function(callback) { var addLocationQueue = function(callback) {
queue.push(callback); queue.push(callback);
} };
var runLocationQueue = function() { var runLocationQueue = function() {
if (hasGoogleLoader()) { if (hasGoogleLoader()) {
@ -121,18 +120,18 @@ var AjaxGeoLocation = (function() {
call(); call();
} }
} }
} };
window['_google_loader_apiLoaded'] = function() { window['_google_loader_apiLoaded'] = function() {
runLocationQueue(); runLocationQueue();
} };
var hasGoogleLoader = function() { var hasGoogleLoader = function() {
return (window['google'] && google['loader']); return (window['google'] && google['loader']);
} };
var checkGoogleLoader = function(callback) { var checkGoogleLoader = function(callback) {
if (hasGoogleLoader()) return true; if (hasGoogleLoader()) { return true; }
addLocationQueue(callback); addLocationQueue(callback);
@ -155,7 +154,7 @@ var AjaxGeoLocation = (function() {
var self = this; var self = this;
if (!checkGoogleLoader(function() { if (!checkGoogleLoader(function() {
self.getCurrentPosition(successCallback, errorCallback, options); self.getCurrentPosition(successCallback, errorCallback, options);
})) return; })) { return; }
if (google.loader.ClientLocation) { if (google.loader.ClientLocation) {
var cl = google.loader.ClientLocation; var cl = google.loader.ClientLocation;
@ -215,3 +214,4 @@ var AjaxGeoLocation = (function() {
navigator.geolocation = (window.google && google.gears) ? GearsGeoLocation() : AjaxGeoLocation(); navigator.geolocation = (window.google && google.gears) ? GearsGeoLocation() : AjaxGeoLocation();
})(); })();
}