94 lines
3.0 KiB
HTML
94 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<link rel="stylesheet" href="../css/bootstrap.min.css" />
|
|
<script src="../jquery-2.1.0.min.js"></script>
|
|
<script src="../jquery.cookie.js"></script>
|
|
<script type="text/javascript" type="text/javascript">
|
|
function client_request(str){
|
|
//$('#output').html("");
|
|
window.parent.postMessage(
|
|
{
|
|
event_id: 'client_request',
|
|
data: {
|
|
v1: str
|
|
}
|
|
},
|
|
"*" //or "www.parentpage.com"
|
|
);
|
|
}
|
|
|
|
function receiveMessage(event){
|
|
console.log(event.data);
|
|
switch(event.data.event_id){
|
|
case "client_response":{
|
|
var data=event.data.data;
|
|
var result=data.v1;
|
|
var ROS_String_Output=data.v2;
|
|
var Rec_HMI_String_Input=data.v3;
|
|
var Client_Request_Cmd=Rec_HMI_String_Input.split(':');
|
|
//console.log(data);
|
|
switch(Client_Request_Cmd[0]){
|
|
|
|
case 'HMISettingGetRemoteID':{
|
|
//console.log("response HMISettingGetRemoteID");
|
|
document.getElementById('output').innerText=ROS_String_Output;
|
|
}break;
|
|
default:{
|
|
//document.getElementById('output').innerText=ROS_String_Output;
|
|
}break;
|
|
|
|
}
|
|
}break;
|
|
}
|
|
}
|
|
|
|
var client_sch=0;
|
|
|
|
window.addEventListener("message", receiveMessage, false);
|
|
|
|
function Timer(){
|
|
if(client_sch==0){
|
|
client_request("HMISettingGetRemoteID");
|
|
client_sch=1;
|
|
}
|
|
document.getElementById('QRCode').setAttribute("src","../QRCode/QRCode.png");
|
|
}
|
|
var T1 = window.setInterval("Timer()",100);
|
|
|
|
function client_setQRCode(str){
|
|
client_request("HMISettingSetQRCode:"+str);
|
|
}
|
|
</script>
|
|
<title>Title</title>
|
|
</head>
|
|
<body>
|
|
<table>
|
|
<tr>
|
|
<div id="output"></div>
|
|
</tr>
|
|
<tr>
|
|
<p><input type=text class="input form-control" id="setQRCode_str" name="set_QRCode_str value" style="width :50%;margin-top: 10px"></input></p>
|
|
<input type=button class="btn" value="setQRCode" onclick=client_setQRCode(setQRCode_str.value) style=" background:#FD4F00FF;color: whitesmoke"></input>
|
|
</tr>
|
|
<tr>
|
|
<div style="text-align: center;height:50px;width:100%;"><img id='QRCode'></img></div>
|
|
</tr>
|
|
</table>
|
|
</body>
|
|
<style>
|
|
*{
|
|
font-size: 20px;
|
|
}
|
|
</style>
|
|
<script>
|
|
$("body").on("focus", ".form-control", function() {
|
|
window.parent.inputDom = this;
|
|
var distance = $(parent.document).scrollTop() + 500 + "px";
|
|
$(".simple-keyboard", parent.document).css("top", distance)
|
|
$(".keyboard", parent.document).show();
|
|
window.parent.clearKeyboard();
|
|
})
|
|
</script>
|
|
</html> |