Ero sivun ”Widget:CitobsDBcounter” versioiden välillä
Järvi-meriwikistä
(6 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 28: | Rivi 28: | ||
var citobs = new CitobsOpen311(); | var citobs = new CitobsOpen311(); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
var today = new Date(); | var today = new Date(); | ||
Rivi 47: | Rivi 38: | ||
var c1 = 0; | var c1 = 0; | ||
var c2 = 0; | var c2 = 0; | ||
+ | |||
+ | var b0 = 0; | ||
+ | var b1 = 0; | ||
+ | var b2 = 0; | ||
+ | var b3 = 0; | ||
+ | |||
for ( var o in citobs.request ) { | for ( var o in citobs.request ) { | ||
c1++; | c1++; | ||
Rivi 52: | Rivi 49: | ||
c2++; | c2++; | ||
} | } | ||
+ | |||
+ | if ( citobs.request[ o ].attributes[ 'algaebloom_singlevaluelist_201808151546174' ] == '1' ) { | ||
+ | b0++; | ||
+ | } | ||
+ | |||
+ | if ( citobs.request[ o ].attributes[ 'algaebloom_singlevaluelist_201808151546174' ] == '2' ) { | ||
+ | b1++; | ||
+ | } | ||
+ | |||
+ | if ( citobs.request[ o ].attributes[ 'algaebloom_singlevaluelist_201808151546174' ] == '3' ) { | ||
+ | b2++; | ||
+ | } | ||
+ | |||
+ | if ( citobs.request[ o ].attributes[ 'algaebloom_singlevaluelist_201808151546174' ] == '4' ) { | ||
+ | b3++; | ||
+ | } | ||
+ | |||
} | } | ||
var out; | var out; | ||
if ( lang == 'fi' ) { | if ( lang == 'fi' ) { | ||
− | out = 'Lisäksi Vesi.fi-palvelun kautta on | + | out = 'Lisäksi Vesi.fi-palvelun kautta on valittuna ajanjaksona lähetetty ' + c1 + ' havaintoa sinilevätilanteesta. Näistä ' + c2 + ' kappaleessa havaittiin sinilevää.'; |
} else { | } else { | ||
− | out = 'In addition, ' + c1 + ' observations about the blue-green algae situation have been sent through the Vesi.fi service | + | out = 'In addition, ' + c1 + ' observations about the blue-green algae situation have been sent through the Vesi.fi service during the selected period. In ' + c2 + ' of these observations, algae had been detected.'; |
} | } | ||
+ | console.log( '0: ' + b0 ); | ||
+ | console.log( '1: ' + b1 ); | ||
+ | console.log( '2: ' + b2 ); | ||
+ | console.log( '3: ' + b3 ); | ||
+ | |||
jQuery( "#<!--{$id|default:vesificounter|escape:'html'}-->_container" ).html ( out ); | jQuery( "#<!--{$id|default:vesificounter|escape:'html'}-->_container" ).html ( out ); | ||