PageSourceSearch

https://staatstheater-hannover.de/register-login/media/js/register-login.js

js staatstheater-hannover.de collected 2026-09-24 09:41:55 UTC 41,563 bytes, 1,196 lines download raw bytes

1
2//   REGISTER LOGIN start
3
4var isWebcalendar = false;        
5
6
7function validateRegisterLoginLayerPasswordFields() {
8    $valid = true;
9    $password = $('input[name="new_password"]').val();
10
11    $('.password-not-same-error, .password-not-strong-error').hide();
12
13    var strengthRequired = 0;
14    var strength = 0;
15    var arrRequired = [/.{10,}/];
16    jQuery.map(arrRequired, function (regexp) {
17        if ($password.match(regexp))
18            strengthRequired++;
19    });
20    var arr = [/.{10,}/, /[a-z]+/, /[0-9]+/, /[A-Z]+/];
21    jQuery.map(arr, function (regexp) {
22        if ($password.match(regexp))
23            strength++;
24    });
25
26    if (strengthRequired < 1 || strength < 4) {
27        $valid = false;
28        $('.password-not-strong-error').fadeIn(666);
29        $('input.register-password').addClass('has-error');
30    }
31
32    return $valid;
33}
34
35function isEmail(email) {
36    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
37    return regex.test(email);
38}
39
40function closeRegisterLoginLayer() {
41    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
42    $('.register-login-layer').html('');
43}
44
45function registerRegisterLoginLayerMenuButton() {
46    // CLOSE BUTTON
47    $('button.register-login-layer-close-button').on('click', function () {
48        closeRegisterLoginLayer();
49    });
50
51    // TAB BUTTONS
52    $('button.menu-button').on('click', function () {
53        var nextTabId = $(this).data('tab-id');
54        $('button.menu-button').removeClass('active');
55        $(this).addClass('active');
56        $('.register-login-layer-tab').removeClass('active');
57        $('.register-login-layer-tab[data-tab-id="' + nextTabId + '"]').addClass('active');
58
59        switch (nextTabId) {
60            case 1:
61                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
62                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="1"]').addClass('active');
63                $('.register-login-layer-tab[data-tab-id="1"] input[name="barcode"]').focus();
64                break;
65            case 2:
66                $('.register-login-layer-tab[data-tab-id="2"] input[name="email"]').focus();
67                break;
68        }
69    });
70}
71
72function sendPasswordMail() {
73    if (isEmail($('input[name="account"]').val())) {
74
75        var tokenPage = 'https://' + window.location.hostname + window.location.pathname;
76
77        if (typeof $('.register-login-layer').data('dynamic-token-url') !== "undefined" && $('.register-login-layer').data('dynamic-token-url') === false) {
78            tokenPage = null;
79        }
80
81        var body = {
82            m: "send_password_mail",
83            project: $('.register-login-layer').data('project'),
84            account: $('input[name="account"]').val(),
85            token_page: tokenPage,
86            item_id: $('.register-login-layer').data('item-id'),
87            item_type: $('.register-login-layer').data('item-type')
88        };
89
90        CbUx.showLoader();
91        $.post("/register-login/api/register_login", body, function (data) {
92            CbUx.hideLoader();
93            $('.forgot-password').hide();
94            if (data.success === true) {
95                $('.forgot-password-message').html(data.message);
96            } else {
97                $('.forgot-password-message').html('error');
98            }
99        });
100    } else {
101        $('.old-account-message').show();
102    }
103
104}
105
106function updateMenuButtonText() {
107    $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text'));
108}
109
110function registerRegisterLoginLayerContainerButtons(closeCallbackFunction) {
111
112    // CHECK ACCOUNT BUTTON
113    function checkAccountRegisterLogin() {
114        //        if (isEmail($.trim($('input[name="account"]').val()))) {
115        var body = {
116            m: 'check_account',
117            account: $('input[name="account"]').val(),
118            project: $('.register-login-layer').data('project'),
119            language_id: ENV.id_language
120        };
121
122        CbUx.showLoader();
123        $.get("/register-login/api/register_login", body, function (data) {
124            CbUx.hideLoader();
125
126            if (data.success === true) {
127                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
128                $('input.regular-login').removeClass('has-error');
129                $('.old-account-message').hide();
130                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="11"]').addClass('active');
131                $('input[name="old_account"]').val($('input[name="account"]').val());
132                $('input[name="password"]').focus();
133                updateMenuButtonText();
134            } else if (data.success === "ACCOUNT_NOT_FINISCHED") {
135                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
136                $('input.regular-login').removeClass('has-error');
137                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="31"]').addClass('active');
138                $('input[name="old_account"]').val($('input[name="account"]').val());
139                updateMenuButtonText();
140            } else if (isEmail($.trim($('input[name="account"]').val()))) {
141                $('input.regular-login').removeClass('has-error');
142                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
143                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="21"]').addClass('active');
144                $('input[name="new_account"]').val($('input[name="account"]').val());
145                updateMenuButtonText();
146            } else {
147                $('.wrong-account-message').html(data.message).show();
148                $('input.regular-login').addClass('has-error');
149            }
150        });
151//        }
152    }
153
154    $('button.check-account-button').on('click', function () {
155        checkAccountRegisterLogin();
156    });
157
158    $('input[name="account"]').on('keypress', function (e) {
159        if (e.which == 13) {
160            checkAccountRegisterLogin();
161        }
162    });
163
164    // LOGIN BUTTON
165    function loginAccountRegisterLogin() {
166        //        if (isEmail($.trim($('input[name="account"]').val()))) {
167        var body = {
168            m: 'login_account',
169            account: $('input[name="account"]').val(),
170            password: $('input[name="password"]').val(),
171            project: $('.register-login-layer').data('project'),
172            language_id: ENV.id_language
173        };
174
175        CbUx.showLoader();
176        $.post("/register-login/api/register_login", body, function (data) {
177            CbUx.hideLoader();
178
179            if (data.success === true) {
180                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
181                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="12"]').addClass('active');
182                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="12"] .ml-headline').html(data.data.headline);
183                $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="12"] .ml-text').html(data.data.text);
184                updateMenuButtonText();
185
186                $(document).on('keypress', function (e) {
187                    if (e.which == 13) {
188                        $('button.login-success-button').trigger('click');
189                    }
190                });
191
192            } else {
193                $('.wrong-password-message').html(data.message).show();
194            }
195        });
196//        }
197    }
198
199    $('button.login-button').on('click', function () {
200        loginAccountRegisterLogin();
201        $('.forgot-password-message').html('');
202        $('.forgot-password').show();
203    });
204
205    $('input[name="password"]').on('keypress', function (e) {
206        if (e.which == 13) {
207            loginAccountRegisterLogin();
208        }
209    });
210
211
212$('button.login-success-button')
213    .unbind('click')
214    .on('click', function () {
215
216        closeRegisterLoginLayer();
217        if (!isWebcalendarPage) { // I dont't know why the url should be cleared after login | 
217CMA (Perhaps BCH knows)
218            window.history.replaceState(null, null, "?"); 
219        } else {
220            console.log('🚫 replaceState wird im Web‑Calendar‑Modus übersprungen');
221        }
222
223        CbUx.showLoader();
224        if (typeof closeCallbackFunction === "function") {
225            closeCallbackFunction();
226        } else {
227            window.location.reload();
228        }
229    });
230    $('button.my-profile-button').unbind('click').on('click', function () {
231        closeRegisterLoginLayer();
232        window.location.href = 'https://' + window.location.hostname + window.location.pathname + "#profile";
233        window.location.reload();
234    });
235
236    // MY VOUCHER BUTTON
237    $('button.my-voucher-button').unbind('click').on('click', function () {
238        closeRegisterLoginLayer();
239        window.location.href = 'https://' + window.location.hostname + window.location.pathname + "#my-voucher";
240        window.location.reload();
241    });
242
243
244    // CREATE ACCOUNT BUTTON
245    $('button.create-accout-button').on('click', function () {
246        if (validateRegisterLoginLayerPasswordFields()) {
247            var body = {
248                m: 'create_new_account',
249                project: $('.register-login-layer').data('project'),
250                password: $('input[name="new_password"]').val(),
251                account: $('input[name="new_account"]').val(),
252                firstname: $('input[name="firstname"]').val(),
253                surname: $('input[name="surname"]').val(),
254                token_page: 'https://' + window.location.hostname + window.location.pathname,
255                language_id: ENV.id_language
256            };
257
258            CbUx.showLoader();
259            $.post("/register-login/api/register_login", body, function (data) {
260                CbUx.hideLoader();
261
262                if (data.success === true) {
263                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
264                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="22"]').addClass('active');
265                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="22"] .ml-headline').html(data.data.headline);
266                    $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="22"] .ml-text').html(data.data.text);
267                    $('.finisch-button').focus();
268                    updateMenuButtonText();
269                } else {
270                    $('.new-customer-error-message').html(data.message).focus();
271                }
272            });
273        }
274    });
275
276
277
278    $(".register-password").focus(function () {
279        $('.password-not-strong-error').fadeIn(666);
280        $('input.register-password').removeClass('has-error');
281    });
282
283    $(".register-password").focusout(function () {
284        setTimeout(function () {
285            if (!$(".register-password").hasClass("has-error")) {
286                $('.password-not-strong-error').fadeOut(40);
287            }
288        }, 333);
289    });
290
291
292    // TOGGLE PASSWORD 
293    $(".toggle-password").click(function () {
294        $(this).toggleClass("fa-eye fa-eye-slash");
295        var input = $('input[name="new_password"]');
296        if (input.attr("type") == "password") {
297            input.attr("type", "text");
298        } else {
299            input.attr("type", "password");
300        }
301    });
302
303    // FINISCH AND CLOSE BUTTON
304    $('button.finisch-button').on('click', function () {
305        $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
306        $('.register-login-layer').html('');
307        CbUx.showLoader();
308        window.location.href = window.location.href + '#stream';
309        window.location.reload();
310    });
311
312    // TOKEN MAIL BUTTON
313    $('.forgot-password').on('click', function () {
314        sendPasswordMail();
315    });
316
317    // GO BACK BUTTON
318    $('.go-back-button').on('click', function () {
319        $('input[name="password"]').val('');
320        $('input[name="account"]').val('');
321        $('input[name="new_password"]').val('');
322        $('input[name="new_account"]').val('');
323        $('input[name="firstname"]').val('');
324        $('input[name="surname"]').val('');
325        $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active');
326        $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="1"]').addClass('active');
327
328        $('.wrong-password-message').html('');
329        $('.forgot-password').show();
330        $('.forgot-password-message').html('');
331        updateMenuButtonText();
332    });
333}
334
335function registerRegisterLoginLayerButtons(closeCallbackFunction = null) {
336    registerRegisterLoginLayerMenuButton();
337    registerRegisterLoginLayerContainerButtons(closeCallbackFunction);
338}
339
340var isWebcalendarPage = $('.register-login-layer').data('project') === 'webcalendar-page';
341//console.log("### Is wbcP: ", isWebcalendarPage);
342//console.log("### Is wbcP: ", $('.register-login-layer').data('project'));
343function openRegisterLoginLayer(closeCallbackFunction = null) {
344    var body = {
345        m: "register_login_layer",
346        project: $('.register-login-layer').data('project'),
347        language_id: ENV.id_language
348    };
349
350    CbUx.showLoader();
351    $.get("/register-login/api/register_login", body, function (data) {
352        CbUx.hideLoader();
353        $('.register-login-layer').html(data);
354        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
355
356        registerRegisterLoginLayerButtons(closeCallbackFunction);
357        $('nav .menu-button.active').focus();
358        updateMenuButtonText();
359    });
360
361    if ($('#film-sile-layer-close-button').length > 0) {
362        $('#film-sile-layer-close-button').click();
363}
364}
365
366
367function registerRegisterRegistrationConfirmLayerMenuButton() {
368    // CLOSE BUTTON
369    $('button.register-login-layer-close-button').on('click', function () {
370        closeRegisterLoginLayer();
371    });
372}
373
374function registerRegisterRegistrationConfirmLayerContainerButtons() {
375    // LOGIN SUCCESS BUTTON
376    $('button.login-success-button').unbind('click').on('click', function () {
377        closeRegisterLoginLayer();
378        CbUx.showLoader();
379        window.location.href = window.location.origin + window.location.pathname;
380    });
381
382    // MY PROFILE BUTTON
383    $('button.my-profile-button').unbind('click').on('click', function () {
384        closeRegisterLoginLayer();
385        window.location.href = 'https://' + window.location.hostname + window.location.pathname + "#profile";
386    });
387
388    // MY VOUCHER BUTTON
389    $('button.my-voucher-button').unbind('click').on('click', function () {
390        closeRegisterLoginLayer();
391        window.location.href = 'https://' + window.location.hostname + window.location.pathname + "#my-voucher";
392    });
393
394    // LOGIN OPEN APP BUTTON
395    $('a.login-open-app-link').unbind('click').on('click', function () {
396        closeRegisterLoginLayer();
397    });
398}
399
400function registerRegisterRegistrationConfirmLayerButtons() {
401    registerRegisterRegistrationConfirmLayerMenuButton();
402    registerRegisterRegistrationConfirmLayerContainerButtons();
403}
404
405function openRegisterRegistrationConfirmLayer() {
406    var body = {
407        m: "register_registration_confirm_layer",
408        project: $('.register-login-layer').data('project'),
409        language_id: ENV.id_language,
410        page_path: window.location.origin + window.location.pathname
411    };
412
413    CbUx.showLoader();
414    $.get("/register-login/api/register_login", body, function (data) {
415        CbUx.hideLoader();
416        $('.register-login-layer').html(data);
417        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
418
419        if ($('.register-login-layer a.login-open-app-link').length > 0) {
420//            var linkBase = $('.register-login-layer a.login-open-app-link').attr("href");
421//            var link = location.href;
422//            link = link.replace("https://", linkBase + "://")
423//            $('.register-login-layer a.login-open-app-link').attr("href", link);
424        }
425
426        registerRegisterRegistrationConfirmLayerButtons();
427        $('nav .menu-button.active').focus();
428    });
429
430    if ($('#film-sile-layer-close-button').length > 0) {
431        $('#film-sile-layer-close-button').click();
432    }
433}
434
435function registerRegisterTokenLoginErrorLayerMenuButton() {
436    // CLOSE BUTTON
437    $('button.register-login-layer-close-button').on('click', function () {
438        closeRegisterLoginLayer();
439    });
440}
441
442function registerRegisterTokenLoginErrorLayerContainerButtons() {
443    // LOGIN SUCCESS BUTTON
444    $('button.login-success-button').unbind('click').on('click', function () {
445        closeRegisterLoginLayer();
446        CbUx.showLoader();
447        window.location.href = window.location.origin + window.location.pathname;
448    });
449}
450
451function registerRegisterTokenLoginErrorLayerButtons() {
452    registerRegisterTokenLoginErrorLayerMenuButton();
453    registerRegisterTokenLoginErrorLayerContainerButtons();
454}
455
456function openRegisterTokenLoginErrorLayer() {
457    var body = {
458        m: "register_register_token_login_error_layer",
459        project: $('.register-login-layer').data('project'),
460        language_id: ENV.id_language
461    };
462
463    CbUx.showLoader();
464    $.get("/register-login/api/register_login", body, function (data) {
465        CbUx.hideLoader();
466        $('.register-login-layer').html(data);
467        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
468
469        registerRegisterTokenLoginErrorLayerButtons();
470        $('nav .menu-button.active').focus();
471    });
472
473    if ($('#film-sile-layer-close-button').length > 0) {
474        $('#film-sile-layer-close-button').click();
475    }
476}
477
478function getUrlParameter(sParam) {
479    var sPageURL = window.location.search.substring(1),
480            sURLVariables = sPageURL.split('&'),
481            sParameterName,
482            i;
483
484    for (i = 0; i < sURLVariables.length; i++) {
485        sParameterName = sURLVariables[i].split('=');
486
487        if (sParameterName[0] === sParam) {
488            return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
489        }
490    }
491    return false;
492}
493
494
495function getRegisterLoginTmpAccountId(callback, createNewId = false) {
496
497    var tmpAccountId = getRegisterLoginCookie('tmp_account_id');
498
499    if (tmpAccountId !== null && typeof callback == "function") {
500        callback(tmpAccountId);
501        return;
502    } else if (tmpAccountId !== null) {
503        return tmpAccountId;
504    }
505
506    if (createNewId === true && typeof callback == "function") {
507        var body = {
508            m: "create_temporary_account",
509            project: $('.register-login-layer').data('project')
510        };
511
512        CbUx.showLoader();
513        $.post("/register-login/api/register_tmp_account", body, function (data) {
514            if (data["id"]) {
515                CbUx.hideLoader();
516                setRegisterLoginCookie('tmp_account_id', data["id"]);
517                setRegisterLoginCookie('tmp_account_id_saved', false);
518                callback(data["id"]);
519            }
520        });
521    } else {
522        return null;
523}
524}
525
526function getRegisterLoginTmpAccountIdWithUserApproval(callback, createNewId = false, callbackNewId = null) {
527
528    if (ENV.auth !== null) {
529        return getRegisterLoginTmpAccountId(callback, createNewId, callbackNewId);
530    }
531
532    var tmpAccountId = getRegisterLoginCookie('tmp_account_id');
533
534    if (tmpAccountId !== null && typeof callback == "function") {
535        callback(tmpAccountId);
536        return;
537    } else if (tmpAccountId !== null) {
538        return tmpAccountId;
539    } else {
540        openRegisterTmpAccountBasicIntroLayerLayer(callback, callbackNewId);
541        return;
542}
543}
544
545function resetRegisterLoginTmpAccountId() {
546    var expires = new Date();
547    expires.setTime(expires.getTime()); //1 year  
548    document.cookie = 'tmp_account_id=null;expires=' + expires.toUTCString();
549    document.cookie = 'PHPSESSID=null;expires=' + expires.toUTCString();
550    document.cookie = 'tmp_account_id_saved=null;expires=' + expires.toUTCString();
551
552//    document.cookie = 'tmp_account_id= ;expires=-1';
553}
554
555
556
557function hasRegisterLoginTmpAccountId() {
558    var tmpAccountId = getRegisterLoginCookie('tmp_account_id');
559    var tmpAccountIdSaved = getRegisterLoginCookie('tmp_account_id_saved');
560    return tmpAccountId !== null && tmpAccountIdSaved === "true";
561}
562
563function setRegisterLoginCookie(key, value) {
564    var expires = new Date();
565    expires.setTime(expires.getTime() + 31536000000); //1 year  
566    document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
567}
568
569function getRegisterLoginCookie(key) {
570    var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
571    return keyValue ? keyValue[2] : null;
572}
573
574//   REGISTER LOGIN end
575
576
577//   REGISTER LOGIN TMP ACCOUNT start
578
579function isEmailRegisterTmpAccountLayer(email) {
580    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
581    return regex.test(email);
582}
583
584function closeRegisterTmpAccountLayer() {
585    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
586    $('.register-login-layer').html('');
587}
588
589function registerRegisterTmpAccountLayerMenuButton() {
590    // CLOSE BUTTON
591    $('button.register-login-layer-close-button').on('click', function () {
592        closeRegisterTmpAccountLayer();
593    });
594
595}
596
597function updateMenuButtonTextRegisterTmpAccountLayer() {
598    $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text'));
599}
600
601function registerRegisterTmpAccountLayerContainerButtons() {
602
603    // BUTTON SAVE
604    $("button.tmp-account-save").on('click', function () {
605        var body = {
606            m: "update_temporary_account",
607            project: $('.register-login-layer').data('project'),
608            id: getRegisterLoginCookie("tmp_account_id"),
609            gender: $("select[name=gender]").val(),
610            taccount_type_id: $("select[name=account_types]").val(),
611            firstname: $("input[name=firstname]").val(),
612            surname: $("input[name=surname]").val(),
613            artistname: $("input[name=artistname]").val(),
614            aliasname: $("input[name=aliasname]").val(),
615            existmail: $("input[name=existmail]").val()
616        };
617
618        CbUx.showLoader();
619        $.post("/register-login/api/register_tmp_account", body, function (data) {
620            setRegisterLoginCookie('tmp_account_id_saved', true);
621            console.log("Before window location Reload 01");
622            window.location.reload();
623            console.log("After window location reload 029");
624        });
625    });
626
627    // BUTTON GO TO INTRO LAYER
628    $("button.tmp-account-go-to-intro-layer").on('click', function () {
629        openRegisterTmpAccountIntroLayerLayer(true);
630    });
631
632
633    // SELECT ACCONT TYPE
634    $("select[name=account_types]").on("change", function () {
635        var newValue = $(this).val();
636        $(".form-row-hidden").removeClass("show");
637
638        var accountTypeConfig = TmpAccaountOptions[newValue];
639        $.each(accountTypeConfig, function (index, item) {
640            if (item) {
641                $(".form-row-hidden.form-row-" + index).addClass("show");
642            }
643        });
644    });
645
646}
647
648function registerRegisterTmpAccountLayerButtons() {
649    registerRegisterTmpAccountLayerMenuButton();
650    registerRegisterTmpAccountLayerContainerButtons();
651}
652
653function openRegisterTmpAccountLayer(id) {
654    var body = {
655        m: "register_tmp_account_layer",
656        project: $('.register-login-layer').data('project'),
657        id: id,
658        language_id: ENV.id_language
659    };
660
661    CbUx.showLoader();
662    $.get("/register-login/api/register_tmp_account", body, function (data) {
663        CbUx.hideLoader();
664        $('.register-login-layer').html(data);
665        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
666
667        var accountTypeId = $("input[name=account_type_id]").val();
668        if (accountTypeId !== "") {
669            $("select[name=account_types]").val(accountTypeId);
670        }
671
672        var genderId = $("input[name=gender_id]").val();
673        if (genderId !== "") {
674            $("select[name=gender]").val(genderId);
675        }
676
677        registerRegisterTmpAccountLayerButtons();
678        $('nav .menu-button.active').focus();
679        updateMenuButtonTextRegisterTmpAccountLayer();
680
681        $("select[name=account_types]").change();
682    });
683
684    if ($('#film-sile-layer-close-button').length > 0) {
685        $('#film-sile-layer-close-button').click();
686    }
687}
688
689//   REGISTER LOGIN TMP ACCOUNT end
690
691
692//   REGISTER LOGIN TMP ACCOUNT INTRO start
693
694function isEmailRegisterTmpAccountIntroLayerLayer(email) {
695    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
696    return regex.test(email);
697}
698
699function closeRegisterTmpAccountIntroLayerLayer() {
700    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
701    $('.register-login-layer').html('');
702}
703
704function registerRegisterTmpAccountIntroLayerLayerMenuButton() {
705    // CLOSE BUTTON
706    $('button.register-login-layer-close-button').on('click', function () {
707        closeRegisterTmpAccountIntroLayerLayer();
708    });
709
710}
711
712function updateMenuButtonTextRegisterTmpAccountIntroLayerLayer() {
713    $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text'));
714}
715
716function registerRegisterTmpAccountIntroLayerLayerContainerButtons() {
717
718    // TMP ACCOUNT OPTION BUTTON
719    $('button.tmp-account-option-button').on('click', function () {
720        $('button.tmp-account-option-button').removeClass("btn-blue");
721        $(this).addClass("btn-blue");
722
723        var tmpAccountOption = $(this).data("option");
724        $("button.tmp-account-next-button").prop("disabled", "");
725        $(".tmp-account-option").removeClass("show");
726        switch (tmpAccountOption) {
727            case "without-registration":
728                $(".tmp-account-option.tmp-account-option-without-registration").addClass("show");
729                break;
730
731            case "with-registration":
732                $(".tmp-account-option.tmp-account-option-with-registration").addClass("show");
733                break;
734        }
735    });
736
737    // TMP ACCOUNT NEXT BUTTON
738    $("button.tmp-account-next-button").on("click", function () {
739        var tmpAccountOption = $('button.tmp-account-option-button.btn-blue').data("option");
740
741        switch (tmpAccountOption) {
742            case "without-registration":
743                getRegisterLoginTmpAccountId(function (id) {
744                    openRegisterTmpAccountLayer(id);
745                }, true);
746                break;
747
748            case "with-registration":
749                openRegisterLoginLayer();
750                break;
751        }
752    });
753}
754
755function registerRegisterTmpAccountIntroLayerLayerButtons() {
756    registerRegisterTmpAccountIntroLayerLayerMenuButton();
757    registerRegisterTmpAccountIntroLayerLayerContainerButtons();
758}
759
760function openRegisterTmpAccountIntroLayerLayer(preselectRegistration = false) {
761    var body = {
762        m: "register_tmp_account_intro_layer",
763        project: $('.register-login-layer').data('project'),
764        language_id: ENV.id_language
765    };
766
767    CbUx.showLoader();
768    $.get("/register-login/api/register_tmp_account", body, function (data) {
769        CbUx.hideLoader();
770        $('.register-login-layer').html(data);
771        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
772
773        registerRegisterTmpAccountIntroLayerLayerButtons();
774        $('nav .menu-button.active').focus();
775        updateMenuButtonTextRegisterTmpAccountIntroLayerLayer();
776
777        if (preselectRegistration === true) {
778            $('.tmp-account-option-button[data-option=with-registration]').click();
779        }
780    });
781
782    if ($('#film-sile-layer-close-button').length > 0) {
783        $('#film-sile-layer-close-button').click();
784}
785}
786
787function getUrlParameter(sParam) {
788    var sPageURL = window.location.search.substring(1),
789            sURLVariables = sPageURL.split('&'),
790            sParameterName,
791            i;
792
793    for (i = 0; i < sURLVariables.length; i++) {
794        sParameterName = sURLVariables[i].split('=');
795
796        if (sParameterName[0] === sParam) {
797            return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
798        }
799    }
800    return false;
801}
802
803//   REGISTER LOGIN TMP ACCOUNT INTRO end
804
805
806//   REGISTER LOGIN TMP ACCOUNT BASIC INTRO start
807
808function isEmailRegisterTmpAccountBasicIntroLayerLayer(email) {
809    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
810    return regex.test(email);
811}
812
813function closeRegisterTmpAccountBasicIntroLayerLayer() {
814    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
815    $('.register-login-layer').html('');
816}
817
818function registerRegisterTmpAccountBasicIntroLayerLayerMenuButton() {
819    // CLOSE BUTTON
820    $('button.register-login-layer-close-button').on('click', function () {
821        closeRegisterTmpAccountBasicIntroLayerLayer();
822        CbUx.showLoader();
823        window.location.reload();
824    });
825
826}
827
828function updateMenuButtonTextRegisterTmpAccountBasicIntroLayerLayer() {
829    $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text'));
830}
831
832function registerRegisterTmpAccountBasicIntroLayerLayerContainerButtons(callback, callbackNewId) {
833
834    // TMP ACCOUNT OPTION BUTTON
835    $('button.tmp-account-option-button').on('click', function () {
836        $('button.tmp-account-option-button').removeClass("btn-blue");
837        $(this).addClass("btn-blue");
838
839        var tmpAccountOption = $(this).data("option");
840        $("button.tmp-account-next-button").prop("disabled", "");
841        $(".tmp-account-option").removeClass("show");
842        switch (tmpAccountOption) {
843            case "without-registration":
844                $(".tmp-account-option.tmp-account-option-without-registration").addClass("show");
845                break;
846
847            case "with-registration":
848                $(".tmp-account-option.tmp-account-option-with-registration").addClass("show");
849                break;
850        }
851    });
852
853    // TMP ACCOUNT NEXT BUTTON
854    $("button.tmp-account-next-button").on("click", function () {
855        var tmpAccountOption = $('button.tmp-account-option-button.btn-blue').data("option");
856
857        switch (tmpAccountOption) {
858            case "without-registration":
859                getRegisterLoginTmpAccountId(callbackNewId, true);
860                break;
861
862            case "with-registration":
863                openRegisterLoginLayer();
864                break;
865        }
866    });
867}
868
869function registerRegisterTmpAccountBasicIntroLayerLayerButtons(callback, callbackNewId) {
870    registerRegisterTmpAccountBasicIntroLayerLayerMenuButton();
871    registerRegisterTmpAccountBasicIntroLayerLayerContainerButtons(callback, callbackNewId);
872}
873
874function openRegisterTmpAccountBasicIntroLayerLayer(callback, callbackNewId) {
875    var body = {
876        m: "register_tmp_account_basic_intro_layer",
877        project: $('.register-login-layer').data('project'),
878        language_id: ENV.id_language
879    };
880
881    CbUx.showLoader();
882    $.get("/register-login/api/register_tmp_account", body, function (data) {
883        CbUx.hideLoader();
884        $('.register-login-layer').html(data);
885        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
886
887        registerRegisterTmpAccountBasicIntroLayerLayerButtons(callback, callbackNewId);
888        $('nav .menu-button.active').focus();
889        updateMenuButtonTextRegisterTmpAccountBasicIntroLayerLayer();
890    });
891
892    if ($('#film-sile-layer-close-button').length > 0) {
893        $('#film-sile-layer-close-button').click();
894    }
895}
896
897//   REGISTER LOGIN TMP ACCOUNT BASIC INTRO end
898
899
900
901//   REGISTER LOGIN TMP ACCOUNT TO ACCOUNT start
902
903
904function isEmailRegisterTmpAccountToAccountLayer(email) {
905    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
906    return regex.test(email);
907}
908
909function closeRegisterTmpAccountToAccountLayer() {
910    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
911    $('.register-login-layer').html('');
912    CbUx.showLoader();
913    window.location.reload();
914}
915
916function registerRegisterTmpAccountToAccountLayerMenuButton() {
917    // CLOSE BUTTON
918    $('button.register-login-layer-close-button').on('click', function () {
919        closeRegisterTmpAccountToAccountLayer();
920        setRegisterLoginCookie('tmp_account_id_skip_migration', true);
921    });
922}
923
924function updateMenuButtonTextRegisterTmpAccountToAccountLayer() {
925    $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text'));
926}
927
928function registerRegisterTmpAccountToAccountLayerContainerButtons() {
929
930    // TMP ACCOUNT NEXT BUTTON
931    $("button.tmp-account-to-account-button").unbind('click').on("click", function () {
932
933        var body = {
934            m: "move_tmp_account_to_account",
935            tmp_account_id: getRegisterLoginCookie("tmp_account_id")
936        };
937
938        $.post(ENV.link_root + "/tmp_account.json", body, function (data) {
939            if (data.success === true) {
940                setRegisterLoginCookie('tmp_account_id_migrated', true);
941                closeRegisterTmpAccountToAccountLayer();
942            }
943        });
944
945    });
946}
947
948function registerRegisterTmpAccountToAccountLayerButtons() {
949    registerRegisterTmpAccountToAccountLayerMenuButton();
950    registerRegisterTmpAccountToAccountLayerContainerButtons();
951}
952
953function openRegisterTmpAccountToAccountLayer() {
954    var body = {
955        m: "register_tmp_account_to_account_layer",
956        project: $('.register-login-layer').data('project'),
957        language_id: ENV.id_language
958    };
959
960    CbUx.showLoader();
961    $.get("/register-login/api/register_tmp_account", body, function (data) {
962        CbUx.hideLoader();
963        $('.register-login-layer').html(data);
964        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
965
966        registerRegisterTmpAccountToAccountLayerButtons();
967        $('nav .menu-button.active').focus();
968        updateMenuButtonTextRegisterTmpAccountToAccountLayer();
969    });
970
971    if ($('#film-sile-layer-close-button').length > 0) {
972        $('#film-sile-layer-close-button').click();
973    }
974}
975
976//   REGISTER LOGIN TMP ACCOUNT TO ACCOUNT end
977
978
979
980// REGISTER LOGIN INFO LAYER start
981
982
983function closeRegisterInfoLayer() {
984    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
985    $('.register-login-layer').html('');
986}
987
988function registerRegisterInfoLayerContainerButtons() {
989
990
991}
992
993function registerRegisterInfoLayerMenuButton() {
994    // CLOSE BUTTON
995    $('button.register-login-layer-close-button').on('click', function () {
996        closeRegisterInfoLayer();
997    });
998}
999
1000function registerRegisterInfoLayerButtons() {
1001    registerRegisterInfoLayerMenuButton();
1002    registerRegisterInfoLayerContainerButtons();
1003}
1004
1005
1006function openRegisterInfoLayer() {
1007    var body = {
1008        m: "register_info_layer",
1009        project: $('.register-login-layer').data('project'),
1010        language_id: ENV.id_language
1011    };
1012
1013    CbUx.showLoader();
1014    $.get("/register-login/api/register_login", body, function (data) {
1015        CbUx.hideLoader();
1016        $('.register-login-layer').html(data);
1017        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
1018
1019        registerRegisterInfoLayerButtons();
1020        $('nav .menu-button.active').focus();
1021        updateMenuButtonText();
1022    });
1023
1024    if ($('#film-sile-layer-close-button').length > 0) {
1025        $('#film-sile-layer-close-button').click();
1026    }
1027}
1028
1029// REGISTER LOGIN INFO LAYER end
1030
1031
1032// REGISTER SEND MAIL LAYER start
1033
1034
1035function closeRegisterSendMail() {
1036    $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666);
1037    $('.register-login-layer').html('');
1038}
1039
1040function registerRegisterSendMailContainerButtons(callbackFunction) {
1041
1042    $('button.register-login-layer-send-mail-button').on('click', function () {
1043
1044        if (typeof callbackFunction === "function") {
1045            var callbackData = {
1046                mail_text: $(".register-login-send-mail-layer textarea[name=mail_text]").val()
1047            };
1048            callbackFunction(callbackData);
1049        }
1050
1051        closeRegisterSendMail();
1052    });
1053}
1054
1055function registerRegisterSendMailMenuButton() {
1056    // CLOSE BUTTON
1057    $('button.register-login-layer-close-button').on('click', function () {
1058        closeRegisterSendMail();
1059    });
1060}
1061
1062function registerRegisterSendMailButtons(callbackFunction) {
1063    registerRegisterSendMailMenuButton();
1064    registerRegisterSendMailContainerButtons(callbackFunction);
1065}
1066
1067
1068function openRegisterSendMail(callbackFunction, userName, state) {
1069    var body = {
1070        m: "register_send_mail_layer",
1071        project: $('.register-login-layer').data('project'),
1072        language_id: ENV.id_language,
1073        state: state,
1074        userName: userName
1075    };
1076
1077    CbUx.showLoader();
1078    $.get("/register-login/api/register_login_member", body, function (data) {
1079        CbUx.hideLoader();
1080        $('.register-login-layer').html(data);
1081        $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666);
1082
1083        registerRegisterSendMailButtons(callbackFunction, userName, state);
1084        $('nav .menu-button.active').focus();
1085        updateMenuButtonText();
1086    });
1087
1088    if ($('#film-sile-layer-close-button').length > 0) {
1089        $('#film-sile-layer-close-button').click();
1090    }
1091}
1092
1093// REGISTER SEND MAIL LAYER end
1094
1095
1096// ON DOCUMENT READY
1097
1098$(document).ready(function () {
1099
1100    $('.register-login-layer-button').on('click', $('body'), function () {
1101        openRegisterLoginLayer();
1102    });
1103
1104    $('#project-login-button').on('click', function () {
1105        //openLogin();
1106
1107        setTimeout(function () {
1108            $('input[name="account"]').focus();
1109        }, 333);
1110    });
1111
1112    $('.register-tmp-account-intro-layer-button').on('click', $('body'), function () {
1113        openRegisterTmpAccountIntroLayerLayer();
1114    });
1115
1116    $('.register-tmp-account-to-account-layer-button').on('click', $('body'), function () {
1117        if (ENV.auth) {
1118            openRegisterTmpAccountToAccountLayer();
1119        } else {
1120            openRegisterLoginLayer();
1121        }
1122    });
1123
1124    if (ENV.auth && getRegisterLoginCookie("tmp_account_id") !== null && getRegisterLoginCookie("tmp_account_id_migrated") !== "true" && getRegisterLoginCookie("tmp_account_id_skip_migration") === null) {
1125        openRegisterTmpAccountToAccountLayer();
1126    }
1127
1128});
1129
1130
1131   function registerEventListener() {
1132        setTimeout(function () {
1133            if (window.addEventListener) {
1134                window.addEventListener("message", handleMessage);
1135            } else {
1136                window.attachEvent("onmessage", handleMessage);
1137            }
1138        }, 500);
1139    }
1140    function handleMessage(event) {
1141        console.log("Received a message from " + event.origin + ".");
1142        // When one window sends a message, or data, to another window via
1143        // `parent.postMessage()`, the message (the first argument) in the
1144        // `parent.postMessage()` call is accessible via `event.data` here.
1145        var messageFromSender = event.data;
1146        // Do something with the data.
1147        console.log(messageFromSender);
1148        if (messageFromSender.close_editor === true) {
1149            $('.editorWrapper').remove();
1150            editorIsOpen = false;
1151            CbUx.showLoader();
1152            window.location.reload();
1153        }
1154
1155        if (messageFromSender.remove_editor === true) {
1156            $('.editorContainer').remove();
1157            console.log("ProjectBased removal");
1158            if (messageFromSender.editor_id === "43") {
1159                window.location.reload();
1160                console.log("Pix Editor ");
1161            }
1162            editorIsOpen = false;
1163        }
1164    }
1165    
1166    function registerMessageListener() {
1167    // Kurz warten, bis das DOM bereit ist – verhindert race‑conditions
1168    setTimeout(function () {
1169        if (window.addEventListener) {
1170            window.addEventListener('message', handleMessage, false);
1171        } else {
1172            // IE‑8 fallback
1173            window.attachEvent('onmessage', handleMessage);
1174        }
1175    }, 0);
1176}
1177
1178function handleMessage(event) {
1179    var allowedOrigins = [
1180        'https://deine-webcalendar-domain.de',   // <- anpassen
1181    ];
1182    if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
1183        console.warn('postMessage von unbekannter Herkunft ignoriert:', event.origin);
1184        return;
1185    }
1186
1187    console.log('📩 Nachricht empfangen von', event.origin, ':', event.data);
1188
1189    if (event.data === 'Iswebcalendar: true') {
1190        isWebcalendar = true;               // Flag setzen
1191        console.log('🔔 Web‑Calendar‑Modus aktiviert');
1192    }
1193
1194}
1195
1196registerMessageListener();

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.