PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / v3 / src / assets / js / common / utilHeaderHeight.js
ameliabooking / v3 / src / assets / js / common Last commit date
appointments.js 1 month ago attendees.js 1 month ago colorManipulation.js 1 month ago customer.js 1 month ago date.js 3 weeks ago defaultCustomize.js 3 weeks ago employee.js 6 days ago events.js 1 month ago formFieldsTemplates.js 1 month ago formatting.js 1 month ago helper.js 6 days ago image.js 1 month ago integrationApple.js 1 month ago integrationGoogle.js 1 month ago integrationOutlook.js 1 month ago integrationStripe.js 1 month ago integrationZoom.js 1 month ago licence.js 1 month ago liveAnnouncer.js 3 weeks ago phone.js 3 weeks ago pricing.js 1 month ago recurring.js 6 days ago responsive.js 1 month ago scrollElements.js 1 month ago settings.js 1 month ago translationsElementPlus.js 1 month ago utilHeaderHeight.js 1 month ago
utilHeaderHeight.js
131 lines
1 function getStickyOrFixedHeaderHeight(options = {}) {
2 let root = options.root
3 let win = options.win || window
4 let edgeSlop = typeof options.edgeSlop === 'number' ? options.edgeSlop : 4
5 let headerThreshold = typeof options.headerThreshold === 'number' ? options.headerThreshold : 200
6 let elementsFromPointMaxDepth =
7 typeof options.elementsFromPointMaxDepth === 'number' ? options.elementsFromPointMaxDepth : 24
8 let ancestorMaxDepth =
9 typeof options.ancestorMaxDepth === 'number' ? options.ancestorMaxDepth : 14
10
11 let doc = win.document
12 let body = root && root.nodeType === 9 ? root.body : root
13 if (!body) {
14 body = doc.body
15 }
16
17 if (!body || typeof body.querySelectorAll !== 'function') {
18 return 0
19 }
20
21 let candidates = collectTopChromeCandidates(
22 body,
23 doc,
24 elementsFromPointMaxDepth,
25 ancestorMaxDepth,
26 )
27
28 let maxBottom = 0
29
30 candidates.forEach((el) => {
31 let rect = el.getBoundingClientRect()
32 if (rect.width <= 0 || rect.height <= 0) {
33 return
34 }
35 if (rect.top > headerThreshold) {
36 return
37 }
38
39 let style = win.getComputedStyle(el)
40 let position = style.position
41
42 if (position !== 'fixed' && position !== 'sticky') {
43 return
44 }
45
46 if (
47 style.display === 'none' ||
48 style.visibility === 'hidden' ||
49 parseFloat(style.opacity) === 0
50 ) {
51 return
52 }
53
54 let top = rect.top
55 let parsedTop = parseFloat(style.top)
56 let anchorTop = Number.isFinite(parsedTop) ? parsedTop : 0
57
58 if (position === 'fixed') {
59 if (top >= anchorTop - edgeSlop && top <= anchorTop + edgeSlop) {
60 maxBottom = Math.max(maxBottom, rect.bottom)
61 }
62 } else if (position === 'sticky') {
63 if (top <= anchorTop + edgeSlop && top >= anchorTop - edgeSlop) {
64 maxBottom = Math.max(maxBottom, rect.bottom)
65 }
66 }
67 })
68
69 return Math.round(maxBottom)
70 }
71
72 function collectTopChromeCandidates(body, doc, elementsFromPointMaxDepth, ancestorMaxDepth) {
73 let set = new Set()
74 let semantic = body.querySelectorAll('header, [role="banner"], .site-header, nav, #wpadminbar')
75
76 for (let i = 0; i < semantic.length; i++) {
77 set.add(semantic[i])
78 }
79
80 let kids = body.children
81 for (let i = 0; i < kids.length; i++) {
82 set.add(kids[i])
83 }
84
85 if (typeof doc.elementsFromPoint !== 'function') {
86 return set
87 }
88
89 let win = doc.defaultView
90 if (!win) {
91 return set
92 }
93
94 let w = win.innerWidth || 0
95 let xs = w > 24 ? [8, Math.floor(w / 2), w - 8] : [Math.max(1, Math.floor(w / 2))]
96 let y = 2
97
98 for (let x = 0; x < xs.length; x++) {
99 let stack = doc.elementsFromPoint(xs[x], y)
100 if (!stack || !stack.length) {
101 continue
102 }
103
104 let limit = Math.min(stack.length, elementsFromPointMaxDepth)
105 for (let i = 0; i < limit; i++) {
106 addAncestorsWithinBody(set, stack[i], body, ancestorMaxDepth)
107 }
108 }
109
110 return set
111 }
112
113 function addAncestorsWithinBody(set, el, body, maxDepth) {
114 let node = el
115 let depth = 0
116
117 while (node && node !== body && depth < maxDepth) {
118 if (node.nodeType === 1) {
119 set.add(node)
120 }
121 node = node.parentElement
122 depth++
123 }
124
125 if (node === body && body.nodeType === 1) {
126 set.add(body)
127 }
128 }
129
130 export { getStickyOrFixedHeaderHeight }
131