1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <html>
- <head>
- <title>relay_std_driver</title>
- <link rel="stylesheet" href="basic/tocas.css">
- <script src="basic/jquery.min.js"></script>
- <style>
- #button{
- background-color:#262626;
- }
- .center{
- display: block;
- margin-left: auto;
- margin-right: auto;
- width: 40%;
- top:30%;
- }
- </style>
- </head>
- <body>
- <div id="ipv4" style="position:fixed;top:3px;left:3px;z-index:10;color:white;"><?php echo $_GET['ip'];?></div>
- <div id="button" style="width:100%;height:100%;position:fixed;left:0px;top:0px;" onClick="toggleSwitch();">
- <img id="icon" class="center" src=""></img>
- </div>
- <div id="uuid" style="position:fixed;bottom:3px;left:3px;color:white;"></div>
- <script>
- status();
- uuid();
- var uuid = "";
- var currentStatus = "OFF";
- function status(){
- $.ajax({url: "http://<?php echo $_GET['ip'];?>/status",
- success: function(result){
- $("#status").html(result);
- if (result == "ON"){
- $("#button").css("background-color","#00cccc");
- currentStatus = "ON";
- }else{
- $("#button").css("background-color","#262626");
- currentStatus = "OFF";
- }
- }});
- }
- function toggleSwitch(){
- if (currentStatus == "OFF"){
- on();
- }else{
- off();
- }
- }
- function off(){
- $.ajax({url: "http://<?php echo $_GET['ip'];?>/off", success: function(result){
- status();
- }});
- }
- function on(){
- $.ajax({url: "http://<?php echo $_GET['ip'];?>/on", success: function(result){
- status();
- }});
- }
- function uuid(){
- $.ajax({url: "http://<?php echo $_GET['ip'];?>/uuid", success: function(result){
- $("#uuid").text(result);
- uuid = result;
- getNickName();
- }});
- }
- function getNickName(){
- $.ajax({url: "../nicknameman.php?uuid=" + $("#uuid").text().trim(), success: function(result){
- if (result.includes("ERROR") == false){
- $("#uuid").text(result);
- getIcon();
- }else{
-
- }
- }});
- }
- function getIcon(){
- $.ajax({url: "../nicknameman.php?nickname=" + $("#uuid").text().trim(), success: function(result){
- if (result.includes("true") == true){
- $("#icon").attr('src','../img/icons/'+ $("#uuid").text().trim() +'.png');
- }
- }});
- }
- </script>
- </body>
- </html>
|