PageSourceSearch

https://www.kirche-bremen.de/_assets/66c271c4118578a0afd46be1d9f75…/liturgical-calendar.js?1790079470

js kirche-bremen.de collected 2026-10-01 12:21:26 UTC 8,978 bytes, 240 lines download raw bytes

1(function($) {
2
3    var $liturgicalCalendar = $('.liturgical-calendar');
4
5    if (typeof(liturgicalCalendar) !== 'undefined' && $liturgicalCalendar.length) {
6        var $churchYear = $('#church-year');
7        var listTemplate = $("#template-litcal-list").html();
8        var dropdownTemplate = $("#template-litcal-dropdown").html();
9
10        Mustache.parse(listTemplate);
11
12        Mustache.parse(dropdownTemplate);
13
14        $liturgicalCalendar.on('click', '.liturgical-calendar__change-button', function () {
15
16            var $view = $('.liturgical-calendar__calendar-view');
17
18            $('.liturgical-calendar__change-button').toggleClass('selected');
19
20            if ($(this).hasClass('liturgical-calendar__change-button--linear')) {
21                $view.removeClass('selected').delay(500).queue(function () {
22                    $view
23                        .addClass('liturgical-calendar__calendar-view--linear')
24                        .removeClass('liturgical-calendar__calendar-view--radial')
25                        .addClass('selected')
26                        .dequeue();
27                });
28            } else {
29                $view.removeClass('selected').delay(500).queue(function () {
30                    $view
31                        .addClass('liturgical-calendar__calendar-view--radial')
32                        .removeClass('liturgical-calendar__calendar-view--linear')
33                        .addClass('selected')
34                        .dequeue();
35                });
36            }
37
38        });
39
40        $liturgicalCalendar.on('click', '.liturgical-calendar-day__content', function () {
41
42            var $columnMore = $(this).find('.liturgical-calendar-day__column--more');
43
44            if (!$(this).hasClass('opened')) {
45                $('.liturgical-calendar-day__content').removeClass('opened');
46                $('.liturgical-calendar-day__column--more').removeClass('rotate-180');
47                $('.liturgical-calendar-day__row-details').slideUp(300);
48                $(this).addClass('opened');
49                $columnMore.addClass('rotate-180');
50                $(this).closest('.liturgical-calendar-day').find('.liturgical-calendar-day__row-details').slideDown(300);
51            }
52            else {
53                $(this).removeClass('opened');
54                $columnMore.removeClass('rotate-180');
55                $(this).closest('.liturgical-calendar-day').find('.liturgical-calendar-day__row-details').slideUp(300);
56            }
57
58        });
59
60        var initHolidaySuggest = function () {
61            var $formFieldHoliday = $('.form__field--holiday');
62            var $holidayOptions = $formFieldHoliday.find('.form-field__suboptions > li');
63            var $holidayPeriods = $formFieldHoliday.find('.form-field__option');
64
65            var contentMap = [];
66
67            $holidayOptions.each(function () {
68                contentMap.push({
69                    text: $(this).text().trim().toLowerCase(),
70                    elm: $(this),
71                    periodElm: $(this).closest('.form-field__option')
72                });
73            });
74
75            $liturgicalCalendar.find('[data-suggest]').on('keydown', function () {
76                var delay;
77                var $this = $(this);
78
79                delay = setTimeout(function () {
80                    clearTimeout(delay);
81                    var s = $this.val().toLowerCase();
82
83                    if (s.length > 1) {
84                        $holidayPeriods.hide();
85                        $holidayOptions.hide();
86                        for (var i = 0; i < contentMap.length; i++) {
87                            var option = contentMap[i];
88                            if (option.text.indexOf(s) !== -1) {
89                                option.elm.show();
90                                option.periodElm.show();
91                            }
92                        }
93                    } else {
94                        $holidayPeriods.show();
95                        $holidayOptions.show();
96                    }
97                }, 500);
98            });
99        };
100
101
102        //
103        // Tooltip
104        //
105        var $tooltip = $('<div class="liturgical-calendar-tooltip" style="display: none"><span class="liturgical-calendar-tooltip__text"></span></div>');
106        var tooltipTimeout;
107
108        $('body').append($tooltip);
109
110        $churchYear.on('mouseenter', '.church-year__day', function () {
111            clearTimeout(tooltipTimeout);
112            $tooltip.show();
113            $tooltip.children().html($(this).data('date') + ' ' + $(this).data('title'));
114        });
115
116        $churchYear.on('mousemove', function (event) {
117            var top = event.pageY - 60;
118            var left = event.pageX - 13;
119            var tooltipWidth = $tooltip.get(0).getBoundingClientRect().width;
120
121            if ( tooltipWidth + left > window.innerWidth) {
122                $tooltip.addClass('liturgical-calendar-tooltip--invert');
123                left -= tooltipWidth - 24;
124            } else {
125                $tooltip.removeClass('liturgical-calendar-tooltip--invert');
126            }
127
128            $tooltip.css({top: top, left: left});
129        });
130
131        $churchYear.on('mouseleave', '.church-year__day', function () {
132            clearTimeout(tooltipTimeout);
133            tooltipTimeout = setTimeout(function () {
134                $tooltip.hide();
135            }, 50);
136        });
137
138        //
139        // Select day
140        //
141        var goToHolidayEvent = function () {
142            var $this = $(this);
143            var $listItem = $liturgicalCalendar.find('#litday-'+$this.data('id'));
144
145            $('html,body').animate({
146                scrollTop: $listItem.offset().top - 165
147            }, 1000);
148
149            setTimeout(function() {
150                $listItem.find('.liturgical-calendar-day__content').click();
151            }, 1000);
152        };
153
154        $churchYear.on('click', '.church-year__day', goToHolidayEvent);
155
156
157        // $('.church-year').on('mouseenter', '.church-year__period', function() {
158        //     $(this).addClass('church-year__period--active');
159        // });
160        //
161        // $('.church-year').on('mouseleave', '.church-year__period', function() {
162        //     $(this).removeClass('church-year__period--active');
163        // });
164
165
166        $('.form__field--year').find('[data-url]').on('click', function () {
167            var $this = $(this);
168            $.get($this.data('url'), function (data) {
169                $('.liturgical-calendar__current-pericope').html(data.state.currentPericope);
170                initializeFrontend(data);
171            });
172        });
173
174        var buildChurchYearSvg = function (data) {
175            $churchYear.churchYearSvg({size: 462, periods: data.periods});
176        };
177
178        var initializeFrontend = function (data) {
179
180
181            var animationTime = $churchYear.churchYearSvg('isReady') ? 1000 : 250;
182
183            $('.liturgical-calendar__circle').animate({opacity: 0}, animationTime, function () {
184                buildChurchYearSvg(data);
185                goTo(data.state.currentPos);
186                $('.liturgical-calendar__circle').animate({opacity: 1}, 1000, function () {
187                    $('.church-year__period[data-date="' + data.state.currentPeriodDate + '"]').addClass('church-year__period--active');
188                });
189            });
190
191
192            var arrayToList = function(object) {
193                if(object === null) return '';
194
195                if(typeof object === 'object') {
196                    return '<ul><li>' + object.join('</li><li>') + '</li></ul>';
197                } else {
198                    return object;
199                }
200            };
201
202
203            $('.liturgical-calendar__list-view').children('.container').html(Mustache.render(listTemplate, {
204                periods: data.periods,
205                songList: function() {
206                    if(this.songs !== null && typeof this.songs === 'object') {
207                        return this.songs.join(', ');
208                    }
209                    return '';
210                },
211                marginaliaList: function() {
212                    return arrayToList(this.marginalia);
213                },
214                psalmList: function() {
215                    return arrayToList(this.psalm);
216                }
217            }));
218            $('.form__field--holiday').html(Mustache.render(dropdownTemplate, {periods: data.periods}));
219
220
221            $('.form__field--holiday').find('[data-id]').on('click', goToHolidayEvent);
222
223            initHolidaySuggest();
224            $(document).formDropdown();
225        };
226
227        // @todo: gehört raus in die nkChurchYearSvg
228        var goTo = function (number) {
229            var sizeStepDeg = 360 / $churchYear.churchYearSvg('getNumDays');
230            var deg = sizeStepDeg * number * -1;
231            $churchYear.css('transform', 'rotate(' + deg + 'deg)');
232        };
233
234        $(function () {
235            initializeFrontend(liturgicalCalendar);
236        });
237    }
238
239})(jQuery);
240

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.