Skip to content

Commit db787b0

Browse files
authored
Merge pull request projecthorus#138 from projecthorus/testing
Tooltips
2 parents 7d5ae7f + d41844e commit db787b0

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

css/main.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,34 @@ header .search form input[type='submit'] {
780780
border: none !important;
781781
}
782782

783+
/* Tooltip container */
784+
.tooltip {
785+
position: relative;
786+
display: inline-block;
787+
}
788+
789+
/* Tooltip text */
790+
.tooltip .tooltiptext {
791+
visibility: hidden;
792+
width: 120px;
793+
background-color: black;
794+
color: #fff;
795+
text-align: center;
796+
padding: 5px 0;
797+
border-radius: 6px;
798+
text-transform: none !important;
799+
800+
/* Position the tooltip text - see examples below! */
801+
position: absolute;
802+
z-index: 1;
803+
}
804+
805+
/* Show the tooltip text when you mouse over the tooltip container */
806+
.tooltip:hover .tooltiptext {
807+
visibility: visible;
808+
}
809+
810+
783811
@media only screen and (min-width: 900px) {
784812
}
785813

js/tracker.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,11 @@ function habitat_data(jsondata, alternative) {
10121012
"xdata": "XDATA"
10131013
};
10141014

1015+
var tooltips = {
1016+
"burst_timer": "If active, this indicates the time (HH:MM:SS) until the radiosonde will automatically power-off.",
1017+
"xdata": "Raw auxiliary data (as hexadecimal) from an external sensor package (often an Ozone sensor)."
1018+
}
1019+
10151020
var hide_keys = {
10161021
"spam": true,
10171022
"battery_millivolts": true,
@@ -1068,11 +1073,14 @@ function habitat_data(jsondata, alternative) {
10681073
if (hide_keys[k] === true)
10691074
continue;
10701075

1071-
var name = "", suffix = "";
1076+
var name = "", suffix = "", tooltip = "";
10721077
if (keys[k] !== undefined)
10731078
name = keys[k];
10741079
else
10751080
name = guess_name(k);
1081+
1082+
if (tooltips[k] !== undefined)
1083+
tooltip = tooltips[k];
10761084

10771085
if (suffixes[k] !== undefined)
10781086
suffix = suffixes[k];
@@ -1104,7 +1112,11 @@ function habitat_data(jsondata, alternative) {
11041112
if(typeof alternative == 'boolean' && alternative) {
11051113
output += "<div><b>" + name + ":&nbsp;</b>" + v + suffix + "</div>";
11061114
} else {
1107-
output += "<dt>" + v + suffix + "</dt><dd>" + name + "</dd>";
1115+
if (tooltip != "") {
1116+
output += "<dt>" + v + suffix + "</dt><dd>" + name + ' <div class="tooltip">🛈<span class="tooltiptext">' + tooltip + '</span></div></dd>';
1117+
} else {
1118+
output += "<dt>" + v + suffix + "</dt><dd>" + name + "</dd>";
1119+
}
11081120
}
11091121
}
11101122
return output;

0 commit comments

Comments
 (0)