You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
818 B
37 lines
818 B
/* globals overpassUrl:true */
|
|
|
|
register_hook('init', function () {
|
|
if (options.overpassUrl) {
|
|
overpassUrl = options.overpassUrl
|
|
}
|
|
})
|
|
|
|
register_hook('options_form', function (def) {
|
|
var values = config.overpassUrl
|
|
if (!Array.isArray(values)) {
|
|
values = [ values ]
|
|
}
|
|
|
|
def.overpassUrl = {
|
|
'name': lang('options:overpassUrl'),
|
|
'type': 'select',
|
|
'values': values,
|
|
'req': false,
|
|
'placeholder': lang('default')
|
|
}
|
|
})
|
|
|
|
register_hook('options_save', function (data) {
|
|
if ('overpassUrl' in data) {
|
|
if (data.overpassUrl === null) {
|
|
overpassUrl = config.overpassUrl
|
|
if (Array.isArray(overpassUrl) && overpassUrl.length) {
|
|
overpassUrl = overpassUrl[0]
|
|
}
|
|
} else {
|
|
overpassUrl = data.overpassUrl
|
|
}
|
|
|
|
overpassFrontend.url = overpassUrl
|
|
}
|
|
})
|