font-size: 0.7em;
white-space: nowrap;
text-align: center;
+ display: none;
}
header .dropdown-menu {
return api_url;
}
-function fetch_from_api(endpoint_name, params, callback) {
+function update_last_updated(endpoint_name, params) {
+ if (endpoint_name === 'status') return;
+
var api_url = generate_full_api_url(endpoint_name, params);
- if (endpoint_name !== 'status') {
- $('#api-request-link').attr('href', api_url);
+ $('#last-updated').show();
+
+ $('#api-request a').attr('href', api_url);
+ $('#api-request').show();
+
+ if (endpoint_name === 'search' || endpoint_name === 'reverse') {
+ $('#api-request-debug a').attr('href', api_url + '&debug=1');
+ $('#api-request-debug').show();
+ } else {
+ $('#api-request-debug').hide();
}
+}
+
+function fetch_from_api(endpoint_name, params, callback) {
+ var api_url = generate_full_api_url(endpoint_name, params);
$.get(api_url, function (data) {
+ if (endpoint_name !== 'status') {
+ update_last_updated(endpoint_name, params);
+ }
callback(data);
});
}
function update_data_date() {
fetch_from_api('status', { format: 'json' }, function (data) {
+ $('#last-updated').show();
$('#data-date').text(data.data_updated);
});
}
format: 'jsonv2'
};
- if (search_params.get('debug') === '1') {
- window.location.href = generate_full_api_url('reverse', api_request_params);
- return;
- }
-
context = {
// aPlace: aPlace,
fLat: api_request_params.lat,
format: 'jsonv2'
};
- if (search_params.get('debug') === '1') {
- window.location.href = generate_full_api_url('search', api_request_params);
- return;
- }
-
context = {
sQuery: api_request_params.q,
sViewBox: search_params.get('viewbox'),
function is_relative_url(url) {
if (!url) return false;
+ if (url.match(/debug=1/)) return false;
if (url.indexOf('?') === 0) return true;
if (url.indexOf('/') === 0) return true;
if (url.indexOf('#') === 0) return false;
</div>
<div id="last-updated" class="col-4 text-center">
<div id="loading">loading...</div>
- Data from <a id="api-request-link" href="">API request</a>
- <br>
- Data last updated:
- <span id="data-date"></span>
+ <div id="api-request">
+ Data from <a href="">API request</a>
+ <span id="api-request-debug">(<a href="">debug output</a>)</span>
+ </div>
+ Data last updated: <span id="data-date"></span>
</div>
<div class="col-4 text-right">
<div class="dropdown">
</div>
<div id="last-updated" class="col-4 text-center">
<div id="loading">loading...</div>
- Data from <a id="api-request-link" href="">API request</a>
- <br>
- Data last updated:
- <span id="data-date"></span>
+ <div id="api-request">
+ Data from <a href="">API request</a>
+ <span id="api-request-debug">(<a href="">debug output</a>)</span>
+ </div>
+ Data last updated: <span id="data-date"></span>
</div>
<div class="col-4 text-right">
<div class="dropdown">
</div>
<div id="last-updated" class="col-4 text-center">
<div id="loading">loading...</div>
- Data from <a id="api-request-link" href="">API request</a>
- <br>
- Data last updated:
- <span id="data-date"></span>
+ <div id="api-request">
+ Data from <a href="">API request</a>
+ <span id="api-request-debug">(<a href="">debug output</a>)</span>
+ </div>
+ Data last updated: <span id="data-date"></span>
</div>
<div class="col-4 text-right">
<div class="dropdown">
</div>
<div id="last-updated" class="col-4 text-center">
<div id="loading">loading...</div>
- Data from <a id="api-request-link" href="">API request</a>
- <br>
- Data last updated:
- <span id="data-date"></span>
+ <div id="api-request">
+ Data from <a href="">API request</a>
+ <span id="api-request-debug">(<a href="">debug output</a>)</span>
+ </div>
+ Data last updated: <span id="data-date"></span>
</div>
<div class="col-4 text-right">
<div class="dropdown">
</div>
<div id="last-updated" class="col-4 text-center">
<div id="loading">loading...</div>
- Data from <a id="api-request-link" href="">API request</a>
- <br>
- Data last updated:
- <span id="data-date"></span>
+ <div id="api-request">
+ Data from <a href="">API request</a>
+ <span id="api-request-debug">(<a href="">debug output</a>)</span>
+ </div>
+ Data last updated: <span id="data-date"></span>
</div>
<div class="col-4 text-right">
<div class="dropdown">
font-size: 0.7em;
white-space: nowrap;
text-align: center;
+ display: none;
}
header .dropdown-menu {
return api_url;
}
-function fetch_from_api(endpoint_name, params, callback) {
+function update_last_updated(endpoint_name, params) {
+ if (endpoint_name === 'status') return;
+
var api_url = generate_full_api_url(endpoint_name, params);
- if (endpoint_name !== 'status') {
- $('#api-request-link').attr('href', api_url);
+ $('#last-updated').show();
+
+ $('#api-request a').attr('href', api_url);
+ $('#api-request').show();
+
+ if (endpoint_name === 'search' || endpoint_name === 'reverse') {
+ $('#api-request-debug a').attr('href', api_url + '&debug=1');
+ $('#api-request-debug').show();
+ } else {
+ $('#api-request-debug').hide();
}
+}
+
+function fetch_from_api(endpoint_name, params, callback) {
+ var api_url = generate_full_api_url(endpoint_name, params);
$.get(api_url, function (data) {
+ if (endpoint_name !== 'status') {
+ update_last_updated(endpoint_name, params);
+ }
callback(data);
});
}
function update_data_date() {
fetch_from_api('status', { format: 'json' }, function (data) {
+ $('#last-updated').show();
$('#data-date').text(data.data_updated);
});
}
function is_relative_url(url) {
if (!url) return false;
+ if (url.match(/debug=1/)) return false;
if (url.indexOf('?') === 0) return true;
if (url.indexOf('/') === 0) return true;
if (url.indexOf('#') === 0) return false;
format: 'jsonv2'
};
- if (search_params.get('debug') === '1') {
- window.location.href = generate_full_api_url('reverse', api_request_params);
- return;
- }
-
context = {
// aPlace: aPlace,
fLat: api_request_params.lat,
format: 'jsonv2'
};
- if (search_params.get('debug') === '1') {
- window.location.href = generate_full_api_url('search', api_request_params);
- return;
- }
-
context = {
sQuery: api_request_params.q,
sViewBox: search_params.get('viewbox'),
</div>
<div id="last-updated" class="col-4 text-center">
<div id="loading">loading...</div>
- Data from <a id="api-request-link" href="">API request</a>
- <br>
- Data last updated:
- <span id="data-date"></span>
+ <div id="api-request">
+ Data from <a href="">API request</a>
+ <span id="api-request-debug">(<a href="">debug output</a>)</span>
+ </div>
+ Data last updated: <span id="data-date"></span>
</div>
<div class="col-4 text-right">
<div class="dropdown">