Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/static/js/customizer/sync/featured_image.js

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + import {
2 + setRatioFor,
3 + watchOptionsWithPrefix,
4 + getOptionFor,
5 + responsiveClassesFor,
6 + } from './helpers'
7 + import { getPrefixFor } from './hero-section'
8 +
9 + watchOptionsWithPrefix({
10 + getPrefix: getPrefixFor,
11 +
12 + getOptionsForPrefix: ({ prefix }) => [
13 + `${prefix}_featured_image_width`,
14 + `${prefix}_featured_image_ratio`,
15 + `${prefix}_featured_image_visibility`,
16 + `${prefix}_content_style`,
17 + ],
18 +
19 + render: ({ prefix, id }) => {
20 + const image = document.querySelector(
21 + '.site-main article .ct-featured-image'
22 + )
23 +
24 + if (!image) {
25 + return
26 + }
27 +
28 + if (
29 + id === `${prefix}_featured_image_width` ||
30 + id === `${prefix}_content_style`
31 + ) {
32 + image.classList.remove('alignwide')
33 + image.classList.remove('alignfull')
34 +
35 + if (getOptionFor('content_style', prefix) !== 'boxed') {
36 + if (getOptionFor('featured_image_width', prefix) === 'wide') {
37 + image.classList.add('alignwide')
38 + }
39 +
40 + if (getOptionFor('featured_image_width', prefix) === 'full') {
41 + image.classList.add('alignfull')
42 + }
43 + }
44 + }
45 +
46 + if (id === `${prefix}_featured_image_ratio`) {
47 + setRatioFor({
48 + ratio: getOptionFor('featured_image_ratio', prefix),
49 + el: image.querySelector('.ct-media-container'),
50 + })
51 + }
52 +
53 + if (id === `${prefix}_featured_image_visibility`) {
54 + responsiveClassesFor(
55 + getOptionFor('featured_image_visibility', prefix),
56 + image
57 + )
58 + }
59 + },
60 + })
61 +