temperature.jsp
3.5 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<%@ include file="/common/taglibs.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<head>
<title><fmt:message key="login.title"/></title>
<meta name="menu" content="Login"/>
</head>
<style>
#temBox{
color: #FFFFFF;
text-align: center;
overflow-x: hidden;
overflow-y: hidden;
overflow: hidden;
}
#numBox{
font-size: 70px;
line-height: 700px;
}
</style>
<body>
<div onclick="fullScreenOp();" id="temBox">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8" id="numBox" >
<span id="temperature">温度: 23.5℃</span> <span id="humidity">湿度: 15%</span>
</div>
<div class="col-md-2"></div>
</div>
</div>
<c:set var="scripts" scope="request">
<script type="text/javascript">
function changeFont()
{
var fontSize = 60 * screen.height/600;
var lineHeight = screen.height;
$("#numBox").attr("style","font-size: "+fontSize+"px;line-height: "+lineHeight+"px;");
}
function fullScreen(){
changeFont();
fullScreened = true;
var el = document.documentElement;
var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullScreen;
//typeof rfs != "undefined" && rfs
if (rfs) {
rfs.call(el);
}
else if (typeof window.ActiveXObject !== "undefined") {
//for IE,这里其实就是模拟了按下键盘的F11,使浏览器全屏
var wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
function exitScreen(){
$("#numBox").attr("style","");
fullScreened = false;
var el = document;
var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen;
//typeof cfs != "undefined" && cfs
if (cfs) {
cfs.call(el);
}
else if (typeof window.ActiveXObject !== "undefined") {
//for IE,这里和fullScreen相同,模拟按下F11键退出全屏
var wscript = new ActiveXObject("WScript.Shell");
if (wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
var fullScreened = false;
function fullScreenOp(){
if(fullScreened){
exitScreen();
}else{
fullScreen();
}
}
function flushStatus(){
$.get('${ctx}/service/store/status?cid=${show}', function (statusBean) {
if(statusBean && statusBean.boxStatus["1"]){
var boxStatusBean = statusBean.boxStatus["1"];
$("#temperature").html("温度:"+boxStatusBean.temperature+"℃");
$("#humidity").html("湿度:"+boxStatusBean.humidity+"%");
}else{
//$("#temperature").html("温度:23℃");
//$("#humidity").html("湿度:12%");
}
});
}
setInterval(function(){
flushStatus();
}, 1000);
</script>
</c:set>
<%--<p><fmt:message key="login.passwordHint"/></p>--%>
<%--<p><fmt:message key="updatePassword.requestRecoveryTokenLink"/></p>--%>
</body>