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

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + import {
2 + getPrefixFor,
3 + getOptionFor,
4 + responsiveClassesFor,
5 + watchOptionsWithPrefix,
6 + applyPrefixFor,
7 + } from './helpers'
8 +
9 + const prefix = getPrefixFor({
10 + allowed_prefixes: [
11 + 'blog',
12 + 'search',
13 + 'author',
14 + 'categories',
15 + 'woo_categories',
16 + ],
17 + default_prefix: 'blog',
18 + })
19 +
20 + const optionPrefix = ['author', 'categories'].includes(prefix) ? 'blog' : prefix
21 +
22 + watchOptionsWithPrefix({
23 + getPrefix: () => prefix,
24 + getOptionsForPrefix: () => [
25 + `${optionPrefix}_load_more_label`,
26 + `${optionPrefix}_paginationDivider`,
27 + `${optionPrefix}_numbers_visibility`,
28 + `${optionPrefix}_arrows_visibility`,
29 + ],
30 +
31 + render: () => {
32 + if (document.querySelector('.ct-load-more')) {
33 + document.querySelector('.ct-load-more').innerHTML = getOptionFor(
34 + 'load_more_label',
35 + optionPrefix
36 + )
37 + }
38 +
39 + ;[...document.querySelectorAll('.ct-pagination')].map((el) => {
40 + el.removeAttribute('data-divider')
41 + ;[...el.parentNode.querySelectorAll('nav > a')].map((el) => {
42 + responsiveClassesFor(
43 + getOptionFor('arrows_visibility', optionPrefix),
44 + el
45 + )
46 + })
47 + ;[...el.parentNode.querySelectorAll('nav > div')].map((el) => {
48 + responsiveClassesFor(
49 + getOptionFor('numbers_visibility', optionPrefix),
50 + el
51 + )
52 + })
53 +
54 + if (
55 + getOptionFor('paginationDivider', optionPrefix).style === 'none'
56 + ) {
57 + return
58 + }
59 +
60 + if (
61 + getOptionFor('pagination_global_type', optionPrefix) ===
62 + 'infinite_scroll'
63 + ) {
64 + return
65 + }
66 +
67 + el.dataset.divider = ''
68 + })
69 + },
70 + })
71 +
72 + export const getPaginationVariables = () => ({
73 + [`${optionPrefix}_paginationSpacing`]: {
74 + selector: applyPrefixFor('.ct-pagination', prefix),
75 + variable: 'spacing',
76 + responsive: true,
77 + unit: '',
78 + },
79 +
80 + [`${optionPrefix}_paginationDivider`]: {
81 + selector: applyPrefixFor('.ct-pagination[data-divider]', prefix),
82 + variable: 'pagination-divider',
83 + type: 'border',
84 + skip_none: true,
85 + },
86 +
87 + [`${optionPrefix}_pagination_border_radius`]: {
88 + selector: applyPrefixFor('.ct-pagination', prefix),
89 + type: 'spacing',
90 + variable: 'theme-button-border-radius',
91 + emptyValue: 4,
92 + },
93 +
94 + [`${optionPrefix}_simplePaginationFontColor`]: [
95 + {
96 + selector: applyPrefixFor(
97 + '[data-pagination="simple"], [data-pagination="next_prev"]',
98 + prefix
99 + ),
100 + variable: 'theme-text-color',
101 + type: 'color:default',
102 + },
103 +
104 + {
105 + selector: applyPrefixFor(
106 + '.ct-pagination[data-pagination="simple"]',
107 + prefix
108 + ),
109 + variable: 'theme-text-active-color',
110 + type: 'color:active',
111 + },
112 +
113 + {
114 + selector: applyPrefixFor(
115 + '[data-pagination="simple"], [data-pagination="next_prev"]',
116 + prefix
117 + ),
118 + variable: 'theme-link-hover-color',
119 + type: 'color:hover',
120 + },
121 + ],
122 +
123 + [`${optionPrefix}_paginationButtonText`]: [
124 + {
125 + selector: applyPrefixFor('[data-pagination="load_more"]', prefix),
126 + variable: 'theme-button-text-initial-color',
127 + type: 'color:default',
128 + },
129 +
130 + {
131 + selector: applyPrefixFor('[data-pagination="load_more"]', prefix),
132 + variable: 'theme-button-text-hover-color',
133 + type: 'color:hover',
134 + },
135 + ],
136 +
137 + [`${optionPrefix}_paginationButton`]: [
138 + {
139 + selector: applyPrefixFor('[data-pagination="load_more"]', prefix),
140 + variable: 'theme-button-background-initial-color',
141 + type: 'color:default',
142 + },
143 +
144 + {
145 + selector: applyPrefixFor('[data-pagination="load_more"]', prefix),
146 + variable: 'theme-button-background-hover-color',
147 + type: 'color:hover',
148 + },
149 + ],
150 + })
151 +