Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 273.67 KB | None | 0 0
  1.  
  2. var ajaxloadingdelay = false;
  3. var ajaxloadingarchivemsg = false;
  4. var block_hiding_loadinglayer_when_loading = false;
  5. var graphwidth = 0;
  6. var keydown = 0;
  7. var no_reload = true;
  8. var last_param_id = 0;
  9. var images=[]; // buffers for preloading loop images
  10. var gifimages=[]; // buffers for preloading gif images
  11. var gifonce = true;
  12. var gifimages_loaded=0;
  13. var loaded_image_sources = [];
  14. var images_loaded =0;
  15. var images_waiting=0;
  16. var images_speed=5; // 0-10 different speeds
  17. var images_delay=[1000,750,400,200,160,140,120,100,90,80,70];
  18. var images_extend_max =8;
  19. var images_extend =1;
  20. var images_islast =0;
  21. var compact_interval=3;
  22. var loading=0;
  23. var popover_status = [];
  24. var favtoggle_status = 'hide';
  25. var adblock_txt = '<div class="abtextout"><div class="abtext"><p>Liebe Benutzerinnen und Benutzer von kachelmannwetter.com</p><p>Unsere Seite hat viele Angebote, die es nirgendwo anders gibt: Stormtracking, Blitzanalyse, Hagelalarm für Deutschland, Schweiz, Österreich und Luxemburg, das SuperHD-Modell mit 1x1 km Auflösung, weltweit viele Parameter des ECMWF-Modells und vieles mehr.</p><p>Dass es das anderswo nicht gibt, hat seinen Grund. Es ist uns was wert, tolle Menschen in der Firma zu haben, die das können, und Daten einzukaufen, die andere nicht haben und damit einen noch besseren Service zu bieten.</p></div><div class="abtext"><p>Das Ganze beruht irgendwie auf der Annahme, dass die User ahnen, dass wir Daten und Gehälter, die das möglich machen, irgendwie finanzieren müssen. Wir werden deshalb in naher Zukunft drei Dinge tun, damit alle etwas beitragen können.</p><p>1. Die Seite wird weiterhin Werbung haben.</p><p>2. Wer keine Werbung mag, wird für wenig Geld eine werbefreie Seite bekommen und für etwas mehr als wenig, aber immer noch wenig Geld eine werbefreie Seite mit zusätzlichen exklusiven Funktionen bekommen.</p></div><div class="abtext"><p>3. Wer einen Adblocker hat und sich nicht solidarisch in unserem UnterstützerInnen-Kollektiv engagieren möchte, wird unsere Seite leider nicht mehr sehen können.</p><p>Wir freuen uns auf alle, die bei uns bleiben - es ändert sich fast nichts und das Angebot wird wie bisher laufend ausgebaut. Wir sind noch lange nicht fertig und voller Ideen und Tatendrang.</p><p>Herzlich<br />Team Kachelmann GmbH</p></div><div style="clear:both;"></div></div>';
  26. var adblock_txt2 = '<div class="abtextout"><p>Werbefläche</p></div>';
  27. var download_image = null;
  28. var is_playing_first = true;
  29. var chartcounter=2;
  30. var xclicksvalue=0;
  31. var open_dd_div1='';
  32. var open_dd_div2='';
  33. var open_dd_tab_valids='';
  34. var open_dd_tab_models='';
  35. var open_dd_tab_params='';
  36. var open_dd_valids='';
  37. var open_dd_start=true;
  38.  
  39. /**
  40. * jQuery Unveil
  41. * A very lightweight jQuery plugin to lazy load images
  42. * http://luis-almeida.github.com/unveil
  43. *
  44. * Licensed under the MIT license.
  45. * Copyright 2013 Luís Almeida
  46. * https://github.com/luis-almeida
  47. */
  48.  
  49. ;(function($) {
  50.  
  51. $.fn.unveil = function(threshold, callback) {
  52.  
  53. var $w = $(window),
  54. th = threshold || 0,
  55. retina = window.devicePixelRatio > 1,
  56. attrib = retina? "data-src-retina" : "data-src",
  57. images = this,
  58. loaded;
  59.  
  60. this.one("unveil", function() {
  61. var source = this.getAttribute(attrib);
  62. source = source || this.getAttribute("data-src");
  63. if (source) {
  64. this.setAttribute("src", source);
  65. if (typeof callback === "function") callback.call(this);
  66. }
  67. });
  68.  
  69. function unveil() {
  70. var inview = images.filter(function() {
  71. var $e = $(this);
  72. if ($e.is(":hidden")) return;
  73.  
  74. var wt = $w.scrollTop(),
  75. wb = wt + $w.height(),
  76. et = $e.offset().top,
  77. eb = et + $e.height();
  78. return eb >= wt - th && et <= wb + th;
  79. });
  80. loaded = inview.trigger("unveil");
  81. images = images.not(loaded);
  82. }
  83. $w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
  84. unveil();
  85. return this;
  86. };
  87. })(window.jQuery || window.Zepto);
  88.  
  89. $(document).ready(function () {
  90. var tmp = parseInt($('#xclicksvalue').attr('data-value'));
  91. if (tmp>0) {
  92. xclicksvalue=tmp;
  93. chartcounter=tmp;
  94. }
  95.  
  96. smartphoneStartupTracks();
  97. resizeWidgets();
  98. $('.dkpw').each(function() {
  99. if (!$(this).is(":visible")) {
  100. $(this).html('');
  101. }
  102. } );
  103. $('.kwadtest').each(function() {
  104. $(this).parent().css('background-color','#dfdfdf');
  105. $(this).parent().html('Placeholder for advertising');
  106. });
  107. $('.freestar-iotest').each(function() {
  108. $(this).parent().css('background-color','#dfdfdf');
  109. $(this).parent().html('Placeholder for advertising');
  110. });
  111. var infocounter=0;
  112. $('.mdtest').each(function() {
  113. infocounter++;
  114. if(document.getElementById('gSxn2hs93hjs2hAhDRb')) {
  115. $(this).css('background-color','#dfdfdf');
  116. //$(this).css('height','100%');
  117. $(this).css('font-size','13px');
  118. $(this).html('<small>Placeholder for advertising:</small><br /><h2>'+$(this).attr('data-nx-container')+'</h2>');
  119. $(this).removeAttr("data-nx-container");
  120. var data = $(this).attr('data-twiago');
  121. if (typeof data !== 'undefined' && data) {
  122. var dat = data.split('|');
  123. if (parseInt(dat[0])>0 && parseInt(dat[1])>0 && parseInt(dat[2])>0) {
  124. $(this).css('width',parseInt(dat[0]));
  125. $(this).css('height',parseInt(dat[1]));
  126. $(this).removeAttr("data-twiago");
  127. $(this).removeClass('twiagoad');
  128. }
  129. }
  130. }
  131. else {
  132. $(this).css('background-color','#f7284b');
  133. $(this).css('color','#ffffff');
  134. $(this).css('height','100%');
  135. $(this).css('font-size','13px');
  136. $(this).removeAttr("data-nx-container");
  137. if (!isGoogle()) {
  138. $(this).html(adblock_txt);
  139. }
  140. else {
  141. $(this).html(adblock_txt2);
  142. }
  143. if (infocounter>=2) {
  144. return false;
  145. }
  146. }
  147. });
  148.  
  149. $('ins').each(function() {
  150. try {
  151. (adsbygoogle = window.adsbygoogle || []).push({});
  152. }
  153. catch(err) {}
  154. });
  155.  
  156. if($('#noadblock-info').attr('data-value') === 'true') {
  157. $('.md, .mdtest').hide();
  158. }
  159.  
  160. a457c035a6dd2ca7c69(function(ret, triggerCode) {
  161. var adblocker = 'Unknown';
  162.  
  163. if(ret) {
  164. adblocker = 'Enabled';
  165. var infocounter=0;
  166. $('.md').each(function() {
  167. infocounter++;
  168. $(this).css('background-color','#f7284b');
  169. $(this).css('color','#ffffff');
  170. $(this).css('height','100%');
  171. $(this).css('font-size','13px');
  172. $(this).removeAttr("data-nx-container");
  173. if (!isGoogle()) {
  174. $(this).html(adblock_txt);
  175. }
  176. else {
  177. $(this).html(adblock_txt2);
  178. }
  179. if (infocounter>=2) {
  180. return false;
  181. }
  182. });
  183. }
  184. else {
  185. adblocker = 'Disabled';
  186. }
  187.  
  188. if(typeof ga !=='undefined'){
  189. ga('send', 'event', 'Adblocker', adblocker, 'Trigger-Code: ' + triggerCode, { nonInteraction: true});
  190. } else if(typeof _gaq !=='undefined'){
  191. _gaq.push(['_trackEvent','Adblocker',adblocker,'Trigger-Code: ' + triggerCode,undefined,true]);
  192. }
  193.  
  194. //console.log({adblocker: adblocker, trigger: triggerCode, isAdblockInfoSite: $('#noadblock-info').attr('data-value') === 'true'});
  195.  
  196. var urlpath = get_url_path();
  197. if (urlpath.length == 0) { urlpath = '/'; }
  198. if (adblocker === 'Enabled' && $('#stop-redirect').attr('data-value') !== 'true' && $('#noadblock-info').attr('data-value') !== 'true' && !isGoogle()) {
  199. if(location.href.indexOf('adpreview=true') !== -1)
  200. location.href = get_url_path()+'/site/adblockuser/'+triggerCode+'/?adpreview=true';
  201. else
  202. location.href = get_url_path()+'/site/adblockuser/'+triggerCode+'/';
  203. }
  204. else if (adblocker === 'Disabled' && $('#noadblock-info').attr('data-value') === 'true' && !isGoogle()) {
  205. if(location.href.indexOf('adpreview=true') !== -1)
  206. location.href = urlpath + '?adpreview=true';
  207. else
  208. location.href = urlpath;
  209. }
  210. else if($('#stop-redirect').attr('data-value') !== 'true' && checkCookie() === 'cookiefail' && !isGoogle()) {
  211. showCookieFail();
  212. }
  213. else if ($('#nocookies-info').attr('data-value') === 'true' && checkCookie() !== 'cookiefail' && !isGoogle()) {
  214. location.href = urlpath;
  215. }
  216.  
  217. });
  218.  
  219. moment.locale(displayLanguageLowerCase());
  220. var legendDate = $('#legende-date').text();
  221. $('#legende-date').text(moment(legendDate, getTimezoneFormat('date')).format(getTimezoneFormat('date', true)));
  222.  
  223. checkOwnAds();
  224. setDropDownListener();
  225. setZoomListener();
  226. place_obs();
  227. resize_video();
  228. setShareListener();
  229. showOrHideOpenStreetMapInfo();
  230. checkHash();
  231. initSatTemp();
  232. initDatePicker();
  233. initTracks();
  234. initFloods();
  235. rdfcPrognose();
  236. initModelSwitcher();
  237. initVarSettings();
  238. initiOSzoomfix();
  239. loadingForecasts();
  240. initOpenDivs();
  241. setModelSelectorListener();
  242. setKlimaVergleichListener();
  243. setVhstationListener();
  244. setPhaenologieListener(true);
  245. $("img").unveil();
  246.  
  247. if ($('#unwetterzentrale').attr('data-location') === 'true' && $('#unwetterzentrale').is(":visible")) {
  248. gps_locating_uwz();
  249. }
  250.  
  251. $('.favtoggle').on('click', function() {
  252. if (favtoggle_status == 'show') {
  253. favtoggle_status = 'hide';
  254. }
  255. else {
  256. favtoggle_status = 'show';
  257. $('#myfavcontent').html(loadingMsg());
  258. if (checkCookie() === 'cookiefail') {
  259. $.get(get_url_path()+'/ajax/mylocationsmobile', {'nocookies':true}, function (data) { $('#myfavcontent').html(data);initiOSzoomfix();},'html');
  260. }
  261. else {
  262. $.get(get_url_path()+'/ajax/mylocationsmobile', {}, function (data) { $('#myfavcontent').html(data);initiOSzoomfix();},'html');
  263. }
  264. }
  265. });
  266. $('.close-addhistory').on('click', function(){
  267. addHistory(3);
  268. });
  269. $('.settings-close').on('click', function(){
  270. if ($('#settings-changed').attr('data-value') !== '0') {
  271. var tld = $('#settings-deftld').attr('data-value');
  272. $.get(get_url_path()+'/ajax/urlchanger', {
  273. 'location': location.href,
  274. 'tld': tld
  275. }, function (data) {
  276. if (data == location.href) {
  277. location.reload();
  278. }
  279. else if (data) {
  280. location.href = data;
  281. }
  282. },'html');
  283.  
  284. }
  285. });
  286.  
  287. if (History.Adapter) {
  288. History.Adapter.bind(window,'statechange',function(){
  289. var State = History.getState();
  290. if (State && no_reload == false) {
  291. location.reload();
  292. }
  293. no_reload = false;
  294. });
  295. setTimeout(function(){ no_reload = false; }, 1000);
  296. }
  297.  
  298. $(window).resize(function() {
  299. resizeWidgets();
  300. place_obs();
  301. resize_video();
  302. Highcharts.charts.forEach(function(v,a,ar){v.reflow();});
  303. });
  304.  
  305. if (displayCountry() !== 'de' && displayCountry() !== 'vh') {
  306. $(window).on('scroll', function() {
  307. var y=window.pageYOffset-$('#top-wrapper').offset().top+110; // 110px upper sticky boundary (top-wrapper offset to detect possible advert)
  308. if(y<35)y=35; // lower limit for top margin in non sticky case
  309. if(y>$('#top-wrapper')[0].clientHeight-$('.kw-ad-right')[0].clientHeight)
  310. y=$('#top-wrapper')[0].clientHeight-$('.kw-ad-right')[0].clientHeight; // upper limit for top-margin (aligned to top-wrapper)
  311. $('.kw-ad-right')[0].style.marginTop=y+"px";
  312. });
  313. }
  314.  
  315.  
  316. var server_response = $('#server-response').attr("data-value");
  317. if (server_response === 'unavailable') {
  318. messageLayer(503,'#error-msg','#error-modal');
  319. }
  320. else if (server_response === 'nologin') {
  321. messageLayer(513,'#error-msg','#error-modal');
  322. }
  323. else {
  324. var blitz = $('#blitz-id-start').attr("data");
  325. if (blitz) {
  326. $('#blitzortung').modal('show');
  327. showLgt(blitz,false);
  328. }
  329.  
  330. var track_url = $('#track-url-start').attr("data");
  331. if (track_url) {
  332. $('#stormtracking').modal('show');
  333. showTrackDetailByURL(track_url, false);
  334. }
  335.  
  336. var flood_url = $('#flood-url-start').attr("data");
  337. if (flood_url) {
  338. $('#stormtracking').modal('show');
  339. showFloodDetailByURL(flood_url, false);
  340. }
  341.  
  342.  
  343. var pollen = $('#pollen-id-start').attr("data");
  344. if (pollen) {
  345. $('#pollen_detail').modal('show');
  346. showPollen(pollen,false);
  347. }
  348. }
  349.  
  350. $('.tldselect').on('click', function(e){
  351. e.preventDefault();
  352. $.get(get_url_path()+'/ajax/cookieset', {
  353. 'element_id': 'cs-tld',
  354. 'id' : $(this).attr('data-select')
  355. }, function(data) {
  356. if (data) {
  357. document.location.href = data;
  358. }
  359. });
  360. });
  361.  
  362. if ($('#register-form-country').html()) {
  363. $('#register-form-hider').hide();
  364. $('#register-form-hider2').hide();
  365. $('#register-form-shower').show();
  366. }
  367. graphTabOnClick();
  368. plotGraph();
  369. plotGraphCompact();
  370. if(typeof ensemble_load != 'undefined')
  371. loadGraphEnsembleLong();
  372. else
  373. plotGraphEnsembleLong();
  374.  
  375. $('[data-toggle="offcanvas"]').on('click', function () {
  376. $('.row-offcanvas').toggleClass('active')
  377. });
  378.  
  379.  
  380. hoverPopover();
  381. $('*[data-pocontent]').on('click', function() {
  382. var e=$(this);
  383. if (popover_status[$(this).data('pocontent')] == 'show') {
  384. e.popover('hide');
  385. }
  386. else {
  387. var poparams = {};
  388. if (checkCookie() == 'cookiefail' && e.data('pocontent') == 'mylocations') {
  389. poparams = {'nocookies':true};
  390. }
  391. e.popover({ 'html': true,
  392. 'placement': 'bottom',
  393. 'trigger':'manual',
  394. 'content': '<div id="poajax_'+e.data('pocontent')+'" style="min-width:246px;">'+loadingMsg()+'</div>',
  395. 'template': '<div class="popover" role="tooltip"><div class="arrow"></div><div class="popover-otitle"><a class="pointer poclose" onclick="popoverClose(\''+e.data('pocontent')+'\');"><span class="popover-otclose">&times;<span></a><h3 class="popover-title"></h3></div><div class="popover-content"></div></div>'
  396. }).popover('show');
  397. $.get(get_url_path()+'/ajax/'+e.data('pocontent'),poparams, function(d) {
  398. $('#poajax_'+e.data('pocontent')).html(d);
  399. },'html');
  400. }
  401. });
  402.  
  403. $('*[data-pocontent]').on('show.bs.popover', function() {
  404. popover_status[$(this).data('pocontent')] = 'show';
  405. });
  406.  
  407. $('*[data-pocontent]').on('hide.bs.popover', function() {
  408. popover_status[$(this).data('pocontent')] = 'hide';
  409. });
  410.  
  411. $('[data-toggle="tooltip"]').tooltip();
  412.  
  413.  
  414. $('#kachelmann-faq h5>a').on("click", function(e){
  415. var url = $(this).attr('href');
  416. setTimeout(function(){$('#kachelmann-faq .in').removeClass('in');},300);
  417. if($(this).attr('data-faq') && $(this).attr('data-target')) {
  418. var obj = $($(this).attr('data-target')+'>div');
  419. if (obj.html() === '...') {
  420. obj.html('Wird geladen!');
  421. $.get(get_url_path()+'/ajax/faqs', {
  422. 'faqid': $(this).attr('data-faq')
  423. }, function (data) {
  424. obj.html(data);
  425. if (url) {
  426. pushHistory(url);
  427. }
  428. },'html');
  429. }
  430. }
  431. e.preventDefault();
  432. });
  433.  
  434. $('.source-marker').on("click", function(e){
  435. $('#'+$(this).attr('data-id')).select();//.select();
  436. e.preventDefault();
  437. });
  438.  
  439. $('#forecast-form-0').on('submit', function(e) {
  440. e.preventDefault();
  441. forecast_search0();
  442. });
  443.  
  444. $('#forecast-form-1').on('submit', function(e) {
  445. e.preventDefault();
  446. forecast_search1();
  447. });
  448.  
  449.  
  450. }).on("keydown", function(e) {
  451. var model_val = $('#model').val();
  452. if (typeof model_val !== 'undefined') {
  453. if(keydown==0){
  454. keydown=1;
  455. if ((e.which || e.keyCode) == 116) refresh(e);
  456. var model = $('#model-flag').val()
  457.  
  458. if (model) { // support cursor keys (reversed direction in model section)
  459. if ((e.which || e.keyCode) == 39) model_hour_prev();
  460. if ((e.which || e.keyCode) == 37) model_hour_next();
  461. if ((e.which || e.keyCode) == 40) model_member_next(e);
  462. if ((e.which || e.keyCode) == 38) model_member_prev(e);
  463. }
  464. else{
  465. if ((e.which || e.keyCode) == 37) model_hour_prev();
  466. if ((e.which || e.keyCode) == 39) model_hour_next();
  467. }
  468. }
  469. }
  470. if(((e.which || e.keyCode) == 39 || (e.which || e.keyCode) == 37) && $('#weather-fccompact-page').length >=1) {
  471.  
  472. var availableModels = $('.mod-fc-essentials');
  473. var currentSelectedIndex = availableModels.index(availableModels.filter('.btn-active'));
  474.  
  475. if(currentSelectedIndex === -1) return;
  476.  
  477. var nextSelectedIndex = currentSelectedIndex;
  478.  
  479. if ((e.which || e.keyCode) == 39) nextSelectedIndex++;
  480. if ((e.which || e.keyCode) == 37) nextSelectedIndex--;
  481.  
  482. if(nextSelectedIndex >= availableModels.length)
  483. nextSelectedIndex = 0;
  484.  
  485. if(nextSelectedIndex < 0)
  486. nextSelectedIndex = availableModels.length - 1;
  487.  
  488. availableModels.get(nextSelectedIndex).click();
  489. }
  490. });
  491. $(document).on("keyup", function(e){keydown=0;});
  492.  
  493.  
  494. var forecast_search0 = function () {
  495. if (forecast_search_setting(0)) {
  496. $('#forecast-form-0').off('submit');
  497. $('#forecast-form-0').submit();
  498. }
  499. };
  500. var wetter_search0 = function () {
  501. $('#forecast-form-0').submit();
  502. };
  503. var forecast_search_setting = function(id) {
  504. var tab = $('#tab-url').attr("data-src");
  505. if (typeof tab !== 'undefined') {
  506. $('#forecast-tab-'+id).val(tab);
  507. }
  508. var model = $('#forecast-model').val();
  509. var action = $('#forecast-action-'+id).val();
  510. if (typeof action !== 'undefined' && action) {
  511. var tmp = action.split('#');
  512. if (typeof model !== 'undefined' && model) {
  513. $('#forecast-action-'+id).val(tmp[0].replace("kompakt1x1","kompakt")+'#'+model);
  514. }
  515. }
  516. /*else {
  517. $('#forecast-action-'+id).val(tmp[0]);
  518. }*/
  519. return true;
  520. };
  521. var forecast_search1 = function () {
  522. if (forecast_search_setting(1)) {
  523. $('#forecast-form-1').off('submit');
  524. $('#forecast-form-1').submit();
  525. }
  526. };
  527. var wetter_search1 = function () {
  528. $('#forecast-form-1').submit();
  529. };
  530. var forecast_search_nav = function () {
  531. $('#forecast-form-nav').submit();
  532. };
  533. var forecast_search_fav = function () {
  534. $('#forecast-form-fav').submit();
  535. };
  536.  
  537. var setShareListener = function() {
  538. $('.mouse-overlay').hide();
  539. $('#content-image').hover(
  540. function(){
  541. $('.mouse-overlay').show();
  542. },
  543. function(){
  544. $('.mouse-overlay').hide();
  545. }
  546. );
  547. };
  548. var setModelSelectorListener = function() {
  549. $('.mod-fc').off('click').
  550. on('click', function(e) {
  551. $('#forecast-model').val($(this).attr('data-value'));
  552. e.preventDefault();
  553. forecastModel();
  554. });
  555. $('.mod-fc-trend').off('click').
  556. on('click', function(e) {
  557. $('#forecast-model').val($(this).attr('data-value'));
  558. e.preventDefault();
  559. forecastModelTrend();
  560. });
  561. $('.mod-fc-switch').off('click').
  562. on('click', function(e) {
  563. e.preventDefault();
  564. switchForecast($(this).attr('data-out'));
  565. });
  566. /*$('.mod-fc-essentials').off('click').
  567. on('click', function(e) {
  568. e.preventDefault();
  569. $('#forecast-model').val($(this).attr('data-value'));
  570. forecastModelEssentials();
  571. });*/
  572. $('.mod-fc-ensemble').off('click').
  573. on('click', function(e) {
  574. e.preventDefault();
  575. $('#forecast-model').val($(this).attr('data-value'));
  576. forecastModelEnsemble();
  577. });
  578. };
  579.  
  580. var setZoomListener = function() {
  581. $('#click-overlay').off('click').
  582. on('click', function(e) {
  583. model_player_stop();
  584. images=[]; // clear buffers for preloading loop images
  585. loaded_image_sources=[];
  586. images_loaded=0; // reset loader
  587. loading=0;
  588. images_extend=1;
  589. //closeMarker();
  590. var left = parseInt($('#top-wrapper').position().left);
  591. var top = parseInt($('#top-wrapper').position().top)+get_abstandY();
  592. var factor = 760 / (parseInt(getImageWidth())+1);
  593. var params = {
  594. 'posX' : Math.round((e.pageX-($('#content-image').position().left+get_abstand())-left)*factor),
  595. 'posY' : Math.round((e.pageY-($('#content-image').position().top)-top)*factor),
  596. 'area_id' : get_selected_area(),
  597. 'area_hierarchy' : get_area_hierarchy(),
  598. 'model' : $('#model').val(),
  599. 'model_valid' : $('#model-valid').val(),
  600. 'model_run' : $('#model-run').val(),
  601. 'model_param' : $('#model-param').val(),
  602. 'model_location' : $('#model-location').val(),
  603. 'model_member' : $('#model-member').val(),
  604. 'geo_lat' : $('#geo-lat').val(),
  605. 'geo_long' : $('#geo-long').val(),
  606. 'fl_newest' : $('#newest-flag').val(),
  607. 'fl_param' : $('#param-flag').val(),
  608. 'fl_model' : $('#model-flag').val(),
  609.  
  610. };
  611. if ($('#model').val() === 'blitze' && $('#blitze-5minonly').prop('checked')) {
  612. params.blitze_5minonly = 'true';
  613. }
  614. if ($('#model').val() === 'cyclone') {
  615. params.model_filter_storm = $('#model-filter-storm').val();
  616. }
  617. //$('.lp_param').html($('.container').width()+' left: '+$('#content-image').position().left+' top:'+$('#content-image').position().top+' factor: '+factor+' posX:'+Math.round((e.pageX-($('#content-image').position().left+get_abstand())-left)*factor)+ ' posY:'+Math.round((e.pageY-($('#content-image').position().top)-top)*factor));
  618. ajaxLoaderShowDelay();
  619. $.post(get_url_path()+'/ajax/zoomall', params, function (data) {
  620. ajaxLoaderHide();
  621. if (data === 'SURVIVAL') {
  622. messageLayer(101,'#error-msg','#error-modal');
  623. }
  624. else if (data === 'NOT_ALLOWED') {
  625. messageLayer(403,'#error-msg','#error-modal');
  626. }
  627. else if (data === 'UNAVAILABLE') {
  628. messageLayer(503,'#error-msg','#error-modal');
  629. }
  630. else if (data !== 'FALSE') {
  631. if (data === 'not_allowed') {
  632. messageLayer(102,'#error-msg','#error-modal');
  633. }
  634. else {
  635. $('#drop-downs').html(data);
  636. setDropDownListener();
  637. changeImage();
  638. showOrHideOpenStreetMapInfo();
  639. place_obs();
  640. reloadIframeAds();
  641. initDatePicker();
  642. initOpenDivs();
  643. }
  644. }
  645. },'html');
  646. }
  647. );
  648. };
  649. var getImageWidth = function() {
  650. return $('#click-overlay').width();
  651. }
  652. var zoom_out = function() {
  653. model_player_stop();
  654. images=[]; // buffers for preloading loop images
  655. loaded_image_sources=[];
  656. images_loaded=0;
  657. loading=0;
  658. var areas = getAreaArray();
  659. ajaxLoaderShowDelay();
  660. $.post(get_url_path()+'/ajax/zoomout', {
  661. 'area_id' : get_selected_area(),
  662. 'areas_1' : areas[1],
  663. 'areas_2' : areas[2],
  664. 'areas_3' : areas[3],
  665. 'areas_4' : areas[4],
  666. 'areas_5' : areas[5],
  667. 'areas_6' : areas[6],
  668. 'areas_7' : areas[7],
  669. 'areas_8' : areas[8],
  670. 'areas_9' : areas[9],
  671. 'model' : $('#model').val(),
  672. 'model_param' : $('#model-param').val(),
  673. 'model_location' : $('#model-location').val(),
  674. 'model_valid' : $('#model-valid').val()
  675. }, function (data) {
  676. ajaxLoaderHide();
  677. if (data === 'not_allowed') {
  678. messageLayer(103,'#error-msg','#error-modal');
  679. }
  680. else if (data === 'NOT_ALLOWED') {
  681. messageLayer(403,'#error-msg','#error-modal');
  682. }
  683. else if (data === 'UNAVAILABLE') {
  684. messageLayer(503,'#error-msg','#error-modal');
  685. }
  686. else {
  687. findAndSetArea(get_selected_area());
  688. //closeMarker();
  689. refreshDropdowns();
  690.  
  691. }
  692. },'html');
  693. };
  694.  
  695. var findAndSetArea = function(area_id) {
  696. var fieldname = '';
  697. var counter = 0;
  698. for (i=1;i<=9;i++) {
  699. counter = counter * 1000;
  700. fieldname = '#form-areaid-'+i;
  701. $(fieldname+' option').each(function(){
  702. counter++;
  703. if (parseInt($(this).attr('value')) === parseInt(area_id) && counter > 1000) {
  704. $(fieldname).val('0');
  705. return fieldname;
  706. }
  707. });
  708. }
  709. };
  710.  
  711. var cookieSettings = function() {
  712. $('#settings-msg').html(loadingGif());
  713. $('#settings-modal').modal('show');
  714. var poparams = {};
  715. if (checkCookie() == 'cookiefail') {
  716. poparams = {'nocookies':true};
  717. }
  718. $.get(get_url_path()+'/ajax/settings', poparams, function(data) {
  719. $('#settings-msg').html(data);
  720. $('#cookie-settings-form select').off('change').
  721. on('change', function(e) {
  722. cookiesave($(this).attr('id'));
  723. e.preventDefault();
  724. }
  725. );
  726. },'html');
  727. };
  728.  
  729. var cookiesave = function(element_id) {
  730. var value = $('#'+element_id).val();
  731. if (typeof value !== 'undefined' && typeof element_id !== 'undefined') {
  732. $.get(get_url_path()+'/ajax/cookieset', {
  733. 'element_id': element_id,
  734. 'id' : value
  735. }, function(data) {
  736. if (element_id === 'cs-tld') {
  737. $('#settings-deftld').attr('data-value',value);
  738. }
  739. $('#settings-changed').attr('data-value','1');
  740. });
  741. }
  742. return false;
  743. };
  744.  
  745. var loadingGif = function() {
  746. var loadingImageURL = $('#loading-image-url').attr('data-value');
  747. if (typeof loadingImageURL === 'undefinded' || !loadingImageURL) {
  748. loadingImageURL = '/images/ajax-loader.gif';
  749. }
  750. return '<p style="text-align:center;margin-top:10px;"><img src="'+loadingImageURL+'" alt="Loading" /></p>';
  751. };
  752.  
  753. var radarus_is_dyn = function(param) {
  754. if (typeof param === 'undefined') {
  755. param = $('#model-mode').val();
  756. }
  757. return (param === 'RADARUS_DYN' || param === 'RADARUS_DYN_HI' || param === 'RADARUS_DYN_AK' || param === 'RADARUS_DYN_NC');
  758. };
  759.  
  760. var setDropDownListener = function() {
  761. $('#drop-downs select').off('change').
  762. on('change', function() {
  763. //closeMarker();
  764. if ($(this).attr('id') !== 'model-player-interval') {
  765. refreshDropdowns(null, null, null, null, $(this));
  766. }
  767. }
  768. );
  769. $('#drop-downs select').off('focus').
  770. on('focus', function() {
  771. //model_player_stop();
  772. }
  773. );
  774. setElementHiders();
  775. setAccListener();
  776. $('#blitze-5minonly').off('change').on('change', function(e){e.preventDefault();lightning5min();});
  777. initAutoRefresh();
  778. };
  779.  
  780. var closeAccLayer = function (obj) {
  781. var id = obj.attr('id');
  782. $('[data-id='+id+']').each(
  783. function() {
  784. if ($(this).hasClass('acc-btn-on')) {
  785. $(this).addClass('acc-btn-active');
  786. }
  787. else {
  788. $(this).removeClass('acc-btn-active');
  789. }
  790. }
  791. );
  792. obj.slideUp();
  793. }
  794. var closeAcc2Layer = function (obj) {
  795. var id = obj.attr('id');
  796. $('.acc2-layer').each(
  797. function() {
  798. if ($(this).hasClass('acc2-btn-active')) {
  799. $(this).removeClass('acc2-btn-active');
  800. }
  801. }
  802. );
  803. obj.slideUp();
  804. }
  805. var openAccLayer = function (obj) {
  806. var id = obj.attr('data-id');
  807. $('[data-id='+id+']').each(
  808. function() {
  809. if ($(this).hasClass('acc-btn-on')) {
  810. $(this).removeClass('acc-btn-active');
  811. }
  812. else {
  813. $(this).addClass('acc-btn-active');
  814. }
  815. }
  816. );
  817. $('#'+id).slideDown();
  818. scrollTopParam();
  819. }
  820. var openAccLayerDirect = function (obj) {
  821. var id = obj.attr('data-id');
  822. $('[data-id='+id+']').each(
  823. function() {
  824. if ($(this).hasClass('acc-btn-on')) {
  825. $(this).removeClass('acc-btn-active');
  826. }
  827. else {
  828. $(this).addClass('acc-btn-active');
  829. }
  830. }
  831. );
  832. $('#'+id).show();
  833. scrollTopParam();
  834. }
  835.  
  836. var scrollTopParam = function() {
  837. var scrolling = $('#ac-id-param').offset();
  838. var start = $('#param-autoscroll-all').offset();
  839. if (typeof scrolling !== 'undefined' && typeof start !== 'undefined') {
  840. //alert(start.top + ' ' + scrolling.top);
  841. $('#param-autoscroll-all').animate({scrollTop:scrolling.top-start.top}, 0);
  842. }
  843. }
  844.  
  845. var openAcc2Layer = function (obj) {
  846. var id = obj.attr('data-id');
  847.  
  848. var previousVisibleLayer = $('.acc2-btn-active').next('.acc2-layer:visible');
  849.  
  850. $('.acc2-layer').each(
  851. function() {
  852. if ($(this).hasClass('acc2-btn-active')) {
  853. $(this).removeClass('acc2-btn-active');
  854. }
  855. }
  856. );
  857. obj.addClass('acc2-btn-active');
  858. $('#'+id).slideDown();
  859.  
  860. //Die angeklickte Kategorie nach oben scrollen, so dass sie nicht außerhalb des sichtbaren Bereichs ist
  861. var parentContainer = obj.closest('div');
  862. var offsetTop = parentContainer.offset().top;
  863.  
  864. var scrollOffsetTop = $('#param-autoscroll-all').offset().top;
  865. var scrollTop = $('#param-autoscroll-all').scrollTop();
  866.  
  867. var previousHeight = 0;
  868. if(previousVisibleLayer.length > 0 && previousVisibleLayer.offset().top < offsetTop)
  869. previousHeight = previousVisibleLayer.height();
  870.  
  871. $('#param-autoscroll-all').animate({scrollTop: scrollTop - (scrollOffsetTop - offsetTop) - previousHeight}, 400);
  872.  
  873. }
  874.  
  875. var setAccListener = function() {
  876. $('.acc-btn').off('click').
  877. on('click', function(e) {
  878. e.preventDefault();
  879. var id = $(this).attr('data-id');
  880. if ($(this).hasClass('acc-btn-on') && $('#'+id).is(":visible")) {
  881. $('.acc-layer').each(function() {
  882. if ($(this).is(":visible")) {
  883. closeAccLayer($(this));
  884. }
  885. });
  886. open_dd_div1 = '';
  887. }
  888. else if ($(this).hasClass('acc-btn-on') && !$('#'+id).is(":visible")) {
  889. $('.acc-layer').each(function() {
  890. if ($(this).is(":visible") && $(this).attr('data-id') !== id) {
  891. closeAccLayer($(this));
  892. }
  893. });
  894. openAccLayer($(this));
  895. open_dd_div1 = id;
  896. }
  897. else {
  898. $('.acc-layer').each(function() {
  899. if ($(this).is(":visible")) {
  900. closeAccLayer($(this));
  901. }
  902. });
  903. open_dd_div1 = '';
  904. }
  905. }
  906. );
  907. $('.acc2-btn').off('click').
  908. on('click', function(e) {
  909. e.preventDefault();
  910. var id = $(this).attr('data-id');
  911. if ($('#'+id).is(":visible")) {
  912. $('.acc2-layer').each(function() {
  913. if ($(this).is(":visible")) {
  914. closeAcc2Layer($(this));
  915. }
  916. });
  917. open_dd_div2 = '';
  918. }
  919. else {
  920. console.log(2);
  921. $('.acc2-layer').each(function() {
  922. if ($(this).is(":visible") && $(this).attr('data-id') !== id) {
  923. closeAcc2Layer($(this));
  924. }
  925. });
  926. openAcc2Layer($(this));
  927. open_dd_div2 = id;
  928. }
  929. }
  930. );
  931.  
  932. $('.ac-btn').off('click').
  933. on('click', function(e) {
  934. e.preventDefault();
  935. var tabid = $(this).parents('.tab-pane').attr('id');
  936. if (typeof tabid !== 'undefined' && tabid) {
  937. if (tabid === 'tab-param-top' || tabid === 'tab-param-daily' || tabid === 'tab-param-all' || tabid === 'tab-param-ens' || tabid === 'tab-param-prob' || tabid === 'tab-param-spagh' || tabid === 'tab-param-meta') {
  938. open_dd_tab_params=tabid;
  939. }
  940. if (tabid === 'tab-dates-date' || tabid === 'tab-dates-hour') {
  941. open_dd_tab_valids=tabid;
  942. }
  943. if (tabid === 'tab-models-all' || tabid === 'tab-models-switch' || tabid === 'tab-models-archive') {
  944. open_dd_tab_models=tabid;
  945. }
  946. }
  947. if (checkChartcounter()) {
  948. var model = $(this).attr('data-model');
  949. if (isModelCard(model)) {
  950. return switch2model(model);
  951. }
  952. var id = $(this).attr('data-id');
  953. var value = $(this).attr('data-value');
  954. var jqobj = $('#'+id).val();
  955. if (typeof jqobj !== 'undefined' && typeof value !== 'undefined') {
  956. $('#'+id).val(value);
  957. return refreshDropdowns(null,null,null,null,$('#'+id));
  958. }
  959. }
  960. //alert('test');
  961. });
  962. $('.ac-btn-disabled').off('click').
  963. on('click', function(e) {
  964. e.preventDefault();
  965. });
  966. $('.pay-btn-disabled').off('click').
  967. on('click', function(e) {
  968. e.preventDefault();
  969. showExtraNotice();
  970. $('#faq-modal').modal('show');
  971. });
  972.  
  973. $('.valid-btn').off('click').
  974. on('click', function(e) {
  975. e.preventDefault();
  976. var id = $(this).attr('data-value');
  977. if (id) {
  978. if ($('.valid-btn').hasClass("btn-active")) {
  979. $('.valid-btn').removeClass("btn-active");
  980. }
  981. $(this).addClass("btn-active");
  982. open_dd_valids = id;
  983. $('.valids-all').hide();
  984. $('.valids-all').addClass('valids-hide');
  985. $('.'+id).show();
  986. $('.'+id).removeClass('valids-hide');
  987. }
  988. });
  989. $('.btn-fc-neighbour').off('click').
  990. on('click', function() {
  991. var new_loc=$(this).attr('data-value');
  992. var old_loc=$('#forecast-loc').attr('data-value');
  993. var new_url = $('#forecast-url').attr("data");
  994. if (typeof new_url !== 'undefined') {
  995. new_url = new_url.replace(old_loc, new_loc);
  996. var tab = $('#tab-url').attr("data-src");
  997. if (tab) {
  998. new_url = new_url+'/'+tab;
  999. }
  1000. goto(new_url);
  1001. }
  1002. });
  1003. $('.btn-fc-tab').off('click').
  1004. on('click', function() {
  1005. var new_loc=$(this).attr('data-value');
  1006. var old_loc=$('#forecast-loc').attr('data-value');
  1007. var new_url = $('#forecast-url').attr("data");
  1008. if (typeof new_url !== 'undefined') {
  1009. new_url = new_url.replace(old_loc, new_loc);
  1010. if (new_url.indexOf('/kompakt') >= 0) {
  1011. new_url = new_url+'/'+$('#forecast-model').val();
  1012. }
  1013. var tab = $('#tab-url').attr("data-src");
  1014. if (tab) {
  1015. if (new_url.indexOf('/ensemble') >= 0 || new_url.indexOf('/xl') >= 0 ) {
  1016. new_url = new_url+'/'+$('#forecast-model').val();
  1017. }
  1018. new_url = new_url+'/'+tab;
  1019. }
  1020. //console.log(new_url);
  1021. goto(new_url);
  1022. }
  1023. });
  1024. $('.btn-map-gps').off('click').
  1025. on('click', function() {
  1026. $('.btn-map-gps').removeClass('tab-current');
  1027. $(this).addClass('tab-current');
  1028. var lat=$(this).attr('data-lat');
  1029. var long=$(this).attr('data-long');
  1030. set_to_latlong(lat,long);
  1031. });
  1032. $('.switch-map').off('click').
  1033. on('click', function(e) {
  1034. e.preventDefault();
  1035. if (checkChartcounter()) {
  1036. var params = {
  1037. 'switcher': 'grid',
  1038. 'model' : $('#model').val(),
  1039. 'model_valid' : $('#model-valid').val(),
  1040. 'model_member' : $('#model-member').val(),
  1041. 'model_run' : $('#model-picked-date').val(),
  1042. 'model_param' : $('#model-param').val(),
  1043. 'model_location' : $('#model-location').val(),
  1044. 'area_id': get_selected_area(),
  1045. 'geo_lat' : $('#geo-lat').val(),
  1046. 'geo_long' : $('#geo-long').val()
  1047. };
  1048. if ($(this).hasClass('map-country')) {
  1049. params.switcher = 'country';
  1050. }
  1051. refreshDropdowns(false, false, params);
  1052. }
  1053. });
  1054. if ($('#animation-player-mobile').is(':visible')) {
  1055. var html = $('#animation-player-mobile').html();
  1056. if (typeof html !== 'undefined' && html.length === 0) {
  1057. $('#animation-player-mobile').html($('#animation-player-desktop').html());
  1058. $('#animation-player-desktop').html('');
  1059. }
  1060. }
  1061. else {
  1062. $('#animation-player-mobile').html('');
  1063. }
  1064. if ($('#animation-player-desktop').is(':visible')) {
  1065. var html = $('#animation-player-desktop').html();
  1066. if (typeof html !== 'undefined' && html.length === 0) {
  1067. $('#animation-player-desktop').html($('#animation-player-mobile').html());
  1068. $('#animation-player-mobile').html('');
  1069. }
  1070. }
  1071. else {
  1072. $('#animation-player-desktop').html('');
  1073. }
  1074. }
  1075.  
  1076. var get_selected_area = function(jqobj) {
  1077. var area_id = 0;
  1078. for (i=1;i<=10;i++) {
  1079. fieldname = '#form-areaid-'+i;
  1080. if ($(fieldname).val() && parseInt($(fieldname).val()) > 0) {
  1081. area_id = $(fieldname).val();
  1082. if (jqobj && '#'+jqobj.attr('id') === fieldname) {
  1083. break;
  1084. }
  1085. }
  1086. else {
  1087. break;
  1088. }
  1089. }
  1090. return area_id;
  1091. };
  1092.  
  1093. var get_area_hierarchy = function() {
  1094. var area_id = new Array(10);
  1095. for (i=1;i<=10;i++) {
  1096. fieldname = '#form-areaid-'+i;
  1097. if ($(fieldname).val() && parseInt($(fieldname).val()) > 0) {
  1098. area_id[i-1] = $(fieldname).val();
  1099. }
  1100. else {
  1101. break;
  1102. }
  1103. }
  1104. return area_id;
  1105. };
  1106.  
  1107. var get_selected_model_path = function() {
  1108. if ($('#model').val()==='px250' || $('#model').val()==='px250blau' || $('#model').val()==='wwanalyze' || $('#model').val()==='radar'|| $('#model').val()==='radarus' || $('#model').val()==='radarde' || $('#model').val()==='radarpre' || $('#model').val()==='singlepx' || $('#model').val()==='plraw' || $('#model').val()==='storms' || $('#model').val()==='floods' || $('#model').val()==='pl' || $('#model').val()==='blitze' || $('#model').val()==='regen' || $('#model').val()==='hagel' || $('#model').val()==='radial' || $('#model').val()==='sweeps' || $('#model').val()==='radar3d' || $('#model').val()==='zsweeps' || $('#model').val()==='sat') {
  1109. var model = $('#model-valid').val();
  1110. var formModel = model.split('/');
  1111. var run_hour = formModel[1];
  1112. var run_date = formModel[0].split('-');
  1113. var ret = new Array(2);
  1114. ret[0] = run_date[0]+'_'+run_date[1]+'_'+run_date[2];
  1115. ret[1] = run_hour;
  1116. return ret;
  1117. }
  1118. var model = $('#model-run').val();
  1119. if (typeof model === 'undefined') {
  1120. return '';
  1121. }
  1122. else {
  1123. var formModel = model.split('/');
  1124. var run_hour = formModel[1];
  1125. var run_date = formModel[0].split('-');
  1126. return run_date[0]+'_'+run_date[1]+'_'+run_date[2]+'_'+run_hour;
  1127. }
  1128. };
  1129.  
  1130. var get_model_image_path = function(satdl, set_model, set_param, set_model_valid, set_location) {
  1131. var area = get_selected_area();
  1132. var model = $('#model').val();
  1133. if (model === 'modvhshd') {
  1134. return false;
  1135. }
  1136. if (typeof set_model !== 'undefined') {
  1137. model = set_model;
  1138. }
  1139. var model_param = $('#model-param').val();
  1140. if (typeof set_param !== 'undefined') {
  1141. model_param = set_param;
  1142. }
  1143. var model_valid = $('#model-valid').val();
  1144. if (typeof set_model_valid !== 'undefined') {
  1145. model_valid = set_model_valid;
  1146. }
  1147. if (model_valid && model === 'cyclone') {
  1148. var filter_storm = $('#model-filter-storm').val();
  1149. if (typeof filter_storm !== 'undefined' && filter_storm) {
  1150. filter_storm = filter_storm + '-'
  1151. }
  1152. else {
  1153. filter_storm = '';
  1154. }
  1155. var param = $('#model-param').val();
  1156. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+$('#model-selector').val()+'_'+$('#model-run').val()+'_'+area+'_'+param+'_'+filter_storm+$('#model-valid').val()+'.png');
  1157. }
  1158. else if (model_valid) {
  1159. var formModel = model_valid.split('/');
  1160. var run_hour = formModel[1];
  1161. var run_date = formModel[0].split('-');
  1162. if (model.substring(0,3) !=='mod') {
  1163. var datum = run_date[0]+'_'+run_date[1]+'_'+run_date[2];
  1164. var uhrzeit = run_hour;
  1165. datum = datum.replace(/-/g, "_");
  1166. uhrzeit = uhrzeit.replace(/:/g, "_");
  1167. }
  1168. if (model === 'radarpre') {
  1169. uhrzeit = uhrzeit.replace(/_/g, "");
  1170. var futuremin = '000';
  1171. if (formModel[2]) {
  1172. futuremin = formModel[2];
  1173. }
  1174. if ($('#model-valid-fcspecial').val() == 'RADARAT_PRO_FX' && futuremin == '000') {
  1175. futuremin = '005';
  1176. }
  1177. if ($('#model-valid-fcspecial').val() == 'RADARCH_PRO_FX' && futuremin == '000') {
  1178. futuremin = '005';
  1179. }
  1180. if ($('#model-valid-fcspecial').val() == 'RADARNL_PRO_FX' && futuremin == '000') {
  1181. futuremin = '005';
  1182. }
  1183. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit+'_'+futuremin+'.png');
  1184. }
  1185. else if (model === 'px250' || model === 'px250blau' || model === 'wwanalyze' || model === 'radarde' || model === 'radar' || model === 'singlepx' || model === 'pl' || model === 'plraw' || model === 'blitze'
  1186. || (model === 'radarus' && $('#model-mode').val() === 'RADARUS')) {
  1187. uhrzeit = uhrzeit.replace(/_/g, "");
  1188. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit+'.png');
  1189. }
  1190. else if (model === 'radarus' && $('#model-mode').val() === 'RADARUS_PARAM') {
  1191. uhrzeit = uhrzeit.replace(/_/g, "");
  1192. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_param+'_'+uhrzeit+'.png');
  1193. }
  1194. else if (model === 'radarus') {
  1195. uhrzeit = uhrzeit.replace(/_/g, "");
  1196. var model_location = $('#model-location').val();
  1197. if (typeof set_location !== 'undefined') {
  1198. model_location = set_location;
  1199. }
  1200. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_location+'_'+model_param+'_'+uhrzeit+'.png');
  1201. }
  1202. else if (model === 'hagel') {
  1203. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit+'_'+area+'_'+model_param+'.png');
  1204. }
  1205. else if (model === 'sat' || model === 'globus') {
  1206. if (satdl === 'PNG') {
  1207. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit+'_'+area+'_'+model_param+'.png');
  1208. }
  1209. else {
  1210. return extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit+'_'+area+'_'+model_param+'.jpg');
  1211. }
  1212. }
  1213. else if (isModelCard(model)) {
  1214. var selected_index = $('#model-valid').prop("selectedIndex");
  1215. $('#model-valid-hidden').prop("selectedIndex", selected_index);
  1216. var model_valid_hidden = $('#model-valid-hidden').val();
  1217. var model_member = $('#model-member').val();
  1218. var member_string = '';
  1219. if (typeof model_member !== 'undefined' && model_member.length>0 && parseInt(model_member)>=0) {
  1220. member_string = '_m'+model_member;
  1221. }
  1222. var run_date = model_valid_hidden.split('#');
  1223. var lang = '';
  1224. if (model_param == 155 || model_param == 213 || model_param == 352 || model_param == 353) {
  1225. lang = '-'+displayLanguage().toString().toLowerCase();
  1226. }
  1227. var modelstring = 'model';
  1228. if (model === 'modezseason') {
  1229. modelstring = 'season';
  1230. }
  1231. else if (model === 'modezwkly') {
  1232. modelstring = 'weekly';
  1233. }
  1234. return extServer(url_path+'/images/data/cache/'+modelstring+'/'+modelstring+lang+'_'+model+'_'+run_date[0]+'_'+run_date[1]+'_'+area+'_'+model_param+member_string+'.png');
  1235. }
  1236. else {
  1237. var axel = Math.random() + "";
  1238. var num = axel * 1000000000000000000;
  1239. var returnurl = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit+'_'+area+'_'+model_param+'.png');
  1240. if (isObsMode(model)) {
  1241. returnurl = returnurl + '?'+num;
  1242. }
  1243. return returnurl;
  1244. }
  1245. }
  1246. };
  1247.  
  1248. var get_model_overlay_path = function(trans) {
  1249. var domain = '';
  1250. if (trans === 'zz') {
  1251. domain = $('#overlay-nonames').attr('data-value');
  1252. }
  1253. else {
  1254. domain = $('#overlay-withnames').attr('data-value');
  1255. }
  1256. var area = get_selected_area();
  1257. if (area === 500000000 || area == 500000001 || area == 500000002) {
  1258. area = 2;
  1259. }
  1260. var path = Math.floor(area/100)*100;
  1261. return domain+path+'/'+area+'.png';
  1262. };
  1263.  
  1264.  
  1265. var changeImage = function() {
  1266. replaceOverlay();
  1267. replaceImage();
  1268. initSatTemp();
  1269. addHistory();
  1270. };
  1271.  
  1272. var replaceOverlay = function() {
  1273. if ($('#model').val() !== 'globus' && $('#model').val() !== 'plraw') {
  1274. $('.map-overlay>img').attr('src', get_model_overlay_path('zz'));
  1275. $('.map-overlay-trans>img').attr('src', get_model_overlay_path(displayCountry()));
  1276. }
  1277. initVarSettings();
  1278.  
  1279. };
  1280.  
  1281. var showOrHideOpenStreetMapInfo = function() {
  1282. showHide('#odbl_visibility','#odbl', 'hide');
  1283. showHide('#model_image_visibility','#model-image', 'show');
  1284. var show = $('#legends_visibility').attr('data');
  1285. if ( show === 'PX250' || show === 'RADARDE' || show === 'RADAR' || show === 'RADAR_CH' || show === 'RADAR_AT' || show === 'RADARNL' || show === 'RADAR_SWE_PRO' ||
  1286. show === 'RADAR_ESTONIA' || show === 'NORWAY_RR' || show === 'FINLAND_DBZH_COMPOSITE' || show === 'UK_RAINRATE' || show === 'SLOVENIA_RR' || show === 'RADAR_SOUTHTYROL' || show === 'RADAR_FRANCE' ||
  1287. show === 'PL' || show === 'PLRAW' || show === 'PLRAW_DE' || show === 'PL_AT' || show === 'PL_NOL' || show === 'PL_AT_NOL' ||
  1288. show === 'FLOODS' || show === 'FLOODWARNAT' || show === 'STORMS' || show === 'STORMSAT' ||
  1289. show === 'RADARSD' || show === 'PLDBZ' || show === 'RADIAL' || show === 'SWEEPS' || show === 'ZSWEEPS' ||
  1290. (show && isObsMode($('#model').val())) ||
  1291. //show === 'HAIL' || show === 'HAIL_AT' || show === '685' || show === '686' || show === '687' || show === '688' || show === '689' || show === '690' ||
  1292. $('#model').val() === 'hagel' ||
  1293. show === 'BLITZWORLD' || show === 'BLITZE' ||
  1294. (show && $('#model').val() == 'regen')) {
  1295. $('#scale-overlay>img').attr('src', scalePath()+show+'.png');
  1296. }
  1297. };
  1298.  
  1299. var showHide = function(id_data, id_image, toggle) {
  1300. var show = $(id_data).attr('data');
  1301. if(show === toggle) {
  1302. $(id_image).hide();
  1303. }
  1304. else {
  1305. $(id_image).show();
  1306. }
  1307. };
  1308.  
  1309. var replaceImage = function(refresh) {
  1310. var model = $('#model').val();
  1311. if (model === 'modvhshd' || model === 'modvhrpd' || model === 'modvhez' || model === 'modvhezwkly' || model === 'modvhanalyze' || model === 'modvhsoil') {
  1312. var lang = displayLanguage().toString().toLowerCase();
  1313. var width = 600;
  1314. var height = 100;
  1315. var mode = $('#acc-layer-model .btn-active').data('model');
  1316. var param = $('#model-param option:selected').val();
  1317. $('#legend').attr('src', '/images/modelscale/'+lang+'/'+mode+'/'+param+'_'+width+'_'+height+'.png');
  1318. return false;
  1319. }
  1320.  
  1321.  
  1322. var image = get_model_image_path();
  1323. var areas = getAreaArray();
  1324. var area_id = get_selected_area();
  1325. var leer = url_path+'/images/overlay/trans.png';
  1326. if (model === 'storms' || model === 'floods') {
  1327. var hidden_model = $('#hidden-model').val();
  1328. if (hidden_model === 'empty') {
  1329. $('#model-image>img').attr('src',leer);
  1330. $('#tstorm-image>img').attr('src',leer);
  1331. $('#stormtrack-image>img').attr('src',image);
  1332. }
  1333. else if (hidden_model == 'pl') {
  1334. $('#model-image>img').attr('src',get_model_image_path('',hidden_model));
  1335. if ($('#hide-lightning-image').attr('data-value') !== 'false') {
  1336. $('#tstorm-image>img').attr('src',get_model_image_path('',hidden_model).replace(/pl/g,"tstorm"));
  1337. }
  1338. $('#stormtrack-image>img').attr('src',image);
  1339. }
  1340. else if (hidden_model == 'px250blau') {
  1341. $('#model-image>img').attr('src',get_model_image_path('',hidden_model));
  1342. if ($('#hide-lightning-image').attr('data-value') !== 'false') {
  1343. $('#tstorm-image>img').attr('src',get_model_image_path('',hidden_model).replace(/px250blau/g,"tstorm"));
  1344. }
  1345. $('#stormtrack-image>img').attr('src',image);
  1346. }
  1347. else {
  1348. var tmp = hidden_model.split("#");
  1349. if (parseInt(tmp[1]) > 0) {
  1350. $('#model-image>img').attr('src',get_model_image_path('',tmp[0], tmp[1]));
  1351. }
  1352. else {
  1353. $('#model-image>img').attr('src',get_model_image_path('',tmp[0]));
  1354. }
  1355. $('#tstorm-image>img').attr('src',leer);
  1356. $('#stormtrack-image>img').attr('src',image);
  1357. }
  1358. }
  1359. else if (model !== 'blitze' && !isObsMode(model)) {
  1360. $('#model-image>img').attr('src', image);
  1361. $('#stormtrack-image>img').attr('src',leer);
  1362. }
  1363. else {
  1364. $('#stormtrack-image>img').attr('src',leer);
  1365. }
  1366. if (model === 'pl' && $('#hide-lightning-image').attr('data-value') !== 'false') {
  1367. $('#tstorm-image>img').attr('src', image.replace(/pl/g,"tstorm"));
  1368. }
  1369. else if (model !== 'storms' && model !== 'floods') {
  1370. $('#tstorm-image>img').attr('src',leer);
  1371. }
  1372.  
  1373. var params = {
  1374. 'model' : $('#model').val(),
  1375. 'model_run' : $('#model-run').val(),
  1376. 'model_param' : $('#model-param').val(),
  1377. 'model_location' : $('#model-location').val(),
  1378. 'image_width' : $('#map-overlay').width(),
  1379. 'model_member' : $('#model-member').val(),
  1380. 'area_id' : area_id,
  1381. 'areas_1' : areas[1],
  1382. 'areas_2' : areas[2],
  1383. 'areas_3' : areas[3],
  1384. 'areas_4' : areas[4],
  1385. 'areas_5' : areas[5],
  1386. 'areas_6' : areas[6],
  1387. 'areas_7' : areas[7],
  1388. 'areas_8' : areas[8],
  1389. 'areas_9' : areas[9],
  1390. 'real_refresh' : 0
  1391. };
  1392. if (refresh !== true) {
  1393. params.model_valid = $('#model-valid').val();
  1394. }
  1395. if (isModelCard(model)) {
  1396. params.mvh = $('#model-valid-hidden').val();
  1397. }
  1398. if (is_playing !== 1) {
  1399. $.get(get_url_path()+'/ajax/legende', params
  1400. , function (data) {
  1401. $('#text-overlay').html(data);
  1402. place_obs();
  1403. var model = $('#model').val();
  1404. $('#copyright_text').html('');
  1405. if (model ==='radarus') {
  1406. if ($('#legends_visibility').attr('data') === 'RADARUS_COMP') {
  1407. $('#scale-overlay>img').attr('src', scalePath()+"RADARUS_COMP.png");
  1408. }
  1409. else if (radarus_is_dyn() || ($('#model-mode').val() === 'RADARUS_PARAM' && $('#model-param').val() !== '358' && $('#model-param').val() !== '432')) {
  1410. replaceScale();
  1411. }
  1412. else {
  1413. $('#scale-overlay>img').attr('src', scalePath()+"RADARUS.png");
  1414. }
  1415. }
  1416. else if (model==='regen' || model==='blitze' || model==='pl' || model==='cyclone' || isObsMode(model) ||
  1417. model === 'sat' || model === 'globus' || isModelCard(model)) {
  1418. replaceScale();
  1419. }
  1420. else if (model === 'px250') {
  1421. var text = $('#copyright_hidden').attr('data');
  1422. if (!text) { text=''; }
  1423. $('#copyright_text').html(text);
  1424. }
  1425. if ((model === 'blitze' || isObsMode(model)) && $('#model_image_visibility').attr('data') !== 'show') {
  1426. $('#model-image>img').attr('src', image);
  1427. }
  1428.  
  1429. var legendDate = $('#legende-date').text();
  1430. $('#legende-date').text(moment(legendDate, getTimezoneFormat('date')).format(getTimezoneFormat('date', true)));
  1431.  
  1432. initTracks();
  1433. initFloods();
  1434. rdfcPrognose();
  1435. lightning5min();
  1436. setTimeout(checkLoader,300);
  1437. hoverPopover();
  1438. });
  1439. }
  1440. else {
  1441. var model_run = $('#model-run').val().split("-");
  1442. $('#legende-date').html(model_run[2]+'.'+model_run[1]+'.'+model_run[0]);
  1443. $('#legende-time').html($('#model-valid').val());
  1444. }
  1445. };
  1446.  
  1447. var checkLoader=function(){
  1448. var loader=$('#model-image>img')[0];
  1449. if (typeof loader !== 'undefined') {
  1450. if(!$('#model-image>img')[0].complete){
  1451. ajaxLoaderShow();
  1452. setTimeout(checkLoader,100);
  1453. }
  1454. else {
  1455. ajaxLoaderHide();
  1456. }
  1457. }
  1458. }
  1459.  
  1460. var replaceText = function() {
  1461. var area_id = get_selected_area();
  1462. var areas = getAreaArray();
  1463. $.post(get_url_path()+'/ajax/overlay', {
  1464. 'model' : $('#model').val(),
  1465. 'model_run' : $('#model-run').val(),
  1466. 'model_valid' : $('#model-valid').val(),
  1467. 'model_param' : $('#model-param').val(),
  1468. 'model_location' : $('#model-location').val(),
  1469. 'area_id' : area_id,
  1470. 'areas_1' : areas[1],
  1471. 'areas_2' : areas[2],
  1472. 'areas_3' : areas[3],
  1473. 'areas_4' : areas[4],
  1474. 'areas_5' : areas[5],
  1475. 'areas_6' : areas[6],
  1476. 'areas_7' : areas[7],
  1477. 'areas_8' : areas[8],
  1478. 'areas_9' : areas[9]
  1479. }, function (data) {
  1480. $('#text-overlay').html(data);
  1481. place_obs();
  1482. replaceScale('overlay');
  1483. });
  1484. };
  1485.  
  1486. var getTimezoneFormat = function(type, addDayname) {
  1487.  
  1488. var tzformatInt = +$('#display-tzformat').attr('data-value');
  1489. if(typeof tzformatInt === 'undefined') {
  1490. tzformatInt = 1;
  1491. }
  1492.  
  1493. var dateStr = '';
  1494. var timeStr = '';
  1495. var formatStr = '';
  1496.  
  1497. switch (tzformatInt) {
  1498. case 0:
  1499. case 3:
  1500. case 5:
  1501. case 6:
  1502. case 8:
  1503. timeStr = 'hh:mma';
  1504. break;
  1505. case 1:
  1506. case 2:
  1507. case 4:
  1508. case 7:
  1509. case 9:
  1510. timeStr = 'HH:mm';
  1511. break;
  1512. }
  1513.  
  1514. switch (tzformatInt) {
  1515. case 0:
  1516. case 2:
  1517. dateStr = 'MM/DD/YYYY';
  1518. break;
  1519. case 1:
  1520. case 5:
  1521. dateStr = 'DD.MM.YYYY';
  1522. break;
  1523. case 3:
  1524. case 4:
  1525. dateStr = 'DD/MM/YYYY';
  1526. break;
  1527. case 6:
  1528. case 7:
  1529. dateStr = 'YYYY-MM-DD';
  1530. break;
  1531. case 8:
  1532. case 9:
  1533. dateStr = 'DD-MM-YYYY';
  1534. break;
  1535. }
  1536.  
  1537. formatStr = dateStr + ', ' + timeStr;
  1538.  
  1539. if(addDayname)
  1540. dateStr = 'ddd ' + dateStr;
  1541.  
  1542. formatStr = dateStr + ', ' + timeStr;
  1543.  
  1544. if(type == 'time')
  1545. return timeStr;
  1546.  
  1547. if(type == 'date')
  1548. return dateStr;
  1549.  
  1550. return formatStr;
  1551. };
  1552.  
  1553. var model_hour_prev = function() {
  1554. if (checkChartcounter()) {
  1555. $('#model-year-block').val('blockyear');
  1556. model_x_change_index_prev('#model-valid','prev');
  1557. }
  1558. };
  1559. var model_date_prev = function() {
  1560. if (checkChartcounter()) {
  1561. $('#model-year-block').val('blockyear');
  1562. model_x_change_index_prev('#model-run','prev');
  1563. }
  1564. };
  1565. var model_year_prev = function() {
  1566. if (checkChartcounter()) {
  1567. model_x_change_index_prev('#model-year', 'prevyear');
  1568. }
  1569. };
  1570.  
  1571. var model_x_change_index_prev = function(mid, prev) {
  1572. var selected = model_player_get_selected_index(mid);
  1573. var items = model_player_get_item_count(mid+" option");
  1574. var newsel = selected + 1;
  1575. if($(mid+" .valids-hide").length>0) {
  1576. var valclass = $('.valid-btn.btn-active').data('value');
  1577. newsel = selected + $(mid+' option:selected').nextUntil('.'+valclass).length + 1;
  1578. console.log(newsel);
  1579. }
  1580. if (selected < items) {
  1581. $(mid).prop("selectedIndex", newsel);
  1582. $(mid).trigger('change');
  1583. }
  1584. else {
  1585. refreshDropdowns(null, null, null, prev);
  1586. }
  1587. };
  1588.  
  1589. var model_x_change_index_next = function (mid) {
  1590. var selected = model_player_get_selected_index(mid);
  1591. var items = model_player_get_item_count(mid+" option");
  1592. var newsel = selected - 1;
  1593. if($(mid+" .valids-hide").length>0) {
  1594. var valclass = $('.valid-btn.btn-active').data('value');
  1595. newsel = selected - $(mid+' option:selected').prevUntil('.'+valclass).length - 1;
  1596. console.log(newsel);
  1597. }
  1598. if (selected > 0) {
  1599. $(mid).prop("selectedIndex", newsel);
  1600. $(mid).trigger('change');
  1601. }
  1602. else {
  1603. refreshDropdowns(null, null, null, 'next');
  1604. }
  1605. };
  1606.  
  1607. var model_hour_next = function() {
  1608. if (checkChartcounter()) {
  1609. $('#model-year-block').val('blockyear');
  1610. model_x_change_index_next('#model-valid');
  1611. }
  1612. };
  1613. var model_date_next = function() {
  1614. if (checkChartcounter()) {
  1615. $('#model-year-block').val('blockyear');
  1616. model_x_change_index_next('#model-run');
  1617. }
  1618. };
  1619. var model_year_next = function() {
  1620. if (checkChartcounter()) {
  1621. model_x_change_index_next('#model-year');
  1622. }
  1623. };
  1624.  
  1625. var model_x_prev = function(mid) {
  1626. var selected = model_player_get_selected_index(mid);
  1627. var items = model_player_get_item_count(mid+" option");
  1628. if (selected < items) {
  1629. $(mid).prop("selectedIndex", selected + 1);
  1630. if (selected+1 < items) {
  1631. images_islast = 0;
  1632. }
  1633. else {
  1634. images_islast = 1;
  1635. }
  1636. }
  1637. else {
  1638. $(mid).prop("selectedIndex", 0);
  1639. }
  1640. if (is_playing === 1) {
  1641. replacePlayerImage(mid);
  1642. }
  1643. else {
  1644. changePlayerImage(mid);
  1645. }
  1646. };
  1647.  
  1648. var model_x_next = function(mid) {
  1649. var selected = model_player_get_selected_index(mid);
  1650. var items = model_player_get_item_count(mid+" option");
  1651. if (selected > 0) {
  1652. $(mid).prop("selectedIndex", selected - 1);
  1653. if (selected-1 > 0) {
  1654. images_islast = 0;
  1655. }
  1656. else {
  1657. images_islast = 1;
  1658. }
  1659. }
  1660. else {
  1661. $(mid).prop("selectedIndex", items);
  1662. }
  1663. if (is_playing === 1) {
  1664. replacePlayerImage(mid);
  1665. }
  1666. else {
  1667. changePlayerImage(mid);
  1668. }
  1669. };
  1670.  
  1671. var changePlayerDropdowns = function() {
  1672. var data = $("#radar-animation").val();
  1673. var opt = data.split('/');
  1674. $('#model-run').val(opt[0]);
  1675. $('#model-valid').val(opt[1]);
  1676. };
  1677.  
  1678. var changePlayerImage = function(domid) {
  1679. replacePlayerImage(domid, true);
  1680. initSatTemp();
  1681. };
  1682.  
  1683. var replacePlayerImage = function(domid, flag_skip) {
  1684. var model = $('#model').val();
  1685. if (model === 'modvhshd') {
  1686. return false;
  1687. }
  1688. //changePlayerDropdowns();
  1689. var meta_data = $(domid).val();
  1690. if (meta_data) {
  1691. var meta_data_split = meta_data.split('#');
  1692. var data = meta_data_split[0];
  1693. var opt = data.split('/');
  1694. var area = get_selected_area();
  1695. if (model.substring(0,3)!=="mod") {
  1696. var datum = opt[0].replace(/-/g, "_");
  1697. var uhrzeit = opt[1].replace(/:/g, "");
  1698. }
  1699. if (model === 'radial' || model === 'sweeps' || model === 'radar3d' || model === 'zsweeps' || isObsMode(model)) {
  1700. var uhrzeit2 = opt[1].replace(/:/g, "_");
  1701. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.png');
  1702. }
  1703. else if (model === 'radarus' && $('#model-mode').val() === 'RADARUS_PARAM') {
  1704. uhrzeit = uhrzeit.replace(/_/g, "");
  1705. var model_param = $('#model-param').val();
  1706. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_param+'_'+uhrzeit+'.png');
  1707. }
  1708. else if (model === 'radarus' && radarus_is_dyn()) {
  1709. uhrzeit = uhrzeit.replace(/_/g, "");
  1710. var model_location = $('#model-location').val();
  1711. var model_param = $('#model-param').val();
  1712. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_location+'_'+model_param+'_'+uhrzeit+'.png');
  1713. }
  1714. else if (model === 'sat' || model === 'globus') {
  1715. var uhrzeit2 = opt[1].replace(/:/g, "_");
  1716. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.jpg');
  1717. }
  1718. else if (model === 'hagel') {
  1719. var uhrzeit2 = opt[1].replace(/:/g, "_");
  1720. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.png');
  1721. }
  1722. else if (model === 'radarpre') {
  1723. var uhrzeit2 = opt[1].replace(/:/g, "");
  1724. var futuremin = '000';
  1725. if (opt[2]) {
  1726. futuremin = opt[2];
  1727. }
  1728. if ($('#model-valid-fcspecial').val() == 'RADARAT_PRO_FX' && futuremin == '000') {
  1729. futuremin = '005';
  1730. }
  1731. if ($('#model-valid-fcspecial').val() == 'RADARCH_PRO_FX' && futuremin == '000') {
  1732. futuremin = '005';
  1733. }
  1734. if ($('#model-valid-fcspecial').val() == 'RADARNL_PRO_FX' && futuremin == '000') {
  1735. futuremin = '005';
  1736. }
  1737. if (parseInt(futuremin)>0) {
  1738. $('#rdfc-button').show();
  1739. $('#legend-parameter').html('Niederschlagsradar (Prognose) (mm/h)');
  1740. }
  1741. else {
  1742. $('#rdfc-button').hide();
  1743. $('#legend-parameter').html('Niederschlagsradar (mm/h)');
  1744. }
  1745. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit2+'_'+futuremin+'.png');
  1746. }
  1747. else if(model.substring(0,3)=="mod"){
  1748. var model_param = $('#model-param').val();
  1749. var model_valid_hidden = $(domid).val();
  1750. var model_member = $('#model-member').val();
  1751. var member_string = '';
  1752. if (typeof model_member !== 'undefined' && model_member.length>0 && parseInt(model_member)>=0) {
  1753. member_string = '_m'+model_member;
  1754. }
  1755. var run_date = model_valid_hidden.split('#');
  1756. var lang = '';
  1757. if (model_param == 155 || model_param == 213 || model_param == 352 || model_param == 353) {
  1758. lang = '-'+displayLanguage().toString().toLowerCase();
  1759. }
  1760. var m = 'model';
  1761. if (model === 'modezseason') {
  1762. m = 'season';
  1763. }
  1764. else if (model === 'modezwkly') {
  1765. m = 'weekly';
  1766. }
  1767. var image = extServer(url_path+'/images/data/cache/'+m+'/'+m+lang+'_'+model+'_'+run_date[0]+'_'+run_date[1]+'_'+area+'_'+model_param+member_string+'.png');
  1768. }
  1769. else {
  1770. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit+'.png');
  1771. }
  1772.  
  1773. //console.log('flag_skip'+flag_skip+' includes: '+loaded_image_sources.includes(image)+ ' -- '+image);
  1774. if (flag_skip === true || loaded_image_sources.indexOf(image) != -1) {
  1775. $('#model-image>img').attr('src', image);
  1776. }
  1777. if (model === 'pl') {
  1778. $('#tstorm-image>img').attr('src', image.replace(/pl/g,"tstorm"));
  1779. }
  1780. else {
  1781. $('#tstorm-image>img').attr('src',url_path+'/images/overlay/trans.png');
  1782. }
  1783. if (model !== 'storms' && model !== 'floods') {
  1784. $('#stormtrack-image>img').attr('src',url_path+'/images/overlay/trans.png');
  1785. }
  1786.  
  1787.  
  1788.  
  1789. if(model.substring(0,3)!=="mod"){
  1790.  
  1791. var momentDate = moment(meta_data_split[1], 'YYYY-MM-DD/HH:mm');
  1792.  
  1793. var dateString = momentDate.format(getTimezoneFormat('date', true));
  1794. var timeString = momentDate.format(getTimezoneFormat('time'));
  1795.  
  1796. if(displayLanguage() == 'DE')
  1797. timeString += ' Uhr';
  1798.  
  1799. $('#legende-date').html(dateString);
  1800. $('#legende-time').html(timeString);
  1801. if (model === 'radarpre') {
  1802. $('#rdfc-time').html(timeString);
  1803. }
  1804. }
  1805. else {
  1806.  
  1807. var momentDate = moment(meta_data_split[3], 'DD.MM.YYYY, HH:mm [Uhr]');
  1808. var dayString = momentDate.format('ddd');
  1809.  
  1810. $('#legende-complete-date').html(dayString + ' ' + meta_data_split[3]);
  1811. $('#legende-modelrun').html(meta_data_split[2].replace(", ", "/"));
  1812. }
  1813. }
  1814. };
  1815.  
  1816. var model_player_first = function() {
  1817. var items = model_player_get_item_count("#radar-animation option");
  1818. $("#radar-animation").prop("selectedIndex", items);
  1819. changePlayerImage();
  1820. };
  1821. var model_player_last = function() {
  1822. $("#radar-animation").prop("selectedIndex", 0);
  1823. changePlayerImage();
  1824. };
  1825.  
  1826. var model_player_prev = function(domid) {
  1827. if($('#model').val().substring(0,3) === 'mod') {
  1828. model_x_next(domid);
  1829. }
  1830. else {
  1831. model_x_prev(domid);
  1832. }
  1833. };
  1834.  
  1835. var model_player_next = function(domid) {
  1836. if($('#model').val().substring(0,3) === 'mod') {
  1837. model_x_prev(domid);
  1838. }
  1839. else {
  1840. model_x_next(domid);
  1841. }
  1842. };
  1843.  
  1844.  
  1845. var model_player_get_selected_index = function(name) {
  1846. return $(name).prop("selectedIndex");
  1847. };
  1848.  
  1849. var model_player_get_item_count = function(name) {
  1850. if(name.substring(0,16)=="#radar-animation"){
  1851. var ret = ($(name).length*images_extend/images_extend_max)-1;
  1852. }
  1853. else{
  1854. var ret = ($(name).length)-1;
  1855. }
  1856. return ret;
  1857. };
  1858.  
  1859. var animate = null;
  1860. var is_playing = 0;
  1861. var current_image = 0;
  1862. var max_images;
  1863.  
  1864.  
  1865.  
  1866.  
  1867. var model_player_start = function(nohistory) {
  1868. if (is_playing === 1) {
  1869. return false;
  1870. };
  1871.  
  1872. //stopAutoRefresh();
  1873.  
  1874. if (isObsMode($('#model').val())) {
  1875. var show = $('#model_image_visibility').attr('data');
  1876. if (show === 'show') {
  1877. $('#model-image').show();
  1878. $('.obs').hide();
  1879. }
  1880. }
  1881. current_image = model_player_get_selected_index('#model-valid');
  1882. var images_counter=12;
  1883. if ($('#model').val() === 'radarpre') {
  1884. $('#radar-animation').prop("selectedIndex", 24);
  1885. images_counter=48;
  1886. }
  1887. if (nohistory != 2) {
  1888. trackPlayer('#radar-animation',images_counter.toString());
  1889. }
  1890. if (nohistory != 1) {
  1891. addHistory(1);
  1892. }
  1893. max_images = model_player_get_item_count("#radar-animation option");
  1894. ajaxLoaderShow();
  1895. model_player_load();
  1896. };
  1897.  
  1898. var modelcharts_player_start = function(nohistory) {
  1899. if (is_playing === 1) {
  1900. return false;
  1901. };
  1902. if (nohistory != 1) {
  1903. addHistory(1);
  1904.  
  1905. }
  1906. var intervall = $('#model-player-interval').val();
  1907. max_images = model_player_get_item_count("#modelcharts-animation-"+intervall+" option");
  1908. trackPlayer("#modelcharts-animation-"+intervall,max_images);
  1909. current_image = model_player_get_selected_index('#model-valid');
  1910. addHistory(1);
  1911. ajaxLoaderShow(true);
  1912. modelcharts_player_load();
  1913. };
  1914.  
  1915. var modelcharts_player_stop = function() {
  1916. is_playing = 0;
  1917. is_playing_first = true;
  1918. images=[]; // buffers for preloading loop images
  1919. loaded_image_sources=[];
  1920. images_loaded=0;
  1921. loading=0;
  1922. refreshDropdowns();
  1923. };
  1924.  
  1925. var model_player_stop = function() {
  1926. is_playing = 0;
  1927. is_playing_first = true;
  1928. images=[]; // buffers for preloading loop images
  1929. loaded_image_sources=[];
  1930. images_loaded=0;
  1931. loading=0;
  1932. clearInterval(player_load_session);
  1933. player_load_session = null;
  1934. initSatTemp();
  1935. if (isObsMode($('#model').val())) {
  1936. var show = $('#model_image_visibility').attr('data');
  1937. if (show === 'show') {
  1938. $('#model-image').hide();
  1939. var mapmarker = $('#map-marker').css('display');
  1940. $('.obs').show();
  1941. $('#map-marker').css('display',mapmarker);
  1942. }
  1943. }
  1944. };
  1945.  
  1946. var model_player_stop_button = function() {
  1947. model_player_stop();
  1948. var starttime = $('#player-start-time').attr('data-value');
  1949. if(typeof starttime !== 'undefined' && starttime.length>0) {
  1950. refreshDropdowns(false);
  1951. }
  1952. else {
  1953. refreshDropdowns(1);
  1954. }
  1955. }
  1956.  
  1957. var frame_count_orig=-1;
  1958. var model_player_extend_button = function() {
  1959. if (loading==1 || images_extend===images_extend_max) {
  1960. return false;
  1961. };
  1962. model_player_stop();
  1963. var images_counter = 12;
  1964. if(frame_count_orig<0){
  1965. frame_count_orig=images_extend_max*document.getElementById('frame_count').innerHTML;
  1966. }
  1967. if (images_extend==1){images_extend=2; images_counter=24;}
  1968. else if(images_extend==2){images_extend=4; images_counter=48;}
  1969. else if(images_extend==3){images_extend=6; images_counter=72;}
  1970. else if(images_extend==4){images_extend=8; images_counter=96;}
  1971. else {images_extend=1;}
  1972. $('#frame_count').html((frame_count_orig*images_extend/images_extend_max));
  1973. //console.log(frame_count_orig+" "+images_extend+" "+images_extend_max);
  1974. images=[]; // buffers for preloading loop images
  1975. loaded_image_sources=[];
  1976. images_loaded=0;
  1977. loading=0;
  1978. $('#radar-animation').prop("selectedIndex", 0);
  1979. trackPlayer('#radar-animation', images_counter.toString());
  1980. model_player_start(2);
  1981. }
  1982.  
  1983. var model_player_extend_level = function(level) {
  1984. images_extend=level;
  1985. model_player_stop();
  1986. if(frame_count_orig<0 && document.getElementById('frame_count')){
  1987. frame_count_orig=images_extend_max*document.getElementById('frame_count').innerHTML;
  1988. }
  1989. $('#frame_count').html((frame_count_orig*images_extend/images_extend_max));
  1990. images=[]; // buffers for preloading loop images
  1991. loaded_image_sources=[];
  1992. images_loaded=0;
  1993. loading=0;
  1994. model_player_start(2);
  1995. }
  1996.  
  1997. var model_player_speed = function() {
  1998. if (is_playing == 0) {
  1999. model_player_start();
  2000. }
  2001. else {
  2002. model_player_stop_button();
  2003. }
  2004. }
  2005. var model_player_load = function() {
  2006. images=[];
  2007. preload_image_animation("#radar-animation");
  2008. };
  2009. var modelcharts_player_load = function() {
  2010. images=[];
  2011. var intervall = $('#model-player-interval').val();
  2012. preload_image_animation("#modelcharts-animation-"+intervall);
  2013. };
  2014.  
  2015. var player_load_session = null;
  2016. var preload_image_animation = function(domid, isGif) {
  2017.  
  2018. $('#ajax-loading-progress .progress-bar').css('width', '0%');
  2019.  
  2020. clearInterval(player_load_session);
  2021. player_load_session = null;
  2022.  
  2023. var parallel_proc = $('#parallel-proc').attr('data-value');
  2024. if (typeof parallel_proc === 'undefined') {
  2025. parallel_proc = 1;
  2026. }
  2027. parallel_proc = parseInt(parallel_proc);
  2028.  
  2029. //Fill Image Url Array
  2030. var image_url_array = [];
  2031.  
  2032. var model = $('#model').val();
  2033. var area = get_selected_area();
  2034. var is_obs_mode = isObsMode(model);
  2035. var is_radarus_dyn = radarus_is_dyn();
  2036. var max_preload_images = model_player_get_item_count(domid+" option") + 1;
  2037.  
  2038. $(domid).find('option').each(function(index) {
  2039.  
  2040. if(image_url_array.length >= max_preload_images) return;
  2041.  
  2042. var optionEl = $(this);
  2043.  
  2044. var meta_data = optionEl.val();
  2045. var meta_data_split = meta_data.split('#');
  2046. var data = meta_data_split[0];
  2047. var opt = data.split('/');
  2048.  
  2049. var image = null;
  2050.  
  2051. if (model.substring(0,3)!=="mod") {
  2052. var datum = opt[0].replace(/-/g, "_");
  2053. var uhrzeit = opt[1].replace(/:/g, "");
  2054. }
  2055.  
  2056. if (model === 'radial' || model === 'sweeps' || model === 'radar3d' || model === 'zsweeps' || is_obs_mode) {
  2057. var uhrzeit2 = opt[1].replace(/:/g, "_");
  2058. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.png');
  2059. }
  2060. else if (model === 'radarus' && $('#model-mode').val() === 'RADARUS_PARAM') {
  2061. uhrzeit = uhrzeit.replace(/_/g, "");
  2062. var model_param = $('#model-param').val();
  2063. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_param+'_'+uhrzeit+'.png');
  2064. }
  2065. else if (model === 'radarus' && is_radarus_dyn) {
  2066. uhrzeit = uhrzeit.replace(/_/g, "");
  2067. var model_location = $('#model-location').val();
  2068. var model_param = $('#model-param').val();
  2069. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_location+'_'+model_param+'_'+uhrzeit+'.png');
  2070. }
  2071. else if (model === 'sat' || model === 'globus') {
  2072. var uhrzeit2 = opt[1].replace(/:/g, "_");
  2073. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.jpg');
  2074. }
  2075. else if (model === 'hagel') {
  2076. var uhrzeit2 = opt[1].replace(/:/g, "_");
  2077. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.png');
  2078. }
  2079. else if (model === 'radarpre') {
  2080. var uhrzeit2 = opt[1].replace(/:/g, "");
  2081. var futuremin = '000';
  2082. if (opt[2]) {
  2083. futuremin = opt[2];
  2084. }
  2085. if ($('#model-valid-fcspecial').val() == 'RADARAT_PRO_FX' && futuremin == '000') {
  2086. futuremin = '005';
  2087. }
  2088. if ($('#model-valid-fcspecial').val() == 'RADARCH_PRO_FX' && futuremin == '000') {
  2089. futuremin = '005';
  2090. }
  2091. if ($('#model-valid-fcspecial').val() == 'RADARNL_PRO_FX' && futuremin == '000') {
  2092. futuremin = '005';
  2093. }
  2094. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit2+'_'+futuremin+'.png');
  2095. }
  2096. else if(model.substring(0,3)=="mod"){
  2097. var model_param = $('#model-param').val();
  2098. var model_valid_hidden = optionEl.val();
  2099. var model_member = $('#model-member').val();
  2100. var member_string = '';
  2101. if (typeof model_member !== 'undefined' && model_member.length>0 && parseInt(model_member)>=0) {
  2102. member_string = '_m'+model_member;
  2103. }
  2104. var run_date = model_valid_hidden.split('#');
  2105. var lang = '';
  2106. if (model_param == 155 || model_param == 213 || model_param == 352 || model_param == 353) {
  2107. lang = '-'+displayLanguage().toString().toLowerCase();
  2108. }
  2109. var m = 'model';
  2110. if (model === 'modezseason') {
  2111. m = 'season';
  2112. }
  2113. else if (model === 'modezwkly') {
  2114. m = 'weekly';
  2115. }
  2116. image = extServer(url_path+'/images/data/cache/'+m+'/'+m+lang+'_'+model+'_'+run_date[0]+'_'+run_date[1]+'_'+area+'_'+model_param+member_string+'.png');
  2117. }
  2118. else {
  2119. image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit+'.png');
  2120. }
  2121.  
  2122. if(image)
  2123. image_url_array.push(image);
  2124.  
  2125. });
  2126.  
  2127. var images_loaded = 0;
  2128. var images_to_load = parallel_proc;
  2129. var loading_in_process = false;
  2130.  
  2131. $('img.animation-cache-image').remove();
  2132.  
  2133. player_load_session = setInterval(function() {
  2134.  
  2135. if(player_load_session == null) return;
  2136.  
  2137. //Exit intervall loop - All images are loaded
  2138. if(images_loaded >= max_preload_images) {
  2139. $('#ajax-loading-progress .progress-bar').css('width', '100%');
  2140.  
  2141. clearInterval(player_load_session);
  2142. player_load_session = null;
  2143.  
  2144. if(!isGif) {
  2145. is_playing = 1;
  2146. setTimeout(function() {
  2147. ajaxLoaderHide();
  2148. model_player_play(domid);
  2149. }, 300);
  2150. } else {
  2151. setTimeout(function() {
  2152. ajaxLoaderHide();
  2153. produceGif(domid);
  2154. }, 300);
  2155. }
  2156.  
  2157. }
  2158.  
  2159.  
  2160. if(images_loaded < images_to_load && !loading_in_process) {
  2161. loading_in_process = true;
  2162.  
  2163. for (var image_index = images_loaded; image_index < images_to_load && image_index < image_url_array.length; image_index++) {
  2164. var bild = new Image();
  2165. bild.setAttribute("data-url", image_url_array[image_index]);
  2166. bild.onload = function(){ images_loaded_increment(); loaded_image_sources.push(this.getAttribute('data-url')); };
  2167. bild.onerror = function(){ images_loaded_increment(); };
  2168. bild.src = image_url_array[image_index];
  2169. bild.className = 'animation-cache-image';
  2170. bild.style.display = 'none';
  2171. $(bild).appendTo($(domid).parent());
  2172. }
  2173.  
  2174. }
  2175.  
  2176. }, 10);
  2177.  
  2178. var images_loaded_increment = function() {
  2179. if(player_load_session == null)
  2180. return;
  2181.  
  2182. images_loaded++;
  2183.  
  2184. if(Math.ceil(model_player_get_item_count(domid+" option") + 1) == image_url_array.length) {
  2185. var percentage = (images_loaded / image_url_array.length * 100).toFixed(3);
  2186. $('#ajax-loading-progress .progress-bar').css('width', percentage + '%');
  2187. }
  2188.  
  2189. if(images_loaded >= images_to_load) {
  2190. loading_in_process = false;
  2191. images_to_load += parallel_proc;
  2192. }
  2193. }
  2194.  
  2195. }
  2196.  
  2197. var raw_model_player_load = function(domid, tmploading, images_waiting, parallel, new_limit, checkeronly) {
  2198. var parallel_proc = $('#parallel-proc').attr('data-value');
  2199. if (typeof parallel_proc === 'undefined') {
  2200. parallel_proc = 1;
  2201. }
  2202. parallel_proc = parseInt(parallel_proc);
  2203. if (typeof parallel === 'undefined') {
  2204. parallel=1;
  2205. }
  2206. if (typeof checkeronly === 'undefined') {
  2207. checkeronly=false;
  2208. }
  2209. if (typeof new_limit === 'undefined') {
  2210. new_limit=parallel_proc;
  2211. }
  2212. if (typeof images_waiting === 'undefined') {
  2213. images_waiting=0;
  2214. }
  2215. if (typeof tmploading === 'undefined') {
  2216. tmploading=0;
  2217. $(domid).prop("selectedIndex", 0);
  2218. }
  2219.  
  2220. //console.log({domid, tmploading, images_waiting, parallel, new_limit, checkeronly});
  2221.  
  2222. var items = model_player_get_item_count(domid+" option");
  2223. if(tmploading===0){
  2224. if (!checkeronly) {
  2225. //for(var i=0;i<=max_images;i++){
  2226. // retrieve path to image
  2227. var meta_data = $(domid).val();
  2228. var meta_data_split = meta_data.split('#');
  2229. var data = meta_data_split[0];
  2230. var opt = data.split('/');
  2231. var model = $('#model').val();
  2232. var area = get_selected_area();
  2233. if (model.substring(0,3)!=="mod") {
  2234. var datum = opt[0].replace(/-/g, "_");
  2235. var uhrzeit = opt[1].replace(/:/g, "");
  2236. }
  2237. if (model === 'radial' || model === 'sweeps' || model === 'radar3d' || model === 'zsweeps' || isObsMode(model)) {
  2238. var uhrzeit2 = opt[1].replace(/:/g, "_");
  2239. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.png');
  2240. }
  2241. else if (model === 'radarus' && $('#model-mode').val() === 'RADARUS_PARAM') {
  2242. uhrzeit = uhrzeit.replace(/_/g, "");
  2243. var model_param = $('#model-param').val();
  2244. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_param+'_'+uhrzeit+'.png');
  2245. }
  2246. else if (model === 'radarus' && radarus_is_dyn()) {
  2247. uhrzeit = uhrzeit.replace(/_/g, "");
  2248. var model_location = $('#model-location').val();
  2249. var model_param = $('#model-param').val();
  2250. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+model_location+'_'+model_param+'_'+uhrzeit+'.png');
  2251. }
  2252. else if (model === 'sat' || model === 'globus') {
  2253. var uhrzeit2 = opt[1].replace(/:/g, "_");
  2254. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.jpg');
  2255. }
  2256. else if (model === 'hagel') {
  2257. var uhrzeit2 = opt[1].replace(/:/g, "_");
  2258. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+uhrzeit2+'_'+area+'_'+$('#model-param').val()+'.png');
  2259. }
  2260. else if (model === 'radarpre') {
  2261. var uhrzeit2 = opt[1].replace(/:/g, "");
  2262. var futuremin = '000';
  2263. if (opt[2]) {
  2264. futuremin = opt[2];
  2265. }
  2266. if ($('#model-valid-fcspecial').val() == 'RADARAT_PRO_FX' && futuremin == '000') {
  2267. futuremin = '005';
  2268. }
  2269. if ($('#model-valid-fcspecial').val() == 'RADARCH_PRO_FX' && futuremin == '000') {
  2270. futuremin = '005';
  2271. }
  2272. if ($('#model-valid-fcspecial').val() == 'RADARNL_PRO_FX' && futuremin == '000') {
  2273. futuremin = '005';
  2274. }
  2275. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit2+'_'+futuremin+'.png');
  2276. }
  2277. else if(model.substring(0,3)=="mod"){
  2278. var model_param = $('#model-param').val();
  2279. var model_valid_hidden = $(domid).val();
  2280. var model_member = $('#model-member').val();
  2281. var member_string = '';
  2282. if (typeof model_member !== 'undefined' && model_member.length>0 && parseInt(model_member)>=0) {
  2283. member_string = '_m'+model_member;
  2284. }
  2285. var run_date = model_valid_hidden.split('#');
  2286. var lang = '';
  2287. if (model_param == 155 || model_param == 213 || model_param == 352 || model_param == 353) {
  2288. lang = '-'+displayLanguage().toString().toLowerCase();
  2289. }
  2290. var m = 'model';
  2291. if (model === 'modezseason') {
  2292. m = 'season';
  2293. }
  2294. else if (model === 'modezwkly') {
  2295. m = 'weekly';
  2296. }
  2297. var image = extServer(url_path+'/images/data/cache/'+m+'/'+m+lang+'_'+model+'_'+run_date[0]+'_'+run_date[1]+'_'+area+'_'+model_param+member_string+'.png');
  2298. }
  2299. else {
  2300. var image = extServer(url_path+'/images/data/cache/'+model+'/'+model+'_'+datum+'_'+area+'_'+uhrzeit+'.png');
  2301. }
  2302.  
  2303. // move selected item one step forward
  2304. var bild = new Image();
  2305. bild.onload = function(){images_loaded++; loaded_image_sources.push(image);};
  2306. bild.onerror = function(){images_loaded++; };
  2307. bild.src=image;
  2308. images.push(bild);
  2309. }
  2310. //console.log('parallel '+parallel+ ' new_limit '+new_limit+ ' checkeronly'+checkeronly+ ' imageswaiting'+images_waiting);
  2311. if (parallel === parallel_proc) {
  2312. checkeronly=true;
  2313. if (images_loaded < new_limit) {
  2314. var tout = 100;
  2315. if(isAutoRefreshActive())
  2316. tout = 10;
  2317. setTimeout(function() {
  2318. raw_model_player_load(domid,0,0,parallel, new_limit, true);
  2319. },tout);
  2320. }
  2321. else {
  2322. new_limit+=parallel_proc;
  2323. parallel = 0;
  2324. checkeronly=false;
  2325. }
  2326. }
  2327.  
  2328. if (!checkeronly) {
  2329. var selected = model_player_get_selected_index(domid);
  2330. if (selected < items) {
  2331. if (is_playing !== 1) {
  2332. $(domid).prop("selectedIndex", selected + 1);
  2333. raw_model_player_load(domid,0,0,parallel+1, new_limit, false);
  2334. }
  2335. }
  2336. }
  2337. }
  2338.  
  2339. if (!checkeronly) {
  2340. if(images_loaded<items && images_waiting<10000) {
  2341. setTimeout(function(){raw_model_player_load(domid, 1, images_waiting+1);},200);
  2342. }
  2343. else {
  2344. //console.log('images_loaded '+images_loaded+' # items '+items+ ' # images_waiting '+images_waiting);
  2345. tmploading=2;
  2346. }
  2347.  
  2348. if (tmploading === 2 && is_playing==0){
  2349. is_playing = 1;
  2350. ajaxLoaderHide();
  2351. //stopAutoRefresh();
  2352. model_player_play(domid);
  2353. }
  2354. }
  2355. };
  2356.  
  2357. var model_player_play = function(domid) {
  2358. //console.log(images);
  2359. if (is_playing === 1) {
  2360. if (is_playing_first === true) {
  2361. is_playing_first = false;
  2362. $(domid).prop("selectedIndex", 0);
  2363. }
  2364. model_player_next(domid);
  2365. if(images_islast==0){
  2366. setTimeout(function() { model_player_play(domid); }, images_delay[images_speed]);
  2367. }
  2368. else{
  2369. setTimeout(function() { model_player_play(domid); }, 8*images_delay[images_speed]);
  2370. images_islast=0;
  2371. }
  2372. }
  2373. else {
  2374. return false;
  2375. }
  2376. };
  2377.  
  2378.  
  2379. var place_obs = function(retry) {
  2380.  
  2381. // Geolocation
  2382. var geo_x = $('#geo-x').val(); geo_x = parseInt(geo_x)-10;
  2383. var geo_y = $('#geo-y').val(); geo_y = parseInt(geo_y)-20;
  2384.  
  2385. if (parseInt(geo_x)>0 && parseInt(geo_y)>0) {
  2386. $('#map-marker').attr("data-left", geo_x);
  2387. $('#map-marker').attr("data-top", geo_y);
  2388. $('#map-marker').show();
  2389. }
  2390.  
  2391.  
  2392. var factor = parseInt($('#map-overlay').width());
  2393. $('#text-overlay').css('width', factor);
  2394.  
  2395. // Chrome's too fast, so retry a little bit later
  2396. if (retry !== true) {
  2397. setTimeout(function(){place_obs(true);}, 500);
  2398. }
  2399. var abstand = get_abstand();
  2400. $('.ap').each(function(){
  2401. var left = parseInt($(this).attr('data-left'));
  2402. var top = parseInt($(this).attr('data-top'));
  2403. if (left < 2 || left > 725 || top < 0 || top > 600) {
  2404. $(this).css('display', 'none');
  2405. }
  2406. else {
  2407. $(this).css('left', ((left/760)*factor+abstand)+'px');
  2408. $(this).css('top', ((top/760)*factor)+'px');
  2409. }
  2410. });
  2411. $('.lp').each(function(){
  2412. var left = parseInt($(this).attr('data-left'));
  2413. var top = parseInt($(this).attr('data-top'));
  2414. if (left < 0) {
  2415. $(this).css('right', ((left/760)*factor*(-1))+'px');
  2416. }
  2417. else {
  2418. $(this).css('left', (((left/760)*factor+abstand))+'px');
  2419. }
  2420. $(this).css('top', ((top/760)*factor)+'px');
  2421. if (factor < 260) {
  2422. $(this).css('display', 'none');
  2423. }
  2424. else if (factor < 321) {
  2425. if (!block_hiding_loadinglayer_when_loading) {
  2426. $(this).css('display', 'block');
  2427. }
  2428. $(this).css('font-size', '8px');
  2429. $('.lp_valid').css('font-size', '7px');
  2430. $('.lp_valid_small').css('font-size', '6px');
  2431. $('.lp_param').css('font-size', '10px');
  2432. $('.faq-button-param').css('font-size', '10px');
  2433. $('.faq-button-param').css('margin-left', '5px');
  2434. }
  2435. else if (factor < 400) {
  2436. if (!block_hiding_loadinglayer_when_loading) {
  2437. $(this).css('display', 'block');
  2438. }
  2439. $(this).css('font-size', '8px');
  2440. $('.lp_valid').css('font-size', '8px');
  2441. $('.lp_valid_small').css('font-size', '6px');
  2442. $('.lp_param').css('font-size', '11px');
  2443. $('.faq-button-param').css('font-size', '12px');
  2444. $('.faq-button-param').css('margin-left', '5px');
  2445. }
  2446. else if (factor < 460) {
  2447. if (!block_hiding_loadinglayer_when_loading) {
  2448. $(this).css('display', 'block');
  2449. }
  2450. $(this).css('font-size', '9px');
  2451. $('.lp_valid_small').css('font-size', '7px');
  2452. $('.lp_param').css('font-size', '14px');
  2453. }
  2454. else if (factor < 540) {
  2455. if (!block_hiding_loadinglayer_when_loading) {
  2456. $(this).css('display', 'block');
  2457. }
  2458. $(this).css('font-size', '10px');
  2459. $('.lp_valid_small').css('font-size', '8px');
  2460. $('.lp_param').css('font-size', '16px');
  2461. }
  2462. else if (factor < 620) {
  2463. if (!block_hiding_loadinglayer_when_loading) {
  2464. $(this).css('display', 'block');
  2465. }
  2466. $(this).css('font-size', '11px');
  2467. $('.lp_valid_small').css('font-size', '9px');
  2468. $('.lp_param').css('font-size', '18px');
  2469. }
  2470. else if (factor < 760) {
  2471. if (!block_hiding_loadinglayer_when_loading) {
  2472. $(this).css('display', 'block');
  2473. }
  2474. $(this).css('font-size', '12px');
  2475. $('.lp_valid_small').css('font-size', '10px');
  2476. $('.lp_param').css('font-size', '20px');
  2477. }
  2478. else {
  2479. if (!block_hiding_loadinglayer_when_loading) {
  2480. $(this).css('display', 'block');
  2481. }
  2482. $(this).css('font-size', '14px');
  2483. $('.lp_valid_small').css('font-size', '10px');
  2484. $('.lp_param').css('font-size', '24px');
  2485. }
  2486. });
  2487. $('.lp_updatetimes').css('font-size','11px');
  2488. if (!block_hiding_loadinglayer_when_loading) {
  2489. $('.lp_wait').css('display','none');
  2490. }
  2491. $('#sld_model_player_speed').slider({min:0, max:10, value:images_speed, slide:function(event,ui){images_speed=ui.value;}});
  2492. showOrHideOpenStreetMapInfo();
  2493. };
  2494.  
  2495. var get_abstandY = function() {
  2496. if (displayCountry() == 'vh') {
  2497. if (parseInt($('.container').width())<=720) {
  2498. return -50;
  2499. }
  2500. /*else if (parseInt($('.app-content').width()) <= 874) {
  2501. return -65;
  2502. */
  2503. return 0;
  2504. }
  2505. return 30;
  2506. };
  2507. var get_abstand = function() {
  2508. var abstand = 10;
  2509. if (displayCountry() == 'vh') {
  2510. if (parseInt($('.container').width()) < 945) {
  2511. abstand = 15;
  2512. }
  2513. return abstand;
  2514. }
  2515. else {
  2516. if (parseInt($('.container').width()) < 940) {
  2517. abstand = 15;
  2518. }
  2519. return abstand;
  2520. }
  2521. };
  2522.  
  2523. var resize_video = function() {
  2524. //resize_video_all(1.778, '.youtube-video');
  2525. resize_video_all(1.778, '.youtube-video');
  2526. if ($('body').width()>= 992) {
  2527. $('.youtube-index-video').each(function() {
  2528. $( this ).replaceWith('<iframe class="youtube-index-video-ifr" width="267" height="150" src="https://www.youtube.com/embed/'+$( this ).attr('data-src')+'" frameborder="0" allowfullscreen></iframe>');
  2529. });
  2530. }
  2531. resize_video_all(1.778, '.youtube-index-video-ifr');
  2532. var faktor1 = 1;
  2533. var faktor2 = 1;
  2534. var htmlwidth=$(document).width();
  2535. if (htmlwidth >= 1200) {
  2536. faktor1 = 1.333;
  2537. faktor2 = 1.778;
  2538. }
  2539. else if (htmlwidth >= 998) {
  2540. faktor1 = 1.5;
  2541. faktor2 = 1.778;
  2542. };
  2543. resize_video_all(faktor1, '.vine-video-detail');
  2544. resize_video_all(faktor2, '.vine-video');
  2545. };
  2546.  
  2547. var resize_video_all = function(fact, select) {
  2548. $(select).each(function(){
  2549. var size = parseInt($(this).parent('div').width());
  2550. var modal = parseInt($('#faq-modal>div').width())-40;
  2551. if (select === '.youtube-video') {
  2552. size = modal;
  2553. }
  2554. $(this).attr('width', size);
  2555. $(this).attr('height', (size/fact));
  2556. });
  2557. };
  2558.  
  2559. var replaceScale = function(test) {
  2560. $('#copyright_text').html('');
  2561. var model = $('#model').val();
  2562. if (model !== 'blitze' && model !== 'pl' && !isModelCard(model) && model !== 'regen' && !isObsMode(model)) {
  2563. $('#scale-overlay>img').attr('src', scalePath()+$('#model-param').val()+".png");
  2564. }
  2565. if (isModelCard(model)) {
  2566. $('#scale-overlay>img').attr('src', scalePath('model/'+displayCountry())+model+".png");
  2567. }
  2568. if (isObsMode(model) || model === 'sat' || model === 'blitze' || model === 'pl' || model === 'px250' || model === 'cyclone' || isModelCard(model)) {
  2569. var text = $('#copyright_hidden').attr('data');
  2570. if (!text) {
  2571. text='';
  2572. }
  2573. $('#copyright_text').html(text);
  2574. }
  2575. }
  2576.  
  2577. var model_addons = function(model) {
  2578. var ret = model;
  2579. var lang = $('#display-language').attr('data-value');
  2580. var tz = $('#display-timezone').attr('data-value');
  2581. var tzf = $('#display-tzformat').attr('data-value');
  2582. var overlay = $('#map-overlay-setting').attr('data-value');
  2583. if (lang.length == 2) {
  2584. ret = ret + '-' +lang;
  2585. if (tz.length == 3) {
  2586. ret = ret + '-' +tz;
  2587. if (parseInt(tzf)>=0 && parseInt(tzf)<10) {
  2588. ret = ret + '-' +tzf;
  2589. if (overlay === '0') {
  2590. ret = ret + '-zz';
  2591. }
  2592. else if (overlay === '2') {
  2593. ret = ret + '-xz';
  2594. }
  2595. }
  2596. }
  2597. }
  2598. return ret;
  2599. }
  2600.  
  2601. var save_as = function(blitz) {
  2602. if ($('#model').val() !== 'sat' && $('#model').val() !== 'globus') {
  2603. var path = get_model_image_path();
  2604. }
  2605. else {
  2606. var path = get_model_image_path('PNG');
  2607. }
  2608. if (!Array.isArray(path) && typeof path !== 'undefined') {
  2609. var model = $('#model').val();
  2610. var model_param = $('#model-param').val();
  2611. if (model === 'modezseason') {
  2612. model = 'season';
  2613. }
  2614. else if (model === 'modezwkly') {
  2615. model = 'weekly';
  2616. }
  2617. else if (model.substring(0,3) === 'mod') {
  2618. model = 'model';
  2619. }
  2620. var download = path.replace("data/cache/"+model+"/"+model+'_', "data/cache/"+model+"/download_"+model_addons(model)+'_');
  2621. if (model_param == 155 || model_param == 213 || model_param == 352 || model_param == 353) {
  2622. download = path.replace("data/cache/"+model+"/"+model+'-'+displayLanguage().toString().toLowerCase()+'_', "data/cache/"+model+"/download_"+model_addons(model)+'_');
  2623. }
  2624. var blitz_id = $('#blitz-id-modal').attr("data");
  2625. if (blitz && blitz_id) {
  2626. download = url_path+'/images/data/cache/blitz/download_'+model_addons('blitz')+'_'+get_selected_area()+'_'+blitz_id+'.png';
  2627. }
  2628. document.location.href = download;
  2629. }
  2630. else {
  2631. alert('Download nicht möglich!');
  2632. }
  2633. };
  2634.  
  2635. var toggle_lightnings = function() {
  2636. $('#lightning-image').toggle();
  2637. };
  2638.  
  2639. var setLastParamId = function() {
  2640. if ($('#model').val() === 'sat') {
  2641. last_param_id = parseInt( $('#model-param').val());
  2642. }
  2643. }
  2644.  
  2645. var switch2radar = function() {
  2646. model_player_stop(); setLastParamId();
  2647. $('#model').val('px250');
  2648. refreshDropdowns(2);
  2649. };
  2650.  
  2651. var switch2wwanalyze = function() {
  2652. model_player_stop(); setLastParamId();
  2653. $('#model').val('wwanalyze');
  2654. $('#legends_visibility').attr('data','');
  2655. $('#scale-overlay>img').attr('src', scalePath()+'WWANALYZE.png');
  2656. refreshDropdowns(2);
  2657. };
  2658.  
  2659. var switch2radarde = function() {
  2660. model_player_stop(); setLastParamId();
  2661. $('#model').val('radarde');
  2662. $('#legends_visibility').attr('data','');
  2663. refreshDropdowns(2);
  2664. //$('#scale-overlay>img').attr('src', scalePath()+'RADARDE.png');
  2665. };
  2666.  
  2667. var switch2radarsd = function() {
  2668. model_player_stop(); setLastParamId();
  2669. $('#model').val('radar');
  2670. $('#legends_visibility').attr('data','');
  2671. refreshDropdowns(2);
  2672. //$('#scale-overlay>img').attr('src', scalePath()+'RADARSD.png');
  2673. };
  2674.  
  2675. var switch2hagel = function(paramid) {
  2676. model_player_stop(); setLastParamId();
  2677. $('#model').val('hagel');
  2678. $('#legends_visibility').attr('data','');
  2679. refreshDropdowns(false, paramid);
  2680. };
  2681.  
  2682. var switch2radar3d = function(paramid) {
  2683. model_player_stop(); setLastParamId();
  2684. $('#model').val('radar3d');
  2685. $('#legends_visibility').attr('data','');
  2686. $('#scale-overlay>img').attr('src', scalePath('model/'+displayCountry())+'neutral.png');
  2687. refreshDropdowns(false, paramid);
  2688. };
  2689.  
  2690. var switch2radarpre = function() {
  2691. model_player_stop(); setLastParamId();
  2692. $('#model').val('radarpre');
  2693. $('#legends_visibility').attr('data','');
  2694. refreshDropdowns(1);
  2695. //$('#scale-overlay>img').attr('src', scalePath()+'RADAR.png');
  2696. };
  2697.  
  2698.  
  2699. var switch2model = function(model) {
  2700. model_player_stop();
  2701. $('#model').val(model);
  2702. $('#legends_visibility').attr('data','')
  2703. refreshDropdowns();
  2704. };
  2705.  
  2706. var switch2singlepx = function() {
  2707. model_player_stop();
  2708. $('#model').val('singlepx');
  2709. $('#legends_visibility').attr('data','')
  2710. refreshDropdowns(2);
  2711. //$('#scale-overlay>img').attr('src', scalePath()+'ZSWEEPS.png');
  2712. };
  2713.  
  2714.  
  2715. var switch2plraw = function() {
  2716. model_player_stop();
  2717. $('#model').val('plraw');
  2718. $('#legends_visibility').attr('data','')
  2719. $('#map-overlay-trans').hide();
  2720. $('#map-overlay').hide();
  2721. $('#map-underlay-trans').hide();
  2722. $('#map-underlay').hide();
  2723. refreshDropdowns(2);
  2724. };
  2725.  
  2726. var switch2sweeps = function() {
  2727. model_player_stop();
  2728. $('#model').val('sweeps');
  2729. $('#legends_visibility').attr('data','')
  2730. refreshDropdowns(2);
  2731. //$('#scale-overlay>img').attr('src', scalePath()+'SWEEPS.png');
  2732. };
  2733.  
  2734. var switch2zsweeps = function() {
  2735. model_player_stop();
  2736. $('#model').val('zsweeps');
  2737. $('#legends_visibility').attr('data','')
  2738. refreshDropdowns(2);
  2739. //$('#scale-overlay>img').attr('src', scalePath()+'ZSWEEPS.png');
  2740. };
  2741.  
  2742. var switch2tracking = function() {
  2743. model_player_stop(); setLastParamId();
  2744. $('#model').val('storms');
  2745. refreshDropdowns(2);
  2746. };
  2747.  
  2748. var switch2floods = function() {
  2749. model_player_stop(); setLastParamId();
  2750. $('#model').val('floods');
  2751. refreshDropdowns(2);
  2752. };
  2753.  
  2754. var switch2regen = function() {
  2755. model_player_stop(); setLastParamId();
  2756. $('#model').val('regen');
  2757. refreshDropdowns(3,264);
  2758. };
  2759.  
  2760. var switch2radarlight = function() {
  2761. model_player_stop(); setLastParamId();
  2762. $('#model').val('pl');
  2763. refreshDropdowns(2);
  2764. };
  2765.  
  2766. var switch2lightnings = function() {
  2767. model_player_stop(); setLastParamId();
  2768. $('#model').val('blitze');
  2769. $('#legends_visibility').attr('data','')
  2770. refreshDropdowns(2);
  2771. };
  2772.  
  2773. var switch2obs = function() {
  2774. model_player_stop();
  2775. $('#model').val('obs');
  2776. $('#legends_visibility').attr('data','')
  2777. refreshDropdowns();
  2778. };
  2779.  
  2780. var switch2obsama = function() {
  2781. model_player_stop();
  2782. $('#model').val('obsama');
  2783. $('#legends_visibility').attr('data','')
  2784. refreshDropdowns();
  2785. };
  2786.  
  2787. var switch2pollen = function() {
  2788. model_player_stop();
  2789. $('#model').val('pollen');
  2790. $('#legends_visibility').attr('data','')
  2791. refreshDropdowns(2);
  2792. };
  2793.  
  2794. var switch2gma = function() {
  2795. model_player_stop();
  2796. $('#model').val('gma');
  2797. $('#legends_visibility').attr('data','')
  2798. refreshDropdowns();
  2799. };
  2800.  
  2801. var switch2radarus = function(param) {
  2802. model_player_stop();
  2803. $('#model').val('radarus');
  2804. $('#legends_visibility').attr('data','')
  2805. if (parseInt(param)>0) {
  2806. refreshDropdowns(false, param);
  2807. }
  2808. else {
  2809. refreshDropdowns(2);
  2810. }
  2811. };
  2812.  
  2813. var switch2radial = function(standort) {
  2814. model_player_stop(); setLastParamId();
  2815. if (standort && standort === 'b') {
  2816. standort = 80;
  2817. }
  2818. else {
  2819. standort = 79;
  2820. }
  2821. $('#model').val('radial');
  2822. $('#legends_visibility').attr('data','')
  2823. refreshDropdowns(false, standort);
  2824. //$('#scale-overlay>img').attr('src', scalePath()+'RADIAL.png');
  2825. };
  2826.  
  2827. var switch2sat = function() {
  2828. switch2sat_raw(131);
  2829. };
  2830.  
  2831. var switch2sat15 = function() {
  2832. switch2sat_raw(132);
  2833. };
  2834.  
  2835. var switch2sat_raw = function(id) {
  2836. if (last_param_id > 0) {
  2837. id = last_param_id;
  2838. }
  2839. //closeMarker();
  2840. model_player_stop();
  2841. $('#model').val('sat');
  2842. $('#legends_visibility').attr('data','')
  2843. refreshDropdowns(false, id);
  2844. };
  2845.  
  2846. var checkHash = function() {
  2847. var hash = window.location.hash;
  2848. var flag_player = ($('#player-flag').attr('data-value') === 'true' ? true : false);
  2849. if (hash.substr(0,4) == '#geo') {
  2850. var data = hash.replace("#","").split(/_/,3);
  2851. $.post(get_url_path()+'/ajax/geoxy', {
  2852. 'area_id' : get_selected_area(),
  2853. 'lat' : data[1],
  2854. 'long' : data[2]
  2855. }, function (data) {
  2856. if (typeof data.x !== 'undefined' && typeof data.y !== 'undefined' &&
  2857. parseInt(data.x)>=0 && parseInt(data.x)<=760 &&
  2858. parseInt(data.y)>=0 && parseInt(data.y)<=616) {
  2859. // Geolocation
  2860. $('#geo-x').val(parseInt(data.x));
  2861. $('#geo-y').val(parseInt(data.y));
  2862. $('#geo-lat').val(data.lat);
  2863. $('#geo-long').val(data.long);
  2864. place_obs();
  2865. }
  2866. },'json');
  2867. }
  2868. else if (hash == '#play' && isModelCard($('#model').val()) && flag_player) {
  2869. block_hiding_loadinglayer_when_loading = true;
  2870. modelcharts_player_start(1);
  2871. }
  2872. else if (hash == '#play' && modelWithPlayer($('#model').val()) && flag_player) {
  2873. block_hiding_loadinglayer_when_loading = true;
  2874. model_player_start(1);
  2875. }
  2876. else if (hash == '#play2' && modelWithPlayer($('#model').val()) && flag_player) {
  2877. block_hiding_loadinglayer_when_loading = true;
  2878. trackPlayer('#radar-animation', '24');
  2879. model_player_extend_level(2);
  2880. }
  2881. else if (hash == '#play4' && modelWithPlayer($('#model').val()) && flag_player) {
  2882. block_hiding_loadinglayer_when_loading = true;
  2883. trackPlayer('#radar-animation', '48');
  2884. model_player_extend_level(4);
  2885. }
  2886. else if (hash == '#play6' && modelWithPlayer($('#model').val()) && flag_player) {
  2887. block_hiding_loadinglayer_when_loading = true;
  2888. trackPlayer('#radar-animation', '72');
  2889. model_player_extend_level(6);
  2890. }
  2891. else if (hash == '#play8' && modelWithPlayer($('#model').val()) && flag_player) {
  2892. block_hiding_loadinglayer_when_loading = true;
  2893. trackPlayer('#radar-animation', '96');
  2894. model_player_extend_level(8);
  2895. }
  2896. else if (hash == '#locateme') {
  2897. gps_locating_wetter();
  2898. }
  2899.  
  2900. };
  2901.  
  2902. var focus_search = function() {
  2903. $('#forecast-input-0').focus();
  2904. };
  2905.  
  2906. var focus_search0 = function() {
  2907. $('#forecast-input-0').focus();
  2908. };
  2909.  
  2910. var focus_search1 = function() {
  2911. $('#forecast-input-1').focus();
  2912. };
  2913.  
  2914. var focus_search8 = function() {
  2915. $('#forecast-input-8').focus();
  2916. };
  2917.  
  2918.  
  2919. var shareWhatsapp = function(blitz, station) {
  2920. document.location.href = 'whatsapp://send?text='+encodeURIComponent(directURL(blitz, station));
  2921. };
  2922.  
  2923. var shareCanonicalFB = function() {
  2924. return shareForecast('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent($('link[rel=canonical]').attr('href')), '_kwFacebook');
  2925. };
  2926.  
  2927. var shareCanonicalTwitter = function() {
  2928. return shareForecast('https://twitter.com/share?url='+encodeURIComponent($('link[rel=canonical]').attr('href')), '_kwTwitter');
  2929. };
  2930.  
  2931. var shareForecastFB = function(tab) {
  2932. var url = $('#forecast-url').attr('data');
  2933. var tab2 = $('#tab-url').attr('data-src');
  2934. if (typeof tab !== 'undefined' && tab.length) {
  2935. url = url + '/' + tab;
  2936. }
  2937. else if (typeof tab2 !== 'undefined' && tab2.length) {
  2938. url = url + '/' + tab2;
  2939. }
  2940. return shareForecast('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url), '_kwFacebook');
  2941. };
  2942.  
  2943. var shareForecastTwitterPlain = function() {
  2944. var url = $('#forecast-url').attr('data');
  2945. return shareForecast('https://twitter.com/share?url='+encodeURIComponent(url), '_kwTwitter');
  2946. };
  2947.  
  2948. var shareForecastFBPlain = function() {
  2949. var url = $('#forecast-url').attr('data');
  2950. return shareForecast('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url), '_kwFacebook');
  2951. };
  2952.  
  2953. var shareForecastTwitter = function(tab) {
  2954. var url = $('#forecast-url').attr('data');
  2955. var tab2 = $('#tab-url').attr('data-src');
  2956. if (typeof tab !== 'undefined' && tab.length) {
  2957. url = url + '/' + tab;
  2958. }
  2959. else if (typeof tab2 !== 'undefined' && tab2.length) {
  2960. url = url + '/' + tab2;
  2961. }
  2962. return shareForecast('https://twitter.com/share?url='+encodeURIComponent(url), '_kwTwitter');
  2963. };
  2964.  
  2965. var shareForecast = function(url, windowname) {
  2966. if (url) {
  2967. window.open(url,windowname,'width=600, height=300');
  2968. }
  2969. return false;
  2970. }
  2971.  
  2972. var shareFB = function(blitz, station) {
  2973. return shareURL('https://www.facebook.com/sharer/sharer.php?u=','_kwFacebook',blitz);
  2974. };
  2975.  
  2976. var shareTwitter = function(blitz, station) {
  2977. return shareURL('https://twitter.com/share?url=','_kwTwitter',blitz, station);
  2978. };
  2979.  
  2980. var copyToClipboard = function(blitz, station) {
  2981. console.log(directURL(blitz, station));
  2982. };
  2983.  
  2984. var directURL = function(blitz, station) {
  2985. var url = $('#share-path').val();
  2986. if (!url) {
  2987. url = '';
  2988. }
  2989. var file = $('#share-file').val();
  2990. if (file && file.length) {
  2991. file = file+"/";
  2992. }
  2993. else {
  2994. file = '';
  2995. }
  2996. return addHash2Url(url+file,blitz, station);
  2997. };
  2998.  
  2999. var shareURL = function(share_url, window_name, blitz, station) {
  3000. completeurl = directURL(blitz, station);
  3001. var hash = window.location.hash;
  3002. var hash_url = completeurl;
  3003. if (hash == '#play' || hash == '#play2' || hash == '#play4' || hash == '#play6' || hash == '#play8') {
  3004. hash_url = window.location.href;
  3005. }
  3006. if ($('#model').val().length) {
  3007. window.open(share_url+encodeURIComponent(hash_url),window_name,'width=600, height=300');
  3008. }
  3009. else {
  3010. window.open(share_url+encodeURIComponent(hash_url),window_name,'width=600, height=300');
  3011. }
  3012. return false;
  3013. };
  3014.  
  3015. var addHash2Url = function(url,blitz, station) {
  3016. var timeurl = '';
  3017. var day = $('#model-valid').val();
  3018. if ($('#model').val() == 'cyclone') {
  3019. timeurl = $('#model-run').val();
  3020. if (day) {
  3021. timeurl = timeurl+'-'+day;
  3022. }
  3023. var filter = $('#model-filter-storm').val();
  3024. if (filter) {
  3025. timeurl = timeurl+'-'+filter;
  3026. }
  3027. timeurl = timeurl+'.html';
  3028. }
  3029. else if (day) {
  3030. day = day.replace(/-/g,'');
  3031. day = day.replace(/:/g,'');
  3032. day = day.replace("/","-");
  3033. timeurl = day;
  3034. if ($('#model').val() == 'radarpre') {
  3035. timeurl = '';
  3036. }
  3037. if ($('#model').val() === 'radarus' && radarus_is_dyn()) {
  3038. timeurl = $('#model-location').val()+'_'+timeurl;
  3039. }
  3040. if (timeurl.length || isObsMode($('#model').val())) {
  3041. timeurl = timeurl+'z';
  3042. var blitz_id = $('#blitz-id-modal').attr("data");
  3043. var track_url = $('#track-url').attr("data");
  3044. var flood_url = $('#flood-url').attr("data");
  3045. if (blitz === 1 && blitz_id) {
  3046. timeurl = timeurl +'-' +blitz_id;
  3047. }
  3048. else if (blitz === 3 && track_url) {
  3049. timeurl = track_url;
  3050. }
  3051. else if (blitz === 4 && flood_url) {
  3052. timeurl = flood_url;
  3053. }
  3054. timeurl = timeurl +'.html';
  3055. }
  3056. }
  3057. else {
  3058. day = $('#model-run').val();
  3059. if (day) {
  3060. timeurl = day;
  3061. if (timeurl.length) {
  3062. if (station) {
  3063. timeurl = station + '-' + timeurl;
  3064. }
  3065. timeurl = timeurl +'.html';
  3066. }
  3067. }
  3068. }
  3069.  
  3070. var hash = window.location.hash;
  3071. var hash_url = '';
  3072. if (hash.substr(0,4) == '#geo') {
  3073. hash_url = hash;
  3074. }
  3075. return url+timeurl+hash_url;
  3076. };
  3077.  
  3078. var showLgt = function(blitzid,counter) {
  3079. $('#map-wrapper').hide();
  3080. $('#map-ajax-loader').show();
  3081. var c = true;
  3082. if (counter === false) {
  3083. c = false;
  3084. }
  3085. $.get(get_url_path()+'/ajax/blitzortung', {
  3086. 'blitz_id' : blitzid,
  3087. 'counter' : c,
  3088. 'lang' : displayLanguage(),
  3089. 'area_id' : get_selected_area()
  3090. }, function (data) {
  3091. $('#map-ajax-loader').hide();
  3092. $('#map-wrapper').show();
  3093. $('#map-wrapper').html(data);
  3094. if (c) { addHistory(null, 1); }
  3095. },'html');
  3096. };
  3097.  
  3098. var showPollen = function(pollen,counter) {
  3099. $('#pollen-detail').modal('show');
  3100. pollen_detail(pollen,counter);
  3101. };
  3102.  
  3103.  
  3104. var obs_detail = function (value, station, timestamp) {
  3105. $('#obs-detail-label').html(station);
  3106. $('#obs-detail-wrapper>h1').html(value);
  3107. $('#obs-detail-wrapper>p>span').html(timestamp);
  3108. return false;
  3109. };
  3110. var obs_detail_3h = function (value, station, timestamp, id, timestamp2, counter) {
  3111. $('#obs-detail-3h-table').html('');
  3112. $('#obs-detail-3h-label').html(station);
  3113. $('#obs-detail-3h-js>h1').html(value);
  3114. $('#obs-detail-3h-js>p>span').html(timestamp);
  3115. var c = true;
  3116. if (counter === false) {
  3117. c = false;
  3118. }
  3119. $.get(get_url_path()+'/ajax/obsdetail', {
  3120. 'station_id' : id,
  3121. 'timestamp' : timestamp2,
  3122. 'param_id' : $('#model-param').val(),
  3123. 'model' : $('#model').val(),
  3124. 'area_id' : get_selected_area(),
  3125. 'counter' : c,
  3126. 'lang' : displayLanguage()
  3127. }, function (data) {
  3128. if (data === 'NOT_ALLOWED') {
  3129. messageLayer(403,'#error-msg','#error-modal');
  3130. }
  3131. else if (data !== 'FALSE') {
  3132. $('#obs-detail-3h-table').html(data);
  3133. if (c) { addHistory(null, 1); }
  3134. }
  3135. },'html');
  3136. };
  3137.  
  3138. var pollen_detail = function (station, counter) {
  3139. $('#pollen-detail-content').html('');
  3140. var c = true;
  3141. if (counter === false) {
  3142. c = false;
  3143. }
  3144. $.post(get_url_path()+'/ajax/pollenmonitor', {
  3145. 'model' : 'pollen_detail',
  3146. 'station_id' : station,
  3147. 'date' : $('#model-run').val(),
  3148. 'counter' : c
  3149. }, function (data) {
  3150. $('#pollen-detail-content').html(data);
  3151. },'html');
  3152. return false;
  3153. };
  3154.  
  3155. var refresh = function(e) {
  3156. model_player_stop();
  3157. if ($('#model').val()) {
  3158. if (e) {
  3159. e.preventDefault();
  3160. }
  3161. refreshDropdowns(1);
  3162. }
  3163. };
  3164.  
  3165. var autoRefresh = function() {
  3166.  
  3167. var areas = getAreaArray();
  3168. var area_id = get_selected_area();
  3169.  
  3170. params = {
  3171. 'model' : $('#model').val(),
  3172. 'model_param' : $('#model-param').val(),
  3173. 'model_member' : $('#model-member').val(),
  3174. 'model_location' : $('#model-location').val(),
  3175. 'area_id' : area_id,
  3176. 'areas_1' : areas[1],
  3177. 'areas_2' : areas[2],
  3178. 'areas_3' : areas[3],
  3179. 'areas_4' : areas[4],
  3180. 'areas_5' : areas[5],
  3181. 'areas_6' : areas[6],
  3182. 'areas_7' : areas[7],
  3183. 'areas_8' : areas[8],
  3184. 'areas_9' : areas[9],
  3185. 'geo_lat' : $('#geo-lat').val(),
  3186. 'geo_long' : $('#geo-long').val(),
  3187. 'fl_newest' : $('#newest-flag').val(),
  3188. 'fl_param' : $('#param-flag').val(),
  3189. 'fl_model' : $('#model-flag').val(),
  3190. 'real_refresh' : 1//,
  3191. };
  3192.  
  3193. $.ajax(
  3194. {
  3195. url: get_url_path() + '/ajax/dropdown',
  3196. data: params,
  3197. cache: false,
  3198. dataType: 'html'
  3199. }
  3200. ).success(function(data) {
  3201. if (data === 'NOT_ALLOWED') {
  3202. resetDropdowns();
  3203. messageLayer(403,'#error-msg','#error-modal');
  3204. }
  3205. else if (data === 'UNAVAILABLE') {
  3206. resetDropdowns();
  3207. messageLayer(503,'#error-msg','#error-modal');
  3208. }
  3209. else if (data === 'NO_MODEL_DATA') {
  3210. $('.ac-btn[data-model]').each(function(){
  3211. if ($(this).hasClass('btn-active') && isModelCard($(this).attr('data-model'))) {
  3212. $('#model').val($(this).attr('data-model'));
  3213. }
  3214. });
  3215. messageLayer(121,'#error-msg','#error-modal');
  3216. }
  3217. else {
  3218.  
  3219. if(data) {
  3220. var newDataTimestamp = $(data).find('#model-valid').val();
  3221. var currentDataTimestamp = $('#autorefresh-last-timestamp').val();
  3222.  
  3223. //console.log({currentDataTimestamp: currentDataTimestamp, newDataTimestamp: newDataTimestamp, newDataAvailable: newDataTimestamp > currentDataTimestamp});
  3224.  
  3225. if(newDataTimestamp > currentDataTimestamp) {
  3226.  
  3227. if(player_load_session == null) {
  3228. var tempIsPlaying = is_playing;
  3229. if(tempIsPlaying)
  3230. model_player_stop();
  3231.  
  3232. $('#drop-downs').html(data);
  3233. $('#autorefresh-info > .glyphicon').addClass('glyphicon-spin');
  3234. setDropDownListener();
  3235. changeImage();
  3236. place_obs();
  3237. reloadIframeAds();
  3238. initDatePicker();
  3239. initVarSettings();
  3240. initOpenDivs();
  3241. if(displayCountry() === 'vh'){
  3242. $('#model')[0].data=data;
  3243. $('#model').trigger('change');
  3244. }
  3245.  
  3246. }
  3247.  
  3248. if(tempIsPlaying)
  3249. model_player_extend_level(images_extend);
  3250.  
  3251. }
  3252.  
  3253. $('#autorefresh-info > .glyphicon').removeClass('glyphicon-spin');
  3254. }
  3255. }
  3256. });
  3257.  
  3258. }
  3259.  
  3260. var autoRefreshHandle = null;
  3261. var currentAutoRefreshParam = null;
  3262. var initAutoRefresh = function(intervalSeconds) {
  3263.  
  3264. intervalSeconds = intervalSeconds || +$('#autorefresh-interval').data('value');
  3265.  
  3266. if(typeof intervalSeconds !== 'number')
  3267. intervalSeconds = 30;
  3268.  
  3269. if($('#model').val() == 'radarpre' && intervalSeconds != -1)
  3270. intervalSeconds = 150;
  3271.  
  3272. var modelRestrictions = [
  3273. 'px250',
  3274. 'wwanalyze',
  3275. 'radar',
  3276. 'pl',
  3277. 'hagel',
  3278. 'blitze',
  3279. 'storms',
  3280. 'floods',
  3281. 'radial',
  3282. 'sat',
  3283. 'regen',
  3284. 'singlepx',
  3285. 'zsweeps',
  3286. 'sweeps',
  3287. 'radar3d',
  3288. 'plraw',
  3289. 'globus',
  3290. 'radarus',
  3291. 'radarpre'
  3292. ];
  3293.  
  3294. var initAutoRefreshResult = true;
  3295. var debugMessage = '';
  3296.  
  3297. if (initAutoRefreshResult && intervalSeconds === -1) {
  3298. initAutoRefreshResult = false;
  3299. debugMessage = 'Survival Mode active';
  3300. }
  3301.  
  3302. if (initAutoRefreshResult && modelRestrictions.indexOf($('#model').val()) === -1) {
  3303. initAutoRefreshResult = false;
  3304. debugMessage = 'Model is not allowed';
  3305. }
  3306.  
  3307. if (initAutoRefreshResult && ($('#paywall-account-type').attr('data-value') !== 'payaccount') && $('#autorefresh-last-timestamp').length == 0) {
  3308. initAutoRefreshResult = false;
  3309. debugMessage = 'Account no payaccount';
  3310. }
  3311.  
  3312. if (initAutoRefreshResult && !$('#autorefresh-last-timestamp').val() || !$('#model-valid').val()) {
  3313. initAutoRefreshResult = false;
  3314. debugMessage = 'Model is not allowed / Not in model view';
  3315. }
  3316.  
  3317. if (initAutoRefreshResult && is_playing == 1 && false) {
  3318. initAutoRefreshResult = false;
  3319. debugMessage = 'Model player is playing';
  3320. }
  3321.  
  3322. if (initAutoRefreshResult && $('#model-valid').val() !== $('#autorefresh-last-timestamp').val()) {
  3323. initAutoRefreshResult = false;
  3324. debugMessage = 'Not latest data timestamp';
  3325. }
  3326.  
  3327. currentAutoRefreshParam = $('#model').val() + ($('#model-param').val() ? '/' + $('#model-param').val() : '');
  3328.  
  3329. if(isAutoRefreshActive()) {
  3330. if(!initAutoRefreshResult) {
  3331. clearInterval(autoRefreshHandle);
  3332. autoRefreshHandle = null;
  3333.  
  3334. $('#autorefresh-info').show().fadeOut(500);
  3335. //console.log('AutoRefresh stopped: ' + debugMessage);
  3336. return false;
  3337. } else {
  3338. $('#autorefresh-info').show();
  3339.  
  3340. return true;
  3341. }
  3342. } else {
  3343. if(!initAutoRefreshResult) {
  3344. //console.log('AutoRefresh init result: Refused starting autorefresh - ' + debugMessage);
  3345. clearInterval(autoRefreshHandle);
  3346. autoRefreshHandle = null;
  3347.  
  3348. $('#autorefresh-info').hide();
  3349.  
  3350. return false;
  3351. } else {
  3352. //console.log('AutoRefresh init result: Started autorefresh with ' + intervalSeconds + 'sec interval');
  3353. $('#autorefresh-info').fadeIn(500);
  3354. }
  3355. }
  3356.  
  3357. clearInterval(autoRefreshHandle);
  3358. autoRefreshHandle = setInterval(function() {
  3359. //DEBUG
  3360. //console.log('AutoRefresh interval');
  3361.  
  3362. $('#autorefresh-info > .glyphicon').addClass('glyphicon-spin');
  3363.  
  3364. autoRefresh();
  3365. }, intervalSeconds * 1000);
  3366. return true;
  3367.  
  3368. }
  3369.  
  3370. var stopAutoRefresh = function() {
  3371.  
  3372. console.log('AutoRefresh force stopped');
  3373.  
  3374. var debugBox = 'auto_refresh = <b>off</b><br>Grund: <em>Force Stop (Probably Model Player)</em>';
  3375. $('.debug#auto-refresh').html(debugBox);
  3376.  
  3377. clearInterval(autoRefreshHandle);
  3378. autoRefreshHandle = null;
  3379. }
  3380.  
  3381. var isAutoRefreshActive = function() {
  3382. return autoRefreshHandle !== null;
  3383. }
  3384.  
  3385. var refreshDropdowns = function(real_refresh, standort, params2, prevnext, jqobj) {
  3386. model_player_stop();
  3387. var so = $('#model-param').val();
  3388. if (standort) {
  3389. so = standort;
  3390. }
  3391. if (!prevnext) {
  3392. prevnext = null;
  3393. }
  3394. var jahr = null;
  3395. if ($('#model-year-block').val() !== 'blockyear' && $('#model-year').val() !== $('#model-year-def').val()) {
  3396. jahr = $('#model-year').val();
  3397. }
  3398. var areas = getAreaArray(jqobj);
  3399. var area_id = get_selected_area(jqobj);
  3400. op = parseInt($('#current-regen-param').attr('data-param'));
  3401. if ((parseInt(so) === 264 || parseInt(so) === 265) && op !== 264 && op !== 265 && $('#current-regen-now').attr('data-param') === 'true') {
  3402. real_refresh = 1;
  3403. }
  3404. var params = {}
  3405.  
  3406. params = {
  3407. 'model' : $('#model').val(),
  3408. 'model_member' : $('#model-member').val(),
  3409. 'model_location' : $('#model-location').val(),
  3410. 'area_id' : area_id,
  3411. 'areas_1' : areas[1],
  3412. 'areas_2' : areas[2],
  3413. 'areas_3' : areas[3],
  3414. 'areas_4' : areas[4],
  3415. 'areas_5' : areas[5],
  3416. 'areas_6' : areas[6],
  3417. 'areas_7' : areas[7],
  3418. 'areas_8' : areas[8],
  3419. 'areas_9' : areas[9],
  3420. 'geo_lat' : $('#geo-lat').val(),
  3421. 'geo_long' : $('#geo-long').val(),
  3422. 'fl_newest' : $('#newest-flag').val(),
  3423. 'fl_param' : $('#param-flag').val(),
  3424. 'fl_model' : $('#model-flag').val(),
  3425. 'real_refresh' : 0//,
  3426. };
  3427. if (real_refresh) {
  3428. params.real_refresh=1;
  3429. if (real_refresh === 1) {
  3430. params.model_param = $('#model-param').val();
  3431. }
  3432. else if (real_refresh === 2) {
  3433. params.model_valid = $('#model-valid').val();
  3434. params.model_run = $('#model-run').val();
  3435. params.model_year = jahr;
  3436. }
  3437. else if (real_refresh === 3) {
  3438. params.model_param = so;
  3439. params.model_valid = $('#model-valid').val();
  3440. params.model_run = $('#model-run').val();
  3441. params.model_year = jahr;
  3442. }
  3443. }
  3444. else {
  3445. params.model_valid = $('#model-valid').val();
  3446. params.model_run = $('#model-run').val();
  3447. params.model_year = jahr;
  3448. params.model_param = so;
  3449. if (prevnext === 'prevyear') {
  3450. params.prevnext = 'prev';
  3451. params.prevyear = 'true';
  3452. }
  3453. else {
  3454. params.prevnext = prevnext;
  3455. }
  3456. }
  3457.  
  3458. if (params2) {
  3459. params = params2;
  3460. }
  3461.  
  3462. //Check für Modell- oder Param-Switch und löschen des model_valid properties, damit der neueste Zeitpunkt geladen wird und AutoRefresh aktiv bleibt.
  3463. if(isAutoRefreshActive() && currentAutoRefreshParam != params.model + (params.model_param ? '/' + params.model_param : '')) {
  3464. delete params.model_valid;
  3465. //console.log(params);
  3466. }
  3467.  
  3468. if ($('#model').val() === 'blitze' && $('#blitze-5minonly').prop('checked')) {
  3469. params.blitze_5minonly = 'true';
  3470. }
  3471. if ($('#model').val() === 'cyclone') {
  3472. params.model_filter_storm = $('#model-filter-storm').val();
  3473. }
  3474.  
  3475. if (parseInt($('#model-player-interval').val()) > 0) {
  3476. params.model_player_interval = $('#model-player-interval').val();
  3477. }
  3478.  
  3479. ajaxLoaderShowDelay(jqobj);
  3480. $.get(get_url_path()+'/ajax/dropdown', params, function (data) {
  3481. ajaxLoaderHide(jqobj);
  3482. if (data === 'NOT_ALLOWED') {
  3483. resetDropdowns();
  3484. messageLayer(403,'#error-msg','#error-modal');
  3485. }
  3486. else if (data === 'UNAVAILABLE') {
  3487. resetDropdowns();
  3488. messageLayer(503,'#error-msg','#error-modal');
  3489. }
  3490. else if (data === 'NO_MODEL_DATA') {
  3491. $('.ac-btn[data-model]').each(function(){
  3492. if ($(this).hasClass('btn-active') && isModelCard($(this).attr('data-model'))) {
  3493. $('#model').val($(this).attr('data-model'));
  3494. }
  3495. });
  3496. messageLayer(121,'#error-msg','#error-modal');
  3497. }
  3498. else {
  3499. $('#drop-downs').html(data);
  3500. setDropDownListener();
  3501. changeImage();
  3502. place_obs();
  3503. reloadIframeAds();
  3504. initDatePicker();
  3505. initVarSettings();
  3506. initOpenDivs();
  3507. images_extend=1;
  3508. frame_count_orig=-1;
  3509. if(displayCountry() === 'vh'){
  3510. $('#model')[0].data=data;
  3511. $('#model').trigger('change');
  3512. }
  3513. }
  3514. },'html');
  3515. }
  3516.  
  3517. var rdfcPrognose = function() {
  3518. if ($('#model').val() === 'radarpre') {
  3519. if ($('#rdfc_prognose').attr('data') === 'true') {
  3520. $('#rdfc-button').show();
  3521. var uhrzeit = $('#legende-time').html();
  3522. $('#rdfc-time').html(uhrzeit.replace("&nbsp;Uhr",""));
  3523. }
  3524. else {
  3525. $('#rdfc-button').hide();
  3526. }
  3527. }
  3528. }
  3529.  
  3530. var addHistory = function(player, blitz, station) {
  3531. // player: 1=play, 2=entferne Geohash, 3=skip GA view
  3532. var completeurl = get_complete_share_url(player,blitz, station);
  3533. if (player == 2) {
  3534. var dat2 = completeurl.split('#');
  3535. if (dat2[0]){
  3536. completeurl = dat2[0];
  3537. }
  3538. }
  3539. pushHistory(completeurl);
  3540. if (typeof ga !== 'undefined' && player != 1 && player != 3) {
  3541. var count_url = completeurl.replace($('#full-base').val(),"");
  3542. ga("send", "pageview", count_url);
  3543. }
  3544. };
  3545.  
  3546. var getFlagPlayer = function () {
  3547. var starttime = $('#player-start-time').attr('data-value');
  3548. var flag_player = true;
  3549. if (parseInt(starttime)>0) {
  3550. flag_player= false;
  3551. }
  3552. return flag_player;
  3553. };
  3554.  
  3555. var get_complete_share_url = function(player,blitz, station) {
  3556. var model = $('#model').val();
  3557. var url = $('#share-path').val();
  3558. var file = $('#share-file').val();
  3559. var completeurl = directURL(blitz, station);
  3560. var param_id = $('#model-param').val();
  3561. var flag_player = getFlagPlayer();
  3562. if (completeurl.match(/NaN/g) != null || (player == 1 && flag_player)) {
  3563. if (!file) {
  3564. file = '';
  3565. }
  3566. else if(file.length) {
  3567. if (isObsMode(model) || model === 'regen' || model === 'radial' || model === 'sweeps' || model === 'radar3d' || model === 'zsweeps' ||
  3568. model === 'sat' || model === 'globus' || isModelCard(model) ||
  3569. model === 'storms' || model === 'floods') {
  3570. file = file+".html";
  3571. }
  3572. else if (!(model === 'radarus' && player == 1 && !radarus_is_dyn())) {
  3573. file = file+"/";
  3574. }
  3575. }
  3576. if (player == 1) {
  3577. if (model === 'radarus' && !radarus_is_dyn() && file.length>0) {
  3578. file = file+".html";
  3579. }
  3580. else if (model === 'radarus' && radarus_is_dyn()) {
  3581. file=file+$('#model-location').val()+'.html';
  3582. }
  3583. if(images_extend==1) {
  3584. completeurl = url+file;
  3585. var ohne_hash = completeurl.split("#");
  3586. completeurl = ohne_hash[0]+'#play';
  3587. }
  3588. else {
  3589. completeurl = url+file;
  3590. var ohne_hash = completeurl.split("#");
  3591. completeurl = ohne_hash[0]+'#play'+images_extend;
  3592. }
  3593. }
  3594. else {
  3595. completeurl = url+file;
  3596. }
  3597. }
  3598. if (player == 1 && !flag_player) {
  3599. if(images_extend==1) {
  3600. var ohne_hash = completeurl.split("#");
  3601. completeurl = ohne_hash[0]+'#play';
  3602. }
  3603. else {
  3604. var ohne_hash = completeurl.split("#");
  3605. completeurl = ohne_hash[0]+'#play'+images_extend;
  3606. }
  3607. }
  3608. return completeurl;
  3609. };
  3610.  
  3611. var get_url_path = function() {
  3612. var ret = url_path;
  3613. var tld = $('#tld').val();
  3614. if (typeof tld !== 'undefined' && tld !== 'us') {
  3615. ret = ret + '/' + tld;
  3616. }
  3617. return ret;
  3618. };
  3619.  
  3620. var set_to_latlong = function(lat, long) {
  3621. gps_success({'coords':{'latitude':lat,'longitude':long}});
  3622. }
  3623. var gps_error = function () {
  3624. messageLayer(201,'#error-msg','#error-modal');
  3625. };
  3626.  
  3627. var gps_success = function(pos) {
  3628. var x = pos.coords.longitude;
  3629. var y = pos.coords.latitude;
  3630. var areas = getAreaArray();
  3631. $.post(get_url_path()+'/ajax/locating', {
  3632. 'lat' : y,
  3633. 'long' : x,
  3634. 'model' : $('#model').val(),
  3635. 'model_param' : parseInt($('#model-param').val()),
  3636. 'model_location' : $('#model-location').val(),
  3637. }, function (data) {
  3638. if (data) {
  3639. var area_id = get_selected_area();
  3640. if (parseInt(data.area_id)) {
  3641. area_id = parseInt(data.area_id);
  3642. };
  3643.  
  3644. refreshDropdowns(null,null, {
  3645. 'model' : $('#model').val(),
  3646. 'model_valid' : $('#model-valid').val(),
  3647. 'model_run' : $('#model-run').val(),
  3648. 'model_param' : $('#model-param').val(),
  3649. 'model_location' : $('#model-location').val(),
  3650. 'area_id' : area_id,
  3651. 'areas_1' : areas[1],
  3652. 'areas_2' : areas[2],
  3653. 'areas_3' : areas[3],
  3654. 'areas_4' : areas[4],
  3655. 'areas_5' : areas[5],
  3656. 'areas_6' : areas[6],
  3657. 'areas_7' : areas[7],
  3658. 'areas_8' : areas[8],
  3659. 'areas_9' : areas[9],
  3660. 'geo_lat' : data.lat,
  3661. 'geo_long' : data.long
  3662. });
  3663. }
  3664. else {
  3665. $('#error-msg').html("<p>Der passende Kartenausschnitt konnte nicht ermittelt werden.</p>");
  3666. $('#error-modal').modal('show');
  3667. }
  3668.  
  3669. }, "json");
  3670. };
  3671.  
  3672. var gps_locating = function () {
  3673. if (navigator.geolocation) {
  3674. navigator.geolocation.getCurrentPosition(gps_success, gps_error, {
  3675. enableHighAccuracy: true,
  3676. timeout: 20000,
  3677. maximumAge: 600000
  3678. });
  3679. } else {
  3680. gps_not_supported();
  3681. }
  3682. };
  3683.  
  3684. var gps_locating_forecast = function () {
  3685. if (navigator.geolocation) {
  3686. navigator.geolocation.getCurrentPosition(gps_success_forecast, gps_error, {
  3687. enableHighAccuracy: true,
  3688. timeout: 20000,
  3689. maximumAge: 600000
  3690. });
  3691. } else {
  3692. gps_not_supported();
  3693. }
  3694. };
  3695.  
  3696. var gps_locating_wetter = function () {
  3697. if (navigator.geolocation) {
  3698. navigator.geolocation.getCurrentPosition(gps_success_wetter, gps_error, {
  3699. enableHighAccuracy: true,
  3700. timeout: 20000,
  3701. maximumAge: 600000
  3702. });
  3703. } else {
  3704. gps_not_supported();
  3705. }
  3706. };
  3707.  
  3708. var gps_locating_uwz = function () {
  3709. if (navigator.geolocation) {
  3710. $('#unwetterzentrale').html('<p>Sie werden jetzt automatisch geortet. Bitte kurz warten.</p>');
  3711. navigator.geolocation.getCurrentPosition(gps_success_uwz, gps_error_uwz, {
  3712. enableHighAccuracy: true,
  3713. timeout: 20000,
  3714. maximumAge: 600000
  3715. });
  3716. } else {
  3717. gps_not_supported_uwz();
  3718. }
  3719. };
  3720.  
  3721. var gps_locating_hpwetter = function () {
  3722. if (navigator.geolocation) {
  3723. navigator.geolocation.getCurrentPosition(gps_success_hpwetter, gps_error, {
  3724. enableHighAccuracy: true,
  3725. timeout: 20000,
  3726. maximumAge: 600000
  3727. });
  3728. } else {
  3729. gps_not_supported();
  3730. }
  3731. };
  3732.  
  3733. var gps_success_forecast = function(pos) {
  3734. return gps_success_global(pos,'/ajax/locatingfc');
  3735. };
  3736.  
  3737. var gps_success_wetter = function(pos) {
  3738. return gps_success_global(pos,'/ajax/locatingwt');
  3739. };
  3740.  
  3741. var gps_success_hpwetter = function(pos) {
  3742. return gps_success_global(pos,'/ajax/locatinghp');
  3743. };
  3744.  
  3745. var gps_success_global = function(pos, url) {
  3746. var x = pos.coords.longitude;
  3747. var y = pos.coords.latitude;
  3748. $.post(get_url_path()+url, {
  3749. 'lat' : y,
  3750. 'long' : x,
  3751. 'model' : $('#model').val(),
  3752. 'forecast_action' : $('#forecast-action-0').val()
  3753. }, function (data) {
  3754. if (data) {
  3755. document.location.href=data;
  3756. }
  3757. else {
  3758. gps_not_supported();
  3759. }
  3760.  
  3761. });
  3762. };
  3763.  
  3764. var gps_not_supported = function() {
  3765. $('#error-msg').html("<p>Ihr Standort befindet sich außerhalb unseres Vorhersagegebiets.</p>");
  3766. $('#error-modal').modal('show');
  3767. };
  3768.  
  3769. var closeMarker = function() {
  3770. $('#map-marker').hide();
  3771. $('#geo-x').val('');
  3772. $('#geo-y').val('');
  3773. $('#geo-lat').val('');
  3774. $('#geo-long').val('');
  3775. addHistory(2);
  3776. };
  3777.  
  3778. var forecastDayTable = function(city_id, idate, imodel) {
  3779. if (typeof imodel === 'undefined') {
  3780. imodel=$('#forecast-model').val();
  3781. }
  3782. $('#forecast-daytable').html('<p>Wird geladen...</p>');
  3783. $.post(get_url_path()+'/ajax/forecastdaytable', {
  3784. 'city_id' : city_id,
  3785. 'date' : idate,
  3786. 'model' : imodel
  3787. }, function (data) {
  3788. $('#forecast-daytable').html(data);
  3789. scrollToAnchor('daytable');
  3790. });
  3791. };
  3792.  
  3793. var forecastDayTableHash = function(daytable) {
  3794. scrollToAnchor(daytable);
  3795. };
  3796.  
  3797. var forecastModel = function() {
  3798. forecastMT('fcxl');
  3799. };
  3800.  
  3801. var forecastModelTrend = function() {
  3802. forecastMT('fcxl');
  3803. }
  3804.  
  3805. var forecastMT = function(url) {
  3806. var params = {
  3807. 'city_id' : $('#city-id').val(),
  3808. 'lang':displayLanguage().toString().toLowerCase(),
  3809. 'units':displayUnits(),
  3810. 'tf':displayTimeformat(),
  3811. 'model':$('#forecast-model').val(),
  3812. 'func':$('#weather-fcxl-page').attr('data-func')
  3813. };
  3814. $('#forecast-full').html('<p>Wird geladen...</p>');
  3815. $.get(get_url_path()+'/ajax/'+url, params, function (data) {
  3816. $('#forecast-full').html(data);
  3817. reloadIframeAds();
  3818. setModelSelectorListener();
  3819. var new_url = $('#forecast-url').attr('data');
  3820. if (new_url) {
  3821. if ($('#tab-url').attr("data-src")) {
  3822. new_url+='/'+$('#tab-url').attr("data-src");
  3823. }
  3824. pushHistory(new_url);
  3825. if (ga) {
  3826. var count_url = new_url.replace($('#full-base').val(),"");
  3827. ga("send", "pageview", count_url);
  3828. }
  3829. }
  3830. });
  3831. };
  3832.  
  3833. var forecastModelEssentials = function(url) {
  3834. var params = {
  3835. 'url' : $('#forecast-url').attr("data"),
  3836. 'model' : $('#forecast-model').val()
  3837. };
  3838. goto(params['url']+'/'+params['model']);
  3839. };
  3840.  
  3841. var forecastModelEnsemble = function(url) {
  3842. var params = {
  3843. 'url' : $('#forecast-url-sw').attr("data"),
  3844. 'model' : $('#forecast-model').val(),
  3845. 'tab_url' : $('#tab-url').attr('data-src')
  3846. };
  3847. var url_ensemble = params['url']+'/'+params['model'];
  3848. if (params['tab_url']) {
  3849. url_ensemble = url_ensemble + '/' +params['tab_url'];
  3850. }
  3851.  
  3852. goto(url_ensemble);
  3853. };
  3854.  
  3855. var scrollToAnchor = function (aid){
  3856. var aTag = $("a[name='"+ aid +"']");
  3857. $('html,body').animate({scrollTop: aTag.offset().top},'slow');
  3858. };
  3859.  
  3860.  
  3861. var goto = function(url) {
  3862. document.location.href = url;
  3863. };
  3864. var temperature_canvas = '';
  3865. var initSatTemp = function() {
  3866. if ($('#model').val() === 'sat') {
  3867. var o_url = $('#model-image>img').attr("src");
  3868. var newlinktemp = o_url.replace("_119.jpg","_123.jpg")
  3869. .replace("_120.jpg","_123.jpg")
  3870. .replace("_121.jpg","_123.jpg")
  3871. .replace("_122.jpg","_123.jpg")
  3872. .replace("_131.jpg","_123.jpg")
  3873. .replace("_133.jpg","_123.jpg")
  3874. .replace("_124.jpg","_128.jpg")
  3875. .replace("_125.jpg","_128.jpg")
  3876. .replace("_126.jpg","_128.jpg")
  3877. .replace("_127.jpg","_128.jpg")
  3878. .replace("_132.jpg","_128.jpg")
  3879. .replace("_134.jpg","_128.jpg")
  3880. .replace("_326.jpg","_128.jpg");
  3881.  
  3882. $("#temperaturemap").attr("src", newlinktemp);
  3883. var temperature_img = $('#temperaturemap')[0];
  3884. if (typeof temperature_img !== 'undefinded') {
  3885. temperature_img.onload=function() {
  3886. temperature_canvas = $('<canvas/>')[0];
  3887. temperature_canvas.width = temperature_img.width;
  3888. temperature_canvas.height = temperature_img.height;
  3889. temperature_canvas.getContext('2d').drawImage(temperature_img, 0, 0, temperature_img.width, temperature_img.height);
  3890. $('#click-overlay').on('mousemove',movehandler);
  3891. $('#click-overlay').on('mouseout',function() {
  3892. $('#temp-button').hide();
  3893. });
  3894. }
  3895. }
  3896. }
  3897. else {
  3898. $('#click-overlay').off('mousemove');
  3899. }
  3900. };
  3901.  
  3902. var movehandler= function(event) {
  3903. var text = $('#copyright_hidden').attr('data');
  3904. if (temperature_canvas && (text == 'Satellitendaten: EUMETSAT' || text == 'Satellite data: EUMETSAT')) {
  3905. var faktor = 1;
  3906. if (temperature_canvas.width > 0) {
  3907. faktor = $('#click-overlay').width()/temperature_canvas.width;
  3908. }
  3909. if (temperature_canvas.getContext('2d').getImageData(Math.floor(event.offsetX/faktor), Math.floor(event.offsetY/faktor), 1, 1).data) {
  3910. $('#temp-button').show();
  3911. var pixelData = temperature_canvas.getContext('2d').getImageData(Math.floor(event.offsetX/faktor), Math.floor(event.offsetY/faktor), 1, 1).data;
  3912. var tempvalue=54-Math.round((144/255)*pixelData[2]);
  3913. if (Math.floor(event.offsetY/faktor) > temperature_canvas.height-1 || Math.floor(event.offsetX/faktor) > temperature_canvas.width-1) {
  3914. $('#temp-button').hide();
  3915. }
  3916. else {
  3917. if(displayLanguage()=="EN"){
  3918. var temptext = 'Temperature';
  3919. }else{
  3920. var temptext = 'Temperatur';
  3921. }
  3922. if(displayUnits()=="us")
  3923. $('#temperatureoutput').html(temptext+': &nbsp; ' + Math.round(tempvalue*1.8+32) + '°F');
  3924. else
  3925. $('#temperatureoutput').html(temptext+': &nbsp; ' + tempvalue + '°C');
  3926. }
  3927. }
  3928. }
  3929. };
  3930.  
  3931. var initOpenDivs = function() {
  3932. if (open_dd_div1) {
  3933. //$('#'+open_dd_div1).show();
  3934. $('[data-id="'+open_dd_div1+'"]').each(function() {
  3935. if ($(this).hasClass('acc-btn-on')) {
  3936. openAccLayerDirect($(this));
  3937. }
  3938. });
  3939. }
  3940. else if (open_dd_start/* && !$('#animation-player-mobile').is(':visible')*/) {
  3941. open_dd_start = false;
  3942. var loc = window.location.href;
  3943. if (typeof loc !== 'undefined' && loc.search('.html') !== -1) {
  3944. if (isObsMode($('#model').val())) {
  3945. $('[data-id="acc-layer-params"]').each(function() {
  3946. if ($(this).hasClass('acc-btn-on')) {
  3947. open_dd_div1 = 'acc-layer-params';
  3948. openAccLayerDirect($(this));
  3949. }
  3950. });
  3951. }
  3952. else if (loc.search('orogra') !== -1) {
  3953. $('[data-id="acc-layer-model"]').each(function() {
  3954. if ($(this).hasClass('acc-btn-on')) {
  3955. open_dd_div1 = 'acc-layer-model';
  3956. openAccLayerDirect($(this));
  3957. }
  3958. });
  3959. }
  3960. else {
  3961. $('[data-id="acc-layer-valid"]').each(function() {
  3962. if ($(this).hasClass('acc-btn-on')) {
  3963. open_dd_div1 = 'acc-layer-valid';
  3964. openAccLayerDirect($(this));
  3965. }
  3966. });
  3967. }
  3968. }
  3969. else {
  3970. $('[data-id="acc-layer-params"]').each(function() {
  3971. if ($(this).hasClass('acc-btn-on')) {
  3972. open_dd_div1 = 'acc-layer-params';
  3973. openAccLayerDirect($(this));
  3974. }
  3975. });
  3976. }
  3977. }
  3978. if (open_dd_div2) {
  3979. $('#'+open_dd_div2).show();
  3980. }
  3981. if (open_dd_tab_params) {
  3982. $('[aria-controls="'+open_dd_tab_params+'"]').trigger('click');
  3983. scrollTopParam();
  3984. }
  3985. if (open_dd_tab_valids) {
  3986. $('[aria-controls="'+open_dd_tab_valids+'"]').trigger('click');
  3987. }
  3988. if (open_dd_tab_models) {
  3989. $('[aria-controls="'+open_dd_tab_models+'"]').trigger('click');
  3990. }
  3991. if (open_dd_valids) {
  3992. $('[data-value="'+open_dd_valids+'"]').trigger('click');
  3993. }
  3994.  
  3995. };
  3996.  
  3997. var satHelp = function() {
  3998. $('.sat-help').hide();
  3999. var tmp = parseInt($('#model-param').val());
  4000. if (tmp === 120 || tmp === 125) {
  4001. $('.sat-help-hd').show();
  4002. }
  4003. else if (tmp === 121 || tmp === 126) {
  4004. $('.sat-help-topalarm').show();
  4005. }
  4006. else if (tmp === 122 || tmp === 127) {
  4007. $('.sat-help-color').show();
  4008. }
  4009. else if (tmp === 123 || tmp === 128) {
  4010. $('.sat-help-infrarot').show();
  4011. }
  4012. else if (tmp === 131 || tmp === 132) {
  4013. $('.sat-help-nature').show();
  4014. }
  4015. else if (tmp === 133 || tmp === 134) {
  4016. $('.sat-help-nebel-check').show();
  4017. }
  4018. else if (tmp === 136 || tmp === 138 || tmp === 140 || tmp === 142 || tmp === 144) {
  4019. $('.sat-help-globushd').show();
  4020. }
  4021. else if (tmp === 135 || tmp === 137 || tmp === 139 || tmp === 141 || tmp === 143) {
  4022. $('.sat-help-globus').show();
  4023. }
  4024. else {
  4025. $('.sat-help').show();
  4026. }
  4027. };
  4028.  
  4029. var gaProperty = 'UA-63122815-1';
  4030. // Disable tracking if the opt-out cookie exists.
  4031. var disableStr = 'ga-disable-' + gaProperty;
  4032. if (document.cookie.indexOf(disableStr + '=true') > -1) {
  4033. window[disableStr] = true;
  4034. }
  4035. // Opt-out function
  4036. var gaOptout = function() {
  4037. document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
  4038. window[disableStr] = true;
  4039. alert("Google Analytics wurde auf dieser Seite deaktiviert.")
  4040. };
  4041.  
  4042. var mdTargeting = function () {
  4043. var tkeys = {}
  4044. var targeting = decodeURI($('#md-targeting').attr('data-value'));
  4045. if (targeting) {
  4046. var keys = targeting.split("|");
  4047. if (keys.length) {
  4048. for (i=0;i<keys.length;i++) {
  4049. if (keys[i]) {
  4050. var tmp2 = keys[i];
  4051. var tmp = tmp2.split("%3D");
  4052. if (tmp.length) {
  4053. var name = tmp[0];
  4054. tkeys[name]=tmp[1].replace("%2C",",");
  4055. }
  4056. }
  4057. }
  4058. }
  4059. }
  4060. return tkeys;
  4061. };
  4062.  
  4063.  
  4064.  
  4065. var nx = nx || {cmd:[]};
  4066. if (nx.cmd && $('#md-domain').attr('data-value') === 'true') {
  4067. var tkeys = mdTargeting();
  4068. nx.cmd.push(function () {
  4069. if (tkeys) {
  4070. nx.set('targeting', tkeys);
  4071. }
  4072. nx.set('targeting', 'mid_mobile_complete_lazy', {adv: 'mobile_interscroller'});
  4073. });
  4074. }
  4075.  
  4076.  
  4077. var reloadMDall = function () {
  4078. if (nx.cmd && $('#md-domain').attr('data-value') === 'true') {
  4079. var tkeys = mdTargeting();
  4080. nx.cmd.push(function () {
  4081. if (tkeys) {
  4082. nx.set('targeting', tkeys);
  4083. }
  4084. nx.trigger('refresh');
  4085. });
  4086. }
  4087. };
  4088.  
  4089. var checkOwnAds = function() {
  4090. $('.twiagoad').each(function() {
  4091. if ($(this).is(":visible")) {
  4092. var data = $(this).attr('data-twiago');
  4093. var dat = data.split('|');
  4094. if (parseInt(dat[0])>0 && parseInt(dat[1])>0 && parseInt(dat[2])>0) {
  4095. $(this).html('<iframe width="'+parseInt(dat[0])+'" height="'+parseInt(dat[1])+'" noresize="noresize" scrolling="no" '+
  4096. 'frameborder="0" marginheight="0" marginwidth="0" '+
  4097. 'src="/ajax/iframe?view=99&amp;id='+parseInt(dat[2])+'" '+
  4098. 'ALLOWTRANSPARENCY="true"></iframe>');
  4099.  
  4100. }
  4101. }
  4102. } );
  4103. $('.kwadspirit').each(function() {
  4104. if ($(this).is(":visible")) {
  4105. var data = $(this).attr('data-md');
  4106. var dat = data.split('|');
  4107. var keys = dat[3];
  4108. var data2 = $('#keyad-md').attr('data-md');
  4109. if (typeof data2 !== 'undefined' && data2) {
  4110. var dat2 = data2.split('|');
  4111. if (dat2[3]) {
  4112. keys = dat2[3];
  4113. }
  4114. }
  4115. if (parseInt(dat[0])>0 && parseInt(dat[1])>0 && parseInt(dat[2])>0 && dat[3]) {
  4116. $(this).html('<iframe width="'+parseInt(dat[0])+'" height="'+parseInt(dat[1])+'" noresize="noresize" scrolling="no" '+
  4117. 'frameborder="0" marginheight="0" marginwidth="0" '+
  4118. 'src="/ajax/iframe?view=97&amp;id='+parseInt(dat[2])+'&amp;keys='+keys+'" '+
  4119. 'ALLOWTRANSPARENCY="true"></iframe>');
  4120.  
  4121. }
  4122. }
  4123. } );
  4124. };
  4125.  
  4126. var reloadIframeAds = function() {
  4127. checkOwnAds();
  4128. reloadMDall();
  4129. };
  4130.  
  4131. var replaceAds = function(id, size, dom) {
  4132. if ($(dom).is(':visible')) {
  4133. $.post(get_url_path()+'/ajax/werbung', {
  4134. 'area_id' : id,
  4135. 'size' : size
  4136. }, function (data) {
  4137. if (data !== false) {
  4138. $(dom).html(data);
  4139. }
  4140. else {
  4141. $(dom).html('');
  4142. }
  4143. });
  4144. }
  4145.  
  4146. };
  4147.  
  4148. var switchForecast = function(input) {
  4149. var tmp = input.split('#');
  4150. var output = tmp[0];
  4151. var model = '';
  4152. if (typeof tmp[1] !== 'undefined' && tmp[1]) {
  4153. model = tmp[1];
  4154. }
  4155. var url = $('#forecast-url').attr('data');
  4156. /*var tmp3 = url.split('/');
  4157. if (tmp3.length > 6) {
  4158. url = tmp3[0]+'/'+tmp3[1]+'/'+tmp3[2]+'/'+tmp3[3]+'/'+tmp3[4]+'/'+tmp3[5];
  4159. }*/
  4160. var tab2 = $('#tab-url').attr('data-src');
  4161. if (output == 'ensemble') {
  4162. url = url + '/' + model;
  4163. }
  4164. if (typeof tab2 !== 'undefined' && tab2.length) {
  4165. if (displayCountry() === 'vh' && (output === 'xl' || output === 'xltrend')) {
  4166. url = url + '/euro';
  4167. }
  4168. url = url + '/' + tab2;
  4169. }
  4170. if (url) {
  4171. url = url.replace('/xltrend','/DUMMY');
  4172. url = url.replace('/xl','/DUMMY');
  4173. url = url.replace('/ensemble','/DUMMY');
  4174. document.location.href = url.replace('/DUMMY','/'+output);
  4175. return false;
  4176. }
  4177. return true;
  4178. };
  4179.  
  4180.  
  4181. var showFAQ = function(model_in,param_in) {
  4182. $('#faq-modal .modal-header').html('');
  4183. $('#faq-modal .modal-body').html(loadingGif());
  4184. var model = $('#model').val();
  4185. if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADAR_CH') {
  4186. model = 'ch';
  4187. }
  4188. else if ((model === 'radarpre') && $('#legends_visibility').attr('data') === 'RADAR_AT') {
  4189. model = 'radarpreat';
  4190. }
  4191. else if ((model === 'radarpre') && $('#legends_visibility').attr('data') === 'RADAR_CH') {
  4192. model = 'radarprech';
  4193. }
  4194. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADAR_AT') {
  4195. model = 'at';
  4196. }
  4197. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADARNL') {
  4198. model = 'RADARNL';
  4199. }
  4200. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADAR_ESTONIA') {
  4201. model = 'RADAR_ESTONIA';
  4202. }
  4203. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'NORWAY_RR') {
  4204. model = 'NORWAY_RR';
  4205. }
  4206. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'FINLAND_DBZH_COMPOSITE') {
  4207. model = 'FINLAND_DBZH_COMPOSITE';
  4208. }
  4209. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'UK_RAINRATE') {
  4210. model = 'UK_RAINRATE';
  4211. }
  4212. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'SLOVENIA_RR') {
  4213. model = 'SLOVENIA_RR';
  4214. }
  4215. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADAR_SOUTHTYROL') {
  4216. model = 'RADAR_SOUTHTYROL';
  4217. }
  4218. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADAR_FRANCE') {
  4219. model = 'RADAR_FRANCE';
  4220. }
  4221. else if ((model === 'px250' || model === 'storms' || model === 'floods') && $('#legends_visibility').attr('data') === 'RADAR_SWE_PRO') {
  4222. model = 'RADAR_SWE_PRO';
  4223. }
  4224. if (model_in) {
  4225. model = model_in;
  4226. }
  4227. var param = $('#model-param').val();
  4228. var param2 = 0;
  4229. if (param_in) {
  4230. param = param_in;
  4231. }
  4232. if (model === 'sat') {
  4233. param2 = get_selected_area();
  4234. }
  4235. var aparams = {
  4236. 'model' : model,
  4237. 'model_param' : param,
  4238. 'model_param2' : param2,
  4239. 'lang' : displayLanguage()
  4240. };
  4241. if (model === 'sat') {
  4242. aparams.timestamp = $('#model-valid').val();
  4243. }
  4244.  
  4245. $.get(get_url_path()+'/ajax_pub/faq', aparams, function (data) {
  4246. if (data !== 'FALSE') {
  4247. $('#faq-modal').html(data);
  4248. resize_video();
  4249. setElementHiders();
  4250. }
  4251. },'html');
  4252. return true;
  4253. };
  4254.  
  4255. var showMesoanalyse = function(city_id) {
  4256. $('#faq-modal .modal-header').html('');
  4257. $('#faq-modal .modal-body').html(loadingGif());
  4258. var aparams = {
  4259. 'city_id' : city_id,
  4260. 'units' : displayUnits(),
  4261. 'lang' : displayLanguage(),
  4262. 'tf': displayTimeformat()
  4263. };
  4264.  
  4265. $.get(get_url_path()+'/ajax_pub/mesoanalyse', aparams, function (data) {
  4266. if (data !== 'FALSE') {
  4267. $('#faq-modal').html(data);
  4268. resize_video();
  4269. setElementHiders();
  4270. }
  4271. },'html');
  4272. return true;
  4273. };
  4274.  
  4275. var showExtraNotice = function() {
  4276. var aparams = {
  4277. 'lang' : displayLanguage()
  4278. };
  4279. $.get(get_url_path()+'/ajax_pub/extranotice', aparams, function (data) {
  4280. if (data !== 'FALSE') {
  4281. $('#faq-modal').html(data);
  4282. resize_video();
  4283. setElementHiders();
  4284. }
  4285. },'html');
  4286. return true;
  4287. };
  4288.  
  4289. var switchXlLight = function (idcounter) {
  4290. if (idcounter === '0') {
  4291. $('#forecast-action-1').val($('#forecast-action-0').val());
  4292. if ($('#forecast-action-0').val() !== 'wetter') {
  4293. if (typeof $('#forecast-form-0').attr('action') !== 'undefined') {
  4294. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/wetter/','/vorhersage/'));
  4295. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/weather/','/forecast/'));
  4296. }
  4297. if (typeof $('#forecast-form-1').attr('action') !== 'undefined') {
  4298. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/wetter/','/vorhersage/'));
  4299. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/weather/','/forecast/'));
  4300. }
  4301. }
  4302. else {
  4303. if (typeof $('#forecast-form-0').attr('action') !== 'undefined') {
  4304. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/vorhersage/','/wetter/'));
  4305. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/forecast/','/weather/'));
  4306. }
  4307. if (typeof $('#forecast-form-1').attr('action') !== 'undefined') {
  4308. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/vorhersage/','/wetter/'));
  4309. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/forecast/','/weather/'));
  4310. }
  4311. }
  4312. //$('#forecast-action-8').val($('#forecast-action-0').val());
  4313. }
  4314. else if (idcounter === '1') {
  4315. $('#forecast-action-0').val($('#forecast-action-1').val());
  4316. if ($('#forecast-action-1').val() !== 'wetter') {
  4317. if (typeof $('#forecast-form-0').attr('action') !== 'undefined') {
  4318. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/wetter/','/vorhersage/'));
  4319. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/weather/','/forecast/'));
  4320. }
  4321. if (typeof $('#forecast-form-1').attr('action') !== 'undefined') {
  4322. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/wetter/','/vorhersage/'));
  4323. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/weather/','/forecast/'));
  4324. }
  4325. }
  4326. else {
  4327. if (typeof $('#forecast-form-0').attr('action') !== 'undefined') {
  4328. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/vorhersage/','/wetter/'));
  4329. $('#forecast-form-0').attr('action',$('#forecast-form-0').attr('action').toString().replace('/forecast/','/weather/'));
  4330. }
  4331. if (typeof $('#forecast-form-1').attr('action') !== 'undefined') {
  4332. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/vorhersage/','/wetter/'));
  4333. $('#forecast-form-1').attr('action',$('#forecast-form-1').attr('action').toString().replace('/forecast/','/weather/'));
  4334. }
  4335. }
  4336. // $('#forecast-action-8').val($('#forecast-action-1').val());
  4337. }
  4338. /*else if (idcounter === '8') {
  4339. $('#forecast-action-0').val($('#forecast-action-8').val());
  4340. $('#forecast-action-1').val($('#forecast-action-8').val());
  4341. }*/
  4342. };
  4343.  
  4344. var navHeight = function () {
  4345. var fbwidth=390;
  4346. if (parseInt($(window).height())>390) {
  4347. fbwidth=parseInt($(window).height());
  4348. }
  4349. $('.navbar-collapse').css('max-height',fbwidth-50);
  4350. $('.menue-button').css('max-height',fbwidth-50);
  4351. $('#myfavourites').css('max-height',fbwidth-50);
  4352. };
  4353.  
  4354. var resizeWidgets = function () {
  4355. navHeight();
  4356. var fbwidth=500;
  4357. if ($('.fb-page').parent('div').width()) {
  4358. fbwidth=$('.fb-page').parent('div').width();
  4359. }
  4360. $('.fb-page').attr('width', fbwidth);
  4361. if ($('body').width()<768) {
  4362. $('.fb-page-outer').html('');
  4363. // $('.fb-page').replaceWidth('');//attr('height', 250);
  4364. // $('.twitter-timeline').replaceWidth('');//.attr('data-widget-id','663795483240996864');
  4365. }
  4366. else if ($('body').width()<992) {
  4367. $('.fb-page').attr('height', 350);
  4368. $('.twitter-timeline').attr('data-widget-id','663797206206570496');
  4369. }
  4370. else if ($('body').width()<1200) {
  4371. $('.fb-page').attr('height', 420);
  4372. $('.twitter-timeline').attr('data-widget-id','663803781461770240');
  4373. }
  4374. };
  4375.  
  4376. var initDatePicker = function() {
  4377. var min = $('#datepicker-startdate').attr('data');
  4378. if (!min) {
  4379. min = 0;
  4380. }
  4381. var max = $('#datepicker-enddate').attr('data');
  4382. if (!max) {
  4383. max = new Date();
  4384. }
  4385. $('#datepicker-run').datetimepicker({
  4386. locale: displayLanguage(),
  4387. format: 'YYYY-MM-DD',
  4388. minDate: min,
  4389. maxDate: max,
  4390. useCurrent: false
  4391. }).on('dp.hide', function (e) {
  4392. var areas = getAreaArray();
  4393. var area_id = get_selected_area();
  4394. ajaxloadingarchivemsg = true;
  4395. refreshDropdowns(false, false, {
  4396. 'model' : $('#model').val(),
  4397. 'model_valid' : $('#model-valid').val(),
  4398. 'model_run' : $('#model-picked-date').val(),
  4399. 'model_param' : $('#model-param').val(),
  4400. 'model_location' : $('#model-location').val(),
  4401. 'area_id' : area_id,
  4402. 'areas_1' : areas[1],
  4403. 'areas_2' : areas[2],
  4404. 'areas_3' : areas[3],
  4405. 'areas_4' : areas[4],
  4406. 'areas_5' : areas[5],
  4407. 'areas_6' : areas[6],
  4408. 'areas_7' : areas[7],
  4409. 'areas_8' : areas[8],
  4410. 'areas_9' : areas[9],
  4411. 'geo_lat' : $('#geo-lat').val(),
  4412. 'geo_long' : $('#geo-long').val()
  4413. });
  4414. });
  4415. };
  4416.  
  4417.  
  4418. var getAreaArray = function (jqobj) {
  4419. var fieldname = '';
  4420. var areas = Array(10);
  4421. if (jqobj && jqobj.attr('data-info') === 'first') {
  4422. return areas;
  4423. }
  4424. for (i=1;i<=9;i++) {
  4425. fieldname = '#form-areaid-'+i;
  4426. if ($(fieldname).val() && parseInt($(fieldname).val()) > 0) {
  4427. areas[i]=$(fieldname).val();
  4428. if (jqobj && '#'+jqobj.attr('id') === fieldname) {
  4429. break;
  4430. }
  4431.  
  4432. }
  4433. else {
  4434. break;
  4435. }
  4436. }
  4437. return areas;
  4438. };
  4439.  
  4440. var showTrack = function(id) {
  4441. resetZoom();
  4442. }
  4443.  
  4444. var resetZoom = function() {
  4445. var scale = 'scale(1)';
  4446. document.body.style.webkitTransform = scale;
  4447. document.body.style.msTransform = scale;
  4448. document.body.style.transform = scale;
  4449. }
  4450.  
  4451. var initTracks = function() {
  4452. $('.trck').on('click', function(e) {
  4453. e.preventDefault();
  4454. showTrackDetailByURL($(this).attr('href'), true);
  4455. });
  4456. };
  4457.  
  4458.  
  4459. var initFloods = function() {
  4460. $('.flds').on('click', function(e) {
  4461. e.preventDefault();
  4462. showFloodDetailByURL($(this).attr('href'), true);
  4463. });
  4464. }
  4465.  
  4466. var showTrackDetailByURL = function (url, counter) {
  4467. var tmp = url.replace(/#/g, "").split('-');
  4468. showTrackDetail(tmp[0].replace("z",""),tmp[1],tmp[2],tmp[3], counter);
  4469. };
  4470.  
  4471.  
  4472. var showTrackDetail = function (datetime, blitzid, areaid, blitzhash, counter) {
  4473. $('#stormtrckd').modal('show');
  4474. $('#stormtrckd-wrapper').hide();
  4475. $('#stormtrckd-ajax-loader').show();
  4476. var c = true;
  4477. if (counter === false) {
  4478. c = false;
  4479. }
  4480. $.get(get_url_path()+'/ajax/stormtracking', {
  4481. 'datetime' : datetime,
  4482. 'track_id' : blitzid,
  4483. 'area_id' : areaid,
  4484. 'track_hash' : blitzhash,
  4485. 'counter' : c,
  4486. 'lang' : displayLanguage()
  4487. }, function (data) {
  4488. $('#stormtrckd-ajax-loader').hide();
  4489. $('#stormtrckd-wrapper').show();
  4490. $('#stormtrckd-wrapper').html(data);
  4491. if (c) { addHistory(null, 3);}
  4492. },'html');
  4493. };
  4494.  
  4495.  
  4496. var showFloodDetailByURL = function (url, counter) {
  4497. var tmp = url.replace(/#/g, "").split('-');
  4498. showFloodDetail(tmp[0].replace("z",""),tmp[1],tmp[2],tmp[3], counter);
  4499. };
  4500.  
  4501. var showFloodDetail = function (datetime, blitzid, areaid, blitzhash, counter) {
  4502. $('#flashflood').modal('show');
  4503. $('#flashflood-wrapper').hide();
  4504. $('#flashflood-ajax-loader').show();
  4505. var c = true;
  4506. if (counter === false) {
  4507. c = false;
  4508. }
  4509. $.get(get_url_path()+'/ajax/flashflood', {
  4510. 'datetime' : datetime,
  4511. 'track_id' : blitzid,
  4512. 'area_id' : areaid,
  4513. 'track_hash' : blitzhash,
  4514. 'counter' : c,
  4515. 'lang' : displayLanguage()
  4516. }, function (data) {
  4517. $('#flashflood-ajax-loader').hide();
  4518. $('#flashflood-wrapper').show();
  4519. $('#flashflood-wrapper').html(data);
  4520. if (c) { addHistory(null, 4); }
  4521. },'html');
  4522. };
  4523. var getSpecialUnderlay = function() {
  4524. return ($('.model').val() === 'blitze' || isObsMode($('#model').val()) || $('#model').val() === 'pollen' || $('#model').val() === 'forecast');
  4525. }
  4526. var toggleCities = function () {
  4527. if ($('#model').val() !== 'plraw') {
  4528. var special_underlay = getSpecialUnderlay();
  4529. if (parseInt($('#map-overlay-setting').attr('data-value')) === 1) {
  4530. if (special_underlay) {
  4531. $('#map-overlay-trans').hide();
  4532. $('#map-overlay').hide();
  4533. $('#map-underlay-trans').hide();
  4534. $('#map-underlay').show();
  4535. }
  4536. else {
  4537. $('#map-overlay-trans').hide();
  4538. $('#map-overlay').show();
  4539. $('#map-underlay-trans').hide();
  4540. $('#map-underlay').hide();
  4541. }
  4542. $('#map-overlay-setting').attr('data-value','0');
  4543. }
  4544. else if (parseInt($('#map-overlay-setting').attr('data-value')) === 0) {
  4545. $('#map-overlay-trans').hide();
  4546. $('#map-overlay').hide();
  4547. $('#map-underlay-trans').hide();
  4548. $('#map-underlay').hide();
  4549. $('#map-overlay-setting').attr('data-value','2');
  4550. }
  4551. else {
  4552. if (special_underlay) {
  4553. $('#map-overlay-trans').hide();
  4554. $('#map-overlay').hide();
  4555. $('#map-underlay-trans').show();
  4556. $('#map-underlay').hide();
  4557. }
  4558. else {
  4559. $('#map-overlay-trans').show();
  4560. $('#map-overlay').hide();
  4561. $('#map-underlay-trans').hide();
  4562. $('#map-underlay').hide();
  4563. }
  4564. $('#map-overlay-setting').attr('data-value','1');
  4565. }
  4566. }
  4567. else {
  4568. $('#map-overlay-trans').hide();
  4569. $('#map-overlay').hide();
  4570. $('#map-underlay-trans').hide();
  4571. $('#map-underlay').hide();
  4572. }
  4573. };
  4574.  
  4575. var initModelSwitcher = function() {
  4576. /*$('.v2-alt-models').hover(function(e){
  4577. $('.v2-prime-row').hide();
  4578. var eid = $(this).attr('data-href');
  4579. if (eid) { $(eid).show(); }
  4580. });*/
  4581. $('.v2-alt-models').on('click',function(e){
  4582. $('.v2-prime-row').hide();
  4583. var eid = $(this).attr('data-href');
  4584. if (eid) { $(eid).show(); }
  4585. });
  4586. };
  4587.  
  4588. var showXLSymbole = function(id) {
  4589. $(id).toggle();
  4590. };
  4591.  
  4592. var isObsMode = function(model) {
  4593. if ( model === 'obs' ||
  4594. model === 'obsama' ||
  4595. model === 'gma') {
  4596. return true;
  4597. }
  4598. return false;
  4599. };
  4600.  
  4601. var isModelCard = function(model) {
  4602. if ( model === 'moddeuhd' ||
  4603. model === 'moddeuhd2' ||
  4604. model === 'moddeu' ||
  4605. model === 'modvhshd' ||
  4606. model === 'modsuihd' ||
  4607. model === 'modswisseu' ||
  4608. model === 'modkorea' ||
  4609. model === 'modrapid' ||
  4610. model === 'modvhrpd' ||
  4611. model === 'modhim' ||
  4612. model === 'modned' ||
  4613. model === 'modfin' ||
  4614. model === 'modgbrhd' ||
  4615. model === 'modgbr' ||
  4616. model === 'modfrahd' ||
  4617. model === 'modfra' ||
  4618. model === 'modphhd' ||
  4619. model === 'modphshd' ||
  4620. model === 'modusa' ||
  4621. model === 'modusahd' ||
  4622. model === 'modusarpd' ||
  4623. model === 'modgfsfv3' ||
  4624. model === 'modaus' ||
  4625. model === 'modbra' ||
  4626. model === 'modcan' ||
  4627. model === 'modez' ||
  4628. model === 'modvhez' ||
  4629. model === 'modezrpd' ||
  4630. model === 'modnychd' ||
  4631. model === 'modcencal' ||
  4632. model === 'modsthcal' ||
  4633. model === 'modnorcal' ||
  4634. model === 'modvir' ||
  4635. model === 'modbc' ||
  4636. model === 'modnsw' ||
  4637. model === 'modbeij' ||
  4638. model === 'moduae' ||
  4639. model === 'modoklatex' ||
  4640. model === 'modezseason' ||
  4641. model === 'modezwkly' ||
  4642. model === 'modvhezwkly' ||
  4643. model === 'modvhanalyze' ||
  4644. model === 'modvhsoil' ||
  4645. model === 'modtcshd' ||
  4646. model === 'modtchd'
  4647. ) {
  4648. return true;
  4649. }
  4650. return false;
  4651. };
  4652.  
  4653.  
  4654. var modelWithPlayer = function(model) {
  4655. if ( model === 'px250' ||
  4656. model === 'wwanalyze' ||
  4657. model === 'radarde' ||
  4658. model === 'radar' ||
  4659. model === 'radarus' ||
  4660. model === 'radarpre' ||
  4661. model === 'pl' ||
  4662. model === 'radial' ||
  4663. model === 'sat' ||
  4664. model === 'globus' ||
  4665. model === 'hagel' ||
  4666. model === 'singlepx' ||
  4667. model === 'plraw' ||
  4668. model === 'sweeps' ||
  4669. model === 'radar3d' ||
  4670. model === 'zsweeps'
  4671. ) {
  4672. return true;
  4673. }
  4674. return false;
  4675. };
  4676.  
  4677.  
  4678. var initVarSettings = function() {
  4679. if ($('#model').val() !== 'plraw') {
  4680. var special_underlay = getSpecialUnderlay();
  4681. if ($('#map-overlay-setting').attr('data-value') === '1') {
  4682. if (special_underlay) {
  4683. $('#map-overlay-trans').hide();
  4684. $('#map-overlay').hide();
  4685. $('#map-underlay-trans').show();
  4686. $('#map-underlay').hide();
  4687. }
  4688. else {
  4689. $('#map-overlay-trans').show();
  4690. $('#map-overlay').hide();
  4691. $('#map-underlay-trans').hide();
  4692. $('#map-underlay').hide();
  4693. }
  4694. }
  4695. else if ($('#map-overlay-setting').attr('data-value') === '2') {
  4696. $('#map-overlay-trans').hide();
  4697. $('#map-overlay').hide();
  4698. $('#map-underlay-trans').hide();
  4699. $('#map-underlay').hide();
  4700. }
  4701. else {
  4702. if (special_underlay) {
  4703. $('#map-overlay-trans').hide();
  4704. $('#map-overlay').hide();
  4705. $('#map-underlay-trans').hide();
  4706. $('#map-underlay').show();
  4707. }
  4708. else {
  4709. $('#map-overlay-trans').hide();
  4710. $('#map-overlay').show();
  4711. $('#map-underlay-trans').hide();
  4712. $('#map-underlay').hide();
  4713. }
  4714. }
  4715. if ($('#map-overlay-start').attr('data-value') === 'true') {
  4716. if ($('#map-overlay-setting').attr('data-value') === '1') {
  4717. if (special_underlay) {
  4718. $('#map-overlay-trans').hide();
  4719. $('#map-overlay').hide();
  4720. $('#map-underlay-trans').show();
  4721. $('#map-underlay').hide();
  4722. }
  4723. else {
  4724. $('#map-overlay-trans').show();
  4725. $('#map-overlay').hide();
  4726. $('#map-underlay-trans').hide();
  4727. $('#map-underlay').hide();
  4728. }
  4729. }
  4730. $('#map-overlay-start').attr('data-value',false);
  4731. }
  4732. }
  4733. else {
  4734. $('#map-overlay-trans').hide();
  4735. $('#map-overlay').hide();
  4736. $('#map-underlay-trans').hide();
  4737. $('#map-underlay').hide();
  4738. }
  4739. }
  4740.  
  4741. var actionFavourite = function(id, action) {
  4742. if (parseInt(id)>0 && (action==='remove'||action==='save')) {
  4743. $.post(get_url_path()+'/ajax/favourite', {
  4744. 'action' : action,
  4745. 'city_id' : id
  4746. }, function (data) {
  4747. if (data !== 'FALSE') {
  4748. $('.favourite-div').html(data);
  4749. hoverPopover();
  4750. }
  4751. else {
  4752. messageLayer(202, '#error-msg','#error-modal');
  4753. }
  4754. },'html');
  4755. }
  4756. return false;
  4757. };
  4758.  
  4759. var setFavourite = function(id) {
  4760. return actionFavourite(id, 'save');
  4761. };
  4762.  
  4763. var removeFavourite = function(id) {
  4764. return actionFavourite(id, 'remove');
  4765. };
  4766.  
  4767.  
  4768. var messageLayer = function (message_id, msg_id, modal_id) {
  4769. $.get(get_url_path()+'/ajax_pub/messages', { 'message_id' : message_id, 'lang' : displayLanguage()},
  4770. function (data) {
  4771. $(msg_id).html(data);
  4772. $(modal_id).modal('show');
  4773. },'html');
  4774. };
  4775.  
  4776. var displayLanguage = function() {
  4777. return $('#user-language').attr('data-value');
  4778. };
  4779.  
  4780. var displayUnits = function() {
  4781. return $('#user-units').attr('data-value');
  4782. };
  4783. var displayTimeformat = function() {
  4784. return $('#display-tzformat').attr('data-value');
  4785. };
  4786.  
  4787. var displayCountry = function() {
  4788. var website = $('#user-country').attr('data-value');
  4789. if (website.length == 2) {
  4790. return website.toLowerCase();
  4791. }
  4792. else {
  4793. return 'de';
  4794. }
  4795. };
  4796.  
  4797. var displayLanguageLowerCase = function() {
  4798. var lang=displayLanguage();
  4799. if (lang.length == 2) {
  4800. return lang.toLowerCase();
  4801. }
  4802. else {
  4803. return 'de';
  4804. }
  4805. };
  4806.  
  4807.  
  4808. var model_member_next = function(e) {
  4809. if (checkChartcounter()) {
  4810. var mid = '#model-member';
  4811. var selected = model_player_get_selected_index(mid);
  4812. var items = model_player_get_item_count(mid+" option");
  4813. if (selected < items) {
  4814. if (selected == 0 && items>1) {
  4815. $(mid).prop("selectedIndex", selected + 2);
  4816. }
  4817. else {
  4818. $(mid).prop("selectedIndex", selected + 1);
  4819. }
  4820. $(mid).trigger('change');
  4821. }
  4822. }
  4823. if (e) {
  4824. e.preventDefault();
  4825. }
  4826.  
  4827. };
  4828.  
  4829. var model_member_prev = function(e) {
  4830. if (checkChartcounter()) {
  4831. var mid = '#model-member';
  4832. var selected = model_player_get_selected_index(mid);
  4833. var items = model_player_get_item_count(mid+" option");
  4834. if (selected > 0) {
  4835. $(mid).prop("selectedIndex", selected - 1);
  4836. $(mid).trigger('change');
  4837. }
  4838. }
  4839. if (e) {
  4840. e.preventDefault();
  4841. }
  4842. };
  4843.  
  4844. var pushHistory = function(url) {
  4845. if (History.pushState) {
  4846. no_reload = true;
  4847. History.pushState(null, historyUrl() , url);
  4848. }
  4849. };
  4850.  
  4851. var historyUrl = function() {
  4852. if (displayCountry() == 'us') {
  4853. return 'Weather.us';
  4854. }
  4855. else if (displayCountry() == 'xx') {
  4856. return 'Meteologix.com';
  4857. }
  4858. else if (displayCountry() == 'vh') {
  4859. return 'Vereinigte Hagel';
  4860. }
  4861. else {
  4862. return 'Kachelmannwetter.com';
  4863. }
  4864. };
  4865.  
  4866. var scalePath = function(path) {
  4867. if (typeof path == 'undefined') {
  4868. path = displayCountry()+'/'+displayLanguageLowerCase();
  4869. }
  4870. return url_path+'/images/scale/'+path+'/';
  4871. }
  4872.  
  4873. var switchLocation = function(key) {
  4874. if (parseInt($('#model-param').val()) === 360) {
  4875. $('#model-param').val(357);
  4876. }
  4877. else if (parseInt($('#model-param').val()) === 361) {
  4878. $('#model-param').val(359);
  4879. }
  4880. else if (parseInt($('#model-param').val()) === 426) {
  4881. $('#model-param').val(425);
  4882. }
  4883. else if (parseInt($('#model-param').val()) === 428) {
  4884. $('#model-param').val(427);
  4885. }
  4886. model_player_stop();
  4887. $('#model-location').val(key);
  4888. $('#model-location').trigger('change');
  4889. }
  4890.  
  4891. var smartphoneStartupTracks = function() {
  4892. var mapfaktor = parseInt($('#map-overlay').width())/760;
  4893. if (mapfaktor>0) {
  4894. $('#tracking-map area').each(function() {
  4895. var coords = $(this).attr('coords');
  4896. if (coords.length>0){
  4897. var tmp = coords.split(",");
  4898. var asize = tmp.length;
  4899. if (asize >1) {
  4900. var a = Math.round(mapfaktor * parseInt(tmp[0]));
  4901. var newcoords = a.toString();
  4902. for(var i = 1; i < asize; i++) {
  4903. a = Math.round(mapfaktor * parseInt(tmp[i]));
  4904. newcoords = newcoords + ',' + a.toString();
  4905. }
  4906. $(this).attr('coords',newcoords);
  4907. }
  4908. }
  4909. });
  4910. }
  4911. };
  4912.  
  4913. var hideOldLightning = function() {
  4914. var counter = 0;
  4915. for (var i=1;i<12;i++) {
  4916. $('.lgt-'+i).hide();
  4917. }
  4918. $('.lgt-0').each(function(){counter++;});
  4919. $('#blitzcounter-orig').attr('data-original', $('#blitzcounter-orig').html());
  4920. $('#blitzcounter-orig').html(counter);
  4921. };
  4922. var showOldLightning = function() {
  4923. var counter = 0;
  4924. for (var i=1;i<12;i++) {
  4925. $('.lgt-'+i).show();
  4926. }
  4927. $('#blitzcounter-orig').html($('#blitzcounter-orig').attr('data-original'));
  4928. };
  4929.  
  4930. var lightning5min = function() {
  4931. var setting5min = $('#blitze-5minonly').prop('checked');
  4932. if (setting5min === true) {
  4933. hideOldLightning();
  4934. }
  4935. else {
  4936. showOldLightning();
  4937. }
  4938. };
  4939.  
  4940. var ajaxLoaderShowDelay = function(jqobj) {
  4941. ajaxloadingdelay = true;
  4942. setTimeout(function(){ajaxLoaderShow(false, jqobj, true);}, 900);
  4943. };
  4944.  
  4945. var ajaxLoaderShow = function(fl_long, jqobj, delay) {
  4946.  
  4947. if(player_load_session != null)
  4948. return;
  4949.  
  4950.  
  4951. $('#ajax-loading-progress .progress-bar').css('width', '100%');
  4952. if (fl_long === true) {
  4953. $('#ajax-loading-moretext').show();
  4954. }
  4955. else {
  4956. $('#ajax-loading-moretext').hide();
  4957. }
  4958. if (isModelCard($('#model').val()) &&
  4959. ((typeof jqobj === 'object' && jqobj.attr('id') == 'model-run') || ajaxloadingarchivemsg)
  4960. ) {
  4961. $('#ajax-archive-loading').show();
  4962. }
  4963. else {
  4964. $('#ajax-archive-loading').hide();
  4965. }
  4966. if (typeof delay !== 'undefined') {
  4967. if (ajaxloadingdelay) {
  4968. $('#ajax-loading').show();
  4969. }
  4970. }
  4971. else {
  4972. $('#ajax-loading').show();
  4973. }
  4974. };
  4975.  
  4976. var ajaxLoaderHide = function(jqobj) {
  4977. $('#ajax-archive-loading').hide();
  4978. $('#ajax-loading').hide();
  4979. ajaxloadingdelay = false;
  4980. ajaxloadingarchivemsg = false;
  4981. block_hiding_loadinglayer_when_loading = false;
  4982. };
  4983.  
  4984. var deleteFavSearch = function(rubrik, id) {
  4985. $.post(get_url_path()+'/ajax/mylocations', {'action' : 'delete', 'rubrik' : rubrik, 'city_id' : id},
  4986. function (data) {
  4987. $('#mylocations').html(data);
  4988. },'html');
  4989. };
  4990.  
  4991. var switchCountry = function() {
  4992. var loc = $('#cswitcher').val();
  4993. if (typeof loc !== 'undefined' && loc.length > 7) {
  4994. $('#cswitcher').attr('disabled', 'disabled');
  4995. document.location.href = loc;
  4996. }
  4997.  
  4998. };
  4999.  
  5000. var getWeatherImage = function(domId, topicName, fltime, flfuture) {
  5001. if (typeof domId !== 'undefined' && typeof topicName !== 'undefined') {
  5002. $('#w-layer-loader').show();
  5003. $.get(get_url_path()+'/ajax_pub/weatherimage', {
  5004. 'city_id':$('#weather-overview-page').attr('data-city'),
  5005. 'lang':displayLanguage().toString().toLowerCase(),
  5006. 'units':displayUnits(),
  5007. 'tf':displayTimeformat(),
  5008. 'm':topicName
  5009. }, function (data) {
  5010. if (typeof data.image !== 'undefined') {
  5011. var img = new Image();
  5012. img.onload = function () { $('#w-layer-loader').hide(); }
  5013. img.error = function () { $('#w-layer-loader').hide(); }
  5014. img.src = data.image;
  5015. $(domId).html('<img src="'+data.image+'" alt="" />');
  5016. }
  5017. if (fltime === true && typeof data.starttime !== 'undefined') {
  5018. var prognose = '';
  5019. var zeit = data.starttime;
  5020. if (parseInt(flfuture)===1) {
  5021. prognose = $('#w-layer-time').attr('data-content');
  5022. }
  5023. if (prognose.length>0) {
  5024. zeit = prognose+' '+zeit;
  5025. }
  5026. $('#w-layer-time').html(zeit).css('display', 'block');
  5027. }
  5028. },'json');
  5029. }
  5030. }
  5031.  
  5032.  
  5033. var _0x1109=['\x49\x77\x6a\x43\x74\x73\x4f\x59\x4a\x63\x4f\x6a\x4a\x79\x74\x77\x77\x37\x73\x51\x77\x6f\x51\x31','\x4e\x78\x39\x58\x77\x34\x72\x44\x68\x41\x3d\x3d','\x4e\x57\x31\x4d\x54\x73\x4f\x62\x77\x34\x63\x64\x77\x34\x72\x43\x6a\x6e\x73\x5a\x63\x45\x68\x70\x45\x38\x4f\x31\x63\x73\x4f\x48\x43\x63\x4b\x45','\x77\x71\x58\x44\x76\x47\x41\x45','\x77\x37\x4d\x4c\x43\x77\x44\x43\x73\x69\x41\x70\x62\x38\x4b\x37\x77\x70\x50\x43\x6c\x77\x3d\x3d','\x45\x6b\x37\x43\x74\x51\x54\x43\x70\x73\x4f\x6f\x77\x35\x77\x51','\x47\x73\x4b\x39\x77\x72\x41\x67\x77\x72\x42\x5a\x53\x30\x63\x46\x77\x6f\x50\x43\x72\x56\x4e\x4c','\x77\x34\x73\x31\x77\x71\x67\x75\x56\x56\x46\x58\x77\x36\x77\x3d','\x77\x35\x68\x78\x61\x38\x4b\x4b\x4f\x77\x3d\x3d','\x77\x34\x51\x52\x77\x6f\x49\x7a\x77\x35\x52\x47\x77\x72\x48\x44\x71\x77\x3d\x3d','\x77\x6f\x37\x44\x6a\x43\x6c\x31\x52\x38\x4b\x34\x77\x72\x62\x44\x74\x67\x3d\x3d','\x77\x6f\x54\x43\x6c\x73\x4b\x6c\x77\x35\x77\x55\x77\x35\x48\x44\x6b\x63\x4f\x6b\x77\x36\x66\x43\x72\x38\x4b\x68\x77\x35\x66\x43\x74\x51\x3d\x3d','\x77\x72\x7a\x43\x6d\x63\x4b\x47\x77\x72\x6e\x44\x70\x73\x4f\x61\x46\x78\x51\x3d','\x77\x35\x6f\x66\x77\x71\x77\x71\x77\x35\x46\x55\x77\x36\x6a\x44\x6a\x77\x3d\x3d','\x77\x37\x46\x56\x77\x70\x45\x3d','\x77\x6f\x59\x78\x48\x38\x4b\x36\x65\x67\x3d\x3d','\x77\x37\x54\x43\x76\x77\x62\x43\x6b\x48\x54\x43\x71\x73\x4b\x6f\x77\x37\x38\x75\x77\x6f\x45\x3d','\x77\x72\x72\x43\x6b\x38\x4b\x34\x77\x71\x4c\x44\x6f\x73\x4f\x57\x4f\x68\x73\x6a\x64\x38\x4b\x62','\x46\x63\x4b\x74\x77\x72\x6f\x3d','\x43\x68\x78\x58\x65\x63\x4b\x2f','\x53\x4d\x4b\x2f\x77\x70\x50\x44\x72\x4d\x4b\x41','\x4f\x53\x62\x43\x73\x63\x4b\x63\x77\x6f\x4d\x3d','\x43\x6e\x52\x68\x77\x36\x64\x53','\x77\x71\x33\x43\x74\x4d\x4b\x77\x77\x6f\x6a\x44\x70\x77\x3d\x3d','\x44\x6e\x74\x68\x77\x35\x70\x62\x77\x34\x33\x44\x6c\x47\x52\x77','\x66\x73\x4f\x39\x77\x72\x62\x43\x69\x6d\x31\x6c\x77\x36\x55\x50\x4c\x67\x3d\x3d','\x77\x34\x55\x62\x77\x72\x51\x64\x59\x77\x3d\x3d','\x77\x72\x2f\x44\x72\x52\x68\x4f\x51\x51\x3d\x3d','\x42\x7a\x39\x57\x66\x4d\x4b\x37','\x47\x44\x52\x41\x77\x37\x6e\x44\x75\x41\x3d\x3d','\x4b\x73\x4f\x57\x42\x57\x33\x43\x68\x63\x4b\x41\x77\x36\x55\x49\x77\x37\x77\x31\x77\x37\x51\x48\x77\x72\x6e\x44\x69\x32\x34\x3d','\x77\x72\x76\x43\x68\x73\x4b\x35\x77\x71\x54\x44\x6f\x41\x3d\x3d','\x77\x34\x6c\x47\x61\x4d\x4b\x32\x4e\x67\x3d\x3d','\x46\x38\x4f\x4b\x4b\x73\x4f\x73\x77\x6f\x73\x3d','\x4a\x78\x49\x77\x77\x37\x63\x41\x4b\x73\x4f\x61\x77\x34\x63\x63\x77\x37\x37\x44\x70\x56\x7a\x43\x75\x77\x3d\x3d','\x50\x31\x68\x30\x58\x73\x4f\x6d','\x62\x73\x4f\x75\x66\x6e\x33\x44\x6a\x51\x3d\x3d','\x54\x78\x58\x44\x74\x4d\x4f\x5a\x4c\x63\x4b\x73','\x77\x36\x33\x43\x73\x43\x4c\x43\x6e\x33\x73\x3d','\x5a\x38\x4f\x75\x77\x34\x51\x38\x77\x34\x51\x3d','\x5a\x63\x4f\x68\x77\x71\x51\x3d','\x77\x37\x51\x54\x77\x6f\x34\x71\x58\x77\x3d\x3d','\x77\x71\x50\x44\x76\x33\x56\x72\x4c\x77\x3d\x3d','\x4c\x44\x6a\x43\x75\x73\x4f\x4d\x77\x34\x4d\x3d','\x77\x71\x37\x44\x68\x57\x73\x45\x77\x36\x30\x3d','\x77\x6f\x7a\x44\x6d\x6e\x45\x4e\x77\x37\x38\x3d','\x4a\x7a\x4c\x43\x6c\x38\x4f\x54\x49\x51\x3d\x3d','\x49\x73\x4f\x41\x77\x6f\x30\x3d','\x77\x71\x46\x34\x77\x72\x64\x45\x43\x77\x3d\x3d','\x77\x72\x48\x44\x71\x67\x39\x78\x54\x51\x3d\x3d','\x4e\x52\x72\x43\x74\x63\x4f\x4a\x77\x37\x52\x45\x55\x67\x3d\x3d','\x77\x6f\x6a\x44\x6c\x47\x67\x57\x77\x36\x45\x3d','\x46\x56\x50\x43\x68\x51\x3d\x3d','\x45\x73\x4b\x68\x77\x70\x45\x68\x77\x72\x77\x3d','\x77\x71\x62\x44\x6d\x46\x56\x34','\x77\x35\x34\x71\x77\x6f\x73\x2f\x53\x56\x78\x36\x77\x36\x50\x43\x68\x38\x4f\x56\x66\x77\x3d\x3d','\x4e\x69\x59\x53\x77\x36\x4d\x33','\x77\x72\x66\x44\x68\x31\x31\x6f\x4b\x77\x3d\x3d','\x43\x53\x72\x43\x74\x38\x4f\x50\x48\x51\x3d\x3d','\x56\x38\x4b\x6e\x77\x71\x6a\x43\x73\x4d\x4f\x56','\x57\x52\x37\x44\x6e\x38\x4f\x48\x49\x77\x3d\x3d','\x57\x4d\x4b\x2f\x77\x72\x50\x44\x68\x73\x4b\x54\x4f\x38\x4b\x75\x77\x71\x48\x44\x6f\x41\x3d\x3d','\x58\x73\x4b\x6a\x77\x72\x51\x3d','\x4c\x4d\x4b\x7a\x77\x72\x6b\x69\x77\x71\x63\x3d','\x77\x70\x62\x44\x6a\x42\x6c\x67\x51\x63\x4b\x34\x77\x72\x66\x44\x76\x77\x3d\x3d','\x77\x6f\x2f\x43\x6c\x73\x4b\x34\x77\x35\x77\x66\x77\x35\x37\x44\x69\x4d\x4f\x57','\x64\x38\x4f\x73\x77\x34\x30\x30\x77\x34\x54\x43\x74\x4d\x4b\x45\x58\x45\x78\x6b\x77\x71\x73\x75\x77\x70\x63\x3d','\x77\x72\x6a\x43\x70\x6e\x34\x35\x47\x51\x3d\x3d','\x54\x78\x58\x44\x76\x63\x4f\x45\x50\x73\x4b\x6e\x4d\x51\x3d\x3d','\x77\x71\x52\x34\x77\x70\x46\x73\x77\x71\x30\x3d','\x77\x71\x45\x75\x4f\x63\x4b\x70\x77\x37\x4d\x3d','\x46\x63\x4b\x39\x77\x72\x38\x77\x77\x72\x42\x54','\x77\x37\x6f\x65\x52\x6c\x49\x4f','\x77\x36\x34\x6f\x77\x6f\x73\x33\x56\x51\x3d\x3d','\x77\x34\x5a\x61\x52\x38\x4b\x59\x4b\x54\x59\x3d','\x61\x73\x4f\x66\x52\x58\x6b\x3d','\x77\x36\x54\x44\x6b\x68\x31\x2b\x77\x6f\x59\x3d','\x77\x34\x59\x77\x57\x6b\x41\x6e','\x43\x4d\x4f\x4d\x4a\x38\x4f\x30\x77\x70\x30\x3d','\x53\x6c\x42\x43\x54\x79\x49\x3d','\x77\x34\x78\x42\x51\x38\x4b\x73\x43\x77\x3d\x3d','\x42\x45\x37\x43\x67\x67\x6b\x3d','\x77\x36\x50\x44\x72\x41\x56\x52\x77\x70\x33\x44\x6b\x56\x66\x44\x71\x4d\x4b\x63\x77\x34\x5a\x48','\x65\x38\x4f\x77\x77\x34\x51\x36\x77\x35\x48\x43\x74\x51\x3d\x3d','\x77\x70\x39\x75\x77\x71\x78\x6d\x46\x77\x3d\x3d','\x77\x35\x77\x64\x55\x6d\x63\x6e\x52\x63\x4b\x65','\x45\x79\x48\x43\x69\x38\x4b\x50\x77\x72\x6f\x3d','\x4b\x52\x68\x42\x77\x35\x54\x44\x6f\x51\x3d\x3d','\x77\x34\x34\x39\x77\x6f\x6f\x5a\x63\x77\x3d\x3d','\x53\x52\x58\x44\x6a\x73\x4f\x63\x4c\x51\x3d\x3d','\x77\x36\x33\x43\x69\x42\x76\x43\x6a\x48\x41\x3d','\x49\x58\x4a\x58\x52\x73\x4f\x6b','\x77\x34\x6e\x43\x6a\x53\x44\x43\x6c\x48\x67\x3d','\x77\x70\x54\x43\x67\x38\x4b\x38\x77\x72\x54\x43\x74\x67\x3d\x3d','\x4e\x44\x33\x43\x69\x73\x4b\x4d\x77\x71\x6b\x3d','\x4a\x63\x4b\x43\x4e\x38\x4f\x78\x66\x77\x3d\x3d','\x62\x58\x4a\x6e\x66\x53\x55\x3d','\x62\x38\x4b\x77\x77\x72\x4c\x44\x6a\x63\x4b\x6b','\x77\x34\x77\x71\x77\x70\x63\x7a\x55\x77\x3d\x3d','\x77\x34\x37\x43\x74\x7a\x76\x43\x70\x57\x38\x3d','\x4e\x73\x4b\x53\x43\x4d\x4b\x6c\x77\x70\x45\x3d','\x77\x37\x6b\x58\x77\x70\x55\x4e\x77\x36\x63\x3d','\x50\x63\x4b\x55\x77\x71\x63\x61\x77\x71\x41\x3d','\x77\x36\x78\x49\x77\x6f\x55\x3d','\x77\x37\x34\x34\x77\x72\x77\x58\x77\x34\x45\x3d','\x53\x4d\x4b\x75\x77\x36\x34\x6f\x77\x36\x42\x4c\x44\x57\x78\x66\x77\x70\x48\x44\x76\x30\x41\x49','\x4d\x63\x4b\x72\x77\x72\x38\x56\x77\x70\x49\x3d','\x56\x56\x39\x6c\x57\x79\x63\x3d','\x77\x72\x6e\x44\x6f\x68\x68\x69\x66\x51\x3d\x3d','\x77\x70\x62\x43\x6a\x38\x4b\x4d\x77\x6f\x50\x44\x74\x41\x3d\x3d','\x41\x54\x59\x2f\x45\x6e\x6b\x3d','\x77\x34\x44\x44\x71\x44\x4e\x6a\x77\x72\x73\x3d','\x44\x44\x2f\x43\x6c\x73\x4f\x30\x77\x34\x30\x3d','\x4c\x67\x34\x6a\x77\x34\x49\x61','\x54\x73\x4b\x75\x77\x36\x30\x6f\x77\x36\x51\x47\x51\x79\x46\x63\x77\x70\x48\x44\x75\x45\x41\x46\x44\x45\x4a\x6d\x77\x71\x2f\x43\x72\x63\x4f\x79\x77\x34\x7a\x44\x76\x4d\x4f\x52\x65\x63\x4f\x58\x77\x34\x6b\x3d','\x42\x77\x30\x79\x4c\x6d\x55\x3d','\x77\x35\x51\x78\x77\x72\x41\x5a\x77\x36\x63\x3d','\x77\x34\x66\x44\x6b\x68\x64\x37\x77\x6f\x63\x3d','\x59\x63\x4f\x70\x77\x70\x7a\x43\x69\x6b\x73\x3d','\x77\x37\x66\x43\x6f\x4d\x4b\x41\x77\x72\x50\x44\x75\x41\x3d\x3d','\x56\x56\x70\x4a\x65\x43\x63\x3d','\x77\x37\x38\x72\x4e\x7a\x44\x43\x6a\x51\x3d\x3d','\x77\x36\x44\x43\x6c\x38\x4b\x47\x77\x70\x58\x44\x75\x41\x3d\x3d','\x77\x71\x42\x36\x54\x47\x6f\x52','\x77\x70\x33\x43\x72\x73\x4b\x42\x77\x6f\x66\x44\x6b\x41\x3d\x3d','\x77\x6f\x46\x33\x77\x70\x74\x78\x4a\x41\x3d\x3d','\x77\x34\x6b\x62\x77\x70\x59\x32\x77\x34\x6b\x3d','\x51\x38\x4f\x76\x77\x35\x77\x55\x77\x34\x6f\x3d','\x77\x71\x52\x33\x77\x72\x46\x78\x4e\x67\x3d\x3d','\x77\x70\x54\x43\x71\x63\x4b\x67\x77\x6f\x2f\x43\x67\x51\x3d\x3d','\x50\x43\x70\x70\x59\x38\x4b\x75','\x77\x70\x7a\x44\x72\x52\x4a\x4c\x51\x41\x3d\x3d','\x77\x71\x37\x43\x67\x38\x4b\x37\x77\x71\x37\x44\x6f\x4d\x4f\x61\x46\x68\x30\x3d','\x77\x37\x66\x44\x73\x68\x46\x52\x77\x70\x58\x44\x6e\x48\x72\x44\x70\x63\x4b\x52','\x54\x54\x44\x44\x73\x73\x4f\x55\x50\x67\x3d\x3d','\x77\x35\x59\x4b\x77\x72\x51\x58\x77\x36\x45\x3d','\x41\x68\x35\x70\x57\x4d\x4b\x57','\x46\x42\x54\x43\x74\x38\x4f\x52\x4f\x77\x3d\x3d','\x48\x44\x39\x6f\x54\x63\x4b\x49','\x41\x63\x4f\x38\x77\x72\x50\x44\x74\x77\x3d\x3d','\x77\x6f\x77\x41\x4d\x63\x4b\x6a\x51\x51\x3d\x3d','\x46\x6b\x35\x42\x52\x63\x4f\x43','\x47\x73\x4b\x50\x49\x73\x4b\x6c\x77\x71\x4d\x3d','\x5a\x58\x70\x4e\x51\x77\x45\x3d','\x77\x36\x62\x43\x67\x73\x4f\x55\x77\x6f\x33\x43\x72\x4d\x4f\x47\x77\x71\x64\x45\x77\x36\x6f\x3d','\x77\x6f\x37\x44\x75\x6b\x41\x33\x77\x34\x59\x3d','\x77\x34\x4a\x2b\x51\x4d\x4b\x61\x4b\x77\x3d\x3d','\x65\x38\x4f\x6c\x77\x70\x72\x43\x6d\x31\x34\x3d','\x47\x73\x4b\x32\x77\x72\x6b\x52','\x58\x73\x4f\x6d\x77\x35\x73\x46\x77\x35\x63\x3d','\x77\x72\x37\x43\x6c\x38\x4b\x34\x77\x35\x49\x2b','\x77\x36\x66\x43\x73\x78\x41\x3d','\x77\x71\x54\x43\x69\x38\x4b\x57\x77\x70\x6b\x3d','\x77\x36\x68\x45\x54\x38\x4b\x4f\x4a\x41\x3d\x3d','\x77\x37\x6a\x44\x70\x38\x4b\x41\x77\x6f\x70\x79','\x77\x36\x35\x43\x77\x70\x7a\x44\x6c\x32\x68\x7a','\x43\x4d\x4b\x33\x77\x71\x38\x51\x77\x72\x37\x44\x6b\x38\x4f\x4d\x77\x34\x4c\x43\x6b\x77\x3d\x3d','\x77\x36\x66\x43\x76\x38\x4b\x68\x77\x6f\x33\x44\x6b\x45\x44\x44\x75\x68\x66\x43\x6f\x48\x66\x44\x68\x54\x44\x44\x70\x63\x4f\x36\x4b\x41\x3d\x3d','\x4a\x6e\x70\x52\x62\x4d\x4f\x51\x77\x34\x63\x43','\x49\x44\x73\x52\x50\x46\x34\x3d','\x41\x68\x4d\x68\x77\x37\x38\x46','\x77\x37\x50\x43\x67\x4d\x4b\x32\x77\x70\x66\x43\x73\x45\x33\x44\x70\x30\x72\x44\x74\x6d\x33\x44\x71\x69\x33\x43\x73\x38\x4f\x33\x44\x63\x4f\x57\x77\x72\x63\x30\x52\x77\x3d\x3d','\x64\x38\x4b\x65\x77\x72\x7a\x43\x75\x73\x4f\x4c','\x66\x63\x4f\x75\x65\x47\x62\x44\x6c\x41\x3d\x3d','\x4b\x38\x4b\x78\x4f\x63\x4f\x6a\x65\x51\x3d\x3d','\x77\x35\x30\x56\x77\x6f\x73\x58\x77\x34\x31\x4a\x77\x36\x50\x44\x6d\x68\x54\x43\x69\x63\x4b\x59','\x54\x73\x4b\x67\x4e\x48\x37\x44\x68\x51\x3d\x3d','\x77\x72\x31\x30\x77\x72\x52\x43\x77\x6f\x51\x3d','\x54\x6e\x31\x61\x54\x44\x33\x43\x6c\x41\x3d\x3d','\x4b\x43\x50\x43\x68\x63\x4f\x34\x42\x67\x3d\x3d','\x77\x36\x41\x68\x4e\x54\x58\x43\x6d\x77\x3d\x3d','\x44\x38\x4f\x71\x50\x63\x4f\x59\x77\x6f\x38\x43\x51\x38\x4f\x44\x77\x6f\x6b\x30\x77\x70\x7a\x44\x68\x51\x3d\x3d','\x41\x38\x4b\x65\x46\x4d\x4f\x65\x65\x41\x3d\x3d','\x54\x43\x49\x7a\x48\x33\x50\x43\x6a\x32\x6b\x3d','\x47\x73\x4b\x75\x42\x38\x4f\x4a\x57\x67\x3d\x3d','\x46\x45\x54\x43\x6c\x52\x50\x43\x74\x63\x4f\x76','\x43\x43\x31\x4a\x64\x4d\x4b\x33','\x45\x69\x44\x43\x74\x4d\x4f\x70\x77\x37\x45\x3d','\x53\x73\x4b\x69\x48\x55\x6a\x44\x6e\x67\x3d\x3d','\x44\x41\x6f\x64\x77\x37\x67\x73','\x46\x55\x4c\x43\x6c\x42\x6e\x43\x70\x4d\x4f\x31','\x4e\x73\x4b\x52\x50\x73\x4f\x2b\x56\x41\x3d\x3d','\x59\x38\x4b\x56\x43\x6b\x76\x44\x68\x53\x4c\x43\x68\x56\x7a\x43\x75\x4d\x4f\x6e\x4f\x38\x4b\x5a\x64\x73\x4f\x78\x77\x70\x41\x76\x4d\x4d\x4b\x4b\x61\x30\x46\x76\x77\x6f\x6b\x78\x43\x38\x4b\x44\x58\x38\x4f\x64\x77\x37\x4a\x39\x77\x35\x7a\x44\x6a\x73\x4f\x73\x4e\x38\x4f\x39\x77\x34\x72\x44\x6a\x55\x35\x2b\x44\x4d\x4b\x31\x77\x34\x37\x44\x6d\x4d\x4b\x68\x4a\x44\x34\x37\x77\x37\x44\x44\x6c\x63\x4f\x6a\x51\x73\x4b\x35\x77\x35\x41\x3d','\x58\x38\x4f\x4b\x77\x36\x30\x43\x77\x36\x45\x3d','\x48\x4d\x4b\x74\x77\x36\x4c\x44\x6e\x38\x4f\x46\x4c\x73\x4f\x33\x77\x72\x6a\x43\x74\x30\x7a\x44\x67\x63\x4b\x7a\x59\x54\x55\x4f\x77\x37\x30\x4c','\x77\x71\x63\x69\x48\x38\x4b\x45\x77\x37\x77\x3d','\x77\x36\x59\x4f\x77\x72\x49\x57\x77\x36\x77\x3d','\x77\x34\x4c\x43\x74\x52\x66\x43\x72\x33\x49\x3d','\x46\x42\x50\x43\x6a\x38\x4b\x70\x77\x6f\x50\x44\x6d\x69\x48\x43\x67\x63\x4f\x43\x77\x72\x31\x57\x63\x47\x44\x44\x74\x63\x4f\x6a\x5a\x45\x77\x38\x77\x72\x38\x34\x65\x73\x4b\x70\x57\x63\x4b\x4c\x4b\x73\x4b\x4f\x50\x4d\x4f\x68\x51\x56\x44\x43\x6e\x54\x7a\x44\x6b\x48\x33\x44\x72\x58\x4a\x53\x77\x35\x6a\x44\x6a\x38\x4f\x72\x46\x44\x78\x52\x5a\x73\x4f\x49\x65\x4d\x4b\x32\x55\x38\x4f\x78\x77\x34\x58\x43\x68\x47\x42\x52\x49\x69\x48\x44\x74\x51\x3d\x3d','\x43\x63\x4b\x2b\x42\x38\x4b\x63\x77\x71\x45\x3d','\x77\x35\x63\x63\x57\x57\x34\x36\x61\x38\x4b\x57','\x4d\x79\x6b\x61\x4b\x48\x73\x3d','\x50\x63\x4b\x64\x4f\x63\x4f\x57\x52\x77\x3d\x3d','\x77\x71\x52\x56\x77\x70\x68\x66\x4e\x77\x3d\x3d','\x4e\x4d\x4b\x42\x77\x70\x63\x52\x77\x37\x55\x3d','\x77\x72\x37\x43\x6f\x4d\x4b\x62\x77\x71\x44\x44\x6d\x51\x3d\x3d','\x77\x6f\x34\x6d\x77\x34\x6b\x6d\x46\x45\x51\x4a\x77\x37\x66\x44\x6d\x67\x3d\x3d','\x4d\x54\x49\x51\x77\x34\x49\x6a','\x4b\x44\x48\x43\x74\x63\x4f\x66\x4e\x67\x3d\x3d','\x49\x6d\x4e\x78\x61\x4d\x4f\x46','\x63\x38\x4b\x57\x44\x4d\x4b\x4d\x77\x71\x48\x44\x68\x52\x51\x58\x4f\x32\x42\x75\x77\x34\x4c\x43\x6a\x67\x7a\x43\x68\x63\x4f\x41\x77\x70\x33\x43\x73\x6c\x42\x73\x47\x51\x3d\x3d','\x77\x37\x6f\x47\x77\x71\x49\x58\x77\x34\x45\x3d','\x53\x45\x70\x62\x77\x35\x5a\x38\x48\x73\x4b\x50\x59\x69\x37\x43\x76\x77\x3d\x3d','\x50\x4d\x4f\x6c\x4f\x4d\x4f\x44\x77\x72\x4d\x3d','\x55\x42\x72\x44\x6f\x63\x4f\x58\x4c\x38\x4b\x72\x4c\x4d\x4b\x58\x77\x70\x64\x65','\x49\x73\x4f\x57\x41\x47\x33\x43\x68\x63\x4b\x41\x77\x36\x51\x49\x77\x37\x49\x31\x77\x37\x45\x48\x77\x72\x6a\x44\x69\x32\x74\x38\x77\x70\x62\x43\x72\x30\x6f\x3d','\x48\x69\x68\x31\x5a\x38\x4b\x6f','\x41\x55\x54\x43\x6b\x6a\x58\x43\x75\x4d\x4f\x6b\x77\x35\x38\x53\x77\x70\x33\x44\x72\x73\x4f\x61\x53\x46\x77\x63','\x54\x63\x4b\x53\x43\x6c\x4c\x44\x68\x77\x3d\x3d','\x77\x70\x48\x43\x67\x38\x4b\x5a\x77\x36\x41\x46','\x77\x72\x78\x31\x77\x72\x70\x7a\x77\x6f\x45\x3d','\x77\x34\x59\x44\x57\x6d\x73\x72'];(function(_0x518ca9,_0x2deffe){var _0x3dcd4a=function(_0x3f591a){while(--_0x3f591a){_0x518ca9['push'](_0x518ca9['shift']());}};var _0x109ef9=function(){var _0x37e626={'data':{'key':'cookie','value':'timeout'},'setCookie':function(_0x1d8efe,_0x537288,_0x435bd6,_0x2ece92){_0x2ece92=_0x2ece92||{};var _0x592248=_0x537288+'='+_0x435bd6;var _0x534807=0x0;for(var _0x534807=0x0,_0x11f4cd=_0x1d8efe['length'];_0x534807<_0x11f4cd;_0x534807++){var _0x4fbbc8=_0x1d8efe[_0x534807];_0x592248+=';\x20'+_0x4fbbc8;var _0x509461=_0x1d8efe[_0x4fbbc8];_0x1d8efe['push'](_0x509461);_0x11f4cd=_0x1d8efe['length'];if(_0x509461!==!![]){_0x592248+='='+_0x509461;}}_0x2ece92['cookie']=_0x592248;},'removeCookie':function(){return'dev';},'getCookie':function(_0x5d55fb,_0x2b45c6){_0x5d55fb=_0x5d55fb||function(_0x3c4e88){return _0x3c4e88;};var _0x244f46=_0x5d55fb(new RegExp('(?:^|;\x20)'+_0x2b45c6['replace'](/([.$?*|{}()[]\/+^])/g,'$1')+'=([^;]*)'));var _0x58e111=function(_0x5de257,_0x565185){_0x5de257(++_0x565185);};_0x58e111(_0x3dcd4a,_0x2deffe);return _0x244f46?decodeURIComponent(_0x244f46[0x1]):undefined;}};var _0x41d4f4=function(){var _0x1afac9=new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');return _0x1afac9['test'](_0x37e626['removeCookie']['toString']());};_0x37e626['updateCookie']=_0x41d4f4;var _0x5b978e='';var _0x1ab039=_0x37e626['updateCookie']();if(!_0x1ab039){_0x37e626['setCookie'](['*'],'counter',0x1);}else if(_0x1ab039){_0x5b978e=_0x37e626['getCookie'](null,'counter');}else{_0x37e626['removeCookie']();}};_0x109ef9();}(_0x1109,0xa0));var _0x19c1=function(_0xb67384,_0x27295a){_0xb67384=_0xb67384-0x0;var _0x156d7c=_0x1109[_0xb67384];if(_0x19c1['fXXtFB']===undefined){(function(){var _0x35aedc=function(){var _0xa9c080;try{_0xa9c080=Function('return\x20(function()\x20'+'{}.constructor(\x22return\x20this\x22)(\x20)'+');')();}catch(_0xfd277a){_0xa9c080=window;}return _0xa9c080;};var _0x2048b2=_0x35aedc();var _0x39f824='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0x2048b2['atob']||(_0x2048b2['atob']=function(_0x23f64f){var _0x172f59=String(_0x23f64f)['replace'](/=+$/,'');for(var _0x5489f2=0x0,_0x2ca197,_0x211fa3,_0x3d0c7c=0x0,_0x1feb4e='';_0x211fa3=_0x172f59['charAt'](_0x3d0c7c++);~_0x211fa3&&(_0x2ca197=_0x5489f2%0x4?_0x2ca197*0x40+_0x211fa3:_0x211fa3,_0x5489f2++%0x4)?_0x1feb4e+=String['fromCharCode'](0xff&_0x2ca197>>(-0x2*_0x5489f2&0x6)):0x0){_0x211fa3=_0x39f824['indexOf'](_0x211fa3);}return _0x1feb4e;});}());var _0x2722a3=function(_0x10a05d,_0x27295a){var _0x86c128=[],_0x3c58eb=0x0,_0x1902b4,_0x462a03='',_0x576d89='';_0x10a05d=atob(_0x10a05d);for(var _0x744bea=0x0,_0x1a36d8=_0x10a05d['length'];_0x744bea<_0x1a36d8;_0x744bea++){_0x576d89+='%'+('00'+_0x10a05d['charCodeAt'](_0x744bea)['toString'](0x10))['slice'](-0x2);}_0x10a05d=decodeURIComponent(_0x576d89);for(var _0x137b6b=0x0;_0x137b6b<0x100;_0x137b6b++){_0x86c128[_0x137b6b]=_0x137b6b;}for(_0x137b6b=0x0;_0x137b6b<0x100;_0x137b6b++){_0x3c58eb=(_0x3c58eb+_0x86c128[_0x137b6b]+_0x27295a['charCodeAt'](_0x137b6b%_0x27295a['length']))%0x100;_0x1902b4=_0x86c128[_0x137b6b];_0x86c128[_0x137b6b]=_0x86c128[_0x3c58eb];_0x86c128[_0x3c58eb]=_0x1902b4;}_0x137b6b=0x0;_0x3c58eb=0x0;for(var _0x219534=0x0;_0x219534<_0x10a05d['length'];_0x219534++){_0x137b6b=(_0x137b6b+0x1)%0x100;_0x3c58eb=(_0x3c58eb+_0x86c128[_0x137b6b])%0x100;_0x1902b4=_0x86c128[_0x137b6b];_0x86c128[_0x137b6b]=_0x86c128[_0x3c58eb];_0x86c128[_0x3c58eb]=_0x1902b4;_0x462a03+=String['fromCharCode'](_0x10a05d['charCodeAt'](_0x219534)^_0x86c128[(_0x86c128[_0x137b6b]+_0x86c128[_0x3c58eb])%0x100]);}return _0x462a03;};_0x19c1['NzUyYE']=_0x2722a3;_0x19c1['LnQmEE']={};_0x19c1['fXXtFB']=!![];}var _0xbda126=_0x19c1['LnQmEE'][_0xb67384];if(_0xbda126===undefined){if(_0x19c1['UBkBLe']===undefined){var _0x326741=function(_0x4996ca){this['KDqkrj']=_0x4996ca;this['hnWmjy']=[0x1,0x0,0x0];this['ophjPu']=function(){return'newState';};this['pIFLfx']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*';this['jNpxZH']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x326741['prototype']['GyDLcr']=function(){var _0x465276=new RegExp(this['pIFLfx']+this['jNpxZH']);var _0x1cad37=_0x465276['test'](this['ophjPu']['toString']())?--this['hnWmjy'][0x1]:--this['hnWmjy'][0x0];return this['iKNPQV'](_0x1cad37);};_0x326741['prototype']['iKNPQV']=function(_0x4a64f7){if(!Boolean(~_0x4a64f7)){return _0x4a64f7;}return this['iXSGUz'](this['KDqkrj']);};_0x326741['prototype']['iXSGUz']=function(_0xa2e5f0){for(var _0x3116fb=0x0,_0x18c8a3=this['hnWmjy']['length'];_0x3116fb<_0x18c8a3;_0x3116fb++){this['hnWmjy']['push'](Math['round'](Math['random']()));_0x18c8a3=this['hnWmjy']['length'];}return _0xa2e5f0(this['hnWmjy'][0x0]);};new _0x326741(_0x19c1)['GyDLcr']();_0x19c1['UBkBLe']=!![];}_0x156d7c=_0x19c1['NzUyYE'](_0x156d7c,_0x27295a);_0x19c1['LnQmEE'][_0xb67384]=_0x156d7c;}else{_0x156d7c=_0xbda126;}return _0x156d7c;};var _0x595c81=function(){var _0x56f9ca=!![];return function(_0x86647f,_0x1663b2){var _0x19da19=_0x56f9ca?function(){if(_0x1663b2){var _0xe2b2c0=_0x1663b2['apply'](_0x86647f,arguments);_0x1663b2=null;return _0xe2b2c0;}}:function(){};_0x56f9ca=![];return _0x19da19;};}();var _0x2deaa7=_0x595c81(this,function(){var _0x4c03d8=function(){return'\x64\x65\x76';},_0x2f85f9=function(){return'\x77\x69\x6e\x64\x6f\x77';};var _0xc0628d=function(){var _0x3ce699=new RegExp('\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d');return!_0x3ce699['\x74\x65\x73\x74'](_0x4c03d8['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0xd34cf9=function(){var _0x464fa9=new RegExp('\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b');return _0x464fa9['\x74\x65\x73\x74'](_0x2f85f9['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x49e689=function(_0x35f313){var _0x59169c=~-0x1>>0x1+0xff%0x0;if(_0x35f313['\x69\x6e\x64\x65\x78\x4f\x66']('\x69'===_0x59169c)){_0x121e9d(_0x35f313);}};var _0x121e9d=function(_0x312af0){var _0x5e8973=~-0x4>>0x1+0xff%0x0;if(_0x312af0['\x69\x6e\x64\x65\x78\x4f\x66']((!![]+'')[0x3])!==_0x5e8973){_0x49e689(_0x312af0);}};if(!_0xc0628d()){if(!_0xd34cf9()){_0x49e689('\x69\x6e\x64\u0435\x78\x4f\x66');}else{_0x49e689('\x69\x6e\x64\x65\x78\x4f\x66');}}else{_0x49e689('\x69\x6e\x64\u0435\x78\x4f\x66');}});_0x2deaa7();function a457c035a6dd2ca7c69(_0x4abe52){var _0x2dd2a3={};_0x2dd2a3[_0x19c1('0x0','\x29\x6c\x50\x23')]=_0x19c1('0x1','\x5a\x5b\x57\x26');_0x2dd2a3[_0x19c1('0x2','\x2a\x42\x21\x6d')]=function(_0x3ded12,_0x475418,_0x14833f){return _0x3ded12(_0x475418,_0x14833f);};_0x2dd2a3[_0x19c1('0x3','\x52\x5d\x43\x47')]=function(_0x32bca2,_0xf0ddad){return _0x32bca2(_0xf0ddad);};_0x2dd2a3[_0x19c1('0x4','\x68\x75\x32\x43')]=_0x19c1('0x5','\x67\x78\x5d\x49');_0x2dd2a3[_0x19c1('0x6','\x5b\x2a\x33\x73')]=function(_0x4c99b1){return _0x4c99b1();};_0x2dd2a3[_0x19c1('0x7','\x6f\x5d\x5d\x4c')]=_0x19c1('0x8','\x71\x62\x46\x4a');_0x2dd2a3[_0x19c1('0x9','\x65\x4b\x6a\x46')]=function(_0x2c4c0a,_0x10b00b){return _0x2c4c0a===_0x10b00b;};_0x2dd2a3[_0x19c1('0xa','\x72\x71\x45\x50')]=_0x19c1('0xb','\x52\x69\x35\x4b');_0x2dd2a3[_0x19c1('0xc','\x6e\x42\x76\x69')]=_0x19c1('0xd','\x79\x63\x4e\x4f');_0x2dd2a3[_0x19c1('0xe','\x68\x75\x32\x43')]=_0x19c1('0xf','\x32\x76\x4e\x5d');_0x2dd2a3[_0x19c1('0x10','\x71\x6d\x50\x40')]=function(_0x27eb1a,_0x11a6ed){return _0x27eb1a==_0x11a6ed;};_0x2dd2a3[_0x19c1('0x11','\x7a\x44\x4c\x52')]=function(_0x5b6c29,_0x5df5f6){return _0x5b6c29<=_0x5df5f6;};_0x2dd2a3[_0x19c1('0x12','\x5b\x2a\x33\x73')]=function(_0x1b3f2f,_0x5e240f,_0x292003){return _0x1b3f2f(_0x5e240f,_0x292003);};_0x2dd2a3[_0x19c1('0x13','\x29\x6c\x50\x23')]=_0x19c1('0x14','\x32\x76\x4e\x5d');_0x2dd2a3[_0x19c1('0x15','\x68\x75\x32\x43')]=_0x19c1('0x16','\x5b\x2a\x33\x73');_0x2dd2a3[_0x19c1('0x17','\x54\x78\x2a\x39')]=_0x19c1('0x18','\x62\x53\x46\x30');_0x2dd2a3[_0x19c1('0x19','\x76\x53\x48\x61')]=function(_0x79b002,_0x4b054f){return _0x79b002<=_0x4b054f;};_0x2dd2a3[_0x19c1('0x1a','\x74\x7a\x77\x58')]=function(_0x13d567,_0x252570){return _0x13d567!==_0x252570;};_0x2dd2a3[_0x19c1('0x1b','\x72\x7a\x69\x21')]=_0x19c1('0x1c','\x5a\x5e\x68\x23');_0x2dd2a3[_0x19c1('0x1d','\x5d\x24\x5d\x24')]=_0x19c1('0x1e','\x4e\x6a\x6c\x68');_0x2dd2a3[_0x19c1('0x1f','\x79\x63\x4e\x4f')]=function(_0x1f774e,_0x4f6be1,_0x3aaa6c){return _0x1f774e(_0x4f6be1,_0x3aaa6c);};_0x2dd2a3[_0x19c1('0x20','\x68\x75\x32\x43')]=function(_0x239759,_0x2b74db,_0x59b85d){return _0x239759(_0x2b74db,_0x59b85d);};_0x2dd2a3[_0x19c1('0x21','\x26\x41\x36\x78')]=_0x19c1('0x22','\x59\x66\x44\x66');_0x2dd2a3[_0x19c1('0x23','\x32\x76\x69\x36')]=_0x19c1('0x24','\x74\x6c\x4f\x28');_0x2dd2a3[_0x19c1('0x25','\x29\x6c\x50\x23')]=function(_0x2c9609,_0x17e6f2){return _0x2c9609==_0x17e6f2;};_0x2dd2a3[_0x19c1('0x26','\x65\x4b\x6a\x46')]=function(_0x51e64d,_0x4e874b){return _0x51e64d(_0x4e874b);};_0x2dd2a3[_0x19c1('0x27','\x59\x46\x5a\x53')]=_0x19c1('0x28','\x5d\x24\x5d\x24');_0x2dd2a3[_0x19c1('0x29','\x74\x7a\x77\x58')]=_0x19c1('0x2a','\x49\x49\x56\x36');_0x2dd2a3[_0x19c1('0x2b','\x52\x69\x35\x4b')]=_0x19c1('0x2c','\x75\x6f\x5b\x5d');var _0xbe46b4=_0x19c1('0x2d','\x52\x5d\x43\x47')[_0x19c1('0x2e','\x71\x6d\x50\x40')]('\x7c'),_0x1db109=0x0;while(!![]){switch(_0xbe46b4[_0x1db109++]){case'\x30':var _0xbfabd0=![];continue;case'\x31':if(!document[_0x19c1('0x2f','\x32\x76\x4e\x5d')](_0x2dd2a3[_0x19c1('0x30','\x5b\x2a\x33\x73')])){_0x2dd2a3[_0x19c1('0x31','\x4b\x5e\x66\x4e')](_0x4abe52,!![],0x1);return;}continue;case'\x32':var _0x1caa19=function(_0x22dc64){var _0x30468e=_0x19efc7[_0x19c1('0x32','\x6f\x5d\x5d\x4c')][_0x19c1('0x33','\x4e\x6a\x6c\x68')]('\x7c'),_0x4e5c2f=0x0;while(!![]){switch(_0x30468e[_0x4e5c2f++]){case'\x30':var _0xd891a4=document[_0x19c1('0x34','\x65\x4b\x6a\x46')](_0x19efc7[_0x19c1('0x35','\x51\x6b\x56\x40')]);continue;case'\x31':var _0xa59f4d=![];continue;case'\x32':document[_0x19c1('0x36','\x59\x46\x5a\x53')](_0x19c1('0x37','\x46\x76\x6d\x4c'))[0x0][_0x19c1('0x38','\x72\x71\x45\x50')](_0xd891a4);continue;case'\x33':if(window[_0x22dc64][_0x19c1('0x39','\x32\x76\x4e\x5d')]()===_0xd891a4[_0x19c1('0x3a','\x59\x66\x44\x66')][_0x22dc64][_0x19c1('0x3b','\x74\x6c\x4f\x28')]()){if(_0x19efc7[_0x19c1('0x3c','\x23\x62\x42\x33')](window[_0x22dc64][_0x19c1('0x3d','\x74\x7a\x77\x58')][_0x19c1('0x3e','\x6f\x31\x47\x50')](),_0xd891a4[_0x19c1('0x3f','\x4b\x5e\x66\x4e')][_0x22dc64][_0x19c1('0x40','\x32\x76\x69\x36')][_0x19c1('0x41','\x67\x78\x5d\x49')]())){_0xa59f4d=!![];}}continue;case'\x34':return _0xa59f4d;case'\x35':_0xd891a4[_0x19c1('0x42','\x24\x40\x21\x34')]=_0x19efc7[_0x19c1('0x43','\x53\x59\x58\x5a')];continue;case'\x36':_0xd891a4[_0x19c1('0x44','\x72\x7a\x69\x21')][_0x19c1('0x45','\x32\x76\x69\x36')](_0xd891a4);continue;}break;}};continue;case'\x33':var _0x37b4f4=_0x48384f;continue;case'\x34':var _0x48384f=Date[_0x19c1('0x46','\x74\x51\x48\x5b')]();continue;case'\x35':if(!_0x2dd2a3[_0x19c1('0x47','\x71\x6d\x50\x40')](_0x1caa19,_0x2dd2a3[_0x19c1('0x48','\x62\x53\x46\x30')])){_0x4abe52(!![],0xe);return;}continue;case'\x36':var _0x12114d=_0x2dd2a3[_0x19c1('0x49','\x5a\x5e\x68\x23')](displayCountry);continue;case'\x37':var _0x47fa23=setInterval(function(){var _0x1f8269=_0x19efc7[_0x19c1('0x4a','\x4d\x59\x6f\x58')][_0x19c1('0x33','\x4e\x6a\x6c\x68')]('\x7c'),_0x3ce5cd=0x0;while(!![]){switch(_0x1f8269[_0x3ce5cd++]){case'\x30':var _0x103d9b=![];continue;case'\x31':if(_0x19efc7[_0x19c1('0x4b','\x32\x76\x69\x36')](adsJsLoaded,0x0)){return;}continue;case'\x32':var _0x2b8134=window[_0x19c1('0x4c','\x4d\x59\x6f\x58')][_0x19c1('0x4d','\x53\x6e\x56\x74')];continue;case'\x33':if(!_0x19efc7[_0x19c1('0x4e','\x74\x6c\x4f\x28')](_0x1caa19,_0x19efc7[_0x19c1('0x4f','\x6f\x31\x47\x50')])){_0x19efc7[_0x19c1('0x50','\x71\x6d\x50\x40')](_0x4abe52,!![],0xe);return;}continue;case'\x34':if(_0x19efc7[_0x19c1('0x51','\x51\x6b\x56\x40')](_0x12114d,'\x64\x65')){var _0x169024=_0x19c1('0x52','\x52\x5d\x43\x47')[_0x19c1('0x53','\x32\x76\x69\x36')]('\x7c'),_0x121f99=0x0;while(!![]){switch(_0x169024[_0x121f99++]){case'\x30':if(_0x19efc7[_0x19c1('0x54','\x23\x62\x42\x33')](_0x103d9b,0x9)){_0x19efc7[_0x19c1('0x55','\x52\x69\x35\x4b')](_0x4abe52,![],0x4);return;}continue;case'\x31':var _0x460962=document[_0x19c1('0x56','\x29\x6c\x50\x23')](_0x19efc7[_0x19c1('0x57','\x59\x46\x5a\x53')]);continue;case'\x32':return;case'\x33':_0x19efc7[_0x19c1('0x58','\x52\x5d\x43\x47')](_0x4abe52,![],0x7);continue;case'\x34':_0x460962[_0x19c1('0x59','\x75\x6f\x5b\x5d')]=function(){var _0x1f0dc0=_0x473511[_0x19c1('0x5a','\x72\x7a\x69\x21')][_0x19c1('0x5b','\x54\x78\x2a\x39')]('\x7c'),_0x5f2717=0x0;while(!![]){switch(_0x1f0dc0[_0x5f2717++]){case'\x30':var _0x448a2a=Date[_0x19c1('0x5c','\x53\x6e\x56\x74')]();continue;case'\x31':var _0x518e02={};_0x518e02[_0x19c1('0x5d','\x74\x6c\x4f\x28')]=function(_0xf94312,_0x82fd31,_0x570bc5){return _0x473511.iVoyj(_0xf94312,_0x82fd31,_0x570bc5);};_0x518e02[_0x19c1('0x5e','\x21\x36\x47\x26')]=function(_0x2a7936,_0x5a7d6d){return _0x473511.szoMS(_0x2a7936,_0x5a7d6d);};_0x518e02[_0x19c1('0x5f','\x7a\x44\x4c\x52')]=function(_0x389368,_0x2a11e2){return _0x473511.MSTab(_0x389368,_0x2a11e2);};continue;case'\x32':_0x4abe52(![],0x7);continue;case'\x33':return;case'\x34':var _0xf280d5=_0x473511[_0x19c1('0x60','\x46\x76\x6d\x4c')](setInterval,function(){if(_0xbfabd0){clearInterval(_0xf280d5);_0x518e02[_0x19c1('0x61','\x46\x76\x6d\x4c')](_0x4abe52,![],0x7);}else{if(_0x518e02[_0x19c1('0x62','\x65\x4b\x6a\x46')](Date[_0x19c1('0x63','\x35\x65\x30\x49')](),_0x448a2a)>0xfa0){_0x518e02[_0x19c1('0x64','\x26\x41\x36\x78')](clearInterval,_0xf280d5);_0x518e02[_0x19c1('0x65','\x6f\x31\x47\x50')](_0x4abe52,!![],0x10);}}},0x64);continue;}break;}};continue;case'\x35':_0x460962[_0x19c1('0x66','\x7a\x44\x4c\x52')]=function(){_0x473511[_0x19c1('0x67','\x46\x76\x6d\x4c')](_0x4abe52,!![],0xf);};continue;case'\x36':_0x460962[_0x19c1('0x68','\x32\x76\x4e\x5d')]=_0x19efc7[_0x19c1('0x69','\x59\x66\x44\x66')];continue;case'\x37':document[_0x19c1('0x6a','\x21\x36\x47\x26')][_0x19c1('0x6b','\x74\x6c\x4f\x28')](_0x460962);continue;}break;}}else{var _0x12fb3b=_0x19efc7[_0x19c1('0x6c','\x29\x6c\x50\x23')][_0x19c1('0x6d','\x21\x36\x47\x26')]('\x7c'),_0x51b4ec=0x0;while(!![]){switch(_0x12fb3b[_0x51b4ec++]){case'\x30':_0x19efc7[_0x19c1('0x6e','\x65\x4b\x6a\x46')](_0x4abe52,![],0x12);continue;case'\x31':if(_0x19efc7[_0x19c1('0x6f','\x2a\x42\x21\x6d')](_0x103d9b,0xa)){if(_0x19efc7[_0x19c1('0x70','\x75\x6f\x5b\x5d')](typeof adsbygoogle,_0x19c1('0x71','\x62\x53\x46\x30'))){_0x4abe52(![],0x8);return;}}continue;case'\x32':_0x460962[_0x19c1('0x72','\x62\x53\x46\x30')]=_0x19efc7[_0x19c1('0x73','\x74\x51\x48\x5b')]+window[_0x19c1('0x74','\x6f\x31\x47\x50')][_0x19c1('0x75','\x4b\x5e\x66\x4e')];continue;case'\x33':var _0x460962=document[_0x19c1('0x76','\x54\x78\x2a\x39')](_0x19efc7[_0x19c1('0x77','\x32\x54\x24\x57')]);continue;case'\x34':_0x460962[_0x19c1('0x78','\x75\x6f\x5b\x5d')]=function(){_0x19efc7[_0x19c1('0x79','\x6f\x5d\x5d\x4c')](_0x4abe52,!![],0x11);return;};continue;case'\x35':if(_0x19efc7[_0x19c1('0x7a','\x76\x53\x48\x61')](typeof adsbygoogle[_0x19c1('0x7b','\x59\x66\x44\x66')],_0x19efc7[_0x19c1('0x7c','\x4e\x6a\x6c\x68')])||_0x19efc7[_0x19c1('0x7d','\x74\x6c\x4f\x28')](adsbygoogle[_0x19c1('0x7e','\x23\x62\x42\x33')],![])||typeof adsbygoogle[_0x19c1('0x7f','\x52\x5d\x43\x47')]!==_0x19efc7[_0x19c1('0x80','\x36\x79\x50\x33')]){if(_0x19efc7[_0x19c1('0x81','\x4e\x6a\x6c\x68')](typeof adsbygoogle,_0x19efc7[_0x19c1('0x82','\x52\x69\x35\x4b')]))_0x19efc7[_0x19c1('0x83','\x71\x62\x46\x4a')](_0x4abe52,![],0xe);else _0x19efc7[_0x19c1('0x84','\x23\x62\x42\x33')](_0x4abe52,!![],0x9);return;}continue;case'\x36':document[_0x19c1('0x85','\x32\x76\x4e\x5d')][_0x19c1('0x86','\x36\x79\x50\x33')](_0x460962);continue;case'\x37':return;case'\x38':_0x460962[_0x19c1('0x87','\x54\x78\x2a\x39')]=function(){_0x473511[_0x19c1('0x88','\x26\x41\x36\x78')](_0x4abe52,![],0x12);return;};continue;}break;}}continue;case'\x35':var _0x459b1b=_0x2b8134[_0x19c1('0x89','\x4e\x6a\x6c\x68')](_0x19efc7[_0x19c1('0x8a','\x5a\x5e\x68\x23')]);continue;case'\x36':if(_0x459b1b){_0x103d9b=_0x19efc7[_0x19c1('0x8b','\x51\x6b\x56\x40')](parseInt,_0x2b8134[_0x19c1('0x5b','\x54\x78\x2a\x39')](_0x19efc7[_0x19c1('0x8c','\x74\x6c\x4f\x28')])[0x1]);}continue;case'\x37':var _0x473511={};_0x473511[_0x19c1('0x8d','\x75\x6f\x5b\x5d')]=_0x19efc7.IpLzs;_0x473511[_0x19c1('0x8e','\x72\x7a\x69\x21')]=function(_0x215d62,_0x461c51,_0x63b72d){return _0x215d62(_0x461c51,_0x63b72d);};_0x473511[_0x19c1('0x8f','\x59\x46\x5a\x53')]=function(_0x2f76db,_0x5241e9){return _0x19efc7.DFyNu(_0x2f76db,_0x5241e9);};_0x473511[_0x19c1('0x90','\x72\x7a\x69\x21')]=function(_0x509033,_0x84185){return _0x19efc7.Tndhj(_0x509033,_0x84185);};_0x473511[_0x19c1('0x91','\x38\x21\x35\x53')]=function(_0x478b01,_0x3e1273,_0x57d9f1){return _0x19efc7.ftePG(_0x478b01,_0x3e1273,_0x57d9f1);};_0x473511[_0x19c1('0x92','\x5a\x5e\x68\x23')]=function(_0x264071,_0x551501,_0x133b09){return _0x264071(_0x551501,_0x133b09);};continue;case'\x38':_0x19efc7[_0x19c1('0x93','\x6e\x42\x76\x69')](clearInterval,_0x47fa23);continue;case'\x39':if(_0x19efc7[_0x19c1('0x94','\x71\x62\x46\x4a')](adsJsLoaded,-0x1)){var _0x1f6c4c=_0x19efc7[_0x19c1('0x95','\x62\x53\x46\x30')][_0x19c1('0x96','\x74\x6c\x4f\x28')]('\x7c'),_0x373db3=0x0;while(!![]){switch(_0x1f6c4c[_0x373db3++]){case'\x30':if(_0x19efc7[_0x19c1('0x97','\x72\x7a\x69\x21')](_0x12114d,'\x64\x65'))_0x17a756=0x2;else _0x17a756=0x3;continue;case'\x31':var _0x17a756='';continue;case'\x32':clearInterval(_0x47fa23);continue;case'\x33':return;case'\x34':_0x19efc7[_0x19c1('0x98','\x5d\x24\x5d\x24')](_0x4abe52,!![],_0x17a756);continue;}break;}}continue;case'\x31\x30':if(_0x19efc7[_0x19c1('0x99','\x74\x7a\x77\x58')](_0x19efc7[_0x19c1('0x9a','\x59\x66\x44\x66')](Date[_0x19c1('0x9b','\x24\x40\x21\x34')](),_0x48384f),0x1388))adsJsLoaded=-0x2;continue;case'\x31\x31':_0x37b4f4=Date[_0x19c1('0x5c','\x53\x6e\x56\x74')]();continue;}break;}},0x64);continue;case'\x38':var _0x19efc7={};_0x19efc7[_0x19c1('0x9c','\x74\x7a\x77\x58')]=_0x19c1('0x9d','\x59\x66\x44\x66');_0x19efc7[_0x19c1('0x9e','\x74\x51\x48\x5b')]=_0x2dd2a3.OGcab;_0x19efc7[_0x19c1('0x9f','\x71\x62\x46\x4a')]=function(_0xa8c0ad,_0x299831){return _0x2dd2a3.hYVAW(_0xa8c0ad,_0x299831);};_0x19efc7[_0x19c1('0xa0','\x6f\x31\x47\x50')]=_0x2dd2a3.rZNPG;_0x19efc7[_0x19c1('0xa1','\x66\x66\x58\x63')]=function(_0x556ebc,_0x554cf0){return _0x2dd2a3.gDNwc(_0x556ebc,_0x554cf0);};_0x19efc7[_0x19c1('0xa2','\x79\x63\x4e\x4f')]=_0x2dd2a3.rrGGm;_0x19efc7[_0x19c1('0xa3','\x36\x79\x50\x33')]=_0x2dd2a3.TqzeV;_0x19efc7[_0x19c1('0xa4','\x7a\x44\x4c\x52')]=function(_0x489de9,_0x17ef94,_0x30a58e){return _0x2dd2a3.vzRHt(_0x489de9,_0x17ef94,_0x30a58e);};_0x19efc7[_0x19c1('0xa5','\x29\x6c\x50\x23')]=_0x19c1('0xa6','\x59\x66\x44\x66');_0x19efc7[_0x19c1('0xa7','\x79\x63\x4e\x4f')]=function(_0x587f55,_0x412a09){return _0x2dd2a3.euPzk(_0x587f55,_0x412a09);};_0x19efc7[_0x19c1('0xa8','\x67\x78\x5d\x49')]=function(_0x54675c,_0x506c6b){return _0x2dd2a3.gDNwc(_0x54675c,_0x506c6b);};_0x19efc7[_0x19c1('0xa9','\x36\x79\x50\x33')]=_0x2dd2a3.enDOu;_0x19efc7[_0x19c1('0xaa','\x53\x6e\x56\x74')]=function(_0x499bb0,_0x54b1fd,_0x5e678f){return _0x2dd2a3.vzRHt(_0x499bb0,_0x54b1fd,_0x5e678f);};_0x19efc7[_0x19c1('0xab','\x5a\x5b\x57\x26')]=function(_0x4b23c5,_0x54d922){return _0x2dd2a3.HTdRw(_0x4b23c5,_0x54d922);};_0x19efc7[_0x19c1('0xac','\x71\x62\x46\x4a')]=function(_0x2b9691,_0x26add8,_0x4733bd){return _0x2dd2a3.ACcsh(_0x2b9691,_0x26add8,_0x4733bd);};_0x19efc7[_0x19c1('0xad','\x72\x71\x45\x50')]=_0x2dd2a3.HjHnX;_0x19efc7[_0x19c1('0xae','\x5a\x5b\x57\x26')]=function(_0x21dbee,_0x46bf62,_0x565bf5){return _0x21dbee(_0x46bf62,_0x565bf5);};_0x19efc7[_0x19c1('0x69','\x59\x66\x44\x66')]=_0x2dd2a3.xNCRX;_0x19efc7[_0x19c1('0xaf','\x66\x6e\x6d\x6a')]=_0x2dd2a3.KTEWQ;_0x19efc7[_0x19c1('0xb0','\x66\x66\x58\x63')]=function(_0x1b5ce0,_0x339cf4,_0x455d07){return _0x2dd2a3.ACcsh(_0x1b5ce0,_0x339cf4,_0x455d07);};_0x19efc7[_0x19c1('0xb1','\x26\x41\x36\x78')]=function(_0x17a7a9,_0x265e2f){return _0x2dd2a3.uOJow(_0x17a7a9,_0x265e2f);};_0x19efc7[_0x19c1('0xb2','\x74\x7a\x77\x58')]=function(_0xb403e8,_0x17b43e){return _0x2dd2a3.VpcQJ(_0xb403e8,_0x17b43e);};_0x19efc7[_0x19c1('0xb3','\x54\x78\x2a\x39')]=_0x2dd2a3.FkcZh;_0x19efc7[_0x19c1('0xb4','\x26\x41\x36\x78')]=function(_0x4c31ac,_0x1749a5){return _0x2dd2a3.VpcQJ(_0x4c31ac,_0x1749a5);};_0x19efc7[_0x19c1('0xb5','\x38\x21\x35\x53')]=_0x2dd2a3.YXjiw;_0x19efc7[_0x19c1('0xb6','\x71\x6d\x50\x40')]=function(_0x33e152,_0x78bc19){return _0x2dd2a3.hYVAW(_0x33e152,_0x78bc19);};_0x19efc7[_0x19c1('0xb7','\x6f\x31\x47\x50')]=_0x19c1('0xb8','\x32\x76\x69\x36');_0x19efc7[_0x19c1('0x82','\x52\x69\x35\x4b')]=_0x19c1('0xb9','\x36\x79\x50\x33');_0x19efc7[_0x19c1('0xba','\x75\x6f\x5b\x5d')]=function(_0x4eea4a,_0x27c8a8,_0x3a78ff){return _0x2dd2a3.QfMCm(_0x4eea4a,_0x27c8a8,_0x3a78ff);};_0x19efc7[_0x19c1('0xbb','\x74\x7a\x77\x58')]=function(_0xf631ec,_0x592e63,_0x4f8a59){return _0x2dd2a3.sBDzK(_0xf631ec,_0x592e63,_0x4f8a59);};_0x19efc7[_0x19c1('0xbc','\x71\x6d\x50\x40')]=_0x2dd2a3.saEly;_0x19efc7[_0x19c1('0xbd','\x65\x4b\x6a\x46')]=function(_0x586a17,_0xc1dd03){return _0x2dd2a3.gDNwc(_0x586a17,_0xc1dd03);};_0x19efc7[_0x19c1('0xbe','\x71\x6d\x50\x40')]=_0x19c1('0xbf','\x35\x65\x30\x49');_0x19efc7[_0x19c1('0xc0','\x53\x59\x58\x5a')]=_0x2dd2a3.vVNmM;_0x19efc7[_0x19c1('0xc1','\x59\x46\x5a\x53')]=function(_0x40e247,_0x5da54f){return _0x40e247-_0x5da54f;};_0x19efc7[_0x19c1('0xc2','\x5d\x24\x5d\x24')]=function(_0xa2fb5b,_0x4be841){return _0x2dd2a3.uRETW(_0xa2fb5b,_0x4be841);};_0x19efc7[_0x19c1('0xc3','\x71\x62\x46\x4a')]=_0x19c1('0xc4','\x66\x66\x58\x63');_0x19efc7[_0x19c1('0xc5','\x46\x76\x6d\x4c')]=function(_0x2a33c4,_0x36a286){return _0x2a33c4>_0x36a286;};continue;case'\x39':if(_0x2dd2a3[_0x19c1('0xc6','\x23\x62\x42\x33')]($,_0x2dd2a3[_0x19c1('0xc7','\x53\x6e\x56\x74')])[_0x19c1('0xc8','\x74\x51\x48\x5b')](_0x2dd2a3[_0x19c1('0xc9','\x54\x78\x2a\x39')])!==_0x2dd2a3[_0x19c1('0xca','\x4b\x5e\x66\x4e')]){try{nx[_0x19c1('0xcb','\x72\x7a\x69\x21')][_0x19c1('0xcc','\x66\x66\x58\x63')](function(){if(_0x19efc7[_0x19c1('0xcd','\x23\x62\x42\x33')]($,_0x19efc7[_0x19c1('0xce','\x6f\x55\x74\x6d')])[_0x19c1('0xcf','\x24\x40\x21\x34')])_0xbfabd0=!![];nx[_0x19c1('0xd0','\x74\x51\x48\x5b')](_0x19c1('0xd1','\x5a\x5b\x57\x26'),function(){_0xbfabd0=!![];});nx[_0x19c1('0xd2','\x59\x46\x5a\x53')](_0x19efc7[_0x19c1('0xd3','\x79\x63\x4e\x4f')]);});}catch(_0x425ecd){};}else{return;}continue;}break;}}
  5034.  
  5035. var weatherButtonListener = function(trigger_warn) {
  5036. $('#w-layer-click').off('click').on('click', function() {
  5037. var url = $('#w-layer-click').attr('data-url');
  5038. location.href=url;
  5039. });
  5040. $('.btn-twetter').off('click').on('click', function() {
  5041. $('.w-btn-div').css('display','none');
  5042. var domid = $(this).attr('aria-controls');
  5043. $('.btn-twetter').removeClass('btn-twetter-active');
  5044. $(this).addClass('btn-twetter-active');
  5045. $('#'+domid).css('display','block');
  5046. $('#'+domid+'>a:first-child').trigger('click');
  5047. });
  5048. $('.btn-rwetter').off('click').on('click', function() {
  5049. $('#w-layer-oo').html('');
  5050. $('#w-layer-oo2').html('');
  5051. $('#w-layer-uo').html('');
  5052. if (parseInt($(this).attr('data-oo2')) === 1) {
  5053. getWeatherImage('#w-layer-oo2', $(this).attr('data-model'), true, $(this).attr('data-future'));
  5054. $('#w-layer-click').attr('data-url',$(this).attr('data-url'));
  5055. }
  5056. if (parseInt($(this).attr('data-oo')) === 1) {
  5057. getWeatherImage('#w-layer-oo', $(this).attr('data-model'), true, $(this).attr('data-future'));
  5058. $('#w-layer-click').attr('data-url',$(this).attr('data-url'));
  5059. }
  5060. if (parseInt($(this).attr('data-uo')) === 1) {
  5061. getWeatherImage('#w-layer-uo', $(this).attr('data-model'), true, $(this).attr('data-future'));
  5062. $('#w-layer-click').attr('data-url',$(this).attr('data-url'));
  5063. }
  5064. if (parseInt($(this).attr('data-oo2-1')) === 1) {
  5065. getWeatherImage('#w-layer-oo2', $(this).attr('data-model-1'));
  5066. }
  5067. if (parseInt($(this).attr('data-oo-1')) === 1) {
  5068. getWeatherImage('#w-layer-oo', $(this).attr('data-model-1'));
  5069. }
  5070. if (parseInt($(this).attr('data-uo-1')) === 1) {
  5071. getWeatherImage('#w-layer-uo', $(this).attr('data-model-1'));
  5072. }
  5073. if (parseInt($(this).attr('data-oo2-2')) === 1) {
  5074. getWeatherImage('#w-layer-oo2', $(this).attr('data-model-2'));
  5075. }
  5076. if (parseInt($(this).attr('data-oo-2')) === 1) {
  5077. getWeatherImage('#w-layer-oo', $(this).attr('data-model-2'));
  5078. }
  5079. if (parseInt($(this).attr('data-uo-2')) === 1) {
  5080. getWeatherImage('#w-layer-uo', $(this).attr('data-model-2'));
  5081. }
  5082. $('.btn-rwetter').removeClass('btn-rwetter-active');
  5083. $(this).addClass('btn-rwetter-active');
  5084. if (parseInt($(this).attr('data-player')) === 1) {
  5085. $('#w-player').css('display', 'block');
  5086. }
  5087. else {
  5088. $('#w-player').css('display', 'none');
  5089. }
  5090. //$('.w-overview-product>h3').html($(this).attr('data-headline'));
  5091. replaceWeatherImages(parseInt($(this).attr('data-x')),parseInt($(this).attr('data-y')),$(this).attr('data-overlay'));
  5092. });
  5093.  
  5094. };
  5095.  
  5096. var replaceWeatherImages = function(x,y, url) {
  5097. if (x>0 && y>0) {
  5098. var spielraum_x = 756-$('#w-overlay').width(); // 75
  5099. var spielraum_y = 616-$('#w-overlay').height(); // 323
  5100. var start_x = Math.round($('#w-overlay').width()/2); // 75
  5101. var start_y = Math.round($('#w-overlay').height()/2); // 323
  5102. var ver_x = 2;
  5103. var ver_y = 2;
  5104. if (x>start_x) {
  5105. ver_x=x-start_x+ver_x;
  5106. if (ver_x>spielraum_x) {
  5107. ver_x=spielraum_x;
  5108. }
  5109. }
  5110. if (y>start_y) {
  5111. ver_y=y-start_y+ver_y;
  5112. if (ver_y>spielraum_y) {
  5113. ver_y=spielraum_y;
  5114. }
  5115. }
  5116. $('.w-overview-layers').css('margin-left', '-'+ver_x+'px');
  5117. $('.w-overview-layers').css('margin-top', '-'+ver_y+'px');
  5118. $('#w-map-marker').css('display', 'block');
  5119. $('#w-map-marker').css('top', (y-ver_y-23)+'px');
  5120. $('#w-map-marker').css('left', (x-ver_x-3)+'px');
  5121. }
  5122. if (typeof url !== 'undefined' && url) {
  5123. $('#w-overlay>img').attr('src', url);
  5124. }
  5125. }
  5126.  
  5127. var placeWeatherOverlay = function(trigger_warn) {
  5128. var x = parseInt($('#w-overlay').attr('data-x'));
  5129. var y = parseInt($('#w-overlay').attr('data-y'));
  5130. replaceWeatherImages(x,y);
  5131. if (trigger_warn === 'trigger_warn') {
  5132. $('.btn-twetter').removeClass('btn-twetter-active');
  5133. $('.w-btn-div').css('display','none');
  5134. $('#w-buttons-t>a:first-child').addClass('btn-twetter-active');
  5135. var domid = $('#w-buttons-t>a:first-child').attr('aria-controls');
  5136. $('#'+domid).css('display','block');
  5137.  
  5138. if ($('#uwz-type-warning').attr('data-product') === 'blitze') {
  5139. $('[data-model="radar/Blitze"]').trigger('click');
  5140. }
  5141. else if ($('#uwz-type-warning').attr('data-product') === 'flood') {
  5142. $('[data-model="radar/floods[0]"]').trigger('click');
  5143. }
  5144. else if ($('#uwz-type-warning').attr('data-product') === 'rain') {
  5145. $('[data-model="radar/storms[0]"]').trigger('click');
  5146. }
  5147. else if ($('#uwz-type-warning').attr('data-product') === 'tornado') {
  5148. $('[data-model="radar/storms[0]"]').trigger('click');
  5149. }
  5150. else if ($('#uwz-type-warning').attr('data-product') === 'sturm') {
  5151. $('[data-model="radar/storms[0]"').trigger('click');
  5152. }
  5153. else if ($('#uwz-type-warning').attr('data-product') === 'hail') {
  5154. $('[data-model="radar/hagel"]').trigger('click');
  5155. }
  5156. else {
  5157. $('#w-buttons-t>a:first-child').trigger('click');
  5158. }
  5159. }
  5160. else {
  5161. $('#w-buttons-t>a:first-child').trigger('click');
  5162. }
  5163. };
  5164.  
  5165. var isMobile = {
  5166. Android: function () {
  5167. return navigator.userAgent.match(/Android/i);
  5168. },
  5169. BlackBerry: function () {
  5170. return navigator.userAgent.match(/BlackBerry/i);
  5171. },
  5172. iOS: function () {
  5173. return navigator.userAgent.match(/iPhone|iPod|iPad/i);
  5174. },
  5175. Opera: function () {
  5176. return navigator.userAgent.match(/Opera Mini/i);
  5177. },
  5178. Windows: function () {
  5179. return navigator.userAgent.match(/IEMobile/i);
  5180. },
  5181. any: function () {
  5182. return ((isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()));
  5183. }
  5184. };
  5185.  
  5186. var isGoogle = function() {
  5187. return (
  5188. true
  5189. );
  5190. };
  5191.  
  5192. var popoverClose = function(name) {
  5193. $('*[data-pocontent]').each(function() {
  5194. if ($(this).data('pocontent') == name) {
  5195. $(this).popover('hide');
  5196. }
  5197. });
  5198. }
  5199.  
  5200. var loadingMsg = function() {
  5201. var loading = $('#myfavcontent').attr('data-loading');
  5202. if (!loading) { loading='Loading'; }
  5203. return loading;
  5204. };
  5205.  
  5206. var hoverPopover = function() {
  5207. if (!isMobile.any()) {
  5208. $('[data-toggle="popover"]').popover({
  5209. 'html': true,
  5210. 'trigger': 'hover',
  5211. 'placement': 'bottom'
  5212. });
  5213. $('[data-toggle="popover"]').on('click', function(){
  5214. $(this).popover('hide');
  5215. });
  5216. }
  5217. $('[data-toggle="pcopover"]').popover({
  5218. 'html': true,
  5219. 'trigger': 'click',
  5220. 'placement': 'bottom'
  5221. });
  5222. $('[data-toggle="popover"]').on('click', function(){
  5223. $(this).popover('hide');
  5224. });
  5225. };
  5226.  
  5227. var initiOSzoomfix = function() {
  5228. // prevent iOS from zooming in
  5229. $('input').off('mousedown').on('mousedown', function(){
  5230. if (!$(this).is(":focus")) { $(this).addClass('ioszoomfix');}});
  5231. $('input').off('focus').on('focus', function(){$(this).removeClass('ioszoomfix'); });
  5232. $('select').off('mousedown').on('mousedown', function(){
  5233. if (!$(this).is(":focus")) { $(this).addClass('ioszoomfix');}});
  5234. $('select').off('focus').on('focus', function(){$(this).removeClass('ioszoomfix'); });
  5235. $('select').off('blur').on('blur', function(){$(this).removeClass('ioszoomfix'); });
  5236. };
  5237.  
  5238. var loadingForecasts = function() {
  5239. if ($('#weather-overview-page').attr('data-load') === 'true') {
  5240. if(parseInt($('#weather-overview-uwz').attr('data-id'))>0) {
  5241. $.get(get_url_path()+'/ajax_pub/uwz', {
  5242. 'city_id' : $('#weather-overview-uwz').attr('data-id'),
  5243. 'lang':displayLanguage().toString().toLowerCase(),
  5244. 'units':displayUnits(),
  5245. 'tf':displayTimeformat(),
  5246. 't' : $('#weather-overview-uwz').attr('data-ts')
  5247. }, function (data) {
  5248. if (data) {
  5249. $('#weather-overview-uwz').html(data);
  5250. hoverPopover();
  5251. }
  5252. $.get(get_url_path()+'/ajax_pub/weathermaps', {
  5253. 'city_id':$('#weather-overview-page').attr('data-city'),
  5254. 'lang':displayLanguage().toString().toLowerCase(),
  5255. 'units':displayUnits(),
  5256. 'tf':displayTimeformat()
  5257. }, function (data) {
  5258. if (data !== 'Not found') {
  5259. $('#weather-overview-maps').html(data);
  5260. weatherButtonListener();
  5261. placeWeatherOverlay('trigger_warn');
  5262. hoverPopover();
  5263. }
  5264. else {
  5265. $('#weather-overview-maps').replaceWith('');
  5266. }
  5267.  
  5268. },'html');
  5269. } );
  5270. }
  5271. else {
  5272. $.get(get_url_path()+'/ajax_pub/weathermaps', {
  5273. 'city_id':$('#weather-overview-page').attr('data-city'),
  5274. 'lang':displayLanguage().toString().toLowerCase(),
  5275. 'units':displayUnits(),
  5276. 'tf':displayTimeformat()
  5277. }, function (data) {
  5278. if (data !== 'Not found') {
  5279. $('#weather-overview-maps').html(data);
  5280. weatherButtonListener();
  5281. placeWeatherOverlay('trigger_warn');
  5282. hoverPopover();
  5283. }
  5284. else {
  5285. $('#weather-overview-maps').replaceWith('');
  5286. }
  5287. hoverPopover();
  5288. },'html');
  5289. }
  5290. $.get(get_url_path()+'/ajax_pub/weathernexthoursdays', {
  5291. 'city_id':$('#weather-overview-page').attr('data-city'),
  5292. 'lang':displayLanguage().toString().toLowerCase(),
  5293. 'units':displayUnits(),
  5294. 'tf':displayTimeformat()
  5295.  
  5296. }, function (data) {
  5297. if (data !== 'Not found') {
  5298. $('#weather-overview-nexthoursdays').html(data);
  5299. }
  5300. else {
  5301. $('#weather-overview-nexthoursdays').replaceWith('');
  5302. }
  5303. $('[data-toggle="tooltip"]').tooltip();
  5304. },'html');
  5305. $.get(get_url_path()+'/ajax_pub/weather14days', {
  5306. 'city_id':$('#weather-overview-page').attr('data-city'),
  5307. 'lang':displayLanguage().toString().toLowerCase(),
  5308. 'units':displayUnits(),
  5309. 'tf':displayTimeformat()
  5310.  
  5311. }, function (data) {
  5312. if (data !== 'Not found') {
  5313. $('#weather-overview-14daystrend').html(data);
  5314. plotWeatherTrend14days();
  5315. }
  5316. else {
  5317. $('#weather-overview-14daystrend').replaceWith('');
  5318. }
  5319. },'html');
  5320. $.get(get_url_path()+'/ajax_pub/weathercompact', {
  5321. 'city_id':$('#weather-overview-page').attr('data-city'),
  5322. 'lang':displayLanguage().toString().toLowerCase(),
  5323. 'units':displayUnits(),
  5324. 'tf':displayTimeformat()
  5325.  
  5326. }, function (data) {
  5327. if (data !== 'Not found') {
  5328. $('#weather-overview-compact').html(data);
  5329. plotGraphCompact();
  5330. }
  5331. else {
  5332. $('#weather-overview-compact').replaceWith('');
  5333. }
  5334. },'html');
  5335.  
  5336. }
  5337. if ($('#weather-fccompact-page').attr('data-load') === 'true') {
  5338. $.get(get_url_path()+'/ajax/fccompact', {
  5339. 'city_id':$('#weather-fccompact-page').attr('data-city'),
  5340. 'lang':displayLanguage().toString().toLowerCase(),
  5341. 'units':displayUnits(),
  5342. 'tf':displayTimeformat(),
  5343. 'm':$('#weather-fccompact-page').attr('data-m'),
  5344. 'c':$('#weather-fccompact-page').attr('data-hash')
  5345. }, function (data) {
  5346. $('#weather-forecast-compact').html(data);
  5347. plotGraphCompact();
  5348. },'html');
  5349.  
  5350. }
  5351. if ($('#weather-fcxl-page').attr('data-load') === 'true') {
  5352. $.get(get_url_path()+'/ajax/fcxlc', {
  5353. 'city_id':$('#weather-fcxl-page').attr('data-city'),
  5354. 'lang':displayLanguage().toString().toLowerCase(),
  5355. 'units':displayUnits(),
  5356. 'tf':displayTimeformat(),
  5357. 'func':$('#weather-fcxl-page').attr('data-func')
  5358. }, function (data) {
  5359. $.get(get_url_path()+'/ajax/fcxl', {
  5360. 'city_id':$('#weather-fcxl-page').attr('data-city'),
  5361. 'lang':displayLanguage().toString().toLowerCase(),
  5362. 'units':displayUnits(),
  5363. 'tf':displayTimeformat(),
  5364. 'model':$('#weather-fcxl-page').attr('data-m'),
  5365. 'func':$('#weather-fcxl-page').attr('data-func')
  5366. }, function (data2) {
  5367. $('#fcxl-chart').html(data);
  5368. $('#forecast-full').html(data2);
  5369. plotGraph();
  5370. graphTabOnClick();
  5371. setModelSelectorListener();
  5372. $('.graphtab').each(function(){
  5373. if ($(this).attr('data-tab') == $('#weather-fcxl-page').attr('data-tab')) {
  5374. $(this).trigger("click");
  5375. }
  5376. });
  5377. },'html');
  5378. },'html');
  5379.  
  5380. }
  5381.  
  5382. if ($('#weather-fccompact-page').attr('data-load') === 'true' || $('#weather-fcxl-page').attr('data-load') === 'true' || $('#weather-ensemble-page').attr('data-load') === 'true') {
  5383. if(parseInt($('#weather-overview-uwz').attr('data-id'))>0) {
  5384. $.get(get_url_path()+'/ajax/uwz', {
  5385. 'city_id' : $('#weather-overview-uwz').attr('data-id'),
  5386. 'lang':displayLanguage().toString().toLowerCase(),
  5387. 'units':displayUnits(),
  5388. 'tf':displayTimeformat(),
  5389. 't' : $('#weather-overview-uwz').attr('data-ts')
  5390. }, function (data) {
  5391. if (data) {
  5392. $('#weather-overview-uwz').html(data);
  5393. hoverPopover();
  5394. }
  5395. }
  5396. );
  5397. }
  5398. }
  5399. };
  5400.  
  5401. var graphTabOnClick = function() {
  5402. $('.graphtab').on('click', function(e){
  5403. var new_url = $(this).attr("data-url");
  5404. var tab = $(this).attr("data-tab");
  5405. $('#tab-url').attr("data-src", tab);
  5406. var model = $('#forecast-model').val();
  5407. if (model && typeof new_url !== 'undefined') {
  5408. new_url = new_url.replace(tab,model+'/'+tab);
  5409. }
  5410. if (new_url) {
  5411. //$('#forecast-url').attr('data', new_url)
  5412. pushHistory(new_url);
  5413. }
  5414. setTimeout(function() { $(window).trigger('resize'); }, 300);
  5415. });
  5416. };
  5417.  
  5418. var extServer = function (url) {
  5419. var serverlist = getImageServers();
  5420. if (serverlist.length <= 0) {
  5421. return url;
  5422. }
  5423. var serverid = hashInt(url)%serverlist.length;
  5424. if (serverlist[serverid]) {
  5425. return serverlist[serverid]+url;
  5426. }
  5427. return url;
  5428. };
  5429. var downloadAnimation = function() {
  5430. raw_downloadAnimation('#radar-animation');
  5431. };
  5432.  
  5433. var downloadChartAnimation = function() {
  5434. var intervall = $('#model-player-interval').val();
  5435. raw_downloadAnimation("#modelcharts-animation-"+intervall);
  5436. };
  5437.  
  5438. var rar_preloadDownloadAnimation = function (domid, tmploading, images_waiting, parallel, new_limit, checkeronly) {
  5439. var all_images = model_player_get_item_count(domid+" option");
  5440. var parallel_proc = $('#parallel-proc').attr('data-value');
  5441. if (typeof parallel_proc === 'undefined') {
  5442. parallel_proc = 1;
  5443. }
  5444. parallel_proc = parseInt(parallel_proc);
  5445. if (typeof parallel === 'undefined') {
  5446. parallel=1;
  5447. }
  5448. if (typeof checkeronly === 'undefined') {
  5449. checkeronly=false;
  5450. }
  5451. if (typeof new_limit === 'undefined') {
  5452. new_limit=parallel_proc;
  5453. }
  5454. if (typeof images_waiting === 'undefined') {
  5455. images_waiting=0;
  5456. }
  5457. if (typeof tmploading === 'undefined') {
  5458. tmploading=0;
  5459. $(domid).prop("selectedIndex", 0);
  5460. }
  5461.  
  5462.  
  5463. if (tmploading === 0) {
  5464. if (!checkeronly) {
  5465. // retrieve path to image
  5466. var meta_data = $(domid).val();
  5467. var meta_data_split = meta_data.split('#');
  5468. var model_valid = meta_data_split[0];
  5469. var image_type = '';
  5470. var image_path = '';
  5471. var intervall = $('#model-player-interval').val();
  5472. if (domid !== '#modelcharts-animation-'+intervall) {
  5473. image_type = '';
  5474. image_path = get_model_image_path(image_type, $('#model').val(), $('#model-param').val(), model_valid);
  5475. }
  5476. else {
  5477. model_valid += '#'+meta_data_split[1];
  5478. var model_param = $('#model-param').val();
  5479. var model_member = $('#model-member').val();
  5480. var area = get_selected_area();
  5481. var model = $('#model').val();
  5482. var member_string = '';
  5483. if (typeof model_member !== 'undefined' && model_member.length>0 && parseInt(model_member)>=0) {
  5484. member_string = '_m'+model_member;
  5485. }
  5486. var run_date = model_valid.split('#');
  5487. var modelstring = 'model';
  5488. if (model === 'modezseason') {
  5489. modelstring = 'season';
  5490. }
  5491. else if (model === 'modezwkly') {
  5492. modelstring = 'weekly';
  5493. }
  5494. image_path = extServer(url_path+'/images/data/cache/'+modelstring+'/'+modelstring+'_'+model+'_'+run_date[0]+'_'+run_date[1]+'_'+area+'_'+model_param+member_string+'.png');
  5495. }
  5496. var download = '';
  5497. if (!Array.isArray(image_path) && typeof image_path !== 'undefined') {
  5498. var model = $('#model').val();
  5499. var model_param = $('#model-param').val();
  5500. if (model === 'modezseason') {
  5501. model = 'season';
  5502. }
  5503. else if (model === 'modezwkly') {
  5504. model = 'weekly';
  5505. }
  5506. else if (model.substring(0,3) === 'mod') {
  5507. model = 'model';
  5508. }
  5509. var download = image_path.replace("data/cache/"+model+"/"+model+'_', "data/cache/"+model+"/complete_"+model_addons(model)+'_');
  5510. }
  5511. if (download) {
  5512. var bild = new Image();
  5513. bild.onload = function(){gifimages_loaded++; };
  5514. bild.onerror = function(){gifimages_loaded++; };
  5515. bild.src=download;
  5516. gifimages.push(bild);
  5517. }
  5518. }
  5519.  
  5520. if (parallel === parallel_proc) {
  5521. checkeronly=true;
  5522. if (gifimages_loaded < new_limit) {
  5523. setTimeout(function() {
  5524. rar_preloadDownloadAnimation(domid,0,0,parallel, new_limit, true);
  5525. },100);
  5526. }
  5527. else {
  5528. new_limit+=parallel_proc;
  5529. parallel = 0;
  5530. checkeronly=false;
  5531. }
  5532. }
  5533.  
  5534. if (!checkeronly) {
  5535. var selected = model_player_get_selected_index(domid);
  5536. //console.log('images_loaded '+gifimages_loaded+' # items '+all_images+ ' # selected '+selected);
  5537. if (selected < all_images) {
  5538. $(domid).prop("selectedIndex", selected + 1);
  5539. rar_preloadDownloadAnimation(domid,0,0,parallel+1, new_limit, false);
  5540. }
  5541. }
  5542. }
  5543.  
  5544. if (!checkeronly) {
  5545. if(gifimages_loaded<all_images && images_waiting<10000) {
  5546. setTimeout(function(){rar_preloadDownloadAnimation(domid, 1, images_waiting+1);},200);
  5547. }
  5548. else {
  5549. console.log('images_loaded '+gifimages_loaded+' # items '+all_images+ ' # images_waiting '+images_waiting);
  5550. tmploading=2;
  5551. }
  5552. if (tmploading === 2 && gifonce) {
  5553. ajaxLoaderHide();
  5554. produceGif(domid);
  5555. }
  5556. }
  5557. };
  5558.  
  5559. var produceGif = function(domid) {
  5560. gifonce = false;
  5561. download_image = null;
  5562. console.log(image_urls);
  5563. if (typeof gifshot !== 'undefined') {
  5564. if (true || gifshot.isSupported()) {
  5565. var first='';
  5566. var all_images = model_player_get_item_count(domid+" option");
  5567. var image_urls = new Array();
  5568. var intervall = $('#model-player-interval').val();
  5569. for(var i=all_images;i>=0;i--){
  5570. $(domid).prop("selectedIndex", i);
  5571. // retrieve path to image
  5572. var meta_data = $(domid).val();
  5573. var meta_data_split = meta_data.split('#');
  5574. var model_valid = meta_data_split[0];
  5575. var image_type = '';
  5576. var image_path = '';
  5577. if (domid !== '#modelcharts-animation-'+intervall) {
  5578. image_type = '';
  5579. image_path = get_model_image_path(image_type, $('#model').val(), $('#model-param').val(), model_valid);
  5580. }
  5581. else {
  5582. model_valid += '#'+meta_data_split[1];
  5583. var model_param = $('#model-param').val();
  5584. var model_member = $('#model-member').val();
  5585. var area = get_selected_area();
  5586. var model = $('#model').val();
  5587. var member_string = '';
  5588. if (typeof model_member !== 'undefined' && model_member.length>0 && parseInt(model_member)>=0) {
  5589. member_string = '_m'+model_member;
  5590. }
  5591. var run_date = model_valid.split('#');
  5592. var modelstring = 'model';
  5593. if (model === 'modezseason') {
  5594. modelstring = 'season';
  5595. }
  5596. else if (model === 'modezwkly') {
  5597. modelstring = 'weekly';
  5598. }
  5599. image_path = extServer(url_path+'/images/data/cache/'+modelstring+'/'+modelstring+'_'+model+'_'+run_date[0]+'_'+run_date[1]+'_'+area+'_'+model_param+member_string+'.png');
  5600. }
  5601. var download = '';
  5602. if (!Array.isArray(image_path) && typeof image_path !== 'undefined') {
  5603. var model = $('#model').val();
  5604. var model_param = $('#model-param').val();
  5605. if (model === 'modezseason') {
  5606. model = 'season';
  5607. }
  5608. else if (model === 'modezwkly') {
  5609. model = 'weekly';
  5610. }
  5611. else if (model.substring(0,3) === 'mod') {
  5612. model = 'model';
  5613. }
  5614. var download = image_path.replace("data/cache/"+model+"/"+model+'_', "data/cache/"+model+"/complete_"+model_addons(model)+'_');
  5615. }
  5616. if (download) {
  5617. if (first === '') {
  5618. first = download;
  5619. }
  5620. image_urls.push(download);
  5621. //alert(download);
  5622. }
  5623. }
  5624. var image_urls_gif = new Array();
  5625. var intervall = $('#model-player-interval').val();
  5626. if (domid === '#modelcharts-animation-'+intervall) {
  5627. image_urls_gif = image_urls.reverse();
  5628. if (first) {
  5629. image_urls_gif.push(first);
  5630. image_urls_gif.push(first);
  5631. image_urls_gif.push(first);
  5632. }
  5633. }
  5634. else {
  5635. image_urls_gif = image_urls;
  5636. if (download) {
  5637. image_urls_gif.push(download);
  5638. image_urls_gif.push(download);
  5639. image_urls_gif.push(download);
  5640. }
  5641. }
  5642. if (image_urls.length>=5) {
  5643. var top_len = 603;
  5644. if ($('#model').val()==='plraw' && get_selected_area() < 5000000) {
  5645. top_len = 655;
  5646. }
  5647. $.get(get_url_path()+'/ajax_pub/gifcreator', {'lang' : displayLanguage()}, function (data) {
  5648. var images_counter = image_urls.length - 3;
  5649. trackGif(images_counter.toString());
  5650. $('#faq-modal').html(data).modal('show');
  5651. $('.gifshot-progress-layer').show();
  5652. $('.gifshot-progress-bar').attr('value',0.01);
  5653. console.log(image_urls);
  5654. var gifShotOptions = {
  5655. gifWidth: 760,
  5656. gifHeight: 760,
  5657. images: image_urls,
  5658. //images: document.querySelectorAll('img.animation-cache-image'),
  5659. interval: images_delay[images_speed]/1000,
  5660. numFrames: 12,
  5661. frameDuration: 1,
  5662. text: getPortalAddr(),
  5663. fontWeight: 'bold',
  5664. fontSize: '32px',
  5665. fontFamily: 'sans-serif',
  5666. fontColor: '#ffffff',
  5667. 'textXCoordinate': 550,
  5668. 'textYCoordinate': top_len,
  5669. sampleInterval: 10,
  5670. numWorkers: 4,
  5671. progressCallback: function (captureProgress) {
  5672. $('.gifshot-progress-layer').show();
  5673. $('.gifshot-progress-bar').attr('value',captureProgress);
  5674. }
  5675. };
  5676.  
  5677. gifshot.createGIF(gifShotOptions, function (obj) {
  5678. if (!obj.error) {
  5679. $('.gifshot-progress-layer').hide();
  5680. download_image = obj.image;
  5681. var animatedImage = document.createElement('img');
  5682. animatedImage.src = download_image;
  5683. animatedImage.id = 'gifshot-result';
  5684. $('.gifshot-preview').append(animatedImage);
  5685. $('.gifshot-preview-layer').show();
  5686. $('.save-gif').attr('href', download_image);
  5687. gifonce=true;
  5688. gifimages_loaded=0;
  5689. gifimages=[];
  5690. }
  5691.  
  5692. });
  5693. },'html').fail(function(){
  5694. gifonce=true;
  5695. gifimages_loaded=0;
  5696. gifimages=[];
  5697. messageLayer(271, '#error-msg','#error-modal');});
  5698. }
  5699. else {
  5700. gifonce=true;
  5701. gifimages_loaded=0;
  5702. gifimages=[];
  5703. messageLayer(272, '#error-msg','#error-modal');
  5704. }
  5705. }
  5706. else {
  5707. gifonce=true;
  5708. gifimages_loaded=0;
  5709. gifimages=[];
  5710. messageLayer(273, '#error-msg','#error-modal');
  5711. }
  5712. }
  5713. else {
  5714. gifonce=true;
  5715. gifimages_loaded=0;
  5716. gifimages=[];
  5717. messageLayer(270, '#error-msg','#error-modal');
  5718. }
  5719. };
  5720.  
  5721. var raw_downloadAnimation = function(domid) {
  5722. model_player_stop();
  5723. var intervall = $('#model-player-interval').val();
  5724. if (domid === '#modelcharts-animation-'+intervall) {
  5725. ajaxLoaderShow(true);
  5726. }
  5727. else {
  5728. ajaxLoaderShow(false);
  5729. }
  5730. preload_image_animation(domid, true);
  5731. };
  5732.  
  5733. var saveGIF = function () {
  5734. if (download_image) {
  5735. var image_data = atob(download_image.split(',')[1]);
  5736. // Use typed arrays to convert the binary data to a Blob
  5737. var arraybuffer = new ArrayBuffer(image_data.length);
  5738. var view = new Uint8Array(arraybuffer);
  5739. for (var i=0; i<image_data.length; i++) {
  5740. view[i] = image_data.charCodeAt(i) & 0xff;
  5741. }
  5742. try {
  5743. // This is the recommended method:
  5744. var blob = new Blob([arraybuffer], {type: 'application/octet-stream'});
  5745. } catch (e) {
  5746. // The BlobBuilder API has been deprecated in favour of Blob, but older
  5747. // browsers don't know about the Blob constructor
  5748. // IE10 also supports BlobBuilder, but since the `Blob` constructor
  5749. // also works, there's no need to add `MSBlobBuilder`.
  5750. var bb = new (window.WebKitBlobBuilder || window.MozBlobBuilder);
  5751. bb.append(arraybuffer);
  5752. var blob = bb.getBlob('application/octet-stream'); // <-- Here's the Blob
  5753. }
  5754. var model_valid = $('#model-valid').val();
  5755. model_valid = model_valid.replace(/-/g, "");
  5756. model_valid = model_valid.replace(/:/g, "");
  5757. model_valid = model_valid.replace(/\//g, "_");
  5758. var model = $('#model').val();
  5759. model = model.replace(/px250/g, "radarhd");
  5760. model = model.replace(/pl/g, "radar_lightning");
  5761. // Use the URL object to create a temporary URL
  5762. saveAs(blob, model+'_'+model_valid+'_animation.gif');
  5763. }
  5764. else {
  5765. alert('Could not download, please try "save as".');
  5766. }
  5767. };
  5768.  
  5769. var getImageServers = function () {
  5770. var server_list = $('#static-images').attr('data-value');
  5771.  
  5772. //Gif Debug für DEV-ENV
  5773. //server_list = 'https://img1.kachelmannwetter.com,https://img1.kachelmannwetter.com,https://img1.kachelmannwetter.com,https://img2.kachelmannwetter.com,https://img2.kachelmannwetter.com,https://img2.kachelmannwetter.com,https://img3.kachelmannwetter.com,https://img3.kachelmannwetter.com,https://img3.kachelmannwetter.com';
  5774.  
  5775. if (typeof server_list === 'undefined') {
  5776. return Array();
  5777. }
  5778. return server_list.split(",");
  5779. }
  5780.  
  5781. var hashInt = function(str) {
  5782. var hash = 0, i, chr;
  5783. if (str.length === 0) return hash;
  5784. for (i = 0; i < str.length; i++) {
  5785. chr = str.charCodeAt(i);
  5786. hash += chr; // Convert to 32bit integer
  5787. }
  5788. return hash;
  5789. };
  5790.  
  5791. var deleteSession = function(token) {
  5792. $.get(get_url_path()+'/dashboard/deletetoken', {
  5793. 'token':token,
  5794. }, function (data) {
  5795. $('#session-list').html(data);
  5796. },'html');
  5797. };
  5798. var trackPlayer = function(domid, ext) {
  5799. var param = $('#model-param').val();
  5800. if (typeof param === 'undefined') {
  5801. param = '';
  5802. }
  5803. else {
  5804. param = '_'+param;
  5805. }
  5806. if(typeof ga !=='undefined'){
  5807. ga('send', 'event', $('#model').val(), 'player'+param, get_selected_area(), ext, { nonInteraction: true});
  5808. } else if(typeof _gaq !=='undefined'){
  5809. _gaq.push(['_trackEvent',$('#model').val(), 'player'+param, get_selected_area(), ext, true]);
  5810. }
  5811. };
  5812. var trackGif = function(images_count) {
  5813. var param = $('#model-param').val();
  5814. if (typeof param === 'undefined') {
  5815. param = '';
  5816. }
  5817. else {
  5818. param = '_'+param;
  5819. }
  5820. if(typeof ga !=='undefined'){
  5821. ga('send', 'event', $('#model').val(), 'gifshot'+param, get_selected_area(), images_count, { nonInteraction: true});
  5822. } else if(typeof _gaq !=='undefined'){
  5823. _gaq.push(['_trackEvent',$('#model').val(), 'gifshot'+param, get_selected_area(), images_count, true]);
  5824. }
  5825. };
  5826.  
  5827. var getPortalAddr = function() {
  5828. var c = $('#user-country').attr('data-value');
  5829. if (c === 'us') {
  5830. return 'weather.us';
  5831. }
  5832. else if (c === 'xx') {
  5833. return 'meteologix.com';
  5834. }
  5835. return 'kachelmannwetter.com';
  5836. };
  5837.  
  5838. var selectPaywallPackage = function(package) {
  5839. $("input[name='RegisterForm[plan]']").each(function(){
  5840. if ($(this).attr('value')==package) {
  5841. $(this).click();
  5842. $('#registerform-email').focus();
  5843. }
  5844. });
  5845. $("input[name='SubscriptionForm[plan]']").each(function(){
  5846. if ($(this).attr('value')==package) {
  5847. $(this).click();
  5848. }
  5849. });
  5850.  
  5851. };
  5852.  
  5853. var setElementHiders = function() {
  5854. $('.elementhider').off("click").on("click", function(e){
  5855. $.get(get_url_path()+'/ajax/elementhider', {
  5856. 'element_id': $(this).attr('data-id')
  5857. });
  5858. });
  5859. $('.elementhider-hide').off("click").on("click", function(e){
  5860. var elementid = $(this).attr('data-id');
  5861. $.get(get_url_path()+'/ajax/elementhider', {
  5862. 'element_id': elementid
  5863. }, function() {
  5864. $('#'+elementid).hide();
  5865. });
  5866. });
  5867. $('.elementhider-hideclass').off("click").on("click", function(e){
  5868. var elementid = $(this).attr('data-id');
  5869. $.get(get_url_path()+'/ajax/elementhider', {
  5870. 'element_id': elementid
  5871. }, function() {
  5872. $('.'+elementid).hide();
  5873. if (elementid === 'cookie_deny') {
  5874. location.href = get_url_path()+'/site/nocookies';
  5875. }
  5876. });
  5877. });
  5878.  
  5879. $('.elementhider-reload').off("click").on("click", function(e){
  5880. e.preventDefault();
  5881. $.get(get_url_path()+'/ajax/elementhider', {
  5882. 'element_id': $(this).attr('data-id')
  5883. }, function() {
  5884. location.reload();
  5885. });
  5886. });
  5887. $('.elementshower-reload').off("click").on("click", function(e){
  5888. e.preventDefault();
  5889. $.get(get_url_path()+'/ajax/elementshower', {
  5890. 'element_id': $(this).attr('data-id')
  5891. }, function() {
  5892. location.reload();
  5893. });
  5894. });
  5895. $('.elementhider-gps').off("click").on("click", function(e){
  5896. e.preventDefault();
  5897. $.get(get_url_path()+'/ajax/elementhider', {
  5898. 'element_id': $(this).attr('data-id')
  5899. }, function(){
  5900. gps_locating_uwz();
  5901. });
  5902. });
  5903. };
  5904.  
  5905. var showXClicksLayer = function() {
  5906. $.get(get_url_path()+'/ajax/xclickslayer', {}, function(data) {
  5907. //var factor = Math.round((615/760)*parseInt($('#map-overlay').width()));
  5908. //if (factor > 200 && factor < 768) {
  5909. //$('#xclicks').css('height', factor);
  5910. //}
  5911. $('#xclicks').html(data);
  5912. $('#main-image-content').hide();
  5913. $('#xclicks').show();
  5914. if (displayCountry() === 'de') {
  5915. rescanMD();
  5916. }
  5917. });
  5918. }
  5919.  
  5920. var checkChartcounter = function() {
  5921. if ($('#paywall-account-type').attr('data-value') === 'payaccount' || xclicksvalue===0) {
  5922. return true;
  5923. }
  5924. if (chartcounter>0) {
  5925. $('#main-image-content').show();
  5926. $('#xclicks').hide();
  5927. chartcounter--;
  5928. return true;
  5929. }
  5930. else {
  5931. xclicksvalue=xclicksvalue+2;
  5932. chartcounter=xclicksvalue;
  5933. showXClicksLayer();
  5934. return false;
  5935. }
  5936. }
  5937.  
  5938.  
  5939. var rescanMD = function() {
  5940. $('.dkpw').each(function() {
  5941. if (!$(this).is(":visible")) {
  5942. $(this).html('');
  5943. }
  5944. } );
  5945. $('.mdtest').each(function() {
  5946. $(this).css('background-color','#dfdfdf');
  5947. $(this).css('font-size','13px');
  5948. var tmp = $(this).attr('data-nx-container');
  5949. if (typeof tmp !== 'undefined') {
  5950. $(this).html('<small>Placeholder for advertising:</small><br /><h2>'+tmp+'</h2>');
  5951. }
  5952. $(this).removeAttr("data-nx-container");
  5953. });
  5954. if ($('#paywall-account-type').attr('data-value') !== 'payaccount') {
  5955. try {
  5956. nx.cmd.push(function () {
  5957. nx.trigger('rescan');
  5958. nx.trigger('refresh', ['content', 'content_limited','mid_mobile_limited_lazy']);
  5959. });
  5960. } catch(err) {};
  5961. }
  5962. }
  5963.  
  5964. var resetDropdowns = function() {
  5965. for (i=1;i<=10;i++) {
  5966. fieldname = '#form-areaid-'+i;
  5967. resetSelectboxById(fieldname);
  5968. }
  5969. resetSelectboxById('#model-year');
  5970. resetSelectboxById('#model-run');
  5971. resetSelectboxById('#model-valid');
  5972. resetSelectboxById('#model-param');
  5973. };
  5974.  
  5975. var checkCookie = function(){
  5976. var cookieEnabled = navigator.cookieEnabled;
  5977. if (!cookieEnabled){
  5978. document.cookie = "ajsgdlkajsghdjashd";
  5979. cookieEnabled = document.cookie.indexOf("ajsgdlkajsghdjashd")!=-1;
  5980. }
  5981. return cookieEnabled || 'cookiefail';
  5982. }
  5983.  
  5984. var showCookieFail = function() {
  5985. location.href = get_url_path()+'/site/cookiesblocked';
  5986. }
  5987.  
  5988. var resetSelectboxById = function(fieldname) {
  5989. $(fieldname+' option').each(function(){
  5990. if ($(this).attr('selected') === 'selected') {
  5991. $(fieldname).val($(this).attr('value'));
  5992. }
  5993. });
  5994. };
  5995.  
  5996. var gps_success_uwz = function(pos) {
  5997. var x = pos.coords.longitude; //x = 12.784669;
  5998. var y = pos.coords.latitude; //y = 46.7013345;
  5999. $('#unwetterzentrale').html("<p>Ort gefunden. Bitte warten Sie auf die Unwetterdaten.</p>");
  6000. $.get(get_url_path()+'/ajax/unwetterzentrale', {
  6001. 'lat' : y,
  6002. 'long' : x
  6003. }, function (data) {
  6004. if (data) {
  6005. $('#unwetterzentrale').html(data);
  6006. hoverPopover();
  6007. $.get(get_url_path()+'/ajax_pub/weathermaps', {
  6008. 'city_id':$('#weather-overview-page').attr('data-city'),
  6009. 'lang':displayLanguage().toString().toLowerCase(),
  6010. 'units':displayUnits(),
  6011. 'tf':displayTimeformat()
  6012. }, function (data) {
  6013. if (data !== 'Not found') {
  6014. $('#weather-overview-maps').html(data);
  6015. weatherButtonListener();
  6016. placeWeatherOverlay('trigger_warn');
  6017. }
  6018. else {
  6019. $('#weather-overview-maps').replaceWith('');
  6020. }
  6021. hoverPopover();
  6022. },'html');
  6023. }
  6024. else {
  6025. gps_not_supported_uwz();
  6026. }
  6027.  
  6028. });
  6029. };
  6030. var gps_error_uwz = function() {
  6031. $('#unwetterzentrale').html("<p> Wir konnten Sie nicht automatisch orten. Entweder liegen keine GPS-Daten vor oder Sie haben die Ortungsfunktion in Ihrem Browser für unsere Webseite blockiert.</p>");
  6032. };
  6033. var gps_not_supported_uwz = function() {
  6034. $('#unwetterzentrale').html("<p>Es scheint als hätten Sie in Ihrem Browser die Ortungsfunktion blockiert. Wir konnten Sie deshalb nicht automatisch orten.</p>");
  6035. };
  6036.  
  6037. var findBtnActive = function(domid) {
  6038. $(domid).each(function() {
  6039. $(this).addClass('btn-active');
  6040. });
  6041. return '';
  6042. };
  6043.  
  6044.  
  6045. var vhstation_date_prev = function () {
  6046. var selected = model_player_get_selected_index('#btn-vhs-date');
  6047. var items = model_player_get_item_count("#btn-vhs-date option");
  6048. if (selected < items) {
  6049. $("#btn-vhs-date").prop("selectedIndex", selected + 1);
  6050. $('#btn-vhs-date').trigger('change');
  6051. }
  6052. };
  6053.  
  6054. var vhstation_date_next = function () {
  6055. var selected = model_player_get_selected_index('#btn-vhs-date');
  6056. if (selected > 0) {
  6057. $("#btn-vhs-date").prop("selectedIndex", selected - 1);
  6058. $('#btn-vhs-date').trigger('change');
  6059. }
  6060. };
  6061.  
  6062. var setKlimaVergleichListener = function(fl_reload) {
  6063. $('.btn-kvgl-tab').off('click').
  6064. on('click', function(e) {
  6065. $(this).removeClass("btn-active");
  6066. $('#kgvl-city-name').html($(this).html().replace("<a>","").replace("</a>",""));
  6067. $('#klima-vergleich').attr('data-value', $(this).attr('data-tab'));
  6068. $('.btn-vhs-station').each(function() { $(this).removeClass('btn-active'); });
  6069. var old_url = '';
  6070. $('.btn-kvgl-tab').each(function() {
  6071. if ($(this).hasClass("tab-current")) {
  6072. $(this).removeClass("tab-current");
  6073. old_url = $(this).attr('data-value');
  6074. }
  6075. });
  6076. if (old_url) {
  6077. $(this).addClass("tab-current");
  6078. var loc = window.location.href;
  6079. if (loc.indexOf(old_url) !== -1) {
  6080. loc = loc.replace(old_url, $(this).attr('data-value'));
  6081. }
  6082. else {
  6083. loc = loc + '/' + $(this).attr('data-value');
  6084. }
  6085. pushHistory(loc);
  6086. }
  6087. KlimavergleichListenerActions();
  6088. });
  6089.  
  6090. $('.btn-kvgl').off('click').
  6091. on('click', function(e) {
  6092. KlimavergleichListenerActions(this);
  6093. });
  6094. if (fl_reload !== true) {
  6095. if ($('#klimavergleich-form').attr('name') === 'klimavergleich') {
  6096. loadKlimavergleich();
  6097. }
  6098. }
  6099. };
  6100.  
  6101. var KlimavergleichListenerActions = function(obj) {
  6102. var old_param = '';
  6103. var new_param = '';
  6104. if (obj) {
  6105. if ($(obj).hasClass('btn-kvgl-mode')) {
  6106. $('.btn-kvgl-mode').removeClass('btn-active');
  6107. }
  6108. else if ($(obj).hasClass('btn-kvgl-param')) {
  6109. old_param = $(obj).attr('data-value');
  6110. new_param = $(obj).attr('data-value');
  6111. $('.btn-kvgl-param').each(function(){
  6112. if ($(this).hasClass('btn-active')) {
  6113. old_param = $(this).attr('data-value');
  6114. }
  6115. });
  6116. $('.btn-kvgl-param').removeClass('btn-active');
  6117. }
  6118. else if ($(obj).hasClass('btn-kvgl-station')) {
  6119. $('.btn-kvgl-station').removeClass('btn-active');
  6120. }
  6121. else if ($(obj).hasClass('btn-kvgl-climate')) {
  6122. $('.btn-kvgl-climate').removeClass('btn-active');
  6123. }
  6124. $(obj).addClass('btn-active');
  6125. }
  6126. if (old_param !== new_param || !obj) {
  6127. //$('#klima-vergleich-buttons').html(loadingGif());
  6128. var params = getKlimavergleichParams();
  6129. params.klimaaction = 'buttons';
  6130. $.get(get_url_path()+'/ajax/klimavergleich', params,
  6131. function (data) {
  6132. if (data !== 'FALSE') {
  6133. $('#klima-vergleich-buttons').html(data);
  6134. setKlimaVergleichListener(true);
  6135. hoverPopover();
  6136. loadKlimavergleich();
  6137. }
  6138. },'html');
  6139. }
  6140. else {
  6141. loadKlimavergleich();
  6142. }
  6143. }
  6144. var VhStationListenerActions = function(obj) {
  6145. var old_mode = '';
  6146. var new_mode = '';
  6147. var old_param = '';
  6148. var new_param = '';
  6149. var station = '';
  6150. if (obj) {
  6151. if ($(obj).hasClass('btn-vhs-mode')) {
  6152. old_mode = $(obj).attr('data-value');
  6153. new_mode = $(obj).attr('data-value');
  6154. $('.btn-vhs-mode').each(function(){
  6155. if ($(this).hasClass('btn-active')) {
  6156. old_mode = $(this).attr('data-value');
  6157. }
  6158. });
  6159. $('.btn-vhs-mode').removeClass('btn-active');
  6160. }
  6161. else if ($(obj).hasClass('btn-vhs-unit')) {
  6162. $('.btn-vhs-unit').removeClass('btn-active');
  6163. }
  6164. else if ($(obj).hasClass('btn-vhs-param')) {
  6165. old_param = $(obj).attr('data-value');
  6166. new_param = $(obj).attr('data-value');
  6167. $('.btn-vhs-param').each(function(){
  6168. if ($(this).hasClass('btn-active')) {
  6169. old_param = $(this).attr('data-value');
  6170. }
  6171. });
  6172. $('.btn-vhs-param').removeClass('btn-active');
  6173. }
  6174. else if ($(obj).hasClass('btn-vhs-station')) {
  6175. $('.btn-vhs-station').each(function(){
  6176. if ($(this).hasClass('btn-active')) {
  6177. station = $(this).attr('data-value');
  6178. }
  6179. });
  6180. $('.btn-vhs-station').removeClass('btn-active');
  6181. }
  6182. $(obj).addClass('btn-active');
  6183. }
  6184. if (old_param !== new_param || old_mode !== new_mode || !obj || station.length===0) {
  6185. //$('#klima-vergleich-buttons').html(loadingGif());
  6186. var params = getVhstationenParams();
  6187. params.vhsaction = 'buttons';
  6188. $.get(get_url_path()+'/ajax/vhstationen', params,
  6189. function (data) {
  6190. if (data !== 'FALSE') {
  6191. $('#vhstationen-buttons').html(data);
  6192. setVhstationListener(true);
  6193. hoverPopover();
  6194. loadVhstationen();
  6195. }
  6196. },'html');
  6197. }
  6198. else {
  6199. loadVhstationen();
  6200. }
  6201. };
  6202. var setVhstationListener = function(fl_reload) {
  6203. $('.btn-vhs-tab').off('click').
  6204. on('click', function(e) {
  6205. $(this).removeClass("btn-active");
  6206. $('#vhs-city-name').html($(this).html().replace("<a>","").replace("</a>",""));
  6207. $('#vh-stationen-graph').attr('data-value', $(this).attr('data-tab'));
  6208. $('.btn-vhs-station').each(function() { $(this).removeClass('btn-active'); });
  6209. var old_url = '';
  6210. $('.btn-vhs-tab').each(function() {
  6211. if ($(this).hasClass("tab-current")) {
  6212. $(this).removeClass("tab-current");
  6213. old_url = $(this).attr('data-value');
  6214. }
  6215. });
  6216. if (old_url) {
  6217. $(this).addClass("tab-current");
  6218. var loc = window.location.href;
  6219. if (loc.indexOf(old_url) !== -1) {
  6220. loc = loc.replace(old_url, $(this).attr('data-value'));
  6221. }
  6222. else {
  6223. loc = loc + '/' + $(this).attr('data-value');
  6224. }
  6225. pushHistory(loc);
  6226. }
  6227. VhStationListenerActions();
  6228. });
  6229. $('.btn-vhs').off('click').
  6230. on('click', function(e) {
  6231. VhStationListenerActions(this);
  6232. });
  6233. $('#btn-vhs-date').off('change').
  6234. on('change', function(e) {
  6235. VhStationListenerActions();
  6236. });
  6237. if (fl_reload !== true) {
  6238. if ($('#vhstationen-form').attr('name') === 'vhstationen') {
  6239. loadVhstationen();
  6240. }
  6241. }
  6242. };
  6243.  
  6244. var getKlimavergleichParams = function() {
  6245. var params = {};
  6246. $('.btn-kvgl-mode').each(function(){
  6247. if ($(this).hasClass('btn-active')) {
  6248. params.period = $(this).attr('data-value');
  6249. }
  6250. });
  6251. $('.btn-kvgl-param').each(function(){
  6252. if ($(this).hasClass('btn-active')) {
  6253. params.paramid = $(this).attr('data-value');
  6254. }
  6255. });
  6256. $('.btn-kvgl-station').each(function(){
  6257. if ($(this).hasClass('btn-active')) {
  6258. params.station_id = $(this).attr('data-value');
  6259. }
  6260. });
  6261. $('.btn-kvgl-climate').each(function(){
  6262. if ($(this).hasClass('btn-active')) {
  6263. params.climate_id = $(this).attr('data-value');
  6264. }
  6265. });
  6266. params.city_id = $('#klima-vergleich').attr('data-value');
  6267. return params;
  6268. };
  6269.  
  6270. var getVhstationenParams = function() {
  6271. var params = {};
  6272. $('.btn-vhs-mode').each(function(){
  6273. if ($(this).hasClass('btn-active')) {
  6274. params.period = $(this).attr('data-value');
  6275. }
  6276. });
  6277. $('.btn-vhs-unit').each(function(){
  6278. if ($(this).hasClass('btn-active')) {
  6279. params.unit = $(this).attr('data-value');
  6280. }
  6281. });
  6282. $('.btn-vhs-param').each(function(){
  6283. if ($(this).hasClass('btn-active')) {
  6284. params.paramid = $(this).attr('data-value');
  6285. }
  6286. });
  6287. $('.btn-vhs-station').each(function(){
  6288. if ($(this).hasClass('btn-active')) {
  6289. params.station_id = $(this).attr('data-value');
  6290. }
  6291. });
  6292. params.date = $('#btn-vhs-date').val();
  6293. params.city_id = $('#vh-stationen-graph').attr('data-value');
  6294. return params;
  6295. };
  6296.  
  6297. var loadKlimavergleich = function() {
  6298. //$('#klima-vergleich').html(loadingGif());
  6299. var params = getKlimavergleichParams();
  6300. params.klimaaction = 'graph';
  6301. $('#klima-vergleich').html(loadingGif());
  6302. $.get(get_url_path()+'/ajax/klimavergleich', params,
  6303. function (data) {
  6304. if (data !== 'FALSE') {
  6305. $('#klima-vergleich').html(data);
  6306. plotKlimaVergleich();//setTimeout('plotKlimaVergleich',1000);
  6307. }
  6308. else {
  6309. $('#klima-vergleich').html('Es fehlt die Berechtigung, um diese Aktion durchzuführen.');
  6310. }
  6311. },'html');
  6312. };
  6313.  
  6314. var loadVhstationen = function() {
  6315. //$('#klima-vergleich').html(loadingGif());
  6316. var params = getVhstationenParams();
  6317. params.vhsaction = 'graph';
  6318. vhstation_rr_data=null;
  6319. vhstation_tl_data=null;
  6320. vhstation_tl_data2=null;
  6321. vhstation_wind_data=null;
  6322. $('#vh-stationen-graph').html(loadingGif());
  6323. $('#vh-stationen-table').html(loadingGif());
  6324. $.get(get_url_path()+'/ajax/vhstationen', params,
  6325. function (data) {
  6326. if (data !== 'FALSE') {
  6327. $('#vh-stationen-graph').html(data);
  6328. plotVHStationen();
  6329. }
  6330. else {
  6331. $('#vh-stationen-graph').html('Es fehlt die Berechtigung, um diese Aktion durchzuführen.');
  6332. }
  6333. },'html');
  6334. params.vhsaction = 'table';
  6335. $.get(get_url_path()+'/ajax/vhstationen', params,
  6336. function (data) {
  6337. if (data !== 'FALSE') {
  6338. $('#vh-stationen-table').html(data);
  6339. }
  6340. else {
  6341. $('#vh-stationen-table').html('Es fehlt die Berechtigung, um diese Aktion durchzuführen.');
  6342. }
  6343. },'html');
  6344. };
  6345.  
  6346. var setPhaenologieListener = function(pageinit) {
  6347.  
  6348. if($('#phaenologie').length == 0) return;
  6349.  
  6350. if(pageinit) {
  6351. $('#phaeno-plant-chart').html(loadingGif());
  6352. plotPhaenologie();
  6353.  
  6354. var nowParams = getPhaenoParams();
  6355. pushPhaenoUrl(nowParams, nowParams, true);
  6356. }
  6357.  
  6358. function getPhaenoParams() {
  6359.  
  6360. var city_val = $('#phaenologie').attr('data-city');
  6361. var city_id = city_val.substring(0, city_val.indexOf('-'));
  6362. var city_name = city_val.substring(city_val.indexOf('-') + 1);
  6363.  
  6364. var station_val = $('.btn-phaeno-station.btn-active').data('value');
  6365. var station_id = station_val.substring(0, station_val.indexOf('-'));
  6366. var station_name = station_val.substring(station_val.indexOf('-') + 1);
  6367.  
  6368. var plant_val = $('#plant-select').val();
  6369. var plant_id = plant_val.substring(0, plant_val.indexOf('-'));
  6370. var plant_name = plant_val.substring(plant_val.indexOf('-') + 1);
  6371.  
  6372. var params = {
  6373. city_id: city_id,
  6374. city: city_name,
  6375. station_id: station_id,
  6376. station: station_name,
  6377. plant_id: plant_id,
  6378. plant: plant_name
  6379. };
  6380.  
  6381. //console.log(params);
  6382.  
  6383. if($('.btn-phaeno-year.btn-active').length != 0)
  6384. params.year = $('.btn-phaeno-year.btn-active').data('value');
  6385.  
  6386. return params;
  6387. }
  6388.  
  6389. var lockUI = false;
  6390. var menuRequestFinished = false;
  6391. function ajaxMenuRequest(params) {
  6392.  
  6393. menuRequestFinished = false;
  6394.  
  6395. $('.menu-container').css('opacity', .6);
  6396. $('#phaeno-plant-chart').html(loadingGif());
  6397. lockUI = true;
  6398.  
  6399. $.get(get_url_path() + '/ajax/phaenologie', params,
  6400. function (data) {
  6401. if (data !== 'FALSE') {
  6402. $('#phaenologie .menu-container').html(data);
  6403. setPhaenologieListener();
  6404. hoverPopover();
  6405. //loadKlimavergleich();
  6406. var nowParams = getPhaenoParams();
  6407. pushPhaenoUrl(nowParams, nowParams, true);
  6408. }
  6409. },'html')
  6410. .always(function() {
  6411. $('.menu-container').css('opacity', '');
  6412. lockUI = false;
  6413. menuRequestFinished = true;
  6414. });
  6415.  
  6416. ajaxGraphRequest(params);
  6417.  
  6418. }
  6419.  
  6420. function ajaxGraphRequest(params) {
  6421.  
  6422. var graphParams = JSON.parse(JSON.stringify(params));
  6423. graphParams.mode = 'graph'
  6424.  
  6425. $.get(get_url_path() + '/ajax/phaenologie', graphParams,
  6426. function (data) {
  6427. if (data !== 'FALSE') {
  6428.  
  6429. var waitForMenuRequest = setInterval(function() {
  6430. if(menuRequestFinished) {
  6431. clearInterval(waitForMenuRequest);
  6432.  
  6433. $('#phaenologie .graph-container').html(data);
  6434. plotPhaenologie();
  6435. }
  6436. }, 20);
  6437. }
  6438. },'html')
  6439. .always(function() {
  6440.  
  6441. });
  6442. }
  6443.  
  6444. //Tab-Buttons
  6445. $('.btn-phaeno-tab').off('click').on('click', function(e) {
  6446.  
  6447. if($(this).hasClass('tab-current') || lockUI) return;
  6448.  
  6449. var oldParams = getPhaenoParams();
  6450.  
  6451. $('.btn-phaeno-tab').removeClass('tab-current');
  6452. $(this).addClass('tab-current');
  6453. $('#phaenologie').attr('data-city', $(this).data('value'));
  6454.  
  6455. var newParams = getPhaenoParams();
  6456.  
  6457. pushPhaenoUrl(oldParams, newParams);
  6458.  
  6459. ajaxMenuRequest(newParams);
  6460. });
  6461.  
  6462. //Station-Buttons
  6463. $('.btn-phaeno-station').off('click').on('click', function(e) {
  6464.  
  6465. if($(this).hasClass('btn-active') || lockUI) return;
  6466.  
  6467. var oldParams = getPhaenoParams();
  6468.  
  6469. $('.btn-phaeno-station').removeClass('btn-active');
  6470. $(this).addClass('btn-active');
  6471.  
  6472. var newParams = getPhaenoParams();
  6473.  
  6474. pushPhaenoUrl(oldParams, newParams);
  6475.  
  6476. ajaxMenuRequest(newParams);
  6477. });
  6478.  
  6479. //Jahr-Buttons
  6480. $('.btn-phaeno-year').off('click').on('click', function(e) {
  6481.  
  6482. if($(this).hasClass('btn-active') || lockUI) return;
  6483.  
  6484. var oldParams = getPhaenoParams();
  6485.  
  6486. $('.btn-phaeno-year').removeClass('btn-active');
  6487. $(this).addClass('btn-active');
  6488.  
  6489. var newParams = getPhaenoParams();
  6490.  
  6491. pushPhaenoUrl(oldParams, newParams);
  6492.  
  6493. phaenologieShowYear($(this).data('value'));
  6494. });
  6495.  
  6496. //Pflanzen-Typ Tab-Buttons
  6497. $('.plant-type-selection .plant-type-tab-button').off('click').on('click', function(e) {
  6498. if($(this).hasClass('active') || lockUI) return;
  6499.  
  6500. var oldParams = getPhaenoParams();
  6501. var newParams = getPhaenoParams();
  6502. newParams.plant_id = $(this).data('plant-type');
  6503.  
  6504. $('.plant-type-selection .plant-type-tab-button').removeClass('active');
  6505. $(this).addClass('active');
  6506.  
  6507. pushPhaenoUrl(oldParams, newParams);
  6508.  
  6509. ajaxMenuRequest(newParams);
  6510. });
  6511.  
  6512. //Pflanzen-Dropdown
  6513. var oldPlantParams = getPhaenoParams();
  6514. $('.plant-select').off('change').on('change', function(e) {
  6515. if(lockUI) return;
  6516.  
  6517. var newParams = getPhaenoParams();
  6518.  
  6519. pushPhaenoUrl(oldPlantParams, newParams);
  6520.  
  6521. ajaxMenuRequest(newParams);
  6522. });
  6523.  
  6524. function pushPhaenoUrl(oldParams, newParams, replace) {
  6525.  
  6526. var old_url = window.location.href;
  6527. var old_city_id = oldParams.city_id;
  6528.  
  6529. var new_url_params = newParams.city_id + '-' + newParams.city + '/' + newParams.station_id + '-' + newParams.station + '/' + newParams.plant_id + '-' + newParams.plant + '/';
  6530.  
  6531. if(newParams.year)
  6532. new_url_params += newParams.year + '/';
  6533.  
  6534. var index_of_old_city_id = old_url.indexOf(old_city_id);
  6535. var new_url = '';
  6536.  
  6537. if (index_of_old_city_id !== -1) {
  6538. new_url = old_url.substring(0, index_of_old_city_id) + new_url_params;
  6539. }
  6540. else {
  6541. new_url = old_url + '/' + new_url_params;
  6542. }
  6543.  
  6544. var newTitle = 'Phänologie für ' + $('.btn-phaeno-station.btn-active').text() + ' | ' + historyUrl();
  6545.  
  6546. if(replace) {
  6547. if (History.replaceState) {
  6548. no_reload = true;
  6549. History.replaceState(null, newTitle, new_url);
  6550. }
  6551. } else {
  6552. if (History.pushState) {
  6553. no_reload = true;
  6554. History.pushState(null, newTitle, new_url);
  6555. }
  6556. }
  6557.  
  6558. }
  6559. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement