PageSourceSearch

https://staatstheater-hannover.de/lib_controlbar/js/cb_controlbar3.js

js staatstheater-hannover.de collected 2026-09-24 09:42:19 UTC 24,051 bytes, 537 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    Controlbar = typeof Controlbar !== 'undefined' ? Controlbar : {};
4
5    Controlbar.ml_projects = (Controlbar.ml_projects instanceof Array ? Controlbar.ml_projects : []);
6
7    function setControlbarCookie(key, value) {
8        var expires = new Date();
9        expires.setTime(expires.getTime() + 31536000000); //1 year  
10        document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
11    }
12
13    function getControlbarCookie(key) {
14        var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
15        return keyValue ? keyValue[2] : null;
16    }
17
18    var window_options = {
19        'projects': Controlbar.ml_projects,
20        'language': Controlbar && Controlbar.language ? Controlbar.language : 'de_DE',
21        'responsive': true,
22        'layerOpacity': 0.75,
23        'layerColor': '#000',
24        'ajax': Controlbar.link_root + '/controlbar_register'
25    };
26
27    var popUpControlbar = function () {
28        //
29    };
30
31    var bigControlbar = function () {
32        $('#controlbar').removeClass('controlbar-show').addClass('controlbar-big');
33        setControlbarCookie('controlbarVisible', false);
34        if (window.location.hash.indexOf('controlbar') !== -1)
35            window.location.hash = '';
36        $(document).trigger("closeControlBar");
37    };
38
39    var hideControlbar = function () {
40        $('#controlbar').removeClass('controlbar-show').addClass('controlbar-hide');
41        setControlbarCookie('controlbarVisible', false);
42        if (window.location.hash.indexOf('controlbar') !== -1)
43            window.location.hash = '';
44        showControlbarButton();
45        $(document).trigger("closeControlBar");
46    };
47
48    var showControlbar = function () {
49        var wasOpen = getControlbarCookie('controlbarVisible');
50        $('#controlbar').removeClass('controlbar-hide').removeClass('controlbar-big').addClass('controlbar-show');
51        setControlbarCookie('controlbarVisible', true);
52        hideControlbarButton();
53        $(document).trigger("openControlBar");
54    };
55
56    var showControlbarButton = function () {
57        $('.controlbar-button-container').removeClass('controlbar-hide').addClass('controlbar-show');
58        if (!Controlbar.no_button)
59            buttonsHoverHandler();
60    };
61
62    var hideControlbarButton = function () {
63        if (setControlbarCookie('controlbarVisible', true)) {
64            // $('.controlbar-button-container').removeClass('controlbar-show').addClass('controlbar-hide');
65        } else {
66            $('#controlbar-show-button').addClass('controlbar-hide');
67        }
68    };
69
70    var buttonsHoverHandler = function () {
71        $('.controlbar-button-container').on({
72            mouseenter: function () {
73                if ($(window).width() > 767) {
74                    $('#controlbar-show-button').removeClass('controlbar-hide').addClass('controlbar-show');
75                }
76            },
77            mouseleave: function () {
78                $('#controlbar-show-button').removeClass('controlbar-show').addClass('controlbar-hide');
79            }
80        });
81    };
82
83    Controlbar.init = function () {
84        
85        if (Controlbar.allowed) {
86            
87            $('#controlbar-login-button').on('click', function () {
88                if (typeof openRegisterLoginLayer === 'function') {
89                    openRegisterLoginLayer();
90                } else if(typeof openLoginWindow !== "undefined") {
91                    openLoginWindow();
92                }
93            });
94
95            $('#controlbar-logout-button').on('click', function () {
96                $.get('/register/ajax.php', {
97                    action: 'logout'
98                }, function () {
99                    window.location.reload();
100                });
101            });
102
103//            $('#controlbar-show-button').mouseenter(function () {
104//                $('.controlbar-content-wrapper').addClass('popup');
105//            });
106//
107//            $('#controlbar').mouseleave(function () {   
108//                setTimeout(function(){
109//                    $('.controlbar-content-wrapper').removeClass('popup');
110//                }, 1000);
111//                
112//            var timer;
113//    
114//            $('#controlbar').mouseleave(function () {   
115//                timer = setTimeout(function(){
116//                    $('.controlbar-content-wrapper').removeClass('popup');
117//                }, 1000);
118//            }, console.log("Timer mouseleave: "+timer));         
119//    
120//            $('#controlbar-show-button').mouseenter(function(){
121//                clearTimeout(timer);
122//            }, function(){
123//                $('.controlbar-content-wrapper').addClass('popup');
124//                console.log("Timer mouseenter: "+timer);
125//            });                
126//                
127                
128            var mouseEnterCounter = 0;    
129            $('#controlbar').mouseenter(function () {
130                if(!$('.controlbar-content-wrapper').hasClass('popup')){
131                    $('.controlbar-content-wrapper').addClass('popup');
132                }
133                mouseEnterCounter++;
134            });
135
136            $('#controlbar').mouseleave(function () {   
137                mouseEnterCounter--;
138                setTimeout(function(){
139                    if(mouseEnterCounter===0){
140                        $('.controlbar-content-wrapper').removeClass('popup');
141                    }
142                    console.log("Timer mouseenter: "+mouseEnterCounter);
143                }, 1000);
144                }); 
145                               
146                
147                
148
149            $('.controlbar-control').on('click', function () {
150                $(this).removeClass('controlbar-show').addClass('controlbar-hide');
151                $('.controlbar-button-container').removeClass('controlbar-hide').addClass('controlbar-show');
152                showControlbar();
153            });
154
155            $('.controlbar-links-label').on('click', function () {
156                //
157            });
158
159            $('#controlbar-show-button').on('click', function () {
160                $(this).removeClass('controlbar-show').addClass('controlbar-hide');
161                $('.controlbar-button-container').removeClass('controlbar-show').addClass('controlbar-hide');
162                bigControlbar();
163            });
164
165            $('#controlbar-hide-button').on('click', hideControlbar);
166
167            if (!Controlbar.no_button)
168                buttonsHoverHandler();
169
170            $('.controlbar-link-container a', '#controlbar').on('click', function (e) {
171                if (this.target == "_blank") {
172                    var href = this.href;
173                    if(href.indexOf("flex2") != -1){
174                        window.open(href, this.text, 'width=1280,height=1000,scrollbars=yes,menubar=no');
175                    } else {
176                        window.open(href, this.text, 'width=1280,height=800,scrollbars=yes,menubar=no');
177                    }
178                    return false;
179                }
180            });
181
182            if (getControlbarCookie('controlbarVisible') === true) {
183                showControlbar();
184                bigControlbar();
185            } else {
186                if (window.location.hash.indexOf('controlbar') !== -1) {
187                    bigControlbar();
188                } else {
189                    showControlbar();
190                }
191            }
192        } else {
193            $('#controlbar-show-button').hide();
194        }
195    };
196
197    Controlbar.init();
198
199    Controlbar.openLoginWindow = function () {
200        if (getControlbarCookie('controlbarVisible')) {
201            if(typeof openLoginWindow !== "undefined") {
202                openLoginWindow();
203            }
204        } else {
205            showControlbar();
206        }
207    };
208
209    Controlbar.open = function () {
210        showControlbar();
211    };
212
213    Controlbar.close = function () {
214        hideControlbar();
215    };
216
217    Controlbar.isOpen = function () {
218        return getControlbarCookie('controlbarVisible');
219    };
220
221    $('.controlbar-cache-reset').on('click', function () {
222        $.post(Controlbar.link_root + '/cache.json?m=do_cache_reset', function () {
223            if (CbUx) {
224                CbUx.showLoader();
225            }
226            window.location.reload();
227        });
228    });
229
230    $('.controlbar-username').on('click', function () {
231        document.location.href = $(this).data("hash");
232    });
233
234    if (typeof REGISTER !== "undefined") {
235        
236        var openLoginWindow = function () {
237            REGISTER.prepare(window_options);
238            $.CbWidgetRegistry.projects = window_options.projects;
239            $.CbWidgetRegistry.language = window_options.language;
240            new REGISTER.CbUserPassWindow({
241                template: ENV.document_root + '/register-work/register_templates/userpass.html',
242                cls: 'CbControlbar2Window CbControlbar2RegisterWindow clearfix'
243            }, $.extend({
244                avoidFrame: true
245            }, window_options), {
246                next: {
247                    'CbMessageWindow': 'CbControlbar2MessageWindow',
248                    'CbNameAddressWindow': 'CbControlbar2NameAddressWindow',
249                    'CbVerifyMailWindow': 'CbControlbar2VerifyMailWindow'
250                }
251            }).open({delay: 500});
252            setTimeout(function () {
253                console.log($('#registerframe_input_stay_logged_in input'));
254                $('#registerframe_input_stay_logged_in input').bootstrapSwitch(
255                        {
256                            'labelText': '<span class="flip-switch-handle"></span>',
257                            'handleWidth': 19,
258                            'labelWidth': 26,
259                            'onText': '&nbsp;',
260                            'offText': '&nbsp;'
261                        }
262                );
263            }, 1500);
264
265        };
266
267
268        REGISTER.CbControlbar2MessageWindow = REGISTER.CbMessageWindow.extend({
269            constructor: function (loadOptions, options, data) {
270                return this.base($.extend({
271                    template: ENV.document_root + '/register-work/register_templates/message.html',
272                    cls: 'CbControlbar2Window CbControlbar2RegisterWindow clearfix'
273                }, loadOptions), $.extend(window_options, options), data);
274            }
275        });
276
277        REGISTER.CbControlbar2VerifyMailWindow = REGISTER.CbVerifyMailWindow.extend({
278            constructor: function (loadOptions, options, data) {
279                return this.base($.extend({
280                    template: ENV.document_root + '/register-work/register_templates/verifymail.html',
281                    cls: 'CbControlbar2Window CbControlbar2RegisterWindow clearfix'
282                }, loadOptions), $.extend(window_options, options), data);
283            }
284        });
285
286        REGISTER.CbControlbar2NameAddressWindow = REGISTER.CbNameAddressWindow.extend({
287            constructor: function (loadOptions, options, data) {
288                return this.base($.extend({
289                    template: ENV.document_root + '/register-work/register_templates/nameaddress.html',
290                    cls: 'CbControlbar2Window CbControlbar2RegisterWindow clearfix'
291                }, loadOptions), $.extend(window_options, options), $.extend(data, {
292                    next: {
293                        'CbMessageWindow': 'CbControlbar2MessageWindow',
294                        'CbVerifyMailWindow': 'CbControlbar2VerifyMailWindow'
295                    }
296                }));
297            }
298        });
299
300        REGISTER.CbControlbar2NameAddressWindowOLD = REGISTER.CbNameAddressWindow.extend({
301            constructor: function (loadOptions, options, data) {
302                var self = this;
303                return this.base($.extend({}, {
304                    template: '/module/lib/framework/templates/cb_controlbar2_nameaddress_window.tpl.php',
305                    cls: 'CbControlbar2Window CbControlbar2RegisterWindow clearfix'
306                }, loadOptions), $.extend(window_options, options), $.extend(data, {
307                    next: {
308                        'CbMessageWindow': 'CbControlbar2MessageWindow',
309                        'CbVerifyMailWindow': 'CbControlbar2VerifyMailWindow'
310                    },
311                    get_loggedin_user_data_callback: function (data) {
312                        self.userData = data;
313                        self.handleData(data);
314                    }
315                }));
316            },
317            handleReady: function () {
318                return this.base({doNotDisable: true, getDescription: true});
319            },
320            handleData: function (data) {
321                this.userData = data;
322                var self = this;
323                var $context = this.element();
324                var $ThumbContainer = $context.find('.pix-upload');
325                var width = $ThumbContainer.width() || 150;
326                var height = $ThumbContainer.height() || 150;
327                if (self.userData.pic_portrait && self.userData.pic_portrait !== '') {
328                    $ThumbContainer.css('background-image', 'url("http://data.heimat.de/transform.php?' +
329                            'file=' + self.userData.pic_portrait +
330                            '&width=' + width +
331                            '&height=' + height + '&do=rescaleIn' + '&color=ffffff")');
332                    $ThumbContainer.addClass('with-image');
333
334                }
335            },
336            handleShow: function () {
337                var self = this;
338                var $context = this.element();
339                var $ThumbContainer = $context.find('.pix-upload');
340                var width = $ThumbContainer.width();
341                var height = $ThumbContainer.height();
342                self.configurePIX();
343                $context.show();
344                $context.find('label.CbControlbar2RegisterWindowTitle').each(function (i, el) {
345                    $(this).off('click').on('click', function () {
346                        $context.find('.tabbed-content').not(this.control).removeClass('active');
347                        $context.find('.tab').not(this).removeClass('active');
348                        $(this).addClass('active');
349                        if (typeof self['prepare' + this.htmlFor] === 'function') {
350                            self['prepare' + this.htmlFor]();
351                        } else {
352                            $context.find('#' + this.htmlFor).addClass('active');
353                        }
354                    });
355                });
356                var register_button = $context.find('#registerframe_button_register');
357                register_button.off('click').on('click', function (e) {
358                    e.stopImmediatePropagation();
359                    if (self.validateInputTab($('.tab-1', $context))) {
360                        $('label[for="ProfileData"]').click();
361                    }
362                });
363                var send_button = $context.find('#registerframe_button_webprofile');
364                send_button.off('click').on('click', function () {
365                    if (!self.validateInputTab($('.tab-1', $context))) {
366                        $('label[for="AddressData"]').click();
367                        return;
368                    }
369                    if (self.validateInputTab($('.tab-2', $context))) {
370                        var params = {'action': 'insert'};
371                        $.each({
372                            surname: 'last',
373                            firstname: 'first',
374                            city: 'city',
375                            email: 'mail',
376                            gender: 'gender',
377                            plz: 'zip',
378                            phone: 'phone',
379                            street: 'street',
380                            nr: 'nr',
381                            description: 'description',
382                            portrait_id_media: 'portrait_id_media',
383                            homepage: 'homepage'
384                        }, function (key, idname) {
385                            var widget = $context.find('#registerframe_input_' + idname).CbWidget();
386                            if (widget) {
387                                params[key] = $.CbWidgetRegistry.bricks['registerframe_input_' + idname] === widget.value() ? '' : widget.value();
388                                if (typeof widget.valueId === 'function')
389                                    params[key + '_id'] = widget.valueId();
390                            }
391                        });
392                        if (!send_button.is('.sending')) {
393                            send_button.addClass('sending');
394                            $.post(REGISTER.config.ajax, params, function (data) {
395                                send_button.removeClass('sending');
396                                $context.find('#registerframe_button_ok').click(function () {
397                                    self.close();
398                                    location.reload();
399                                })
400                                $context.find('label[for="SuccessMessage"]').click();
401                            }, 'json');
402                        }
403                    }
404                });
405
406
407                $context.find('.pix-upload').click(function (e) {
408                    var setPreviewImage = function (pic, height, width) {
409                        $ThumbContainer.css('background-image', 'url("http://data.heimat.de/transform.php?' +
410                                'file=' + pic.Uri.replace(/\.(\w+)$/, '_t1.$1') +
411                                '&width=' + width +
412                                '&height=' + height + '&do=rescaleIn' + '&color=ffffff")');
413                        jQuery('.id-media-input', '#CbTexThumb').attr('value', pic.Id);
414                        $ThumbContainer.addClass('with-image');
415                        $context.find('#registerframe_input_portrait_id_media').val(pic.Id);
416                    };
417                    if ($(window).width() > 950) {
418                        e.stopImmediatePropagation();
419                        $context.find('#image-upload').attr('disabled', true);
420                        PIX.selectPicture(function (pic) {
421                            setPreviewImage(
422                                    pic,
423                                    height,
424                                    width
425                                    );
426                        });
427                    } else {
428                        $context.find('#image-upload').removeAttr('disabled');
429                        $context.find('#image-upload').off('change').on('change', function () {
430                            var fileField = this;
431                            var formData = new FormData($context.find('form[n
431ame="profile-form"]').get(0));
432                            var fileObject = {
433                                name: fileField.files[0].name,
434                                size: fileField.files[0].size
435                            }
436                            var loaderWithProgress = new $.CbWidget.loaderWithProgress();
437                            var xhr = $.ajax({
438                                type: 'POST',
439                                url: '/pix/pictures/by/' + self.options.auth.accountId + '.json',
440                                data: formData,
441                                success: function (data, status) {
442                                    if (loaderWithProgress)
443                                        loaderWithProgress.setEnd();
444                                    setPreviewImage(
445                                            data,
446                                            height,
447                                            width
448                                            );
449                                },
450                                uploadProgress: function (e) {
451                                    if (e.lengthComputable) {
452                                        var percentComplete = e.loaded / e.total * 100;
453                                        if (loaderWithProgress)
454                                            loaderWithProgress.setProgress(percentComplete, e.loaded, e.total);
455                                    }
456                                },
457                                cache: false,
458                                contentType: false,
459                                processData: false
460                            });
461                            if (loaderWithProgress) {
462                                loaderWithProgress.setStart(xhr, [fileObject], [], '*.jpg, *.gif, *.png');
463                            }
464                        });
465                    }
466                })
467                $context.find('.pix-upload-delete').off('click.delete').on('click.delete', function (e) {
468                    e.stopImmediatePropagation();
469                    $context.find('#registerframe_input_portrait_id_media').val('');
470                    $(e.currentTarget).parent().css('background-image', '');
471                });
472            },
473            /**
474             * Validate all validatable widgets in the context (those with a class __CbValidate*).
475             */
476            validateInputTab: function (context) {
477                var valid = true;
478                var self = this;
479                jQuery('[class*="__CbValidate"]', $(context)).each(function () {
480                    if (!jQuery(this).CbWidget().isValidationSuspended()) {
481                        var widget_valid = jQuery(this).CbWidget().validate();
482                        if (!widget_valid) {
483                            self.trigger('error', {element: this});
484                            valid = false;
485                        }
486                    }
487                });
488                if (valid)
489                    self.valid();
490                return valid;
491            },
492            addTag: function (container, id, text) {
493                var tag = $('<span class="register-tag like-input" data-tag-id="' + id + '">
493' + text +
494                        '<span class="tag-delete-button"></span></span>');
495                tag.find('.tag-delete-button').click(function () {
496                    this.parentNode.parentNode.removeChild(this.parentNode)
497                });
498                $(container).append(tag)
499            },
500            configurePIX: function () {
501                var self = this;
502                PIX.configure({
503                    language: self.options.language,
504                    auth: self.options.auth
505                });
506            },
507            getDisplayName: function (data) {
508                var p = data;
509                p.gender = p.Gender ? p.Gender === 2 ? '' : '' : '';
510                p.displayName = p.ArtistnameOnly ? p.Artistname + ' (BN: ' + p.Firstname + ' ' + p.Surname + ')' :
511                        p.Firstname + ' ' + p.Surname + (p.Artistname ? ' (' + p.Artistname + ')' : '');
512                p.displayName = p.gender + p.displayName;
513                return p.displayName;
514            }
515
516        });
517
518        REGISTER.CbControlbar2PasswdChangeWindow = REGISTER.CbPasswdChangeWindow.extend({
519            constructor: function (loadOptions, options, data) {
520                REGISTER.prepare(window_options);
521                $.CbWidgetRegistry.projects = window_options.projects;
522                $.CbWidgetRegistry.language = window_options.language;
523                return this.base($.extend({
524                    template: '/module/lib/framework/templates/cb_controlbar2_passwdchange_window.tpl.php',
525                    cls: 'CbControlbar2Window CbControlbar2RegisterWindow clearfix'
526                }, loadOptions), $.extend(window_options, options), $.extend(data, {
527                    next: {
528                        'CbMessageWindow': 'CbControlbar2MessageWindow',
529                        'CbVerifyMailWindow': 'CbControlbar2VerifyMailWindow'
530                    }
531                }));
532            }
533        });
534
535    }
536
537});

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.