PageSourceSearch

https://www.bayfor.org/typo3conf/ext/psb_bayfor_research_asso/Reso…/Js/psb_bayfor_research_asso.js?1737026762

js bayfor.org collected 2026-10-02 03:58:05 UTC 3,209 bytes, 146 lines download raw bytes

1/**
2 * The menu manager
3 * @type {{$subMenus: {}}}
4 */
5psbMenuManager = {
6    $subMenus: {}
7};
8
9/**
10 * Initializes the menuManager
11 */
12psbMenuManager.init = function() {
13    this.$subMenus = $('.anchor-link');
14    if(this.$subMenus.length) {
15        this.setEventListener();
16    }
17};
18
19/**
20 * Sets event listeners
21 */
22psbMenuManager.setEventListener = function() {
23    this.$subMenus.click(function(e) {
24       e.preventDefault();
25       var $clickedLink = $(e.target);
26       psbMenuManager.triggerSubMenuClick($clickedLink);
27    });
28};
29
30/**
31 * Triggers the click on a sub menu element
32 * @param object $clickedLink
33 */
34psbMenuManager.triggerSubMenuClick = function($clickedLink) {
35    var target = $clickedLink.attr('href');
36    // Escape slashes in ID selectors e. g. #wissenschaftler/in
37    target = target.replace('/', '\\/');
38    var $targetElement = $(target);
39    var $targetContainer = $clickedLink.parents('ul.submenu').parent('li');
40    var $targetLink = $(' > a', $targetContainer);
41
42    if($targetLink.length) {
43        $targetLink.click();
44
45        if($targetElement.length) {
46            $targetElement.click();
47        }
48    }
49
50};
51
52/**
53 * TabManager
54 */
55/**
56 * The tab manager
57 * @type {{$container: {}}}
58 */
59psbTabManager = {
60    $container: {}
61};
62
63/**
64 * Initializes the TabManager
65 */
66psbTabManager.init = function() {
67    this.$container = $('.tx-psb-bayfor-research-asso .bfv_reiter_menu');
68    if(this.$container.length) {
69        this.checkNumberOfTabs();
70    }
71};
72
73/**
74 * Checks the number of tabs
75 */
76psbTabManager.checkNumberOfTabs = function() {
77    var $tabs = $('> li', this.$container);
78    if($tabs.length && $tabs.length === 7) {
79        this.setContainerClass();
80    }
81};
82
83/**
84 * Sets a class on the tab container
85 */
86psbTabManager.setContainerClass = function() {
87    this.$container.addClass('full-width');
88};
89
90/**
91 * HotFixManager
92 */
93/**
94 * The hotfix manager
95 * @type {{$container: {}}}
96 */
97psbHotFixManager = {
98    $listImageContainers: {}
99};
100
101/**
102 * Initializes the HotFix manager
103 */
104psbHotFixManager.init = function() {
105    this.$listImageContainers = $('.area-image--list');
106    if(this.$listImageContainers.length) {
107        this.verticalAlignImagesInContainer();
108        this.setEventListener();
109    }
110};
111
112/**
113 * Vertical align the image in its container
114 */
115psbHotFixManager.verticalAlignImagesInContainer = function() {
116    $.each(this.$listImageContainers, function(index) {
117        var $listImageContainer = psbHotFixManager.$listImageContainers.eq(index);
118        var $image = $('img', $listImageContainer);
119
120        if($image.length) {
121            var containerHeight = $listImageContainer.height();
122            var imageHeight = $image.height();
123
124            if(imageHeight < containerHeight) {
125                var offsetTop = (containerHeight - imageHeight) / 2;
126                $image.css('margin-top', offsetTop)
127            }
128        }
129
130    });
131};
132
133psbHotFixManager.setEventListener = function() {
134    $(window).resize(function() {
135        psbHotFixManager.verticalAlignImagesInContainer();
136    });
137};
138
139/**
140 * Document ready listener
141 */
142$(document).ready(function() {
143    psbMenuManager.init();
144    psbTabManager.init();
145    psbHotFixManager.init();
146});

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.