mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-14 18:38:29 +02:00
Use geolocation api to try to determine city
This commit is contained in:
@ -853,6 +853,25 @@ app.classes.home.home_list_portlet = app.classes.home.home_portlet.extend({
|
||||
}
|
||||
}
|
||||
});
|
||||
app.classes.home.home_weather_portlet = app.classes.home.home_portlet.extend({
|
||||
init: function(portlet) {
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
// Use location API
|
||||
if(!this.portlet.options.settings && 'geolocation' in navigator)
|
||||
{
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
if(portlet && portlet.options && portlet.options.settings &&
|
||||
portlet.options.settings.position && portlet.options.settings.position == position.coords.latitude + ',' + position.coords.longitude)
|
||||
{
|
||||
return;
|
||||
}
|
||||
portlet._process_edit(et2_dialog.OK_BUTTON, {position: position.coords.latitude + ',' + position.coords.longitude});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
app.classes.home.home_favorite_portlet = app.classes.home.home_portlet.extend({
|
||||
observer: function(_msg, _app, _id, _type, _msg_type, _targetapp)
|
||||
{
|
||||
|
Reference in New Issue
Block a user