Ero sivun ”Widget:Test” versioiden välillä
Järvi-meriwikistä
Rivi 14: | Rivi 14: | ||
function <!--{$id|default:TestWidget|escape:'html'}-->_func() { | function <!--{$id|default:TestWidget|escape:'html'}-->_func() { | ||
− | var co = new CitobsOpen311(); | + | var co = new CitobsOpen311(); |
− | var jw = new jwApi(); | + | var jw = new jwApi(); |
− | var ready = function() { | + | var ready = function() { |
− | + | if ( --loadr == 0 ) { | |
− | + | console.log( co ); | |
− | + | console.log( jw ); | |
− | + | var sites = {}; | |
− | + | for ( var s in jw.site ) { | |
− | + | if ( jw.site[ s ].obses.length > 1 ) { | |
− | + | for ( var o in jw.site[ s ].obses[ o ] ) { | |
− | + | console.log( jw.obs[ jw.site[ s ].obses[ o ] ] ); | |
− | + | } | |
− | + | } | |
− | + | } | |
− | + | for ( var o in co.request ) { | |
− | + | jw.obs[ ] = {}; | |
− | + | } | |
+ | } | ||
} | } | ||
− | var loadr = 0; | + | var loadr = 0; |
− | var days = 6; | + | var days = 6; |
− | var startDate = new Date(); | + | var startDate = new Date(); |
− | startDate.setDate( startDate.getDate()-days ); | + | startDate.setDate( startDate.getDate()-days ); |
− | loadr++; jw.loadObses( { 'obscode': 'alg', 'startdate': startDate.toISOString() }, ready ); | + | loadr++; jw.loadObses( { 'obscode': 'alg', 'startdate': startDate.toISOString() }, ready ); |
− | for ( var ot in jw.jwToCitobs ) { | + | for ( var ot in jw.jwToCitobs ) { |
− | + | loadr++; co.loadRequests( { 'keyword': '_VesiFiObservation', 'service_code': jw.jwToCitobs[ ot ].service_code, 'start_date': startDate.toISOString(), 'status': 'valid' }, ready ); | |
+ | } | ||
} | } | ||
− | + | ||
− | + | </script> | |
</includeonly> | </includeonly> |