switching to gmap3
This commit is contained in:
41
script/spot.js
Normal file → Executable file
41
script/spot.js
Normal file → Executable file
@@ -3,7 +3,7 @@ function Spot(asGlobals)
|
||||
self = this;
|
||||
this.consts = asGlobals.consts;
|
||||
this.consts.hash_sep = '-';
|
||||
this.consts.title = 'Find Me Spot';
|
||||
this.consts.title = 'Te Araroa';
|
||||
this.consts.default_page = 'messages';
|
||||
|
||||
/* Initialization */
|
||||
@@ -58,6 +58,38 @@ function Spot(asGlobals)
|
||||
return self.vars(asVarName, oValue);
|
||||
};
|
||||
|
||||
/* Interface with server */
|
||||
|
||||
this.get = function(sAction, fOnSuccess, oVars, fOnError, bProcessIcon)
|
||||
{
|
||||
if(!oVars) oVars = {};
|
||||
bProcessIcon = bProcessIcon || false;
|
||||
//if(bProcessIcon) self.addBufferIcon();
|
||||
|
||||
oVars['a'] = sAction;
|
||||
$.ajax(
|
||||
{
|
||||
url: self.consts.process_page,
|
||||
data: oVars,
|
||||
dataType: 'json'
|
||||
})
|
||||
.done(function(oData)
|
||||
{
|
||||
if(oData.result==self.consts.error) fOnError(oData.desc);
|
||||
else
|
||||
{
|
||||
//if(bProcessIcon) self.resetIcon();
|
||||
fOnSuccess(oData.data);
|
||||
}
|
||||
})
|
||||
.fail(function(jqXHR, textStatus, errorThrown)
|
||||
{
|
||||
//if(bProcessIcon) self.resetIcon();
|
||||
if(!fOnError) console.log(textStatus+' '+errorThrown);
|
||||
else fOnError(textStatus);
|
||||
});
|
||||
};
|
||||
|
||||
/* Page Switch - Trigger & Event catching */
|
||||
|
||||
this.onHashChange = function()
|
||||
@@ -181,4 +213,9 @@ function setElem(aoAnchor, asPath, oValue)
|
||||
var sKey = (typeof asPath == 'object')?asPath.shift():asPath;
|
||||
return aoAnchor[sKey] = (!(sKey in aoAnchor) && (oValue in asTypes))?asTypes[oValue]:oValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.prototype.addIcon = function(sIcon)
|
||||
{
|
||||
return $(this).prepend($('<i>', {'class':'fa '+sIcon}));
|
||||
};
|
||||
Reference in New Issue
Block a user