updated website
This commit is contained in:
parent
cdc4da40e4
commit
a9b0f33d9a
@ -6,7 +6,7 @@
|
||||
© {{ now.Format "2006" }} <a href="https://git.paulbsd.com/paulbsd">paulbsd</a>. <br>
|
||||
{{ with .Site.Params.copyright }}{{ . | markdownify}}{{ end }}
|
||||
</footer>
|
||||
<footer id="footer-right">Your IP address : <a id="dip">{{ "{{" }} returnstring {{ "}}" }}</a></footer>
|
||||
<footer id="footer-right">Your IP address : <a id="dip" target="_blank"></a></footer>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{ .Site.BaseURL }}/js/main.js">
|
||||
|
@ -17,8 +17,6 @@
|
||||
<script src="{{ .Site.BaseURL }}/bower_components/d3/d3.min.js"></script>
|
||||
<script src="{{ .Site.BaseURL }}/bower_components/cal-heatmap/cal-heatmap.min.js"></script>
|
||||
<script src="{{ .Site.BaseURL }}/bower_components/highlightjs/highlight.pack.min.js"></script>
|
||||
<script src="{{ .Site.BaseURL }}/bower_components/vue/vue.min.js"></script>
|
||||
<script src="{{ .Site.BaseURL }}/bower_components/axios/axios.min.js"></script>
|
||||
<script>
|
||||
hljs.initHighlightingOnLoad();
|
||||
</script>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,41 +1,18 @@
|
||||
// dip service
|
||||
|
||||
var dip = new Vue({
|
||||
el: '#dip',
|
||||
|
||||
data () {
|
||||
return {
|
||||
dipjson: {"ip": "", "hostname": "", "city": "", "country": ""},
|
||||
returnstring: "",
|
||||
autorefresh: false,
|
||||
interval: null,
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
this.updateIP();
|
||||
this.runTimer();
|
||||
},
|
||||
|
||||
methods: {
|
||||
updateIP: function () {
|
||||
axios.get("https://ip.paulbsd.com/json")
|
||||
.then(response => {
|
||||
this.dipjson = response.data;
|
||||
if (this.dipjson.hostname != "") {
|
||||
this.returnstring = this.dipjson.ip + '/' + this.dipjson.hostname;
|
||||
} else {
|
||||
this.returnstring = this.dipjson.ip;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
});
|
||||
},
|
||||
runTimer: function () {
|
||||
if (this.autorefresh) {
|
||||
this.interval = setInterval(this.updateIP,10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
var dip;
|
||||
function get_elements() {
|
||||
dip = document.getElementById("dip");
|
||||
}
|
||||
);
|
||||
|
||||
function get_ip() {
|
||||
let a = fetch("https://ip.paulbsd.com/json");
|
||||
a.then((resp) => {
|
||||
resp.json().then(js => {
|
||||
dip.innerHTML = js["ip"];
|
||||
dip.href = `https://ip.paulbsd.com/${js["ip"]}`;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
get_elements();
|
||||
get_ip();
|
Loading…
Reference in New Issue
Block a user