PageSourceSearch

https://apollosauna.at/assets/common.js

js apollosauna.at collected 2026-10-08 06:57:15 UTC 15,160 bytes, 587 lines download raw bytes

1(function($) {
2  'use strict';
3  $.fn.sqrAcc = function() {
4    $(this).each(function() {
5      var container = $(this);
6      container.children('.sqracchead').on('click', function(e) {
7        e.preventDefault();
8        if (container.hasClass('sqraccopen')) {
9          container.removeClass('sqraccopen');
10        } else {
11          container.addClass('sqraccopen');
12          var content = container.find('.sqracccontainer');
13          content.css({
14            'transition': 'none',
15            'opacity': '0'
16          });
17          content.height();
18		  $(window).trigger('resize');
19          content.css({
20            'transition': 'opacity 1s',
21            'opacity': '1'
22          });
23        }
24      });
25    });
26  };
27
28  $.fn.sqrTableReflow = function() {
29    $(this).each(function() {
30      var headers = $(this).find('thead').find('th');
31	  if (headers.length>0) {
32        $(this).find('tbody').find('td').each(function() {
33          $(this).attr('data-header', headers.eq($(this).index()).text().trim());
34        });
35	  }
36    });
37  };
38
39  $.fn.sqrTabs = function() {
40    $(this).each(function() {
41      var tabs = $(this).find('.sqrtabshead>ul>li');
42      var container = $(this).find('.sqrtabscontainer>div');
43
44      tabs.on('mousedown', function(e) {
45        if (!$(this).hasClass('sqrtabactive')) {
46          var index = $(this).index();
47          container.removeClass('sqrtabactive');
48          tabs.removeClass('sqrtabactive');
49          tabs.eq(index).addClass('sqrtabactive');
50          container.eq(index).addClass('sqrtabactive');
51  	      $(window).trigger('resize');
52          container.eq(index).css({
53            'transition': 'none',
54            'opacity': '0'
55          });
56          container.eq(index).height();
57          container.eq(index).css({
58            'transition': 'opacity 1s',
59            'opacity': '1'
60          });
61        }
62        e.preventDefault();
63      });
64    });
65
66  };
67
68  $.fn.sqrLightBox = function() {
69    var backdrop;
70    var lightboxImage;
71    var caption;
72    var siblings;
73    var offset;
74    var gonext;
75    var goprev;
76    var wait;
77    var closer;
78    var viewTimeout;
79    var closeTimeout;
80    var waitTimeout;
81    var drag = false;
82    var lastx = 0;
83    var newx = 0;
84
85    function close() {
86      $(window).off('resize', position);
87      $(window).off('keydown', handleKeyboard);
88
89      $('.sqrlbbackdrop').css({
90        'opacity': '0'
91      });
92
93      if (closeTimeout !== undefined) clearTimeout(closeTimeout);
94      if (viewTimeout !== undefined) clearTimeout(viewTimeout);
95
96      closeTimeout = setTimeout(function() {
97        closeTimeout = undefined;
98        $('.sqrlbbackdrop').css({
99          'display': 'none'
100        });
101      }, 250);
102    }
103
104    function position() {
105      var width = lightboxImage.data('width');
106      var height = lightboxImage.data('height');
107      var backWidth = backdrop.width();
108      var backHeight = backdrop.height();
109
110      var gutter = 96;
111
112      if (backWidth < 768) gutter = 0;
113
114      var ratio = width / height;
115
116      if (width > backWidth - gutter) {
117        width = Math.floor(backWidth - gutter);
118        height = Math.floor(width / ratio);
119      }
120      if (height > backHeight - gutter) {
121        height = Math.floor(backHeight - gutter);
122        width = Math.floor(height * ratio);
123      }
124
125      var left = Math.floor((backWidth - width) / 2);
126      var top = Math.floor((backHeight - height) / 2);
127
128      lightboxImage.css({
129        'width': width + 'px',
130        'height': height + 'px',
131        'left': left + 'px',
132        'top': top + 'px'
133      });
134
135      gonext.css({
136        'top': Math.floor(backHeight / 2 - 48) + 'px'
137      });
138      goprev.css({
139        'top': Math.floor(backHeight / 2 - 48) + 'px'
140      });
141
142      if (gutter === 0) {
143        caption.css('bottom', top + 'px');
144      } else {
145        caption.css('bottom', '0px');
146      }
147
148      setPrevNext();
149
150    }
151
152    function handleKeyboard(e) {
153      if (e.keyCode == 27) close();
154      if (e.keyCode == 39) handleNext();
155      if (e.keyCode == 37) handlePrev();
156    }
157
158    function handleNext() {
159      if (siblings.length === 0) return;
160      if (offset >= siblings.length - 1) return;
161      handleOffset(1, 20);
162    }
163
164    function handlePrev() {
165      if (siblings.length === 0) return;
166      if (offset === 0) return;
167      handleOffset(-1, 20);
168    }
169
170    function handleOffset(direction, shift) {
171      offset += direction;
172
173      var image = new Image();
174
175      $(image).load(function() {
176        hideWait();
177
178        if (viewTimeout !== undefined) clearTimeout(viewTimeout);
179
180        viewTimeout = setTimeout(function() {
181
182          viewTimeout = undefined;
183
184          lightboxImage.css({
185            'transition': 'none',
186            'opacity': 0,
187            'transform': 'translateX(' + direction * shift + 'px)'
188          });
189
190          lightboxImage.attr({
191            'src': ''
192          });
193
194          lightboxImage.height();
195
196          lightboxImage.attr({
197            'src': image.src
198          });
199          lightboxImage.data({
200            'width': image.width,
201            'height': image.height
202          });
203
204          position();
205
206          lightboxImage.height();
207          lightboxImage.css({
208            'transition': 'opacity 0.2s, transform 0.2s',
209            'opacity': 1,
210            'transform': 'none'
211          });
212          caption.css({
213            'transition': 'opacity 0.2s',
214            'opacity': 1
215          });
216
217          setTitle();
218
219        }, 300);
220      });
221
222      lightboxImage.css({
223        'transition': 'opacity 0.2s, transform 0.2s',
224        'opacity': 1,
225        'transform': 'none'
226      });
227      lightboxImage.height();
228      lightboxImage.css({
229        'opacity': 0,
230        'transform': 'translateX(' + (direction * shift * -1) + 'px)'
231      });
232
233      startWait();
234      image.src = siblings.eq(offset).attr('href');
235    }
236
237    function setTitle() {
238      var title = siblings.eq(offset).attr('title') === undefined ? '' : siblings.eq(offset).attr('title');
239      if (siblings.length > 1) {
240        if (title !== '') title += ' ';
241        title += '(' + (offset + 1) + '/' + siblings.length + ')';
242      }
243      caption.html(title);
244    }
245
246    function setPrevNext() {
247      if (siblings.length > 0) {
248        if (offset > 0) {
249          goprev.css('display', 'block');
250        } else {
251          goprev.css('display', 'none');
252        }
253        if (offset < siblings.length - 1) {
254          gonext.css('display', 'block');
255        } else {
256          gonext.css('display', 'none');
257        }
258      } else {
259        goprev.css('display', 'none');
260        gonext.css('display', 'none');
261      }
262    }
263
264    function showWait() {
265      waitTimeout = undefined;
266      wait.css('opacity', 1);
267    }
268
269    function hideWait() {
270      if (waitTimeout !== undefined) clearTimeout(waitTimeout);
271      wait.css('opacity', 0);
272    }
273
274    function startWait() {
275      if (waitTimeout === undefined) {
276        waitTimeout = setTimeout(showWait, 300);
277      }
278    }
279
280    function handleTouchEnd(e) {
281      if (siblings.length === 0) return;
282      handleEnd();
283    }
284
285    function handleTouchMove(e) {
286      if (siblings.length === 0) return;
287      if (e.originalEvent.touches.length == 1) {
288        handleMove(e.originalEvent.touches[0].pageX);
289        e.preventDefault();
290      }
291    }
292
293    function handleTouchStart(e) {
294      if (siblings.length === 0) return;
295      if (e.originalEvent.touches.length == 1) {
296        handleStart(e.originalEvent.touches[0].pageX);
297        e.preventDefault();
298      }
299    }
300
301    function handleMouseDown(e) {
302      if (e.originalEvent.pointerType === 'touch') {
303        handleStart(e.pageX);
304      }
305    }
306
307    function handleMouseMove(e) {
308      if (e.originalEvent.pointerType === 'touch') {
309        handleMove(e.pageX);
310        e.preventDefault();
311      }
312    }
313
314    function handleMouseUp(e) {
315      if (e.originalEvent.pointerType === 'touch') {
316        handleEnd();
317      }
318    }
319
320
321    function handleStart(x) {
322      drag = true;
323      lastx = x;
324      newx = lastx;
325    }
326
327    function handleMove(x) {
328      if (drag) {
329
330        newx = x;
331
332        var translate = lastx - newx;
333
334        if (offset <= 0) {
335          if (translate < 0) translate = 0;
336        }
337        if (offset >= siblings.length - 1) {
338          if (translate > 0) translate = 0;
339        }
340
341        var opacity = 1 - Math.abs(translate) / 300;
342
343        if (opacity < 0) opacity = 0;
344        if (opacity > 1) opacity = 1;
345
346        lightboxImage.css({
347          'transition': 'none',
348          'transform': 'translateX(' + (-translate) + 'px)',
349          'opacity': opacity
350        });
351
352        caption.css({
353          'transition': 'opacity 0.2s',
354          'opacity': 0
355        });
356
357      }
358    }
359
360    function handleEnd() {
361		
362	  if (drag) {	
363		  drag=false;
364	  
365		  var change = 0;
366
367		  var translate = lastx - newx;
368
369		  if (translate > 100 && offset < siblings.length - 1) {
370			change = 1;
371		  }
372		  if (translate < -100 && offset > 0) {
373			change = -1;
374		  }
375
376		  if (change !== 0) {
377			handleOffset(change, Math.abs(translate * 2));
378			caption.css({
379			  'transition': 'opacity 0.2s',
380			  'opacity': 0
381			});
382		  } else {
383			lightboxImage.css({
384			  'transition': 'opacity 0.2s, transform 0.2s',
385			  'opacity': 1,
386			  'transform': 'none'
387			});
388			caption.css({
389			  'transition': 'opacity 0.2s',
390			  'opacity': 1
391			});
392		  }
393	  }
394
395    }
396
397    function showLightBox(e) {
398
399      e.preventDefault();
400
401      siblings = $(this).parents('.sqrlbgroup').find('a.sqrlblink');
402      offset = siblings.index(this);
403
404      if (backdrop === undefined) {
405        backdrop = $('<div>', {
406          class: 'sqrlbbackdrop'
407        });
408        wait = $('<div>', {
409          class: 'sqrlbwait'
410        });
411        closer = $('<div>', {
412          class: 'sqrlbclose'
413        });
414        gonext = $('<div>', {
415          class: 'sqrlbnext'
416        });
417        goprev = $('<div>', {
418          class: 'sqrlbprev'
419        });
420        caption = $('<div>', {
421          class: 'sqrlbcaption'
422        });
423        lightboxImage = $('<img>');
424
425        backdrop.append(wait);
426        backdrop.append(closer);
427        backdrop.append(gonext);
428        backdrop.append(goprev);
429        backdrop.append(caption);
430        backdrop.append(lightboxImage);
431
432        gonext.on('click', handleNext);
433        goprev.on('click', handlePrev);
434        closer.on('click', close);
435
436        lightboxImage.on('touchstart', handleTouchStart);
437        lightboxImage.on('touchend', handleTouchEnd);
438        lightboxImage.on('touchmove', handleTouchMove);
439        lightboxImage.on('pointerdown', handleMouseDown);
440        lightboxImage.on('pointerup', handleMouseUp);
441        lightboxImage.on('pointermove', handleMouseMove);
442
443        $('body').append(backdrop);
444      }
445
446      $(window).on('resize', position);
447      $(window).on('keydown', handleKeyboard);
448
449      lightboxImage.css('display', 'none');
450      goprev.css('display', 'none');
451      gonext.css('display', 'none');
452      backdrop.css({
453        'display': 'block',
454        'opacity': '0'
455      });
456      backdrop.height();
457      backdrop.css({
458        'opacity': '1'
459      });
460
461      var image = new Image();
462
463      $(image).load(function() {
464        lightboxImage.attr('src', image.src);
465        lightboxImage.data({
466          'width': image.width,
467          'height': image.height
468        });
469        lightboxImage.css({
470          'transition': 'none',
471          'opacity': 0,
472          'transform': 'scale(0.9)',
473          'display': 'block'
474        });
475        lightboxImage.height();
476        lightboxImage.css({
477          'transition': 'opacity 0.2s, transform 0.2s',
478          'opacity': 1,
479          'transform': 'none'
480        });
481        caption.css({
482          'opacity': 1
483        });
484
485
486        position();
487        hideWait();
488        setTitle();
489      });
490
491      startWait();
492      image.src = $(this).attr('href');
493    }
494
495    $(this).each(function() {
496      $(this).on('click', showLightBox);
497    });
498
499  };
500  
501  $.fn.sqrPicProtect = function () {
502	  $(this).each(function() {
503		$(this).on('contextmenu', 'img', function(e) {
504			e.preventDefault();
505		});
506	  });
507  };
508
509  $.fn.sqrForm = function() {
510    $(this).each(function() {
511      var form = $(this);
512      var fieldCaptchaCode = form.find('input[name="fgwcaptchacode"]');
513      var fieldCaptchaId = form.find('input[name="fgwcaptchaid"]');
514      var captchaImg = form.find('img');
515      var captchaUrl = form.attr('data-captchaurl');
516      var captchaOk = (captchaUrl === undefined);
517
518      function handleCaptchaResponse(data) {
519        if (data == 'ok') {
520          captchaOk = true;
521          form.submit();
522        } else {
523          var imgUrl = captchaImg.attr('src');
524          imgUrl = imgUrl.substr(0, imgUrl.indexOf('=') + 1) + data;
525          captchaImg.attr('src', imgUrl);
526          fieldCaptchaId.val(data);
527          fieldCaptchaCode.val('');
528          fieldCaptchaCode.addClass('sqrformerr');
529        }
530      }
531
532      function handleSubmit(e) {
533        form.find('.sqrformerr').removeClass('sqrformerr');
534        if (!captchaOk) {
535          var captchaId = fieldCaptchaId.val();
536          var captchaCode = fieldCaptchaCode.val();
537          $.post({
538            url: captchaUrl,
539            data: {
540              id: captchaId,
541              code: captchaCode
542            },
543            success: handleCaptchaResponse
544          });
545          e.preventDefault();
546        }
547
548        form.find('input[required]').each(function() {
549          if ($(this).attr('type') === 'checkbox') {
550            if (!($(this).prop('checked'))) {
551              $(this).parent('label').addClass('sqrformerr');
552              e.preventDefault();
553            }
554          } else if ($(this).attr('type') === 'email') {
555            if (!(/.*\@.*\..*/.test($(this).val()))) {
556              $(this).addClass('sqrformerr');
557              e.preventDefault();
558            }
559          } else {
560            if ($(this).val() === '') {
561              $(this).addClass('sqrformerr');
562              e.preventDefault();
563            }
564          }
565        });
566
567        form.find('textarea[required]').each(function() {
568          if ($(this).val() === '') {
569            $(this).addClass('sqrformerr');
570            e.preventDefault();
571          }
572        });
573      }
574
575      form.on('submit', handleSubmit);
576    });
577  };
578})(jQuery);
579
580$(document).ready(function() {
581  $('.sqracc').sqrAcc();
582  $('.sqrtablereflow').sqrTableReflow();
583  $('.sqrtabs').sqrTabs();
584  $('a.sqrlblink').sqrLightBox();
585  $('form.sqrformcheck').sqrForm();
586  $('.sqrpicprotect').sqrPicProtect();
587});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.