Add tooltip overlay for detailed RSSI values

This commit is contained in:
phl0 2017-01-08 13:57:22 +01:00
parent 6bf3cceb7c
commit 4e20431680
No known key found for this signature in database
GPG key ID: 48EA1E640798CA9A
3 changed files with 76 additions and 28 deletions

46
css/tooltip.css Normal file
View file

@ -0,0 +1,46 @@
/* Tooltip container */
.tooltip2 {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip2 .tooltip2text {
visibility: hidden;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text */
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -60px;
/* Fade in tooltip */
opacity: 0;
transition: opacity 1s;
}
/* Tooltip arrow */
.tooltip2 .tooltip2text::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip2:hover .tooltip2text {
visibility: visible;
opacity: 1;
}

View file

@ -258,20 +258,20 @@ function getHeardList($logLines, $onlyLast) {
if (substr($ber, 6) != "-0/-0/-0 dBm") { if (substr($ber, 6) != "-0/-0/-0 dBm") {
$rssiString = substr($ber, 6); $rssiString = substr($ber, 6);
$rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
if ($rssiAvg > "-53") $rssi = "<img src=\"images/4.png\" \> S9+40dB ($rssiAvg dBm)"; if ($rssiAvg > "-53") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+40dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-63") $rssi = "<img src=\"images/4.png\" \> S9+30dB ($rssiAvg dBm)"; else if ($rssiAvg > "-63") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+30dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-73") $rssi = "<img src=\"images/4.png\" \> S9+20dB ($rssiAvg dBm)"; else if ($rssiAvg > "-73") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+20dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-83") $rssi = "<img src=\"images/4.png\" \> S9+10dB ($rssiAvg dBm)"; else if ($rssiAvg > "-83") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+10dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-93") $rssi = "<img src=\"images/4.png\" \> S9 ($rssiAvg dBm)"; else if ($rssiAvg > "-93") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-99") $rssi = "<img src=\"images/3.png\" \> S8 ($rssiAvg dBm)"; else if ($rssiAvg > "-99") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S8 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-105") $rssi = "<img src=\"images/3.png\" \> S7 ($rssiAvg dBm)"; else if ($rssiAvg > "-105") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S7 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-111") $rssi = "<img src=\"images/2.png\" \> S6 ($rssiAvg dBm)"; else if ($rssiAvg > "-111") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S6 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-117") $rssi = "<img src=\"images/2.png\" \> S5 ($rssiAvg dBm)"; else if ($rssiAvg > "-117") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S5 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-123") $rssi = "<img src=\"images/1.png\" \> S4 ($rssiAvg dBm)"; else if ($rssiAvg > "-123") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S4 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-129") $rssi = "<img src=\"images/1.png\" \> S3 ($rssiAvg dBm)"; else if ($rssiAvg > "-129") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S3 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-135") $rssi = "<img src=\"images/0.png\" \> S2 ($rssiAvg dBm)"; else if ($rssiAvg > "-135") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S2 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-141") $rssi = "<img src=\"images/0.png\" \> S1 ($rssiAvg dBm)"; else if ($rssiAvg > "-141") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S1 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else $rssi = "<img src=\"images/0.png\" \> S0 ($rssiAvg dBm)"; else $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S0 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
} }
$ber = substr($loss, 5); $ber = substr($loss, 5);
$loss = ""; $loss = "";
@ -283,20 +283,20 @@ function getHeardList($logLines, $onlyLast) {
if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") {
$rssiString = substr($lineTokens[5], 6); $rssiString = substr($lineTokens[5], 6);
$rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); $rssiAvg = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString);
if ($rssiAvg > "-53") $rssi = "<img src=\"images/4.png\" \> S9+40dB ($rssiAvg dBm)"; if ($rssiAvg > "-53") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+40dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-63") $rssi = "<img src=\"images/4.png\" \> S9+30dB ($rssiAvg dBm)"; else if ($rssiAvg > "-63") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+30dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-73") $rssi = "<img src=\"images/4.png\" \> S9+20dB ($rssiAvg dBm)"; else if ($rssiAvg > "-73") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+20dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-83") $rssi = "<img src=\"images/4.png\" \> S9+10dB ($rssiAvg dBm)"; else if ($rssiAvg > "-83") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9+10dB ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-93") $rssi = "<img src=\"images/4.png\" \> S9 ($rssiAvg dBm)"; else if ($rssiAvg > "-93") $rssi = "<img src=\"images/4.png\" \> <div class=\"tooltip2\">S9 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-99") $rssi = "<img src=\"images/3.png\" \> S8 ($rssiAvg dBm)"; else if ($rssiAvg > "-99") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S8 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-105") $rssi = "<img src=\"images/3.png\" \> S7 ($rssiAvg dBm)"; else if ($rssiAvg > "-105") $rssi = "<img src=\"images/3.png\" \> <div class=\"tooltip2\">S7 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-111") $rssi = "<img src=\"images/2.png\" \> S6 ($rssiAvg dBm)"; else if ($rssiAvg > "-111") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S6 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-117") $rssi = "<img src=\"images/2.png\" \> S5 ($rssiAvg dBm)"; else if ($rssiAvg > "-117") $rssi = "<img src=\"images/2.png\" \> <div class=\"tooltip2\">S5 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-123") $rssi = "<img src=\"images/1.png\" \> S4 ($rssiAvg dBm)"; else if ($rssiAvg > "-123") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S4 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-129") $rssi = "<img src=\"images/1.png\" \> S3 ($rssiAvg dBm)"; else if ($rssiAvg > "-129") $rssi = "<img src=\"images/1.png\" \> <div class=\"tooltip2\">S3 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-135") $rssi = "<img src=\"images/0.png\" \> S2 ($rssiAvg dBm)"; else if ($rssiAvg > "-135") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S2 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else if ($rssiAvg > "-141") $rssi = "<img src=\"images/0.png\" \> S1 ($rssiAvg dBm)"; else if ($rssiAvg > "-141") $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S1 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
else $rssi = "<img src=\"images/0.png\" \> S0 ($rssiAvg dBm)"; else $rssi = "<img src=\"images/0.png\" \> <div class=\"tooltip2\">S0 ($rssiAvg dBm)<span class=\"tooltip2text\">$rssiString</span></div>";
} }
} }

View file

@ -21,6 +21,8 @@ include "version.php";
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.6,maximum-scale=1, user-scalable=yes"> <meta name="viewport" content="width=device-width, initial-scale=0.6,maximum-scale=1, user-scalable=yes">
<!-- CSS for tooltip display -->
<link rel="stylesheet" href="css/tooltip.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<!-- Das neueste kompilierte und minimierte CSS --> <!-- Das neueste kompilierte und minimierte CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">