-
Notifications
You must be signed in to change notification settings - Fork 0
/
advanced-controls.php
524 lines (439 loc) · 15.5 KB
/
advanced-controls.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<?php
/**
* Yourseobook Customizer Custom Controls
*
*/
/**
* Custom Your SEO Book Control Base Class
*
* @author Dimitar Krumov Prime <https://seobookpro.com>
* @license http://www.gnu.org/licenses/gpl-2.0.html
* @link https://github.com/seobookpro
*/
if ( class_exists( 'WP_Customize_Control' ) ) {
class Yourseobook_Tabbed_Custom_Control extends WP_Customize_Control {
public $type = 'tabbed_menu';
public function render_content() {
?>
<div class="yourseobook-tabbed-menu">
<h2 style="font-size: 16px;text-align: center;border-bottom: 2px solid #0c0fc4;padding: 0px 0px 10px 0px;margin: 0px 0px 20px 0px;box-shadow: 0px 10px 10px -10px #000;color: #0a0fb6;">Main Header Navigation Styles Settings</h2>
<div style="margin:15px 0px 15px 0px;padding:15px 10px 15px 10px;border:1px solid #000;">
<details>
<summary>
Header Menu Navigation Style Settings
</summary>
<p>The Header Menu Navigation Style Settings provide options to customize the appearance and layout of the header menu on your website.</p>
<h3>Here's a brief glossary of the style CSS attributes related to these settings:</h3>
<ul>
<li>Header Menu Width: Specifies the width of the header menu element. It determines how much horizontal space the menu occupies.</li>
<li>Header Menu Height: Defines the height of the header menu element. It determines its vertical size.</li>
</ul>
</details>
<details>
<summary>
Setup the Header Navigation Styles
</summary>
<p style="font-size: 14px;">By adjusting these style settings, you can customize the dimensions, spacing, positioning, display, shadows, and background of the header menu to match your website's design and branding requirements.</p>
</details>
</div>
<script>
function filterStyles() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
jQuery(document).ready(function($) {
// Reset margin control
$(document).on('click', '.reset-margin-button', function(e) {
e.preventDefault();
// Reset the margin control to its default value
wp.customize('yourseobook_header_main_navigation_master_menu_margin').set('');
});
// Reset padding control
$(document).on('click', '.reset-padding-button', function(e) {
e.preventDefault();
// Reset the padding control to its default value
wp.customize('yourseobook_header_main_navigation_master_menu_padding').set('');
});
// Reset Width control
$(document).on('click', '.reset-width-button', function(e) {
e.preventDefault();
// Reset the width control to its default value
wp.customize('yourseobook_header_main_navigation_master_menu_width').set('');
});
// Reset Height control
// Reset height control and update the height-value span
$(document).on('click', '.reset-height-button', function(e) {
e.preventDefault();
// Reset the height control to its default value
wp.customize('yourseobook_header_main_navigation_master_menu_height').set('');
});
// Display Values on Range Slide
// Update margin value
wp.customize('yourseobook_header_main_navigation_master_menu_margin', function(value) {
value.bind(function(newVal) {
$('.margin-value').text(newVal);
});
});
// Update padding value
wp.customize('yourseobook_header_main_navigation_master_menu_padding', function(value) {
value.bind(function(newVal) {
$('.padding-value').text(newVal);
});
});
// Update width value
wp.customize('yourseobook_header_main_navigation_master_menu_width', function(value) {
value.bind(function(newVal) {
$('.width-value').text(newVal);
});
});
// Update height value
// Bind height control value and update the height-value span
wp.customize('yourseobook_header_main_navigation_master_menu_height', function(value) {
value.bind(function(newVal) {
$('.height-value').text(newVal);
});
});
});
const headerWidthInput = document.getElementById('headerheight');
const headerWidthValue = document.getElementById('hhve');
// Update the target element with the initial value
headerWidthValue.textContent = headerWidthInput.value + 'px';
// Listen for the input event on the range input
headerWidthInput.addEventListener('input', function() {
// Update the target element with the current value
headerWidthValue.textContent = headerWidthInput.value + 'px';
});
const headerMarginInput = document.getElementById('headermargin');
const headerMarginValue = document.getElementById('hmve');
// Update the target element with the initial value
headerMarginValue.textContent = headerMarginInput.value + 'px';
// Listen for the input event on the range input
headerMarginInput.addEventListener('input', function() {
// Update the target element with the current value
headerMarginValue.textContent = headerMarginInput.value + 'px';
});
function clearInput(event) {
event.preventDefault();
document.getElementById('myInput').value = ''; // Clear the input field
filterStyles(); // Call the filterStyles function to update the filtered results
}
</script>
<style>
div#settings-filter {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
column-gap: 5px;
}
button#clearButton {
background: #0c0fc4;
border: none;
border-radius: 8px;
text-transform: uppercase;
font-weight: 500;
color: #fff;
font-size: 12px;
padding: 0px 20px;
margin: 5px;
line-height: 0;
max-height: 30px;
}
div#settings-filter input#myInput {
max-height: 30px;
border: 1px solid #0c0fc4;
background: #ffe102;
color: #000 !important;
font-size: 10px;
margin: 6px auto;
border-radius: 8px;
padding: 5px;
max-width: 85%;
}
div#settings-filter input#myInput {
height: 40px;
border: 1px solid #0c0fc4;
background: #ffe102;
color: #000 !important;
font-size: 12px;
}
.header-nav-content {
max-width: 100%;
padding: 5px 0px 5px 0px;
background: #00000008;
color: #0c0fc4;
font-size: 14px;
margin: 5px 0px 5px 0px;
display: flex;
flex-wrap: nowrap;
justify-content: space-around;
align-items: center;
column-gap: 10px;
text-align: center;
flex-direction: row;
border: 1px solid #4002ff47;
}
.header-nav-tab {
width: 100%;
padding: 5px 0px 5px 0px;
color: #3f01fb;
font-size: 14px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
}
.column-title {
float: left;
width: 20%;
font-size: 12px;
text-align: left;
padding: 5px 15px 5px 15px;
}
.column-settings {
float: left;
width: 75%;
font-size: 12px;
padding: 0px;
text-align: left;
margin: 0px auto !IMPORTANT;
display: block;
}
.column-settings label {
float: left;
width: 90%;
display: flex;
column-gap: 10px;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
}
.column-help {
float: left;
min-width: 25%;
font-size: 12px;
padding: 5px 5px 0px 5px;
text-align: left;
display: flex;
justify-content: space-evenly;
flex-direction: row;
align-items: center;
column-gap: 10px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the three columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.column {
width: 100%;
}
}
span.dashicons.dashicons-image-rotate {
background: none !important;
border: none !important;
font-size: 14px;
}
button.reset-height-button {
background: none;
border: none;
font-size: 12px !IMPORTANT;
height: 20px;
width: 20px;
color: #000;
margin: 0px 0px;
}
.column-settings input[type="range"] {
height: 3px;
width: 100%;
padding: 2px;
line-height: 9px;
opacity: .8;
}
span.height-value, span.margin-value {
background: #000;
font-size: 12px;
margin: 0px 3px;
padding: 0px 6px;
color: #fff;
min-width: 40%;
text-align: center;
}
</style>
<div class="yourseobook-tabbed-menu-content">
<div class="yourseobook-tabbed-menu-pane active" data-tab="header">
<?php $this->render_header_content(); ?>
</div>
<div class="yourseobook-tabbed-menu-pane" data-tab="style">
<?php $this->render_style_content(); ?>
</div>
</div>
</div>
<?php
}
public function render_header_content() {
?>
<?php }
public function render_style_content() {
?>
<div id="settings-filter">
<button id="clearButton" onclick="clearInput(event)">Clear</button>
<input type="text" id="myInput" onkeyup="filterStyles()" placeholder="Search for Header Menu Style Settings.." title="Search for Header Menu Style Settings" class="maybe-sticky is-in-view is-sticky" list="styleOptions"/>
<datalist id="styleOptions">
<option value="Nav Menu Background"></option>
<option value="Nav Menu Width"></option>
<option value="Nav Menu Height"></option>
<option value="Nav Menu Margin"></option>
<option value="Nav Menu Padding"></option>
</datalist>
</div>
<table id="myTable" class="header-nav-tab">
<tbody class="row">
<tr class="header-nav-tab">
<th class="column-title">HTML</th>
<th class="column-settings">CSS Settings</th>
<th class="column-help">FAQ</th>
</tr>
<tr class="header-nav-content">
<td class="column-title">Nav Menu Background</td>
<td class="column-settings">
<?php $this->color_control( 'yourseobook_header_main_navigation_master_menu_background_color', __( '', 'yourseobook' ), __( '', 'yourseobook' ) ); ?>
</td>
<td class="column-help">
<button class="reset-background-button"><span class="dashicons dashicons-image-rotate"></span></button>
</span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Nav Menu Width</td>
<td class="column-settings">
<?php $this->width_control ( 'yourseobook_header_main_navigation_master_menu_width', __( '', 'yourseobook' ), __( '', 'yourseobook' ) ); ?>
</td>
<td class="column-help">
<button class="reset-width-button"><span class="dashicons dashicons-image-rotate"></span></button>
<span class="width-value"></span>
</td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Nav Menu Height</td>
<td class="column-settings">
<?php $this->height_control ( 'yourseobook_header_main_navigation_master_menu_height', __( '', 'yourseobook' ), __( '', 'yourseobook' ) ); ?>
</td>
<td class="column-help">
<button class="reset-height-button"><span class="dashicons dashicons-image-rotate"></span></button>
<span id="hhve" class="height-value"></span>
</td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Nav Menu Margin</td>
<td class="column-settings">
<?php $this->margin_control ( 'yourseobook_header_main_navigation_master_menu_margin', __( '', 'yourseobook' ), __( '', 'yourseobook' ) ); ?>
</td>
<td class="column-help">
<button class="reset-margin-button"><span class="dashicons dashicons-image-rotate"></span></button>
<span id="hmve" class="margin-value"></span>
</td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Nav Menu Padding</td>
<td class="column-settings">
<?php $this->padding_control ( 'yourseobook_header_main_navigation_master_menu_padding', __( '', 'yourseobook' ), __( '', 'yourseobook' ) ); ?>
</td>
<td class="column-help">
<button class="reset-padding-button"><span class="dashicons dashicons-image-rotate"></span></button>
<span id="hhve" class="padding-value"></span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Margin</td>
<td class="column-settings">Sweden</td>
<td class="column-help"><span class="dashicons dashicons-editor-help"></span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Padding</td>
<td class="column-settings">Sweden</td>
<td class="column-help"><span class="dashicons dashicons-editor-help"></span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Border</td>
<td class="column-settings">Sweden</td>
<td class="column-help"><span class="dashicons dashicons-editor-help"></span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Shadow</td>
<td class="column-settings">Sweden</td>
<td class="column-help"><span class="dashicons dashicons-editor-help"></span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Position</td>
<td class="column-settings">Sweden</td>
<td class="column-help"><span class="dashicons dashicons-editor-help"></span></td>
</tr>
<tr class="header-nav-content">
<td class="column-title">Display</td>
<td class="column-settings">Sweden</td>
<td class="column-help"><span class="dashicons dashicons-editor-help"></span></td>
</tr>
</tbody>
</table>
<? }
public function color_control( $setting, $label, $description ) {
$value = get_theme_mod( $setting );
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $label ); ?></span>
<input type="color" data-customize-setting-link="<?php echo esc_attr( $setting ); ?>" value="<?php echo esc_attr( $value ); ?>">
<span class="description"><?php echo esc_html( $description ); ?></span>
</label>
<?php
}
public function width_control( $setting, $label, $description ) {
$value = get_theme_mod( $setting );
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $label ); ?></span>
<input type="range" data-customize-setting-link="<?php echo esc_attr( $setting ); ?>" value="<?php echo esc_attr( $value ); ?>">
<span class="description"><?php echo esc_html( $description ); ?></span>
</label>
<?php
}
public function height_control( $setting, $label, $description ) {
$value = get_theme_mod( $setting );
?>
<input class="range-slider" type="range" id="headerheight" min="40" max="120" step="1" value="60" data-customize-setting-link="<?php echo esc_attr( $setting ); ?>" />
<?php
}
public function margin_control( $setting, $label, $description ) {
$value = get_theme_mod( $setting );
?>
<input class="range-slider" type="range" id="headermargin" min="0" max="120" step="1" value="0" data-customize-setting-link="<?php echo esc_attr( $setting ); ?>" />
<?php
}
public function padding_control( $setting, $label, $description ) {
$value = get_theme_mod( $setting );
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $label ); ?></span>
<input type="range" data-customize-setting-link="<?php echo esc_attr( $setting ); ?>" value="<?php echo esc_attr( $value ); ?>">
<span class="description"><?php echo esc_html( $description ); ?></span>
</label>
<?php
}
}
}