PageSourceSearch

https://www.corkcitylibraries.ie/scripts/common.js?d=1b2847c63693bfb74df50a5be151a5c11aa77c0d

js corkcitylibraries.ie collected 2026-10-02 12:48:11 UTC 5,860 bytes, 187 lines download raw bytes

1const appWidthHeight = () => {
2    const doc = document.documentElement
3    doc.style.setProperty('--app-width', `${document.documentElement.clientWidth}px`)
4    doc.style.setProperty('--app-height', `${window.innerHeight}px`)
5}
6window.addEventListener('resize', appWidthHeight)
7appWidthHeight()
8
9const offcanvasAside = document.getElementById('offcanvasAside')
10offcanvasAside.addEventListener('show.bs.offcanvas', event => {
11    document.querySelectorAll(".mobile-nav ul").forEach((e) => {
12        e.style.top = (document.querySelector(".mobile-nav").offsetTop - 1) + "px";
13    })
14})
15
16document.body.classList.toggle("header-is-sticky", window.scrollY > 0)
17window.addEventListener('scroll', () => {
18    document.body.classList.toggle("header-is-sticky", window.scrollY > 0)
19});
20
21const flips = document.querySelectorAll(".flip");
22for (let flip of flips) {
23    var result;
24    var h = window.innerWidth < 500 ? "250px" : "600px";
25
26    var flipbookURL = flip.getAttribute("data-url");
27    var flipbookSize = flip.getAttribute("data-flipbooksize");
28    if (flipbookURL != '' && flipbookURL != null) {
29        result = flipbookURL.match(/\/view\/([0-9]+)/);
30		if(result != null){
31        var id = result[1];
32        if (flipbookSize == 'Full Width') {
33            flip.outerHTML = ("<div class='mt-20'><a href=" + flipbookURL + " class='fbo-embed' data-fbo-id='" + id + "' data-fbo-lightbox='yes' data-fbo-width='900px' data-fbo-height='" + h + "' data-fbo-version='1' style='max-width: 100%;'></a></div>");
34        }
35        else {
36            flip.outerHTML = ("<div class='mt-20'><a href=" + flipbookURL + " class='fbo-embed' data-fbo-id='" + id + "' data-fbo-lightbox='yes' data-fbo-width='250px' data-fbo-height='250px' data-fbo-version='1' style='max-width: 100%;'></a></div>");
37        }
38        var tag = document.createElement('script');
39        tag.src = "https://online.flippingbook.com/EmbedScriptUrl.aspx?m=redir&hid=" + id;
40        tag.async = true;
41        tag.defer = 'defer';
42        console.log(tag)
43
44        var firstScriptTag = document.getElementsByTagName('script')[0];
45        firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
46		}
47    }
48}
49
50
51const dropdowns = document.querySelectorAll('.js-nav-item');
52for (let q of dropdowns) {
53    q.onmouseenter = function () {
54        var self = this;
55        for (let dd of dropdowns) {
56            clearTimeout(dd.delayOut);
57        }
58        q.delayIn = setTimeout(function () {
59            for (let dd of dropdowns) {
60                if (q != dd) {
61                    dd.classList.remove('hovered');
62                }
63                clearTimeout(dd.delayOut);
64            }
65            self.classList.add('hovered');
66
67        }, 400);
68    }
69    q.onmouseleave = function () {
70        var self = this;
71
72        for (let dd of dropdowns) {
73
74            clearTimeout(dd.delayIn);
75
76        }
77        q.delayOut = setTimeout(function () {
78            self.classList.remove('hovered');
79        }, 400);
80    }
81}
82
83const searchTopOffcanvas = document.getElementById('offcanvasTop');
84searchTopOffcanvas.addEventListener('show.bs.offcanvas', event => {
85    searchTopOffcanvas.style.height = document.querySelector(".global-header").clientHeight + 'px';
86});
87
88searchTopOffcanvas.addEventListener('shown.bs.offcanvas', event => {
89    document.querySelector(".global-search input").focus();
90});
91
92
93
94/* Main Nav */
95const mainNavList = document.querySelectorAll(".navbar-nav ul");
96const mainNavbarCollapsible = document.getElementById('mainNavigationContent')
97if (mainNavbarCollapsible) {
98    mainNavbarCollapsible.addEventListener('show.bs.collapse', event => {
99        for (const item of mainNavList) {
100            item.style.top = document.querySelector(".navbar-custom").clientHeight + "px"
101        }
102    })
103    mainNavbarCollapsible.addEventListener('hide.bs.collapse', event => {
104        for (const item of mainNavList) {
105            item.style.top = 0
106        }
107    })
108}
109
110
111const mainNavItems = document.querySelectorAll(".mobile-nav a");
112if (mainNavItems) {
113    for (const item of mainNavItems) {
114        item.addEventListener('click', function (e) {
115
116            if (this.classList.contains("nav-go-back")) {
117                this.closest(".has-children").classList.remove("active")
118            }
119            else {
120                if (this.parentNode.classList.contains("has-children")) {
121                    e.preventDefault();
122                    this.parentNode.classList.add("active");
123                }
124                else {
125                    return true;
126                }
127            }
128
129        })
130    }
131
132}
133
134
135function openFirstAccordionSection() {
136    if (accItem[0]) {
137        accItem[0].className = 'p-a-item active';
138    }
139}
140
141function toggleItem() {
142    var itemClass = this.parentNode.className;
143    for (i = 0; i < accItem.length; i++) {
144        accItem[i].className = 'p-a-item';
145    }
146    if (itemClass.indexOf("active") <= -1) {
147        this.parentNode.className = 'p-a-item active';
148    }
149}
150
151function openAllAccordionSections() {
152    for (i = 0; i < accItem.length; i++) {
153        accItem[i].className = 'p-a-item active';
154    }
155}
156
157
158
159var accItem = document.getElementsByClassName('p-a-item');
160var accHD = document.getElementsByClassName('p-a-header');
161for (i = 0; i < accHD.length; i++) {
162    if (!accHD[i].hasAttribute('data-click')) {
163        accHD[i].addEventListener('click', toggleItem, false);
164        accHD[i].setAttribute('data-click', 'toggleItem');
165    }
166}
167
168
169
170
171
172
173document.addEventListener("DOMContentLoaded", function () {
174 
175 
176
177    /* Dropdown Close */
178    const dropdownCloseButtonList = document.querySelectorAll('.dropdown .btn-close')
179    dropdownCloseButtonList.forEach((e) => {
180        e.addEventListener('click', () => {
181            new bootstrap.Dropdown(e.closest(".dropdown").querySelector("[data-bs-toggle='dropdown']")).hide()
182        })
183    })
184});
185
186
187      

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.