-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
69 lines (57 loc) · 2.38 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="/common/js/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#refreshButton').click(function() { writeInfoData(); });
$('#getIpButton').click(function() {
//$.get("http://icanhazip.com/", function(data){ $("#ipSpan").html(data); });
$("#ipSpan").html("127.0.0.1");
});
writeInfoData();
});
function writeInfoData() {
var weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var currentdate = new Date();
var date = weekday[currentdate.getDay()] + " " + format(currentdate.getDate()) + "." + format((currentdate.getMonth()+1)) + "." + currentdate.getFullYear();
var time = format(currentdate.getHours()) + ":" + format(currentdate.getMinutes()) + ":" + format(currentdate.getSeconds());
$("#output1").html(date + " " + time + "<br>");
$("#output1").append(new Date().getTime() + "<br><br>");
$("#output1").append(navigator.userAgent + "<br><br>");
$("#output1").append("window.innerWidth: " + window.innerWidth + "<br>");
$("#output1").append("window.innerHeight: " + window.innerHeight + "<br><br>");
$("#output1").append("screen.width: " + screen.width + "<br>");
$("#output1").append("screen.height: " + screen.height + "<br><br>");
var ratio = window.devicePixelRatio;
$("#output1").append("window.devicePixelRatio: " + window.devicePixelRatio + "<br>");
$("#output1").append("screen.width * ratio: " + (screen.width*ratio) + "<br>");
$("#output1").append("screen.height * ratio: " + (screen.height*ratio) + "<br><br>");
$("#output1").append("$(document).width(): " + $(document).width() + "<br>");
$("#output1").append("$(document).height(): " + $(document).height() + "<br><br>");
$("#output1").append("$(window).width(): " + $(window).width() + "<br>");
$("#output1").append("$(window).height(): " + $(window).height() + "<br><br>");
}
function format(num) {
if(num < 10) {
return "0" + num;
} else {
return num;
}
}
</script>
<style>
span {font-family: Consolas,monospace; font-size: 16px; margin-left: 25px;}
#output1 {font-family: Consolas,monospace; font-size: 16px;}
</style>
</head>
<body>
<div id="output1"></div>
<br><br>
<button id="refreshButton">Refresh</button>
<br><br>
<div id="ipDiv"><button id="getIpButton">Get IP address</button><span id="ipSpan"></span></div>
</body>
</html>