Ero sivun ”Widget:Test2” versioiden välillä
Järvi-meriwikistä
p (Tekstin korvaus – ”|limit=1000” muotoon ”|limit=2000”) |
|||
(15 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
− | + | <includeonly> | |
− | + | <script type="text/javascript"> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
(function() { | (function() { | ||
− | + | ||
// globals | // globals | ||
− | + | var today = new Date(); | |
− | + | function <!--{$id|default:TheGraph|escape:'html'}-->_jQueryTest() { | |
− | + | if ( typeof window.jQuery == 'undefined' ) { | |
− | + | setTimeout( function(){ <!--{$id|default:TheGraph|escape:'html'}-->_jQueryTest() }, 300); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
− | + | <!--{$id|default:TheGraph|escape:'html'}-->_func(); | |
} | } | ||
− | |||
− | |||
− | |||
} | } | ||
+ | setTimeout( function(){ <!--{$id|default:TheGraph|escape:'html'}-->_jQueryTest() }, 300); | ||
− | function | + | function <!--{$id|default:TheGraph|escape:'html'}-->_func() { |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
css_link = jQuery( "<link>", { rel: "stylesheet", type: "text/css", href: "//www.jarviwiki.fi/widgets/css/obschartwidget.css?ver=1" }); | css_link = jQuery( "<link>", { rel: "stylesheet", type: "text/css", href: "//www.jarviwiki.fi/widgets/css/obschartwidget.css?ver=1" }); | ||
css_link.appendTo('head'); | css_link.appendTo('head'); | ||
− | + | jQuery.getScript( "https://www.jarviwiki.fi/citobsjs/jwapi.js", function() { | |
− | jQuery.getScript( "https:// | + | jQuery.getScript( '//www.gstatic.com/charts/loader.js', function() { |
− | + | google.charts.load( 'current', {'packages':['corechart']} ); | |
− | + | google.charts.setOnLoadCallback( loadObservations ); | |
− | + | }); | |
− | + | }); | |
− | |||
− | |||
− | }); | ||
} | } | ||
− | |||
function loadObservations() { | function loadObservations() { | ||
− | jQuery( '. | + | jQuery( '.jwChartWidget' ).each( function() { |
var memo = {}; | var memo = {}; | ||
Rivi 156: | Rivi 42: | ||
memo.loaderEl.css( "background-position", "center center" ); | memo.loaderEl.css( "background-position", "center center" ); | ||
memo.loaderEl.css( "background-size", "75px 75px" ); | memo.loaderEl.css( "background-size", "75px 75px" ); | ||
− | memo.loaderEl.css( "background-image", "url( ' | + | memo.loaderEl.css( "background-image", "url( '/scripts/jwol3js/animated_spinner.gif' )" ); |
memo.loaderEl.fadeIn( "slow" ); | memo.loaderEl.fadeIn( "slow" ); | ||
Rivi 212: | Rivi 98: | ||
searchStr += encodeURI('|?ObsCode|?Päivämäärä|?SiteID|?Koordinaatit|?Lisätiedot|?Image|?DataJSON|?Display_fi|?Display_sv|?Display_en|?Ylläpito'); | searchStr += encodeURI('|?ObsCode|?Päivämäärä|?SiteID|?Koordinaatit|?Lisätiedot|?Image|?DataJSON|?Display_fi|?Display_sv|?Display_en|?Ylläpito'); | ||
− | searchStr += encodeURI('|sort=Päivämäärä|order=descending|limit= | + | searchStr += encodeURI('|sort=Päivämäärä|order=descending|limit=2000'); |
searchStr += '&format=json'; | searchStr += '&format=json'; | ||
Rivi 227: | Rivi 113: | ||
obs = req.query.results[o]; | obs = req.query.results[o]; | ||
//console.log(obs); | //console.log(obs); | ||
− | obsDate = new Date(parseInt(obs.printouts['Päivämäärä'][0])*1000); | + | obsDate = new Date(parseInt(obs.printouts['Päivämäärä'][0].timestamp)*1000); |
if ( typeof obs.printouts['Lisätiedot'][0] != 'undefined' ) { | if ( typeof obs.printouts['Lisätiedot'][0] != 'undefined' ) { | ||
Rivi 328: | Rivi 214: | ||
// margin settings | // margin settings | ||
− | memo.margins = { top: | + | memo.margins = { top: 0, right: 25, bottom: 60, left: 60 }; |
if ( typeof i18n[ memo.obscode ].direction != 'undefined' ) { memo.vaxisdir = i18n[ memo.obscode ].direction; } else { memo.vaxisdir = 1; } | if ( typeof i18n[ memo.obscode ].direction != 'undefined' ) { memo.vaxisdir = i18n[ memo.obscode ].direction; } else { memo.vaxisdir = 1; } | ||
Rivi 334: | Rivi 220: | ||
// defaults for all charts | // defaults for all charts | ||
memo.options = { | memo.options = { | ||
− | title: i18n[memo.obscode]['title'][memo.lang], | + | title: "", //i18n[memo.obscode]['title'][memo.lang], |
//titleTextStyle: { fontSize: 14 }, | //titleTextStyle: { fontSize: 14 }, | ||
backgroundColor: 'transparent', | backgroundColor: 'transparent', | ||
Rivi 1 530: | Rivi 1 416: | ||
} | } | ||
}; | }; | ||
− | |||
})(); // We call our anonymous function immediately | })(); // We call our anonymous function immediately | ||
− | + | </script> | |
− | + | </includeonly> | |
− |