website/themes/hugo-theme-wave/static/js/main.js

32 lines
552 B
JavaScript
Raw Normal View History

2020-02-08 22:13:01 +01:00
// dip service
function main() {
2020-02-09 11:50:54 +01:00
var jqxhr =
2020-02-08 22:13:01 +01:00
$.ajax({
2020-02-09 10:43:22 +01:00
type: "GET",
2020-02-08 22:13:01 +01:00
url: "https://ip.paulbsd.com",
headers: {
'Access-Control-Allow-Origin': '*',
'Accept': 'application/json',
},
dataType: 'json',
2020-02-09 11:50:54 +01:00
}).done(function(data) {
var dip = $('#dip');
dip[0].text = data.ip;
});
2020-02-09 10:43:22 +01:00
return jqxhr;
}
function transformIPInfo(data) {
if (data.hostname != '') {
return data.ip + '/' + data.hostname;
}
else {
return data.ip;
}
2020-02-08 22:13:01 +01:00
}
$(document).ready(function() {
main();
});