PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
2.4.8 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 / public / customFontFace.js
ameliabooking / v3 / src / assets / js / public Last commit date
actions.js 1 month ago booking.js 1 month ago cabinet.js 1 month ago cart.js 1 month ago catalog.js 1 month ago coupon.js 1 month ago customFields.js 1 month ago customFontFace.js 1 month ago eventFormCssVars.js 1 month ago events.js 1 month ago facebookPixel.js 1 month ago ivy.js 1 month ago package.js 1 month ago panel.js 1 month ago public.js 1 month ago renderActions.js 1 month ago restore.js 1 month ago slots.js 1 month ago translation.js 1 month ago user.js 1 month ago
customFontFace.js
33 lines
1 const CUSTOM_FONT_FACE_STYLE_ID = 'amCustomFont'
2
3 /**
4 * Injects a single @font-face rule into document head when Amelia uses an uploaded custom font.
5 * Removes any previous node with the same id (legacy behavior).
6 *
7 * @param {{ customFontSelected?: boolean, fontFamily?: string, fontUrl?: string }|null|undefined} fonts
8 */
9 export function applyCustomFontFaceIfSelected(fonts) {
10 if (!fonts || !fonts.customFontSelected) {
11 return
12 }
13
14 if (!fonts.fontFamily || !fonts.fontUrl) {
15 return
16 }
17
18 const head = document.head || document.getElementsByTagName('head')[0]
19 const existing = head.querySelector(`#${CUSTOM_FONT_FACE_STYLE_ID}`)
20 if (existing) {
21 existing.remove()
22 }
23
24 const safeFontFamily = String(fonts.fontFamily).replace(/['\\\n\r]/g, '\\$&')
25 const safeFontUrl = String(fonts.fontUrl).replace(/["\\)\n\r]/g, '\\$&')
26 const css = `@font-face { font-family: '${safeFontFamily}'; src: url("${safeFontUrl}"); }`
27 const style = document.createElement('style')
28 head.appendChild(style)
29 style.setAttribute('type', 'text/css')
30 style.setAttribute('id', CUSTOM_FONT_FACE_STYLE_ID)
31 style.appendChild(document.createTextNode(css))
32 }
33