PageSourceSearch

https://borntraeger-cramer.com/js/compiled/website.js

js borntraeger-cramer.com collected 2026-10-02 23:28:17 UTC 21,719 bytes, 669 lines download raw bytes

1// Generated by CoffeeScript 2.6.1
2(function() {
3  var QUICKFIND_MAX_RESULTS, adminbars_hidden, adminbars_timer, currentSize, matchTerms, quickfindSearch, quickfind_db, quickfind_db_req, quickfind_previous_query, quickfind_selected_item, responsive, selectResult;
4
5  $(document).ready(function() {
6    return $('img.lightbox').click(function() {
7      var img, lightbox, zoomIn;
8      $('#lightbox').remove();
9      lightbox = $('<div></div>').attr('id', 'lightbox');
10      img = $('<div/>');
11      if (Modernizr.backgroundsize) {
12        img.css('background-image', 'url(' + $(this).attr('src') + ')');
13      } else {
14        $('<img/>').attr('src', $(this).attr('src')).appendTo(img);
15      }
16      zoomIn = function() {
17        img.css('top', 0);
18        img.css('left', 0);
19        img.css('height', '100%');
20        return img.css('width', '100%');
21      };
22      if (Modernizr.csstransitions) {
23        img.css('top', $(this).offset().top - $(document).scrollTop() + 'px');
24        img.css('left', $(this).offset().left - $(document).scrollLeft() + 'px');
25        img.css('width', $(this).innerWidth() + 'px');
26        img.css('height', $(this).innerHeight() + 'px');
27      } else {
28        zoomIn();
29      }
30      img.appendTo(lightbox);
31      lightbox.click(function() {
32        return $('#lightbox').fadeOut(500, function() {
33          return $('#lightbox').remove();
34        });
35      });
36      lightbox.hide();
37      lightbox.prependTo('body');
38      lightbox.fadeIn(500);
39      if (Modernizr.csstransitions) {
40        return setTimeout((function() {
41          return zoomIn();
42        }), 100);
43      }
44    });
45  });
46
47  $(document).ready(function() {
48    return $(".mc_calendar").each(function(i, element) {
49      var adjustSize, back, calendar, front, goToPage, imageDidLoad, month, name, nextPage, page, prevPage, results1, year;
50      calendar = $(element);
51      if (Modernizr.csstransforms3d) {
52        calendar.addClass('mc_calendar_3d');
53      }
54      year = calendar.attr("data-calendar-year");
55      name = calendar.attr("data-calendar-name");
56      calendar.attr("data-loaded-images", 0);
57      $("<div class=\"loading\"><div class=\"progress\"><div class=\"bar\" style=\"width:0%;\"></div></div><p>" + window.config.lstr['calendar_loading'] + "</p></div>").appendTo(calendar);
58      month = 0;
59      adjustSize = function() {
60        var h, p;
61        h = calendar.innerWidth() * (463 / 660);
62        p = calendar.attr('data-page');
63        if (p === "0") {
64          return calendar.parent().css("height", h + 'px');
65        } else {
66          return calendar.parent().css("height", (h * 2) + 'px');
67        }
68      };
69      goToPage = function(p) {
70        var forward, pp;
71        if (p > 12) {
72          p = 12;
73        }
74        if (p < 0) {
75          p = 0;
76        }
77        pp = calendar.attr("data-page");
78        if (pp === p) {
79          return;
80        }
81        forward = p > pp;
82        calendar.attr("data-page", p);
83        return calendar.find(".page").each(function(month, page) {
84          if (Modernizr.csstransforms3d) {
85            if (month + 2 === p || month + 1 === p || month === p || month === p + 1) {
86              $(page).css("display", "block");
87            } else {
88              $(page).css("display", "none");
89            }
90            if (month < p) {
91              $(page).css("-webkit-transform", "rotateX(180deg)");
92              $(page).css("-moz-transform", "rotateX(180deg)");
93              $(page).css("transform", "rotateX(180deg)");
94            } else {
95              $(page).css("-webkit-transform", "rotateX(0deg)");
96              $(page).css("-moz-transform", "rotateX(0deg)");
97              $(page).css("transform", "rotateX(0deg)");
98            }
99            if ((forward && month < p) || (!forward && month <= p)) {
100              // Upper stack
101              $(page).css("z-index", 20 + month);
102            } else {
103              // Lower stack
104              $(page).css("z-index", 19 - month);
105            }
106          } else {
107            if (month === p) {
108              $(page).show();
109              $(page).children(".front").show();
110              $(page).children(".back").hide();
111              $(page).css("bottom", "0");
112              $(page).css("top", "auto");
113            } else if (month === (p - 1)) {
114              $(page).show();
115              $(page).children(".front").hide();
116              $(page).children(".back").show();
117              $(page).css("bottom", "auto");
118              $(page).css("top", "0");
119            } else {
120              $(page).hide();
121            }
122          }
123          return adjustSize();
124        });
125      };
126      $(window).resize(function() {
127        return adjustSize();
128      });
129      nextPage = function() {
130        var p;
131        p = calendar.attr("data-page");
132        return goToPage(++p);
133      };
134      prevPage = function() {
135        var p;
136        p = calendar.attr("data-page");
137        return goToPage(--p);
138      };
139      imageDidLoad = function() {
140        i = calendar.attr("data-loaded-images");
141        i++;
142        calendar.attr("data-loaded-images", i);
143        if (i >= 26) {
144          goToPage(0);
145          calendar.children(".loading").remove();
146          return calendar.children(".page").show();
147        } else {
148          return calendar.children(".loading").children(".progress").children(".bar").css("width", ((i / 26) * 100) + "%");
149        }
150      };
151      results1 = [];
152      while (month <= 12) {
153        page = $("<div>").addClass("page");
154        page.css("z-index", 20 - month);
155        front = $("<img>").addClass("front").click(function(e) {
156          return nextPage();
157        }).load(function(e) {
158          return imageDidLoad();
159        }).appendTo(page);
160        back = $("<img>").addClass("back").click(function(e) {
161          return prevPage();
162        }).load(function(e) {
163          return imageDidLoad();
164        }).appendTo(page);
165        if (!Modernizr.csstransforms3d) {
166          page.children(".back").hide();
167        }
168        page.hide();
169        page.appendTo(calendar);
170        front.attr("src", "/resources/images/calendars/" + name + "/" + year + "_" + month + ".jpg");
171        back.attr("src", "/resources/images/calendars/" + name + "/" + year + "_" + month + "_back.jpg");
172        results1.push(month++);
173      }
174      return results1;
175    });
176  });
177
178  currentSize = null;
179
180  responsive = function() {
181    var h, size, width;
182    // Ensure that the content height fits left/right sidebars
183    h = $(window).innerHeight() - 120 - 120 - 85;
184    h = Math.max(h, $('#sidebar_left').innerHeight());
185    h = Math.max(h, $('#sidebar_right').innerHeight());
186    $('#content').css('min-height', h + 'px');
187    width = $(window).innerWidth();
188    if (width <= 500) {
189      // The following widths must match the _constants.less media queries!
190      size = 's';
191    }
192    if (width > 500 && width <= 800) {
193      size = 'm';
194    }
195    if (width > 800 && width <= 1100) {
196      size = 'l';
197    }
198    if (width > 1100) {
199      size = 'xl';
200    }
201    if (size !== currentSize) {
202      currentSize = size;
203      if (size === 's') {
204        $('#menu').hide();
205      } else {
206        $('#menu').show();
207      }
208      if (size === 's' || size === 'm') {
209        // Move the right sidebar down after the content
210        $('#sidebar_right').insertAfter('#contentstripe');
211      }
212      if (size === 'l') {
213        // Move the right sidebar to the left below the menu
214        $('#sidebar_right').appendTo('#sidebar_left');
215      }
216      if (size === 'xl') {
217        // Move the right sidebar to the original position on the right
218        return $('#sidebar_right').insertAfter('#sidebar_left');
219      }
220    }
221  };
222
223  $(document).ready(function() {
224    $('#menu_button').click(function() {
225      if (!$('#menu').is(":visible")) {
226        $('#menu').slideDown(500);
227      } else {
228        $('#menu').slideUp(500);
229      }
230      return $('#menu_button > span').toggle();
231    });
232    return responsive();
233  });
234
235  $(window).resize(function() {
236    return responsive();
237  });
238
239  if (window.location.pathname === '/shop/checkout') {
240    $(function() {
241      var areas, field, k, label, len, paymentOptions, ref, row, selectArea, selectCountry, toISOLatin1;
242      toISOLatin1 = function(string) {
243        if (window.config.version === 2) {
244          return string;
245        } else {
246          return decodeURIComponent(escape(string));
247        }
248      };
249      areas = JSON.parse($('#country_administrative_areas').html());
250      ref = ['country', 'shipping_country'];
251      for (k = 0, len = ref.length; k < len; k++) {
252        field = ref[k];
253        selectCountry = $('select[name="form_checkout_' + field + '"]');
254        selectArea = $('select[name="form_checkout_' + field + '_area"]');
255        label = $('label[for="form_checkout_' + field + '_area"]');
256        row = selectArea.parent().parent();
257        (function(selectCountry, selectArea, row, label) {
258          return selectCountry.change(function() {
259            var id, item, l, len1, ref1;
260            id = selectCountry.val();
261            selectArea.children(':not([value=""])').remove();
262            if (id in areas) {
263              ref1 = areas[id].areas;
264              for (l = 0, len1 = ref1.length; l < len1; l++) {
265                item = ref1[l];
266                $('<option></option>').attr('value', item.laufnr).html(toISOLatin1(item.name)).appendTo(selectArea);
267              }
268              label.html(toISOLatin1(areas[id].label));
269              row.css('visibility', 'visible');
270              return row.show();
271            } else {
272              row.css('visibility', 'hidden');
273              return row.hide();
274            }
275          });
276        })(selectCountry, selectArea, row, label);
277      }
278      paymentOptions = $('input[name="form_checkout_payment_type"]');
279      paymentOptions.each(function(i, option) {
280        if ($(option).prop('checked')) {
281          return $('.payment_info_' + $(option).val()).show();
282        }
283      });
284      return paymentOptions.change(function() {
285        $('.payment_info').hide();
286        return $('.payment_info_' + $(this).val()).show();
287      });
288    });
289  }
290
291  $(document).ready(function() {
292    $('.collapse_scope').each(function(i, element) {
293      var collapsed, container, state, toggle;
294      container = $(element);
295      state = container.attr('data-expanded');
296      collapsed = true;
297      if ((state != null) && (state === 1 || state === '1')) {
298        collapsed = false;
299      }
300      toggle = function(collapsedOverride, animationOverride) {
301        var animate, toHide, toShow;
302        if (collapsedOverride != null) {
303          collapsed = collapsedOverride;
304        } else {
305          collapsed = !collapsed;
306        }
307        toHide = container.find('.hide_when_collapsed');
308        toShow = container.find('.hide_when_expanded');
309        if (!collapsed) {
310          [toHide, toShow] = [toShow, toHide];
311        }
312        animate = function(element, hide, animation) {
313          if (animation === 'none') {
314            if (hide) {
315              element.hide();
316            }
317            if (!hide) {
318              return element.show();
319            }
320          } else if (animation === 'fade') {
321            if (hide) {
322              element.fadeOut(300);
323            }
324            if (!hide) {
325              return element.fadeIn(300);
326            }
327          } else if (animation === 'slide') {
328            if (hide) {
329              element.slideUp(300);
330            }
331            if (!hide) {
332              return element.slideDown(300);
333            }
334          }
335        };
336        toHide.each(function(j, element) {
337          var a;
338          a = animationOverride;
339          if (a == null) {
340            a = $(element).attr('data-animation');
341          }
342          if (a == null) {
343            a = 'none';
344          }
345          return animate($(element), true, a);
346        });
347        return toShow.each(function(j, element) {
348          var a;
349          a = animationOverride;
350          if (a == null) {
351            a = $(element).attr('data-animation');
352          }
353          if (a == null) {
354            a = 'none';
355          }
356          return animate($(element), false, a);
357        });
358      };
359      container.find('.collapse_toggle').click(function() {
360        return toggle();
361      });
362      container.find('.collapse_collapse').click(function() {
363        return toggle(true);
364      });
365      container.find('.collapse_expand').click(function() {
366        return toggle(false);
367      });
368      container.find('.collapse_checked').change(function() {
369        return toggle($(this).prop('checked'));
370      });
371      container.find('.collapse_not_checked').change(function() {
372        return toggle(!($(this).prop('checked')));
373      });
374      return toggle(collapsed, 'none');
375    });
376    return $('input[name=form_login_submittype]').change(function() {
377      if ($('.shop_noaccount').prop('checked')) {
378        $('.hide_when_noaccount').hide();
379        return $('.show_when_noaccount').show();
380      } else {
381        $('.hide_when_noaccount').show();
382        return $('.show_when_noaccount').hide();
383      }
384    });
385  });
386
387  window.lockPage = function(lockText) {
388    $("#locked_text").text(lockText);
389    $(".hideonlock").hide();
390    return $("#locked").show();
391  };
392
393  window.openPopup = function(url, name) {
394    var height, params, popup_window, width, x, y;
395    width = screen.availWidth * 0.9;
396    height = screen.availHeight - 20;
397    x = (screen.width - width) / 2;
398    y = (screen.height - height) / 2;
399    params = "";
400    params += "menubar=no";
401    params += ",toolbar=no";
402    params += ",scrollbars=yes";
403    params += ",copyhistory=no";
404    params += ",location=no";
405    params += ",height=" + height;
406    params += ",width=" + width;
407    params += ",left=" + x;
408    params += ",top=" + y;
409    popup_window = window.open(url, name, params);
410    if (name === 'admin_popup') {
411      setTimeout(function() {
412        popup_window.moveTo(x, y);
413        return popup_window.resizeTo(width, height);
414      }, 1000);
415    }
416    return popup_window.focus();
417  };
418
419  window.reader_popup = function(resource) {
420    return openPopup("/services/reader?resource=" + resource, "reader_popup");
421  };
422
423  window.admin_popup = function(url) {
424    return openPopup(url, "admin_popup");
425  };
426
427  adminbars_hidden = true;
428
429  adminbars_timer = null;
430
431  $(document).ready(function() {
432    var $root;
433    $('input[type=text], input[type=search], input[type=password]').blur(function(e) {
434      var defaultText;
435      defaultText = $(this).attr('title');
436      if ((defaultText != null) && $(this).val() === '') {
437        $(this).val(defaultText);
438        return $(this).addClass('default_text');
439      }
440    }).focus(function(e) {
441      if ($(this).hasClass('default_text')) {
442        $(this).val('');
443        return $(this).removeClass('default_text');
444      }
445    }).each(function(i, input) {
446      return $(input).blur();
447    });
448    $root = $("html, body");
449    $("a").click(function() {
450      var href;
451      href = $.attr(this, "href");
452      if ((href != null) && href.substr(0, 1) === '#') {
453        if (href === '#') {
454          href = 'html';
455        }
456        $root.animate({
457          scrollTop: $(href).offset().top
458        }, 500, function() {
459          return window.location.hash = href;
460        });
461        return false;
462      }
463    });
464    return $('.admin_debug_log > span').each(function(i, element) {
465      $(element).click(() => {
466        var k, level, ref, results1;
467        $('.admin_debug_log .message').hide();
468        $('.admin_debug_log > span').removeClass('active');
469        $(element).addClass('active');
470        results1 = [];
471        for (level = k = ref = i; (ref <= 10 ? k <= 10 : k >= 10); level = ref <= 10 ? ++k : --k) {
472          results1.push($('.admin_debug_log .message_log_level_' + level).show());
473        }
474        return results1;
475      });
476      if (i === 1) {
477        return $(element).trigger('click');
478      }
479    });
480  });
481
482  $(document).ready(function() {
483    return $('.featured_items').each(function(i, container) {
484      var moveToItem, timer;
485      timer = null;
486      $(container).attr('data-index', 0);
487      moveToItem = function(index) {
488        var children;
489        clearTimeout(timer);
490        children = $(container).children('.item');
491        children.each(function(j, item) {
492          return $(item).css('left', ((j - index) * 100) + '%');
493        });
494        $(container).children('.links').children('a').each(function(j, link) {
495          if (j === index) {
496            return $(link).addClass('current');
497          } else {
498            return $(link).removeClass('current');
499          }
500        });
501        return timer = setTimeout((function() {
502          return moveToItem((index + 1) % children.length);
503        }), 6000);
504      };
505      $(container).children('.links').children('a').each(function(j, link) {
506        return $(link).click(function() {
507          return moveToItem(j);
508        });
509      });
510      return moveToItem(0);
511    });
512  });
513
514  quickfind_db = void 0;
515
516  quickfind_db_req = void 0;
517
518  quickfind_selected_item = -1;
519
520  quickfind_previous_query = "";
521
522  QUICKFIND_MAX_RESULTS = 15;
523
524  $(document).ready(function() {
525    $('#site_search').focus(function() {
526      if ((quickfind_db == null) && (quickfind_db_req == null)) {
527        return quickfind_db_req = $.ajax('/resources/quickfind.json', {
528          beforeSend: function(xhr) {
529            return xhr.overrideMimeType('application/json; charset=utf-8');
530          },
531          dataType: 'text',
532          success: function(data, status) {
533            quickfind_db = $.parseJSON(data);
534            return quickfindSearch();
535          },
536          error: function(xhr, status, error) {
537            return console.log('Failed to load quickfind data');
538          }
539        });
540      } else {
541        return quickfindSearch();
542      }
543    });
544    $('#site_search').blur(function() {
545      return $('#quickfind').hide();
546    });
547    $('#site_search').keyup(function() {
548      if ($('#site_search').val() !== quickfind_previous_query) {
549        quickfind_previous_query = $('#site_search').val();
550        return quickfindSearch();
551      }
552    });
553    return $('#site_search').keydown(function(e) {
554      var i, move, results, url;
555      move = 0;
556      i = quickfind_selected_item;
557      if (e.keyCode === 38) {
558        move = -1;
559      } else if (e.keyCode === 40) {
560        move = 1;
561      }
562      if (move !== 0) {
563        results = $('#quickfind > .result').length;
564        if (results === 0) {
565          return;
566        }
567        i += move;
568        if (i < 0) {
569          i = results - 1;
570        }
571        if (i > (results - 1)) {
572          i = 0;
573        }
574        selectResult(i);
575        e.preventDefault();
576      }
577      if (e.keyCode === 13 && i > 0) {
578        url = $('#quickfind > .result').eq(i).attr('data-url');
579        location.href = url;
580        return e.preventDefault();
581      }
582    });
583  });
584
585  selectResult = function(i) {
586    quickfind_selected_item = i;
587    $('#quickfind > .result').removeClass('selected');
588    return $('#quickfind > .result').eq(i).addClass('selected');
589  };
590
591  quickfindSearch = function() {
592    var count, i, item, k, len, query, result, results1, title;
593    if (quickfind_db == null) {
594      return;
595    }
596    // replace < and > with &lt; and &gt; to prevent XSS (see INTERN-163)
597    query = $('#site_search').val().replace(/</g, '&lt;').replace(/>/g, '&gt;');
598    $('#quickfind').hide();
599    $('#quickfind').empty();
600    quickfind_selected_item = -1;
601    count = 0;
602    if (query === '') {
603      return;
604    }
605    result = $('<div/>').addClass('result').addClass('result_default');
606    $('<span/>').addClass('title').html("<b>" + window.config.lstr['quickfind_search'] + " '" + query + "'</b>...").appendTo(result);
607    result.appendTo('#quickfind');
608    $('#quickfind').show();
609    results1 = [];
610    for (k = 0, len = quickfind_db.length; k < len; k++) {
611      item = quickfind_db[k];
612      if (matchTerms(query, item['q'])) {
613        result = $('<div/>').addClass('result');
614        if ((item['l'] != null)) {
615          title = item['l'];
616        }
617        if (!(item['l'] != null)) {
618          title = item['l_' + window.config.language];
619        }
620        $('<span/>').addClass('title').text(title).appendTo(result);
621        $('<span/>').addClass('type').text(window.config.lstr['quickfind_type_' + item['t']]).appendTo(result);
622        result.attr('data-url', item['u']);
623        i = count;
624        result.mousemove(function(e) {
625          return selectResult($(this).index());
626        });
627        result.mousedown(function(e) {
628          return location.href = $(this).attr('data-url');
629        });
630        result.appendTo('#quickfind');
631        count++;
632        if (count >= QUICKFIND_MAX_RESULTS) {
633          break;
634        } else {
635          results1.push(void 0);
636        }
637      } else {
638        results1.push(void 0);
639      }
640    }
641    return results1;
642  };
643
644  matchTerms = function(queryStr, termsStr) {
645    var k, l, len, len1, match, queryMatch, queryTerm, queryTerms, term, terms;
646    terms = termsStr.split(" ");
647    queryTerms = queryStr.split(" ");
648    match = true;
649    for (k = 0, len = queryTerms.length; k < len; k++) {
650      queryTerm = queryTerms[k];
651      queryTerm = queryTerm.toLowerCase();
652      if ((queryTerm == null) || queryTerm === "") {
653        continue;
654      }
655      queryMatch = false;
656      for (l = 0, len1 = terms.length; l < len1; l++) {
657        term = terms[l];
658        term = term.toLowerCase();
659        if (term.indexOf(queryTerm) !== -1) {
660          queryMatch = true;
661          break;
662        }
663      }
664      match = match && queryMatch;
665    }
666    return match;
667  };
668
669}).call(this);

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.