Phi: metar widget tweaks
- skip leading timestamp garbage - bind tooltip so hovering the mouse displays complete metar
This commit is contained in:
parent
1d1c8e28d1
commit
3e6c115abd
3 changed files with 12 additions and 9 deletions
|
@ -104,7 +104,7 @@
|
|||
|
||||
jquery.get(url).done(function(data) {
|
||||
if( context ) callback.call( context, data.value );
|
||||
else callback(value);
|
||||
else callback(data.value);
|
||||
}).fail(function(a,b) {
|
||||
console.log("failed to getPropertyValue(): ", a, b );
|
||||
}).always(function() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<style>
|
||||
</style>
|
||||
<div
|
||||
data-bind="text: scrolledMetar"
|
||||
style="text-align: center; font-family: 'Liberation Mono'; display: block; white-space: pre; background: #101010; color: red;">
|
||||
data-bind="text: scrolledMetar, attr: { title: metar }, tooltip: {}"
|
||||
style="cursor: default; font-family: 'Liberation Mono'; display: block; white-space: pre; background: #101010; color: red;">
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
define([
|
||||
'jquery', 'knockout', 'text!./metar.html'
|
||||
], function(jquery, ko, htmlString) {
|
||||
'knockout', 'text!./metar.html', 'fgcommand', 'kojqui/tooltip'
|
||||
], function(ko, htmlString, fgCommand ) {
|
||||
|
||||
function ViewModel(params) {
|
||||
var NO_METAR = "no METAR";
|
||||
var NO_METAR = "*** no METAR ";
|
||||
self.scrolledMetar = ko.observable("");
|
||||
self.textStart = 0;
|
||||
self.metar = ko.observable(NO_METAR);
|
||||
|
@ -14,10 +14,13 @@ define([
|
|||
self.metar(NO_METAR);
|
||||
return;
|
||||
}
|
||||
self.metar("Wait..");
|
||||
jquery.get('/json/environment/metar/data', null, function(data) {
|
||||
self.metar("Wait.. ");
|
||||
fgCommand.getPropertyValue('/environment/metar/data', function(value) {
|
||||
self.textStart = 0;
|
||||
self.metar(data.value);
|
||||
// start with station id (4 upcase chars), skip leading garbage
|
||||
var idx = value.search("[A-Z]{4}");
|
||||
if( idx >= 0 ) value = value.substring(idx);
|
||||
self.metar(value);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue