Real Testimonials - Version 2.5.8

Version Description

  • Sept 02, 2022 =
  • Fix: Few Deprecated JS warnings on the plugin admin page.
Download this release

Release Info

Developer rubel_miah
Plugin Icon 128x128 Real Testimonials
Version 2.5.8
Comparing to
See all releases

Code changes from version 2.5.7 to 2.5.8

readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://shapedplugin.com/donate
4
  Tags: testimonial, testimonials, testimonial showcase, testimonials showcase, testimonial slider, testimonials slider, testimonial carousel, testimonial front-end submission form, testimonials widget, easy testimonial, testimonial rotator, random testimonials, custom testimonial, collect testimonials, social proof, simple testimonial plugin, best testimonials showcase plugin, free testimonial, customers reviews, real testimonials
5
  Requires at least: 4.0
6
  Tested up to: 6.0
7
- Stable tag: 2.5.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -318,6 +318,9 @@ Thank you!
318
 
319
  == Changelog ==
320
 
 
 
 
321
  = 2.5.7 - Aug 03, 2022 =
322
  * Improved: Migrated to Swiper from Slick js for Carousel/Slider.
323
  * Fix: The Dequeue options of Advanced Settings do not work along with Elementor Plugin.
4
  Tags: testimonial, testimonials, testimonial showcase, testimonials showcase, testimonial slider, testimonials slider, testimonial carousel, testimonial front-end submission form, testimonials widget, easy testimonial, testimonial rotator, random testimonials, custom testimonial, collect testimonials, social proof, simple testimonial plugin, best testimonials showcase plugin, free testimonial, customers reviews, real testimonials
5
  Requires at least: 4.0
6
  Tested up to: 6.0
7
+ Stable tag: 2.5.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
318
 
319
  == Changelog ==
320
 
321
+ = 2.5.8 - Sept 02, 2022 =
322
+ * Fix: Few Deprecated JS warnings on the plugin admin page.
323
+
324
  = 2.5.7 - Aug 03, 2022 =
325
  * Improved: Migrated to Swiper from Slick js for Carousel/Slider.
326
  * Fix: The Dequeue options of Advanced Settings do not work along with Elementor Plugin.
src/Admin/Views/Framework/assets/js/spftestimonial.js CHANGED
@@ -1,2121 +1,2121 @@
1
  ; (function ($, window, document, undefined) {
2
- 'use strict';
3
-
4
- //
5
- // Constants
6
- //
7
- var SPFTESTIMONIAL = SPFTESTIMONIAL || {};
8
-
9
- SPFTESTIMONIAL.funcs = {};
10
-
11
- SPFTESTIMONIAL.vars = {
12
- onloaded: false,
13
- $body: $('body'),
14
- $window: $(window),
15
- $document: $(document),
16
- $form_warning: null,
17
- is_confirm: false,
18
- form_modified: false,
19
- code_themes: [],
20
- is_rtl: $('body').hasClass('rtl'),
21
- };
22
-
23
- //
24
- // Helper Functions
25
- //
26
- SPFTESTIMONIAL.helper = {
27
-
28
- //
29
- // Generate UID
30
- //
31
- uid: function (prefix) {
32
- return (prefix || '') + Math.random().toString(36).substr(2, 9);
33
- },
34
-
35
- // Quote regular expression characters
36
- //
37
- preg_quote: function (str) {
38
- return (str + '').replace(/(\[|\])/g, "\\$1");
39
- },
40
-
41
- //
42
- // Reneme input names
43
- //
44
- name_nested_replace: function ($selector, field_id) {
45
-
46
- var checks = [];
47
- var regex = new RegExp(SPFTESTIMONIAL.helper.preg_quote(field_id + '[\\d+]'), 'g');
48
-
49
- $selector.find(':radio').each(function () {
50
- if (this.checked || this.orginal_checked) {
51
- this.orginal_checked = true;
52
- }
53
- });
54
-
55
- $selector.each(function (index) {
56
- $(this).find(':input').each(function () {
57
- this.name = this.name.replace(regex, field_id + '[' + index + ']');
58
- if (this.orginal_checked) {
59
- this.checked = true;
60
- }
61
- });
62
- });
63
-
64
- },
65
-
66
- //
67
- // Debounce
68
- //
69
- debounce: function (callback, threshold, immediate) {
70
- var timeout;
71
- return function () {
72
- var context = this, args = arguments;
73
- var later = function () {
74
- timeout = null;
75
- if (!immediate) {
76
- callback.apply(context, args);
77
- }
78
- };
79
- var callNow = (immediate && !timeout);
80
- clearTimeout(timeout);
81
- timeout = setTimeout(later, threshold);
82
- if (callNow) {
83
- callback.apply(context, args);
84
- }
85
- };
86
- },
87
- //
88
- // Get a cookie
89
- //
90
- get_cookie: function (name) {
91
-
92
- var e, b, cookie = document.cookie, p = name + '=';
93
-
94
- if (!cookie) {
95
- return;
96
- }
97
-
98
- b = cookie.indexOf('; ' + p);
99
-
100
- if (b === -1) {
101
- b = cookie.indexOf(p);
102
-
103
- if (b !== 0) {
104
- return null;
105
- }
106
- } else {
107
- b += 2;
108
- }
109
-
110
- e = cookie.indexOf(';', b);
111
-
112
- if (e === -1) {
113
- e = cookie.length;
114
- }
115
-
116
- return decodeURIComponent(cookie.substring(b + p.length, e));
117
-
118
- },
119
-
120
- //
121
- // Set a cookie
122
- //
123
- set_cookie: function (name, value, expires, path, domain, secure) {
124
-
125
- var d = new Date();
126
-
127
- if (typeof (expires) === 'object' && expires.toGMTString) {
128
- expires = expires.toGMTString();
129
- } else if (parseInt(expires, 10)) {
130
- d.setTime(d.getTime() + (parseInt(expires, 10) * 1000));
131
- expires = d.toGMTString();
132
- } else {
133
- expires = '';
134
- }
135
-
136
- document.cookie = name + '=' + encodeURIComponent(value) +
137
- (expires ? '; expires=' + expires : '') +
138
- (path ? '; path=' + path : '') +
139
- (domain ? '; domain=' + domain : '') +
140
- (secure ? '; secure' : '');
141
-
142
- },
143
- //
144
- // Remove a cookie
145
- //
146
- remove_cookie: function (name, path, domain, secure) {
147
- SPFTESTIMONIAL.helper.set_cookie(name, '', -1000, path, domain, secure);
148
- },
149
- };
150
-
151
- //
152
- // Custom clone for textarea and select clone() bug
153
- //
154
- $.fn.spftestimonial_clone = function () {
155
-
156
- var base = $.fn.clone.apply(this, arguments),
157
- clone = this.find('select').add(this.filter('select')),
158
- cloned = base.find('select').add(base.filter('select'));
159
-
160
- for (var i = 0; i < clone.length; ++i) {
161
- for (var j = 0; j < clone[i].options.length; ++j) {
162
-
163
- if (clone[i].options[j].selected === true) {
164
- cloned[i].options[j].selected = true;
165
- }
166
-
167
- }
168
- }
169
 
170
- this.find(':radio').each(function () {
171
- this.orginal_checked = this.checked;
172
- });
173
 
174
- return base;
175
 
176
- };
177
 
178
- //
179
- // Expand All Options
180
- //
181
- $.fn.spftestimonial_expand_all = function () {
182
- return this.each(function () {
183
- $(this).on('click', function (e) {
184
 
185
- e.preventDefault();
186
- $('.spftestimonial-wrapper').toggleClass('spftestimonial-show-all');
187
- $('.spftestimonial-section').spftestimonial_reload_script();
188
- $(this).find('.fa').toggleClass('fa-indent').toggleClass('fa-outdent');
189
 
190
- });
191
- });
192
- };
193
 
194
- //
195
- // Options Navigation
196
- //
197
- $.fn.spftestimonial_nav_options = function () {
198
- return this.each(function () {
199
 
200
- var $nav = $(this),
201
- $window = $(window),
202
- $wpwrap = $('#wpwrap'),
203
- $links = $nav.find('a'),
204
- $last;
205
 
206
- $window.on('hashchange spftestimonial.hashchange', function () {
207
 
208
- var hash = window.location.hash.replace('#tab=', '');
209
- var slug = hash ? hash : $links.first().attr('href').replace('#tab=', '');
210
- var $link = $('[data-tab-id="' + slug + '"]');
211
 
212
- if ($link.length) {
213
 
214
- $link.closest('.spftestimonial-tab-item').addClass('spftestimonial-tab-expanded').siblings().removeClass('spftestimonial-tab-expanded');
215
 
216
- if ($link.next().is('ul')) {
217
 
218
- $link = $link.next().find('li').first().find('a');
219
- slug = $link.data('tab-id');
220
 
221
- }
222
 
223
- $links.removeClass('spftestimonial-active');
224
- $link.addClass('spftestimonial-active');
225
 
226
- if ($last) {
227
- $last.addClass('hidden');
228
- }
229
 
230
- var $section = $('[data-section-id="' + slug + '"]');
231
 
232
- $section.removeClass('hidden');
233
- $section.spftestimonial_reload_script();
234
 
235
- $('.spftestimonial-section-id').val($section.index() + 1);
236
 
237
- $last = $section;
238
 
239
- if ($wpwrap.hasClass('wp-responsive-open')) {
240
- $('html, body').animate({ scrollTop: ($section.offset().top - 50) }, 200);
241
- $wpwrap.removeClass('wp-responsive-open');
242
- }
243
 
244
- }
245
 
246
- }).trigger('spftestimonial.hashchange');
247
 
248
- });
249
- };
250
 
251
- //
252
- // Metabox Tabs
253
- //
254
- $.fn.spftestimonial_nav_metabox = function () {
255
- return this.each(function () {
256
 
257
- var $nav = $(this),
258
- $links = $nav.find('a'),
259
- $sections = $nav.parent().find('.spftestimonial-section'),
260
- unique_id = $nav.data('unique'),
261
- post_id = $('#post_ID').val() || 'global',
262
- $last;
263
 
264
- $links.each(function (index) {
265
 
266
- $(this).on('click', function (e) {
267
 
268
- e.preventDefault();
269
 
270
- var $link = $(this);
271
- var section_id = $link.data('section');
272
- $links.removeClass('spftestimonial-active');
273
- $link.addClass('spftestimonial-active');
274
- if ($last !== undefined) {
275
- $last.addClass('hidden');
276
- }
277
 
278
- var $section = $sections.eq(index);
279
 
280
- $section.removeClass('hidden');
281
- $section.spftestimonial_reload_script();
282
- SPFTESTIMONIAL.helper.set_cookie('spftestimonial-last-metabox-tab-' + post_id + '-' + unique_id, section_id);
283
 
284
- $last = $section;
285
 
286
- });
287
 
288
- });
289
 
290
- var get_cookie = SPFTESTIMONIAL.helper.get_cookie('spftestimonial-last-metabox-tab-' + post_id + '-' + unique_id);
291
- if (get_cookie) {
292
- $nav.find('a[data-section="' + get_cookie + '"]').trigger('click');
293
- } else {
294
- $links.first('a').trigger('click');
295
- }
296
 
297
- });
298
- };
299
 
300
 
301
 
302
- //
303
- // Search
304
- //
305
- $.fn.spftestimonial_search = function () {
306
- return this.each(function () {
307
 
308
- var $this = $(this),
309
- $input = $this.find('input');
310
 
311
- $input.on('change keyup', function () {
312
 
313
- var value = $(this).val(),
314
- $wrapper = $('.spftestimonial-wrapper'),
315
- $section = $wrapper.find('.spftestimonial-section'),
316
- $fields = $section.find('> .spftestimonial-field:not(.spftestimonial-depend-on)'),
317
- $titles = $fields.find('> .spftestimonial-title, .spftestimonial-search-tags');
318
 
319
- if (value.length > 3) {
320
 
321
- $fields.addClass('spftestimonial-metabox-hide');
322
- $wrapper.addClass('spftestimonial-search-all');
323
 
324
- $titles.each(function () {
325
 
326
- var $title = $(this);
327
 
328
- if ($title.text().match(new RegExp('.*?' + value + '.*?', 'i'))) {
329
 
330
- var $field = $title.closest('.spftestimonial-field');
331
 
332
- $field.removeClass('spftestimonial-metabox-hide');
333
- $field.parent().spftestimonial_reload_script();
334
 
335
- }
336
 
337
- });
338
 
339
- } else {
340
 
341
- $fields.removeClass('spftestimonial-metabox-hide');
342
- $wrapper.removeClass('spftestimonial-search-all');
343
 
344
- }
345
 
346
- });
347
 
348
- });
349
- };
350
 
351
- //
352
- // Sticky Header
353
- //
354
- $.fn.spftestimonial_sticky = function () {
355
- return this.each(function () {
356
 
357
- var $this = $(this),
358
- $window = $(window),
359
- $inner = $this.find('.spftestimonial-header-inner'),
360
- padding = parseInt($inner.css('padding-left')) + parseInt($inner.css('padding-right')),
361
- offset = 32,
362
- scrollTop = 0,
363
- lastTop = 0,
364
- ticking = false,
365
- stickyUpdate = function () {
366
 
367
- var offsetTop = $this.offset().top,
368
- stickyTop = Math.max(offset, offsetTop - scrollTop),
369
- winWidth = $window.innerWidth();
370
 
371
- if (stickyTop <= offset && winWidth > 782) {
372
- $inner.css({ width: $this.outerWidth() - padding });
373
- $this.css({ height: $this.outerHeight() }).addClass('spftestimonial-sticky');
374
- } else {
375
- $inner.removeAttr('style');
376
- $this.removeAttr('style').removeClass('spftestimonial-sticky');
377
- }
378
 
379
- },
380
- requestTick = function () {
381
 
382
- if (!ticking) {
383
- requestAnimationFrame(function () {
384
- stickyUpdate();
385
- ticking = false;
386
- });
387
- }
388
 
389
- ticking = true;
390
 
391
- },
392
- onSticky = function () {
393
 
394
- scrollTop = $window.scrollTop();
395
- requestTick();
396
 
397
- };
398
 
399
- $window.on('scroll resize', onSticky);
400
 
401
- onSticky();
402
 
403
- });
404
- };
405
 
406
- //
407
- // Dependency System
408
- //
409
- $.fn.spftestimonial_dependency = function () {
410
- return this.each(function () {
411
 
412
- var $this = $(this),
413
- $fields = $this.children('[data-controller]');
414
 
415
- if ($fields.length) {
416
 
417
- var normal_ruleset = $.spftestimonial_deps.createRuleset(),
418
- global_ruleset = $.spftestimonial_deps.createRuleset(),
419
- normal_depends = [],
420
- global_depends = [];
421
 
422
- $fields.each(function () {
423
 
424
- var $field = $(this),
425
- controllers = $field.data('controller').split('|'),
426
- conditions = $field.data('condition').split('|'),
427
- values = $field.data('value').toString().split('|'),
428
- is_global = $field.data('depend-global') ? true : false,
429
- ruleset = (is_global) ? global_ruleset : normal_ruleset;
430
 
431
- $.each(controllers, function (index, depend_id) {
432
 
433
- var value = values[index] || '',
434
- condition = conditions[index] || conditions[0];
435
 
436
- ruleset = ruleset.createRule('[data-depend-id="' + depend_id + '"]', condition, value);
437
 
438
- ruleset.include($field);
439
 
440
- if (is_global) {
441
- global_depends.push(depend_id);
442
- } else {
443
- normal_depends.push(depend_id);
444
- }
445
 
446
- });
447
 
448
- });
449
 
450
- if (normal_depends.length) {
451
- $.spftestimonial_deps.enable($this, normal_ruleset, normal_depends);
452
- }
453
 
454
- if (global_depends.length) {
455
- $.spftestimonial_deps.enable(SPFTESTIMONIAL.vars.$body, global_ruleset, global_depends);
456
- }
457
 
458
- }
459
 
460
- });
461
- };
462
 
463
- //
464
- // Field: accordion
465
- //
466
- $.fn.spftestimonial_field_accordion = function () {
467
- return this.each(function () {
468
 
469
- var $titles = $(this).find('.spftestimonial-accordion-title');
470
 
471
- $titles.on('click', function () {
472
 
473
- var $title = $(this),
474
- $icon = $title.find('.spftestimonial-accordion-icon'),
475
- $content = $title.next();
476
 
477
- if ($icon.hasClass('fa-angle-right')) {
478
- $icon.removeClass('fa-angle-right').addClass('fa-angle-down');
479
- } else {
480
- $icon.removeClass('fa-angle-down').addClass('fa-angle-right');
481
- }
482
 
483
- if (!$content.data('opened')) {
484
 
485
- $content.spftestimonial_reload_script();
486
- $content.data('opened', true);
487
 
488
- }
489
 
490
- $content.toggleClass('spftestimonial-accordion-open');
491
 
492
- });
493
- if ($(this).hasClass('opened_accordion')) {
494
- $titles.trigger('click');
495
- }
496
 
497
- });
498
- };
499
 
500
- //
501
- // Field: code_editor
502
- //
503
- $.fn.spftestimonial_field_code_editor = function () {
504
- return this.each(function () {
505
 
506
- if (typeof CodeMirror !== 'function') { return; }
507
 
508
- var $this = $(this),
509
- $textarea = $this.find('textarea'),
510
- $inited = $this.find('.CodeMirror'),
511
- data_editor = $textarea.data('editor');
512
 
513
- if ($inited.length) {
514
- $inited.remove();
515
- }
516
 
517
- var interval = setInterval(function () {
518
- if ($this.is(':visible')) {
519
 
520
- var code_editor = CodeMirror.fromTextArea($textarea[0], data_editor);
521
 
522
- // load code-mirror theme css.
523
- if (data_editor.theme !== 'default' && SPFTESTIMONIAL.vars.code_themes.indexOf(data_editor.theme) === -1) {
524
 
525
- var $cssLink = $('<link>');
526
 
527
- $('#spftestimonial-codemirror-css').after($cssLink);
528
 
529
- $cssLink.attr({
530
- rel: 'stylesheet',
531
- id: 'spftestimonial-codemirror-' + data_editor.theme + '-css',
532
- href: data_editor.cdnURL + '/theme/' + data_editor.theme + '.min.css',
533
- type: 'text/css',
534
- media: 'all'
535
- });
536
 
537
- SPFTESTIMONIAL.vars.code_themes.push(data_editor.theme);
538
 
539
- }
540
 
541
- CodeMirror.modeURL = data_editor.cdnURL + '/mode/%N/%N.min.js';
542
- CodeMirror.autoLoadMode(code_editor, data_editor.mode);
543
 
544
- code_editor.on('change', function (editor, event) {
545
- $textarea.val(code_editor.getValue()).trigger('change');
546
- });
547
 
548
- clearInterval(interval);
549
 
550
- }
551
- });
552
 
553
- });
554
- };
555
 
556
- //
557
- // Field: fieldset
558
- //
559
- $.fn.spftestimonial_field_fieldset = function () {
560
- return this.each(function () {
561
- $(this).find('.spftestimonial-fieldset-content').spftestimonial_reload_script();
562
- });
563
- };
564
 
565
 
566
- //
567
- // Field: repeater
568
- //
569
- $.fn.spftestimonial_field_repeater = function () {
570
- return this.each(function () {
571
 
572
- var $this = $(this),
573
- $fieldset = $this.children('.spftestimonial-fieldset'),
574
- $repeater = $fieldset.length ? $fieldset : $this,
575
- $wrapper = $repeater.children('.spftestimonial-repeater-wrapper'),
576
- $hidden = $repeater.children('.spftestimonial-repeater-hidden'),
577
- $max = $repeater.children('.spftestimonial-repeater-max'),
578
- $min = $repeater.children('.spftestimonial-repeater-min'),
579
- field_id = $wrapper.data('field-id'),
580
- max = parseInt($wrapper.data('max')),
581
- min = parseInt($wrapper.data('min'));
582
 
583
- $wrapper.children('.spftestimonial-repeater-item').children('.spftestimonial-repeater-content').spftestimonial_reload_script();
584
 
585
- $wrapper.sortable({
586
- axis: 'y',
587
- handle: '.spftestimonial-repeater-sort',
588
- helper: 'original',
589
- cursor: 'move',
590
- placeholder: 'widget-placeholder',
591
- update: function (event, ui) {
592
 
593
- SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children('.spftestimonial-repeater-item'), field_id);
594
- // $wrapper.spftestimonial_customizer_refresh();
595
- // ui.item.spftestimonial_reload_script_retry();
596
 
597
- }
598
- });
599
 
600
- $repeater.children('.spftestimonial-repeater-add').on('click', function (e) {
601
 
602
- e.preventDefault();
603
 
604
- var count = $wrapper.children('.spftestimonial-repeater-item').length;
605
 
606
- $min.hide();
607
 
608
- if (max && (count + 1) > max) {
609
- $max.show();
610
- return;
611
- }
612
 
613
- var $cloned_item = $hidden.spftestimonial_clone(true);
614
 
615
- $cloned_item.removeClass('spftestimonial-repeater-hidden');
616
 
617
- $cloned_item.find(':input[name!="_pseudo"]').each(function () {
618
- this.name = this.name.replace('___', '').replace(field_id + '[0]', field_id + '[' + count + ']');
619
- });
620
 
621
- $wrapper.append($cloned_item);
622
- $cloned_item.children('.spftestimonial-repeater-content').spftestimonial_reload_script();
623
- // $wrapper.spftestimonial_customizer_refresh();
624
- // $wrapper.spftestimonial_customizer_listen({ closest: true });
625
 
626
- });
627
 
628
- var event_clone = function (e) {
629
 
630
- e.preventDefault();
631
 
632
- var count = $wrapper.children('.spftestimonial-repeater-item').length;
633
 
634
- $min.hide();
635
 
636
- if (max && (count + 1) > max) {
637
- $max.show();
638
- return;
639
- }
640
 
641
- var $this = $(this),
642
- $parent = $this.parent().parent().parent(),
643
- $cloned_content = $parent.children('.spftestimonial-repeater-content').spftestimonial_clone(),
644
- $cloned_helper = $parent.children('.spftestimonial-repeater-helper').spftestimonial_clone(true),
645
- $cloned_item = $('<div class="spftestimonial-repeater-item" />');
646
 
647
- $cloned_item.append($cloned_content);
648
- $cloned_item.append($cloned_helper);
649
 
650
- $wrapper.children().eq($parent.index()).after($cloned_item);
651
 
652
- $cloned_item.children('.spftestimonial-repeater-content').spftestimonial_reload_script();
653
 
654
- SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children('.spftestimonial-repeater-item'), field_id);
655
 
656
- // $wrapper.spftestimonial_customizer_refresh();
657
- // $wrapper.spftestimonial_customizer_listen({ closest: true });
658
 
659
- };
660
 
661
- $wrapper.children('.spftestimonial-repeater-item').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-clone', event_clone);
662
- $repeater.children('.spftestimonial-repeater-hidden').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-clone', event_clone);
663
 
664
- var event_remove = function (e) {
665
 
666
- e.preventDefault();
667
 
668
- var count = $wrapper.children('.spftestimonial-repeater-item').length;
669
 
670
- $max.hide();
671
- $min.hide();
672
 
673
- if (min && (count - 1) < min) {
674
- $min.show();
675
- return;
676
- }
677
 
678
- $(this).closest('.spftestimonial-repeater-item').remove();
679
 
680
- SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children('.spftestimonial-repeater-item'), field_id);
681
 
682
- // $wrapper.spftestimonial_customizer_refresh();
683
 
684
- };
685
 
686
- $wrapper.children('.spftestimonial-repeater-item').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-remove', event_remove);
687
- $repeater.children('.spftestimonial-repeater-hidden').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-remove', event_remove);
688
 
689
- });
690
- };
691
 
692
- //
693
- // Field: sortable
694
- //
695
- $.fn.spftestimonial_field_sortable = function () {
696
- return this.each(function () {
697
 
698
- var $sortable = $(this).find('.spftestimonial-sortable');
699
 
700
- $sortable.sortable({
701
- axis: 'y',
702
- helper: 'original',
703
- cursor: 'move',
704
- placeholder: 'widget-placeholder',
705
- update: function (event, ui) {
706
- // $sortable.spftestimonial_customizer_refresh();
707
- }
708
- });
709
 
710
- $sortable.find('.spftestimonial-sortable-content').spftestimonial_reload_script();
711
- $('.form_fields').find('.spftestimonial-sortable').sortable("disable");
712
 
713
- });
714
- };
715
 
716
- //
717
- // Field: sorter
718
- //
719
- $.fn.spftestimonial_field_sorter = function () {
720
- return this.each(function () {
721
 
722
- var $this = $(this),
723
- $enabled = $this.find('.spftestimonial-enabled'),
724
- $has_disabled = $this.find('.spftestimonial-disabled'),
725
- $disabled = ($has_disabled.length) ? $has_disabled : false;
726
 
727
- $enabled.sortable({
728
- connectWith: $disabled,
729
- placeholder: 'ui-sortable-placeholder',
730
- update: function (event, ui) {
731
 
732
- var $el = ui.item.find('input');
733
 
734
- if (ui.item.parent().hasClass('spftestimonial-enabled')) {
735
- $el.attr('name', $el.attr('name').replace('disabled', 'enabled'));
736
- } else {
737
- $el.attr('name', $el.attr('name').replace('enabled', 'disabled'));
738
- }
739
 
740
- // $this.spftestimonial_customizer_refresh();
741
 
742
- }
743
- });
744
 
745
- if ($disabled) {
746
 
747
- $disabled.sortable({
748
- connectWith: $enabled,
749
- placeholder: 'ui-sortable-placeholder',
750
- update: function (event, ui) {
751
- // $this.spftestimonial_customizer_refresh();
752
- }
753
- });
754
 
755
- }
756
-
757
- });
758
- };
759
-
760
- //
761
- // Field: spinner
762
- //
763
- $.fn.spftestimonial_field_spinner = function () {
764
- return this.each(function () {
765
-
766
- var $this = $(this),
767
- $input = $this.find('input'),
768
- $inited = $this.find('.ui-button'),
769
- data = $input.data();
770
-
771
- if ($inited.length) {
772
- $inited.remove();
773
- }
774
-
775
- $input.spinner({
776
- min: data.min || 0,
777
- max: data.max || 100,
778
- step: data.step || 1,
779
- create: function (event, ui) {
780
- if (data.unit) {
781
- $input.after('<span class="ui-button spftestimonial--unit">' + data.unit + '</span>');
782
- }
783
- },
784
- spin: function (event, ui) {
785
- $input.val(ui.value).trigger('change');
786
- }
787
- });
788
-
789
- });
790
- };
791
-
792
- //
793
- // Field: switcher
794
- //
795
- $.fn.spftestimonial_field_switcher = function () {
796
- return this.each(function () {
797
-
798
- var $switcher = $(this).find('.spftestimonial--switcher');
799
-
800
- $switcher.on('click', function () {
801
-
802
- var value = 0;
803
- var $input = $switcher.find('input');
804
-
805
- if ($switcher.hasClass('spftestimonial--active')) {
806
- $switcher.removeClass('spftestimonial--active');
807
- } else {
808
- value = 1;
809
- $switcher.addClass('spftestimonial--active');
810
- }
811
 
812
- $input.val(value).trigger('change');
813
-
814
- });
815
-
816
- });
817
- };
818
-
819
- //
820
- // Field: typography
821
- //
822
- $.fn.spftestimonial_field_typography = function () {
823
- return this.each(function () {
824
-
825
- var base = this;
826
- var $this = $(this);
827
- var loaded_fonts = [];
828
- var webfonts = spftestimonial_typography_json.webfonts;
829
- var googlestyles = spftestimonial_typography_json.googlestyles;
830
- var defaultstyles = spftestimonial_typography_json.defaultstyles;
831
 
832
- //
833
- //
834
- // Sanitize google font subset
835
- base.sanitize_subset = function (subset) {
836
- subset = subset.replace('-ext', ' Extended');
837
- subset = subset.charAt(0).toUpperCase() + subset.slice(1);
838
- return subset;
839
- };
840
-
841
- //
842
- //
843
- // Sanitize google font styles (weight and style)
844
- base.sanitize_style = function (style) {
845
- return googlestyles[style] ? googlestyles[style] : style;
846
- };
847
-
848
- //
849
- //
850
- // Load google font
851
- base.load_google_font = function (font_family, weight, style) {
852
 
853
- if (font_family && typeof WebFont === 'object') {
854
 
855
- weight = weight ? weight.replace('normal', '') : '';
856
- style = style ? style.replace('normal', '') : '';
857
 
858
- if (weight || style) {
859
- font_family = font_family + ':' + weight + style;
860
- }
861
 
862
- if (loaded_fonts.indexOf(font_family) === -1) {
863
- WebFont.load({ google: { families: [font_family] } });
864
- }
865
 
866
- loaded_fonts.push(font_family);
867
 
868
- }
869
 
870
- };
871
 
872
- //
873
- //
874
- // Append select options
875
- base.append_select_options = function ($select, options, condition, type, is_multi) {
876
 
877
- $select.find('option').not(':first').remove();
878
 
879
- var opts = '';
880
 
881
- $.each(options, function (key, value) {
882
 
883
- var selected;
884
- var name = value;
885
 
886
- // is_multi
887
- if (is_multi) {
888
- selected = (condition && condition.indexOf(value) !== -1) ? ' selected' : '';
889
- } else {
890
- selected = (condition && condition === value) ? ' selected' : '';
891
- }
892
 
893
- if (type === 'subset') {
894
- name = base.sanitize_subset(value);
895
- } else if (type === 'style') {
896
- name = base.sanitize_style(value);
897
- }
898
 
899
- opts += '<option value="' + value + '"' + selected + '>' + name + '</option>';
900
 
901
- });
902
 
903
- $select.append(opts).trigger('spftestimonial.change').trigger('chosen:updated');
904
 
905
- };
906
 
907
- base.init = function () {
908
 
909
- //
910
- //
911
- // Constants
912
- var selected_styles = [];
913
- var $typography = $this.find('.spftestimonial--typography');
914
- var $type = $this.find('.spftestimonial--type');
915
- var $styles = $this.find('.spftestimonial--block-font-style');
916
- var unit = $typography.data('unit');
917
- var line_height_unit = $typography.data('line-height-unit');
918
- var exclude_fonts = $typography.data('exclude') ? $typography.data('exclude').split(',') : [];
919
 
920
- //
921
- //
922
- // Chosen init
923
- if ($this.find('.spftestimonial--chosen').length) {
924
 
925
- var $chosen_selects = $this.find('select');
926
 
927
- $chosen_selects.each(function () {
928
 
929
- var $chosen_select = $(this),
930
- $chosen_inited = $chosen_select.parent().find('.chosen-container');
931
 
932
- if ($chosen_inited.length) {
933
- $chosen_inited.remove();
934
- }
935
 
936
- $chosen_select.chosen({
937
- allow_single_deselect: true,
938
- disable_search_threshold: 15,
939
- width: '100%'
940
- });
941
 
942
- });
943
 
944
- }
945
 
946
- //
947
- //
948
- // Font family select
949
- var $font_family_select = $this.find('.spftestimonial--font-family');
950
- var first_font_family = $font_family_select.val();
951
 
952
- // Clear default font family select options
953
- $font_family_select.find('option').not(':first-child').remove();
954
 
955
- var opts = '';
956
 
957
- $.each(webfonts, function (type, group) {
958
 
959
- // Check for exclude fonts
960
- if (exclude_fonts && exclude_fonts.indexOf(type) !== -1) { return; }
961
 
962
- opts += '<optgroup label="' + group.label + '">';
963
 
964
- $.each(group.fonts, function (key, value) {
965
 
966
- // use key if value is object
967
- value = (typeof value === 'object') ? key : value;
968
- var selected = (value === first_font_family) ? ' selected' : '';
969
- opts += '<option value="' + value + '" data-type="' + type + '"' + selected + '>' + value + '</option>';
970
 
971
- });
972
 
973
- opts += '</optgroup>';
974
 
975
- });
976
 
977
- // Append google font select options
978
- $font_family_select.append(opts).trigger('chosen:updated');
979
 
980
- //
981
- //
982
- // Font style select
983
- var $font_style_block = $this.find('.spftestimonial--block-font-style');
984
 
985
- if ($font_style_block.length) {
986
 
987
- var $font_style_select = $this.find('.spftestimonial--font-style-select');
988
- var first_style_value = $font_style_select.val() ? $font_style_select.val().replace(/normal/g, '') : '';
989
 
990
- //
991
- // Font Style on on change listener
992
- $font_style_select.on('change spftestimonial.change', function (event) {
993
 
994
- var style_value = $font_style_select.val();
995
 
996
- // set a default value
997
- if (!style_value && selected_styles && selected_styles.indexOf('normal') === -1) {
998
- style_value = selected_styles[0];
999
- }
1000
 
1001
- // set font weight, for eg. replacing 800italic to 800
1002
- var font_normal = (style_value && style_value !== 'italic' && style_value === 'normal') ? 'normal' : '';
1003
- var font_weight = (style_value && style_value !== 'italic' && style_value !== 'normal') ? style_value.replace('italic', '') : font_normal;
1004
- var font_style = (style_value && style_value.substr(-6) === 'italic') ? 'italic' : '';
1005
 
1006
- $this.find('.spftestimonial--font-weight').val(font_weight);
1007
- $this.find('.spftestimonial--font-style').val(font_style);
1008
 
1009
- });
1010
 
1011
- //
1012
- //
1013
- // Extra font style select
1014
- var $extra_font_style_block = $this.find('.spftestimonial--block-extra-styles');
1015
 
1016
- if ($extra_font_style_block.length) {
1017
- var $extra_font_style_select = $this.find('.spftestimonial--extra-styles');
1018
- var first_extra_style_value = $extra_font_style_select.val();
1019
- }
1020
 
1021
- }
1022
 
1023
- //
1024
- //
1025
- // Subsets select
1026
- var $subset_block = $this.find('.spftestimonial--block-subset');
1027
- if ($subset_block.length) {
1028
- var $subset_select = $this.find('.spftestimonial--subset');
1029
- var first_subset_select_value = $subset_select.val();
1030
- var subset_multi_select = $subset_select.data('multiple') || false;
1031
- }
1032
 
1033
- //
1034
- //
1035
- // Backup font family
1036
- var $backup_font_family_block = $this.find('.spftestimonial--block-backup-font-family');
1037
 
1038
- //
1039
- //
1040
- // Font Family on Change Listener
1041
- $font_family_select.on('change spftestimonial.change', function (event) {
1042
 
1043
- // Hide subsets on change
1044
- if ($subset_block.length) {
1045
- $subset_block.addClass('hidden');
1046
- }
1047
 
1048
- // Hide extra font style on change
1049
- if ($extra_font_style_block.length) {
1050
- $extra_font_style_block.addClass('hidden');
1051
- }
1052
 
1053
- // Hide backup font family on change
1054
- if ($backup_font_family_block.length) {
1055
- $backup_font_family_block.addClass('hidden');
1056
- }
1057
 
1058
- var $selected = $font_family_select.find(':selected');
1059
- var value = $selected.val();
1060
- var type = $selected.data('type');
1061
 
1062
- if (type && value) {
1063
 
1064
- // Show backup fonts if font type google or custom
1065
- if ((type === 'google' || type === 'custom') && $backup_font_family_block.length) {
1066
- $backup_font_family_block.removeClass('hidden');
1067
- }
1068
 
1069
- // Appending font style select options
1070
- if ($font_style_block.length) {
1071
 
1072
- // set styles for multi and normal style selectors
1073
- var styles = defaultstyles;
1074
 
1075
- // Custom or gogle font styles
1076
- if (type === 'google' && webfonts[type].fonts[value][0]) {
1077
- styles = webfonts[type].fonts[value][0];
1078
- } else if (type === 'custom' && webfonts[type].fonts[value]) {
1079
- styles = webfonts[type].fonts[value];
1080
- }
1081
 
1082
- selected_styles = styles;
1083
 
1084
- // Set selected style value for avoid load errors
1085
- var set_auto_style = (styles.indexOf('normal') !== -1) ? 'normal' : styles[0];
1086
- var set_style_value = (first_style_value && styles.indexOf(first_style_value) !== -1) ? first_style_value : set_auto_style;
1087
 
1088
- // Append style select options
1089
- base.append_select_options($font_style_select, styles, set_style_value, 'style');
1090
 
1091
- // Clear first value
1092
- first_style_value = false;
1093
 
1094
- // Show style select after appended
1095
- $font_style_block.removeClass('hidden');
1096
 
1097
- // Appending extra font style select options
1098
- if (type === 'google' && $extra_font_style_block.length && styles.length > 1) {
1099
 
1100
- // Append extra-style select options
1101
- base.append_select_options($extra_font_style_select, styles, first_extra_style_value, 'style', true);
1102
 
1103
- // Clear first value
1104
- first_extra_style_value = false;
1105
 
1106
- // Show style select after appended
1107
- $extra_font_style_block.removeClass('hidden');
1108
 
1109
- }
1110
 
1111
- }
1112
 
1113
- // Appending google fonts subsets select options
1114
- if (type === 'google' && $subset_block.length && webfonts[type].fonts[value][1]) {
1115
 
1116
- var subsets = webfonts[type].fonts[value][1];
1117
- var set_auto_subset = (subsets.length < 2 && subsets[0] !== 'latin') ? subsets[0] : '';
1118
- var set_subset_value = (first_subset_select_value && subsets.indexOf(first_subset_select_value) !== -1) ? first_subset_select_value : set_auto_subset;
1119
 
1120
- // check for multiple subset select
1121
- set_subset_value = (subset_multi_select && first_subset_select_value) ? first_subset_select_value : set_subset_value;
1122
 
1123
- base.append_select_options($subset_select, subsets, set_subset_value, 'subset', subset_multi_select);
1124
 
1125
- first_subset_select_value = false;
1126
 
1127
- $subset_block.removeClass('hidden');
1128
 
1129
- }
1130
 
1131
- } else {
1132
 
1133
- // Clear Styles
1134
- $styles.find(':input').val('');
1135
 
1136
- // Clear subsets options if type and value empty
1137
- if ($subset_block.length) {
1138
- $subset_select.find('option').not(':first-child').remove();
1139
- $subset_select.trigger('chosen:updated');
1140
- }
1141
 
1142
- // Clear font styles options if type and value empty
1143
- if ($font_style_block.length) {
1144
- $font_style_select.find('option').not(':first-child').remove();
1145
- $font_style_select.trigger('chosen:updated');
1146
- }
1147
 
1148
- }
1149
 
1150
- // Update font type input value
1151
- $type.val(type);
1152
 
1153
- }).trigger('spftestimonial.change');
1154
 
1155
- //
1156
- //
1157
- // Preview
1158
- var $preview_block = $this.find('.spftestimonial--block-preview');
1159
 
1160
- if ($preview_block.length) {
1161
 
1162
- var $preview = $this.find('.spftestimonial--preview');
1163
 
1164
- // Set preview styles on change
1165
- $this.on('change', SPFTESTIMONIAL.helper.debounce(function (event) {
1166
 
1167
- $preview_block.removeClass('hidden');
1168
 
1169
- var font_family = $font_family_select.val(),
1170
- font_weight = $this.find('.spftestimonial--font-weight').val(),
1171
- font_style = $this.find('.spftestimonial--font-style').val(),
1172
- font_size = $this.find('.spftestimonial--font-size').val(),
1173
- font_variant = $this.find('.spftestimonial--font-variant').val(),
1174
- line_height = $this.find('.spftestimonial--line-height').val(),
1175
- text_align = $this.find('.spftestimonial--text-align').val(),
1176
- text_transform = $this.find('.spftestimonial--text-transform').val(),
1177
- text_decoration = $this.find('.spftestimonial--text-decoration').val(),
1178
- text_color = $this.find('.spftestimonial--color').val(),
1179
- word_spacing = $this.find('.spftestimonial--word-spacing').val(),
1180
- letter_spacing = $this.find('.spftestimonial--letter-spacing').val(),
1181
- custom_style = $this.find('.spftestimonial--custom-style').val(),
1182
- type = $this.find('.spftestimonial--type').val();
1183
 
1184
- if (type === 'google') {
1185
- base.load_google_font(font_family, font_weight, font_style);
1186
- }
1187
 
1188
- var properties = {};
1189
 
1190
- if (font_family) { properties.fontFamily = font_family; }
1191
- if (font_weight) { properties.fontWeight = font_weight; }
1192
- if (font_style) { properties.fontStyle = font_style; }
1193
- if (font_variant) { properties.fontVariant = font_variant; }
1194
- if (font_size) { properties.fontSize = font_size + unit; }
1195
- if (line_height) { properties.lineHeight = line_height + line_height_unit; }
1196
- if (letter_spacing) { properties.letterSpacing = letter_spacing + unit; }
1197
- if (word_spacing) { properties.wordSpacing = word_spacing + unit; }
1198
- if (text_align) { properties.textAlign = text_align; }
1199
- if (text_transform) { properties.textTransform = text_transform; }
1200
- if (text_decoration) { properties.textDecoration = text_decoration; }
1201
- if (text_color) { properties.color = text_color; }
1202
 
1203
- $preview.removeAttr('style');
1204
 
1205
- // Customs style attribute
1206
- if (custom_style) { $preview.attr('style', custom_style); }
1207
 
1208
- $preview.css(properties);
1209
 
1210
- }, 100));
1211
 
1212
- // Preview black and white backgrounds trigger
1213
- $preview_block.on('click', function () {
1214
 
1215
- $preview.toggleClass('spftestimonial--black-background');
1216
 
1217
- var $toggle = $preview_block.find('.spftestimonial--toggle');
1218
 
1219
- if ($toggle.hasClass('fa-toggle-off')) {
1220
- $toggle.removeClass('fa-toggle-off').addClass('fa-toggle-on');
1221
- } else {
1222
- $toggle.removeClass('fa-toggle-on').addClass('fa-toggle-off');
1223
- }
1224
 
1225
- });
1226
 
1227
- if (!$preview_block.hasClass('hidden')) {
1228
- $this.trigger('change');
1229
- }
1230
 
1231
- }
1232
 
1233
- };
1234
 
1235
- base.init();
1236
 
1237
- });
1238
- };
1239
 
1240
- //
1241
- // Confirm
1242
- //
1243
- $.fn.spftestimonial_confirm = function () {
1244
- return this.each(function () {
1245
- $(this).on('click', function (e) {
1246
 
1247
- var confirm_text = $(this).data('confirm') || window.spftestimonial_vars.i18n.confirm;
1248
- var confirm_answer = confirm(confirm_text);
1249
 
1250
- if (confirm_answer) {
1251
- SPFTESTIMONIAL.vars.is_confirm = true;
1252
- SPFTESTIMONIAL.vars.form_modified = false;
1253
- } else {
1254
- e.preventDefault();
1255
- return false;
1256
- }
1257
 
1258
- });
1259
- });
1260
- };
1261
 
1262
- $.fn.serializeObject = function () {
1263
 
1264
- var obj = {};
1265
 
1266
- $.each(this.serializeArray(), function (i, o) {
1267
- var n = o.name,
1268
- v = o.value;
1269
 
1270
- obj[n] = obj[n] === undefined ? v
1271
- : $.isArray(obj[n]) ? obj[n].concat(v)
1272
- : [obj[n], v];
1273
- });
1274
 
1275
- return obj;
1276
 
1277
- };
1278
 
1279
- //
1280
- // Options Save
1281
- //
1282
- $.fn.spftestimonial_save = function () {
1283
- return this.each(function () {
1284
 
1285
- var $this = $(this),
1286
- $buttons = $('.spftestimonial-save'),
1287
- $panel = $('.spftestimonial-options'),
1288
- flooding = false,
1289
- timeout;
1290
 
1291
- $this.on('click', function (e) {
1292
 
1293
- if (!flooding) {
1294
 
1295
- var $text = $this.data('save'),
1296
- $value = $this.val();
1297
 
1298
- $buttons.attr('value', $text);
1299
 
1300
- if ($this.hasClass('spftestimonial-save-ajax')) {
1301
 
1302
- e.preventDefault();
1303
 
1304
- $panel.addClass('spftestimonial-saving');
1305
- $buttons.prop('disabled', true);
1306
 
1307
- window.wp.ajax.post('spftestimonial_' + $panel.data('unique') + '_ajax_save', {
1308
- data: $('#spftestimonial-form').serializeJSONSPFTESTIMONIAL()
1309
- })
1310
- .done(function (response) {
1311
 
1312
- // clear errors
1313
- $('.spftestimonial-error').remove();
1314
 
1315
- if (Object.keys(response.errors).length) {
1316
 
1317
- var error_icon = '<i class="spftestimonial-label-error spftestimonial-error">!</i>';
1318
 
1319
- $.each(response.errors, function (key, error_message) {
1320
 
1321
- var $field = $('[data-depend-id="' + key + '"]'),
1322
- $link = $('a[href="#tab=' + $field.closest('.spftestimonial-section').data('section-id') + '"]'),
1323
- $tab = $link.closest('.spftestimonial-tab-item');
1324
 
1325
- $field.closest('.spftestimonial-fieldset').append('<p class="spftestimonial-error spftestimonial-error-text">' + error_message + '</p>');
1326
 
1327
- if (!$link.find('.spftestimonial-error').length) {
1328
- $link.append(error_icon);
1329
- }
1330
 
1331
- if (!$tab.find('.spftestimonial-arrow .spftestimonial-error').length) {
1332
- $tab.find('.spftestimonial-arrow').append(error_icon);
1333
- }
1334
- // $('.spftestimonial-options .spftestimonial-save.spftestimonial-save-ajax').attr('disabled', true);
1335
- });
1336
 
1337
- }
1338
 
1339
- $panel.removeClass('spftestimonial-saving');
1340
- $buttons.prop('disabled', true).attr('value', 'Changes Saved');
1341
- flooding = false;
1342
 
1343
- SPFTESTIMONIAL.vars.form_modified = false;
1344
- SPFTESTIMONIAL.vars.$form_warning.hide();
1345
 
1346
- clearTimeout(timeout);
1347
 
1348
- var $result_success = $('.spftestimonial-form-success');
1349
- $result_success.empty().append(response.notice).fadeIn('fast', function () {
1350
- timeout = setTimeout(function () {
1351
- $result_success.fadeOut('fast');
1352
- }, 1000);
1353
- });
1354
 
1355
- })
1356
- .fail(function (response) {
1357
- alert(response.error);
1358
- });
1359
 
1360
- } else {
1361
 
1362
- SPFTESTIMONIAL.vars.form_modified = false;
1363
 
1364
- }
1365
 
1366
- }
1367
 
1368
- flooding = true;
1369
 
1370
- });
1371
 
1372
- });
1373
- };
1374
 
1375
- //
1376
- // Option Framework
1377
- //
1378
- $.fn.spftestimonial_options = function () {
1379
- return this.each(function () {
1380
 
1381
- var $this = $(this),
1382
- $content = $this.find('.spftestimonial-content'),
1383
- $form_success = $this.find('.spftestimonial-form-success'),
1384
- $form_warning = $this.find('.spftestimonial-form-warning'),
1385
- $save_button = $this.find('.spftestimonial-header .spftestimonial-save');
1386
 
1387
- SPFTESTIMONIAL.vars.$form_warning = $form_warning;
1388
 
1389
- // Shows a message white leaving theme options without saving
1390
- if ($form_warning.length) {
1391
 
1392
- window.onbeforeunload = function () {
1393
- return (SPFTESTIMONIAL.vars.form_modified) ? true : undefined;
1394
- };
1395
 
1396
- $content.on('change keypress', ':input', function () {
1397
- if (!SPFTESTIMONIAL.vars.form_modified) {
1398
- $form_success.hide();
1399
- $form_warning.fadeIn('fast');
1400
- SPFTESTIMONIAL.vars.form_modified = true;
1401
- }
1402
- });
1403
 
1404
- }
1405
 
1406
- if ($form_success.hasClass('spftestimonial-form-show')) {
1407
- setTimeout(function () {
1408
- $form_success.fadeOut('fast');
1409
- }, 1000);
1410
- }
1411
 
1412
- $(document).keydown(function (event) {
1413
- if ((event.ctrlKey || event.metaKey) && event.which === 83) {
1414
- $save_button.trigger('click');
1415
- event.preventDefault();
1416
- return false;
1417
- }
1418
- });
1419
 
1420
- });
1421
- };
1422
 
1423
- //
1424
- // WP Color Picker
1425
- //
1426
- if (typeof Color === 'function') {
1427
 
1428
- Color.prototype.toString = function () {
1429
 
1430
- if (this._alpha < 1) {
1431
- return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
1432
- }
1433
 
1434
- var hex = parseInt(this._color, 10).toString(16);
1435
 
1436
- if (this.error) { return ''; }
1437
 
1438
- if (hex.length < 6) {
1439
- for (var i = 6 - hex.length - 1; i >= 0; i--) {
1440
- hex = '0' + hex;
1441
- }
1442
- }
1443
 
1444
- return '#' + hex;
1445
 
1446
- };
1447
 
1448
- }
1449
 
1450
- SPFTESTIMONIAL.funcs.parse_color = function (color) {
1451
 
1452
- var value = color.replace(/\s+/g, ''),
1453
- trans = (value.indexOf('rgba') !== -1) ? parseFloat(value.replace(/^.*,(.+)\)/, '$1') * 100) : 100,
1454
- rgba = (trans < 100) ? true : false;
1455
 
1456
- return { value: value, transparent: trans, rgba: rgba };
1457
 
1458
- };
1459
 
1460
- $.fn.spftestimonial_color = function () {
1461
- return this.each(function () {
1462
 
1463
- var $input = $(this),
1464
- picker_color = SPFTESTIMONIAL.funcs.parse_color($input.val()),
1465
- palette_color = window.spftestimonial_vars.color_palette.length ? window.spftestimonial_vars.color_palette : true,
1466
- $container;
1467
 
1468
- // Destroy and Reinit
1469
- if ($input.hasClass('wp-color-picker')) {
1470
- $input.closest('.wp-picker-container').after($input).remove();
1471
- }
1472
 
1473
- $input.wpColorPicker({
1474
- palettes: palette_color,
1475
- change: function (event, ui) {
1476
 
1477
- var ui_color_value = ui.color.toString();
1478
 
1479
- $container.removeClass('spftestimonial--transparent-active');
1480
- $container.find('.spftestimonial--transparent-offset').css('background-color', ui_color_value);
1481
- $input.val(ui_color_value).trigger('change');
1482
-
1483
- },
1484
- create: function () {
1485
-
1486
- $container = $input.closest('.wp-picker-container');
1487
-
1488
- var a8cIris = $input.data('a8cIris'),
1489
- $transparent_wrap = $('<div class="spftestimonial--transparent-wrap">' +
1490
- '<div class="spftestimonial--transparent-slider"></div>' +
1491
- '<div class="spftestimonial--transparent-offset"></div>' +
1492
- '<div class="spftestimonial--transparent-text"></div>' +
1493
- '<div class="spftestimonial--transparent-button">transparent <i class="fa fa-toggle-off"></i></div>' +
1494
- '</div>').appendTo($container.find('.wp-picker-holder')),
1495
- $transparent_slider = $transparent_wrap.find('.spftestimonial--transparent-slider'),
1496
- $transparent_text = $transparent_wrap.find('.spftestimonial--transparent-text'),
1497
- $transparent_offset = $transparent_wrap.find('.spftestimonial--transparent-offset'),
1498
- $transparent_button = $transparent_wrap.find('.spftestimonial--transparent-button');
1499
-
1500
- if ($input.val() === 'transparent') {
1501
- $container.addClass('spftestimonial--transparent-active');
1502
- }
1503
-
1504
- $transparent_button.on('click', function () {
1505
- if ($input.val() !== 'transparent') {
1506
- $input.val('transparent').trigger('change').removeClass('iris-error');
1507
- $container.addClass('spftestimonial--transparent-active');
1508
- } else {
1509
- $input.val(a8cIris._color.toString()).trigger('change');
1510
- $container.removeClass('spftestimonial--transparent-active');
1511
- }
1512
- });
1513
-
1514
- $transparent_slider.slider({
1515
- value: picker_color.transparent,
1516
- step: 1,
1517
- min: 0,
1518
- max: 100,
1519
- slide: function (event, ui) {
1520
-
1521
- var slide_value = parseFloat(ui.value / 100);
1522
- a8cIris._color._alpha = slide_value;
1523
- $input.wpColorPicker('color', a8cIris._color.toString());
1524
- $transparent_text.text((slide_value === 1 || slide_value === 0 ? '' : slide_value));
1525
 
1526
- },
1527
- create: function () {
1528
 
1529
- var slide_value = parseFloat(picker_color.transparent / 100),
1530
- text_value = slide_value < 1 ? slide_value : '';
1531
-
1532
- $transparent_text.text(text_value);
1533
- $transparent_offset.css('background-color', picker_color.value);
1534
-
1535
- $container.on('click', '.wp-picker-clear', function () {
1536
-
1537
- a8cIris._color._alpha = 1;
1538
- $transparent_text.text('');
1539
- $transparent_slider.slider('option', 'value', 100);
1540
- $container.removeClass('spftestimonial--transparent-active');
1541
- $input.trigger('change');
1542
 
1543
- });
1544
 
1545
- $container.on('click', '.wp-picker-default', function () {
1546
 
1547
- var default_color = SPFTESTIMONIAL.funcs.parse_color($input.data('default-color')),
1548
- default_value = parseFloat(default_color.transparent / 100),
1549
- default_text = default_value < 1 ? default_value : '';
1550
-
1551
- a8cIris._color._alpha = default_value;
1552
- $transparent_text.text(default_text);
1553
- $transparent_slider.slider('option', 'value', default_color.transparent);
1554
-
1555
- if (default_color.value === 'transparent') {
1556
- $input.removeClass('iris-error');
1557
- $container.addClass('spftestimonial--transparent-active');
1558
- }
1559
-
1560
- });
1561
-
1562
- }
1563
- });
1564
- }
1565
- });
1566
-
1567
- });
1568
- };
1569
-
1570
- //
1571
- // ChosenJS
1572
- //
1573
- $.fn.spftestimonial_chosen = function () {
1574
- return this.each(function () {
1575
-
1576
- var $this = $(this),
1577
- $inited = $this.parent().find('.chosen-container'),
1578
- is_sortable = $this.hasClass('spftestimonial-chosen-sortable') || false,
1579
- is_ajax = $this.hasClass('spftestimonial-chosen-ajax') || false,
1580
- is_multiple = $this.attr('multiple') || false,
1581
- set_width = is_multiple ? '100%' : 'auto',
1582
- set_options = $.extend({
1583
- allow_single_deselect: true,
1584
- disable_search_threshold: 10,
1585
- width: set_width,
1586
- no_results_text: window.spftestimonial_vars.i18n.no_results_text,
1587
- }, $this.data('chosen-settings'));
1588
-
1589
- if ($inited.length) {
1590
- $inited.remove();
1591
- }
1592
-
1593
- // Chosen ajax
1594
- if (is_ajax) {
1595
-
1596
- var set_ajax_options = $.extend({
1597
- data: {
1598
- type: 'post',
1599
- nonce: '',
1600
- },
1601
- allow_single_deselect: true,
1602
- disable_search_threshold: -1,
1603
- width: '100%',
1604
- min_length: 3,
1605
- type_delay: 500,
1606
- typing_text: window.spftestimonial_vars.i18n.typing_text,
1607
- searching_text: window.spftestimonial_vars.i18n.searching_text,
1608
- no_results_text: window.spftestimonial_vars.i18n.no_results_text,
1609
- }, $this.data('chosen-settings'));
1610
-
1611
- $this.SPFTESTIMONIALAjaxChosen(set_ajax_options);
1612
-
1613
- } else {
1614
-
1615
- $this.chosen(set_options);
1616
-
1617
- }
1618
-
1619
- // Chosen keep options order
1620
- if (is_multiple) {
1621
-
1622
- var $hidden_select = $this.parent().find('.spftestimonial-hide-select');
1623
- var $hidden_value = $hidden_select.val() || [];
1624
-
1625
- $this.on('change', function (obj, result) {
1626
-
1627
- if (result && result.selected) {
1628
- $hidden_select.append('<option value="' + result.selected + '" selected="selected">' + result.selected + '</option>');
1629
- } else if (result && result.deselected) {
1630
- $hidden_select.find('option[value="' + result.deselected + '"]').remove();
1631
- }
1632
-
1633
- // Force customize refresh
1634
- if (window.wp.customize !== undefined && $hidden_select.children().length === 0 && $hidden_select.data('customize-setting-link')) {
1635
- window.wp.customize.control($hidden_select.data('customize-setting-link')).setting.set('');
1636
- }
1637
-
1638
- $hidden_select.trigger('change');
1639
-
1640
- });
1641
-
1642
- // Chosen order abstract
1643
- $this.SPFTESTIMONIALChosenOrder($hidden_value, true);
1644
-
1645
- }
1646
-
1647
- // Chosen sortable
1648
- if (is_sortable) {
1649
-
1650
- var $chosen_container = $this.parent().find('.chosen-container');
1651
- var $chosen_choices = $chosen_container.find('.chosen-choices');
1652
-
1653
- $chosen_choices.bind('mousedown', function (event) {
1654
- if ($(event.target).is('span')) {
1655
- event.stopPropagation();
1656
- }
1657
- });
1658
-
1659
- $chosen_choices.sortable({
1660
- items: 'li:not(.search-field)',
1661
- helper: 'orginal',
1662
- cursor: 'move',
1663
- placeholder: 'search-choice-placeholder',
1664
- start: function (e, ui) {
1665
- ui.placeholder.width(ui.item.innerWidth());
1666
- ui.placeholder.height(ui.item.innerHeight());
1667
- },
1668
- update: function (e, ui) {
1669
-
1670
- var select_options = '';
1671
- var chosen_object = $this.data('chosen');
1672
- var $prev_select = $this.parent().find('.spftestimonial-hide-select');
1673
-
1674
- $chosen_choices.find('.search-choice-close').each(function () {
1675
- var option_array_index = $(this).data('option-array-index');
1676
- $.each(chosen_object.results_data, function (index, data) {
1677
- if (data.array_index === option_array_index) {
1678
- select_options += '<option value="' + data.value + '" selected>' + data.value + '</option>';
1679
- }
1680
- });
1681
- });
1682
 
1683
- $prev_select.children().remove();
1684
- $prev_select.append(select_options);
1685
- $prev_select.trigger('change');
1686
 
1687
- }
1688
- });
1689
 
1690
- }
1691
 
1692
- });
1693
- };
1694
 
1695
- //
1696
- // Helper Checkbox Checker
1697
- //
1698
- $.fn.spftestimonial_checkbox = function () {
1699
- return this.each(function () {
1700
 
1701
- var $this = $(this),
1702
- $input = $this.find('.spftestimonial--input'),
1703
- $checkbox = $this.find('.spftestimonial--checkbox');
1704
 
1705
- $checkbox.on('click', function () {
1706
- $input.val(Number($checkbox.prop('checked'))).trigger('change');
1707
- });
1708
 
1709
- });
1710
- };
1711
 
1712
- //
1713
- // Siblings
1714
- //
1715
- $.fn.spftestimonial_siblings = function () {
1716
- return this.each(function () {
1717
 
1718
- var $this = $(this),
1719
- $siblings = $this.find('.spftestimonial--sibling'),
1720
- multiple = $this.data('multiple') || false;
1721
 
1722
- $siblings.on('click', function () {
1723
 
1724
- var $sibling = $(this);
1725
 
1726
- if (multiple) {
1727
 
1728
- if ($sibling.hasClass('spftestimonial--active')) {
1729
- $sibling.removeClass('spftestimonial--active');
1730
- $sibling.find('input').prop('checked', false).trigger('change');
1731
- } else {
1732
- $sibling.addClass('spftestimonial--active');
1733
- $sibling.find('input').prop('checked', true).trigger('change');
1734
- }
1735
 
1736
- } else {
1737
 
1738
- $this.find('input').prop('checked', false);
1739
- $sibling.find('input').prop('checked', true).trigger('change');
1740
- $sibling.addClass('spftestimonial--active').siblings().removeClass('spftestimonial--active');
1741
 
1742
- }
1743
 
1744
- });
1745
 
1746
- });
1747
- };
1748
 
1749
- //
1750
- // Help Tooltip
1751
- //
1752
- $.fn.spftestimonial_help = function () {
1753
- return this.each(function () {
1754
 
1755
- var $this = $(this),
1756
- $tooltip,
1757
- offset_left;
1758
 
1759
- $this.on({
1760
- mouseenter: function () {
1761
 
1762
- $tooltip = $('<div class="spftestimonial-tooltip"></div>').html($this.find('.spftestimonial-help-text').html()).appendTo('body');
1763
- offset_left = (SPFTESTIMONIAL.vars.is_rtl) ? ($this.offset().left - $tooltip.outerWidth()) : ($this.offset().left + 24);
1764
 
1765
- $tooltip.css({
1766
- top: $this.offset().top - (($tooltip.outerHeight() / 2) - 14),
1767
- left: offset_left,
1768
- });
1769
 
1770
- },
1771
- mouseleave: function () {
1772
 
1773
- if ($tooltip !== undefined) {
1774
- $tooltip.remove();
1775
- }
1776
 
1777
- }
1778
 
1779
- });
1780
 
1781
- });
1782
- };
1783
 
1784
 
1785
- //
1786
- // Window on resize
1787
- //
1788
- SPFTESTIMONIAL.vars.$window.on('resize spftestimonial.resize', SPFTESTIMONIAL.helper.debounce(function (event) {
1789
 
1790
- var window_width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? SPFTESTIMONIAL.vars.$window.width() : window.innerWidth;
1791
 
1792
- if (window_width <= 782 && !SPFTESTIMONIAL.vars.onloaded) {
1793
- $('.spftestimonial-section').spftestimonial_reload_script();
1794
- SPFTESTIMONIAL.vars.onloaded = true;
1795
- }
1796
 
1797
- }, 200)).trigger('spftestimonial.resize');
1798
 
1799
- //
1800
- // Reload Plugins
1801
- //
1802
- $.fn.spftestimonial_reload_script = function (options) {
1803
 
1804
- var settings = $.extend({
1805
- dependency: true,
1806
- }, options);
1807
 
1808
- return this.each(function () {
1809
-
1810
- var $this = $(this);
1811
-
1812
- // Avoid for conflicts
1813
- if (!$this.data('inited')) {
1814
-
1815
- // Field plugins
1816
- $this.children('.spftestimonial-field-accordion:not(.tfree_pro_only)').spftestimonial_field_accordion();
1817
- $this.children('.spftestimonial-field-code_editor').spftestimonial_field_code_editor();
1818
- $this.children('.spftestimonial-field-fieldset').spftestimonial_field_fieldset();
1819
- $this.children('.spftestimonial-field-repeater').spftestimonial_field_repeater();
1820
- $this.children('.spftestimonial-field-sortable').spftestimonial_field_sortable();
1821
- $this.children('.spftestimonial-field-sorter').spftestimonial_field_sorter();
1822
- $this.children('.spftestimonial-field-spinner').spftestimonial_field_spinner();
1823
- $this.children('.spftestimonial-field-switcher').spftestimonial_field_switcher();
1824
- $this.children('.spftestimonial-field-typography').spftestimonial_field_typography();
1825
-
1826
- // Field colors
1827
- $this.children('.spftestimonial-field-border').find('.spftestimonial-color').spftestimonial_color();
1828
- $this.children('.spftestimonial-field-background').find('.spftestimonial-color').spftestimonial_color();
1829
- $this.children('.spftestimonial-field-color').find('.spftestimonial-color').spftestimonial_color();
1830
- $this.children('.spftestimonial-field-color_group').find('.spftestimonial-color').spftestimonial_color();
1831
- $this.children('.spftestimonial-field-link_color').find('.spftestimonial-color').spftestimonial_color();
1832
- $this.children('.spftestimonial-field-typography').find('.spftestimonial-color').spftestimonial_color();
1833
-
1834
- // Field chosenjs
1835
- $this.children('.spftestimonial-field-select').find('.spftestimonial-chosen').spftestimonial_chosen();
1836
-
1837
- // Field Checkbox
1838
- $this.children('.spftestimonial-field-checkbox').find('.spftestimonial-checkbox').spftestimonial_checkbox();
1839
-
1840
- // Field Siblings
1841
- $this.children('.spftestimonial-field-button_set').find('.spftestimonial-siblings').spftestimonial_siblings();
1842
- $this.children('.spftestimonial-field-image_select, .spftestimonial-field-icon_select').find('.spftestimonial-siblings').spftestimonial_siblings();
1843
- $this.children('.spftestimonial-field-palette').find('.spftestimonial-siblings').spftestimonial_siblings();
1844
-
1845
- // Help Tooptip
1846
- $this.children('.spftestimonial-field').find('.spftestimonial-help').spftestimonial_help();
1847
-
1848
- if (settings.dependency) {
1849
- $this.spftestimonial_dependency();
1850
- }
1851
-
1852
- $this.data('inited', true);
1853
-
1854
- $(document).trigger('spftestimonial-reload-script', $this);
1855
-
1856
- }
1857
-
1858
- });
1859
- };
1860
-
1861
- //
1862
- // Document ready and run scripts
1863
- //
1864
- $(document).ready(function () {
1865
-
1866
- $('.spftestimonial-save').spftestimonial_save();
1867
- $('.spftestimonial-options').spftestimonial_options();
1868
- $('.spftestimonial-sticky-header').spftestimonial_sticky();
1869
- $('.spftestimonial-nav-options').spftestimonial_nav_options();
1870
- $('.spftestimonial-nav-metabox').spftestimonial_nav_metabox();
1871
- $('.spftestimonial-search').spftestimonial_search();
1872
- $('.spftestimonial-confirm').spftestimonial_confirm();
1873
- $('.spftestimonial-expand-all').spftestimonial_expand_all();
1874
- $('.spftestimonial-onload').spftestimonial_reload_script();
1875
-
1876
- });
1877
-
1878
- // Live Preview script for Testimonial-free.
1879
- // var is_manage_preview = $('body').hasClass('post-type-spt_shortcodes');
1880
- // var is_form_preview = $('body').hasClass('post-type-spt_testimonial_form');
1881
-
1882
- // if (is_manage_preview) {
1883
-
1884
- // }
1885
- // if (is_form_preview) {
1886
- // var preview_display = $('#sp_tpro_form_live_preview').hide();
1887
- // var action = 'sp_testimonial_form_preview';
1888
- // var nonce = $('#spftestimonial_metabox_noncesp_tpro_form_live_preview').val();
1889
-
1890
- // }
1891
- $(document).on('click', '#sp-testimonial-show-preview:contains(Hide)', function (e) {
1892
- e.preventDefault();
1893
- var _this = $(this);
1894
- _this.html('<i class="fa fa-eye" aria-hidden="true"></i> Show Preview');
1895
- preview_box.html('');
1896
- preview_display.hide();
1897
- });
1898
- var preview_box = $('#sp_tpro-preview-box');
1899
- var preview_display = $('#sp_tpro_live_preview').hide();
1900
- var action = 'sp_tpro_preview_meta_box';
1901
- var nonce = $('#spftestimonial_metabox_noncesp_tpro_shortcode_options').val();
1902
- $(document).on('click', '#sp-testimonial-show-preview:not(:contains(Hide))', function (e) {
1903
- e.preventDefault();
1904
- var previewJS = window.spftestimonial_vars.previewJS;
1905
- var _data = $('form#post').serialize();
1906
- var _this = $(this);
1907
- var data = {
1908
- action: action,
1909
- data: _data,
1910
- ajax_nonce: nonce
1911
- };
1912
- $.ajax({
1913
- type: "POST",
1914
- url: ajaxurl,
1915
- data: data,
1916
- error: function (response) {
1917
- console.log(response)
1918
- },
1919
- success: function (response) {
1920
-
1921
- preview_display.show();
1922
- preview_box.html(response);
1923
- $.getScript(previewJS, function () {
1924
- _this.html('<i class="fa fa-eye-slash" aria-hidden="true"></i> Hide Preview');
1925
- $(document).on('keyup change', function (e) {
1926
- e.preventDefault();
1927
- _this.html('<i class="fa fa-refresh" aria-hidden="true"></i> Update Preview');
1928
- });
1929
- $("html, body").animate({ scrollTop: preview_display.offset().top - 50 }, "slow");
1930
- });
1931
- $('.sp-testimonial-preloader').animate({ opacity: 1 }, 600).hide();
1932
- }
1933
- })
1934
- });
1935
-
1936
- /* Copy to clipboard */
1937
- $('.sp-testimonial-copy-btn,.tpro-sc-code,.spftestimonial-shortcode-selectable').click(function (e) {
1938
- e.preventDefault();
1939
- spftestimonial_copyToClipboard($(this));
1940
- spftestimonial_SelectText($(this));
1941
- $(this).focus().select();
1942
- $('.sp-testimonial-after-copy-text').animate({
1943
- opacity: 1,
1944
- bottom: 25
1945
- }, 300);
1946
- setTimeout(function () {
1947
- jQuery(".sp-testimonial-after-copy-text").animate({
1948
- opacity: 0,
1949
- }, 200);
1950
- jQuery(".sp-testimonial-after-copy-text").animate({
1951
- bottom: 0
1952
- }, 0);
1953
- }, 2000);
1954
- });
1955
- $('.stpro_input').click(function (e) {
1956
- e.preventDefault();
1957
- /* Get the text field */
1958
- var copyText = $(this);
1959
- /* Select the text field */
1960
- copyText.select();
1961
- document.execCommand("copy");
1962
- $('.sp-testimonial-after-copy-text').animate({
1963
- opacity: 1,
1964
- bottom: 25
1965
- }, 300);
1966
- setTimeout(function () {
1967
- jQuery(".sp-testimonial-after-copy-text").animate({
1968
- opacity: 0,
1969
- }, 200);
1970
- jQuery(".sp-testimonial-after-copy-text").animate({
1971
- bottom: 0
1972
- }, 0);
1973
- }, 2000);
1974
- });
1975
- function spftestimonial_copyToClipboard(element) {
1976
- var $temp = $("<input>");
1977
- $("body").append($temp);
1978
- $temp.val($(element).text()).select();
1979
- document.execCommand("copy");
1980
- $temp.remove();
1981
- }
1982
- function spftestimonial_SelectText(element) {
1983
- var r = document.createRange();
1984
- var w = element.get(0);
1985
- r.selectNodeContents(w);
1986
- var sel = window.getSelection();
1987
- sel.removeAllRanges();
1988
- sel.addRange(r);
1989
- }
1990
- // Testimonial pro export.
1991
- var $export_type = $('.spt_what_export').find('input:checked').val();
1992
- $('.spt_what_export').on('change', function () {
1993
- $export_type = $(this).find('input:checked').val();
1994
- });
1995
- // Check is valid JSON string
1996
- function isValidJSONString(str) {
1997
- try {
1998
- JSON.parse(str);
1999
- } catch (e) {
2000
- return false;
2001
- }
2002
- return true;
2003
- }
2004
- $('.spt_export .spftestimonial--button').click(function (event) {
2005
- event.preventDefault();
2006
- var $shortcode_ids = $('.spt_post_id select').val();
2007
- var $forms_ids = $('.spt_post_forms_id select').val();
2008
- var $ex_nonce = $('#spftestimonial_options_noncesp_testimonial_pro_tools').val();
2009
- if ($export_type === 'all_testimonial') {
2010
- var data = {
2011
- action: 'spt_export_shortcodes',
2012
- lcp_ids: 'all_testimonial',
2013
- nonce: $ex_nonce,
2014
- }
2015
- } else if ('all_spt_shortcodes' === $export_type) {
2016
- var data = {
2017
- action: 'spt_export_shortcodes',
2018
- lcp_ids: 'all_spt_shortcodes',
2019
- nonce: $ex_nonce,
2020
- }
2021
- } else if ('all_spt_form' === $export_type) {
2022
- var data = {
2023
- action: 'spt_export_shortcodes',
2024
- lcp_ids: 'all_spt_form',
2025
- nonce: $ex_nonce,
2026
- }
2027
- } else if ('selected_spt_shortcodes' === $export_type) {
2028
- var data = {
2029
- action: 'spt_export_shortcodes',
2030
- lcp_ids: $shortcode_ids,
2031
- text_ids: 'select_shortcodes',
2032
- nonce: $ex_nonce,
2033
- }
2034
- } else if ('selected_spt_form' === $export_type) {
2035
- var data = {
2036
- action: 'spt_export_shortcodes',
2037
- lcp_ids: $forms_ids,
2038
- text_ids: 'select_forms',
2039
- nonce: $ex_nonce,
2040
- }
2041
- } else {
2042
- $('.spftestimonial-form-result.spftestimonial-form-success').text('No group selected.').show();
2043
- setTimeout(function () {
2044
- $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2045
- }, 3000);
2046
- }
2047
- $.post(ajaxurl, data, function (resp) {
2048
- if (resp) {
2049
- // Convert JSON Array to string.
2050
- if (isValidJSONString(resp)) {
2051
- var json = JSON.stringify(JSON.parse(resp));
2052
- } else {
2053
- var json = JSON.stringify(resp);
2054
- }
2055
- // var json = JSON.stringify(resp);
2056
- // Convert JSON string to BLOB.
2057
- json = [json];
2058
- var blob = new Blob(json);
2059
- var link = document.createElement('a');
2060
- var lcp_time = $.now();
2061
- link.href = window.URL.createObjectURL(blob);
2062
- link.download = "testtimonial-pro-export-" + lcp_time + ".json";
2063
- link.click();
2064
- $('.spftestimonial-form-result.spftestimonial-form-success').text('Exported successfully!').show();
2065
- setTimeout(function () {
2066
- $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2067
- $('.spt_post_id select').val('').trigger('chosen:updated');
2068
- $('.spt_post_forms_id select').val('').trigger('chosen:updated');
2069
- }, 3000);
2070
- }
2071
- });
2072
- });
2073
- // Testimonial free import.
2074
- $('.spt_import button.import').click(function (event) {
2075
- event.preventDefault();
2076
- var lcp_shortcodes = $('#import').prop('files')[0];
2077
- if ($('#import').val() != '') {
2078
- var $im_nonce = $('#spftestimonial_options_noncesp_testimonial_pro_tools').val();
2079
- var reader = new FileReader();
2080
- reader.readAsText(lcp_shortcodes);
2081
- reader.onload = function (event) {
2082
- var jsonObj = JSON.stringify(event.target.result);
2083
- $.ajax({
2084
- url: ajaxurl,
2085
- type: 'POST',
2086
- data: {
2087
- shortcode: jsonObj,
2088
- action: 'spt_import_shortcodes',
2089
- nonce: $im_nonce,
2090
- },
2091
- success: function (resp) {
2092
- $('.spftestimonial-form-result.spftestimonial-form-success').text('Imported successfully!').show();
2093
- setTimeout(function () {
2094
- $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2095
- $('#import').val('');
2096
- if (resp.data === 'spt_testimonial') {
2097
- window.location.replace($('#spt_testimonial_link_redirect').attr('href'));
2098
- } else if (resp.data === 'spt_testimonial_form') {
2099
- window.location.replace($('#spt_forms_link_redirect').attr('href'));
2100
- } else {
2101
- window.location.replace($('#spt_shortcode_link_redirect').attr('href'));
2102
- }
2103
- }, 2000);
2104
- }
2105
- });
2106
- }
2107
- } else {
2108
- $('.spftestimonial-form-result.spftestimonial-form-success').text('No exported json file chosen.').show();
2109
- setTimeout(function () {
2110
- $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2111
- }, 3000);
2112
- }
2113
- });
2114
- // Disabled save button.
2115
- $(document).on('keyup change', '.spftestimonial-options #spftestimonial-form', function (e) {
2116
- e.preventDefault();
2117
- $(this).find('.spftestimonial-save.spftestimonial-save-ajax').attr('value', 'Save Settings').attr('disabled', false);
2118
- });
2119
- $("select option:contains((Pro))").attr('disabled', true).css('opacity', '0.8');
2120
- $("label:contains((Pro))").css({ 'pointer-events': 'none' }).css('opacity', '0.8');
2121
  })(jQuery, window, document);
1
  ; (function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ //
5
+ // Constants
6
+ //
7
+ var SPFTESTIMONIAL = SPFTESTIMONIAL || {};
8
+
9
+ SPFTESTIMONIAL.funcs = {};
10
+
11
+ SPFTESTIMONIAL.vars = {
12
+ onloaded: false,
13
+ $body: $('body'),
14
+ $window: $(window),
15
+ $document: $(document),
16
+ $form_warning: null,
17
+ is_confirm: false,
18
+ form_modified: false,
19
+ code_themes: [],
20
+ is_rtl: $('body').hasClass('rtl'),
21
+ };
22
+
23
+ //
24
+ // Helper Functions
25
+ //
26
+ SPFTESTIMONIAL.helper = {
27
+
28
+ //
29
+ // Generate UID
30
+ //
31
+ uid: function (prefix) {
32
+ return (prefix || '') + Math.random().toString(36).substr(2, 9);
33
+ },
34
+
35
+ // Quote regular expression characters
36
+ //
37
+ preg_quote: function (str) {
38
+ return (str + '').replace(/(\[|\])/g, "\\$1");
39
+ },
40
+
41
+ //
42
+ // Reneme input names
43
+ //
44
+ name_nested_replace: function ($selector, field_id) {
45
+
46
+ var checks = [];
47
+ var regex = new RegExp(SPFTESTIMONIAL.helper.preg_quote(field_id + '[\\d+]'), 'g');
48
+
49
+ $selector.find(':radio').each(function () {
50
+ if (this.checked || this.orginal_checked) {
51
+ this.orginal_checked = true;
52
+ }
53
+ });
54
+
55
+ $selector.each(function (index) {
56
+ $(this).find(':input').each(function () {
57
+ this.name = this.name.replace(regex, field_id + '[' + index + ']');
58
+ if (this.orginal_checked) {
59
+ this.checked = true;
60
+ }
61
+ });
62
+ });
63
+
64
+ },
65
+
66
+ //
67
+ // Debounce
68
+ //
69
+ debounce: function (callback, threshold, immediate) {
70
+ var timeout;
71
+ return function () {
72
+ var context = this, args = arguments;
73
+ var later = function () {
74
+ timeout = null;
75
+ if (!immediate) {
76
+ callback.apply(context, args);
77
+ }
78
+ };
79
+ var callNow = (immediate && !timeout);
80
+ clearTimeout(timeout);
81
+ timeout = setTimeout(later, threshold);
82
+ if (callNow) {
83
+ callback.apply(context, args);
84
+ }
85
+ };
86
+ },
87
+ //
88
+ // Get a cookie
89
+ //
90
+ get_cookie: function (name) {
91
+
92
+ var e, b, cookie = document.cookie, p = name + '=';
93
+
94
+ if (!cookie) {
95
+ return;
96
+ }
97
+
98
+ b = cookie.indexOf('; ' + p);
99
+
100
+ if (b === -1) {
101
+ b = cookie.indexOf(p);
102
+
103
+ if (b !== 0) {
104
+ return null;
105
+ }
106
+ } else {
107
+ b += 2;
108
+ }
109
+
110
+ e = cookie.indexOf(';', b);
111
+
112
+ if (e === -1) {
113
+ e = cookie.length;
114
+ }
115
+
116
+ return decodeURIComponent(cookie.substring(b + p.length, e));
117
+
118
+ },
119
+
120
+ //
121
+ // Set a cookie
122
+ //
123
+ set_cookie: function (name, value, expires, path, domain, secure) {
124
+
125
+ var d = new Date();
126
+
127
+ if (typeof (expires) === 'object' && expires.toGMTString) {
128
+ expires = expires.toGMTString();
129
+ } else if (parseInt(expires, 10)) {
130
+ d.setTime(d.getTime() + (parseInt(expires, 10) * 1000));
131
+ expires = d.toGMTString();
132
+ } else {
133
+ expires = '';
134
+ }
135
+
136
+ document.cookie = name + '=' + encodeURIComponent(value) +
137
+ (expires ? '; expires=' + expires : '') +
138
+ (path ? '; path=' + path : '') +
139
+ (domain ? '; domain=' + domain : '') +
140
+ (secure ? '; secure' : '');
141
+
142
+ },
143
+ //
144
+ // Remove a cookie
145
+ //
146
+ remove_cookie: function (name, path, domain, secure) {
147
+ SPFTESTIMONIAL.helper.set_cookie(name, '', -1000, path, domain, secure);
148
+ },
149
+ };
150
+
151
+ //
152
+ // Custom clone for textarea and select clone() bug
153
+ //
154
+ $.fn.spftestimonial_clone = function () {
155
+
156
+ var base = $.fn.clone.apply(this, arguments),
157
+ clone = this.find('select').add(this.filter('select')),
158
+ cloned = base.find('select').add(base.filter('select'));
159
+
160
+ for (var i = 0; i < clone.length; ++i) {
161
+ for (var j = 0; j < clone[i].options.length; ++j) {
162
+
163
+ if (clone[i].options[j].selected === true) {
164
+ cloned[i].options[j].selected = true;
165
+ }
166
+
167
+ }
168
+ }
169
 
170
+ this.find(':radio').each(function () {
171
+ this.orginal_checked = this.checked;
172
+ });
173
 
174
+ return base;
175
 
176
+ };
177
 
178
+ //
179
+ // Expand All Options
180
+ //
181
+ $.fn.spftestimonial_expand_all = function () {
182
+ return this.each(function () {
183
+ $(this).on('click', function (e) {
184
 
185
+ e.preventDefault();
186
+ $('.spftestimonial-wrapper').toggleClass('spftestimonial-show-all');
187
+ $('.spftestimonial-section').spftestimonial_reload_script();
188
+ $(this).find('.fa').toggleClass('fa-indent').toggleClass('fa-outdent');
189
 
190
+ });
191
+ });
192
+ };
193
 
194
+ //
195
+ // Options Navigation
196
+ //
197
+ $.fn.spftestimonial_nav_options = function () {
198
+ return this.each(function () {
199
 
200
+ var $nav = $(this),
201
+ $window = $(window),
202
+ $wpwrap = $('#wpwrap'),
203
+ $links = $nav.find('a'),
204
+ $last;
205
 
206
+ $window.on('hashchange spftestimonial.hashchange', function () {
207
 
208
+ var hash = window.location.hash.replace('#tab=', '');
209
+ var slug = hash ? hash : $links.first().attr('href').replace('#tab=', '');
210
+ var $link = $('[data-tab-id="' + slug + '"]');
211
 
212
+ if ($link.length) {
213
 
214
+ $link.closest('.spftestimonial-tab-item').addClass('spftestimonial-tab-expanded').siblings().removeClass('spftestimonial-tab-expanded');
215
 
216
+ if ($link.next().is('ul')) {
217
 
218
+ $link = $link.next().find('li').first().find('a');
219
+ slug = $link.data('tab-id');
220
 
221
+ }
222
 
223
+ $links.removeClass('spftestimonial-active');
224
+ $link.addClass('spftestimonial-active');
225
 
226
+ if ($last) {
227
+ $last.addClass('hidden');
228
+ }
229
 
230
+ var $section = $('[data-section-id="' + slug + '"]');
231
 
232
+ $section.removeClass('hidden');
233
+ $section.spftestimonial_reload_script();
234
 
235
+ $('.spftestimonial-section-id').val($section.index() + 1);
236
 
237
+ $last = $section;
238
 
239
+ if ($wpwrap.hasClass('wp-responsive-open')) {
240
+ $('html, body').animate({ scrollTop: ($section.offset().top - 50) }, 200);
241
+ $wpwrap.removeClass('wp-responsive-open');
242
+ }
243
 
244
+ }
245
 
246
+ }).trigger('spftestimonial.hashchange');
247
 
248
+ });
249
+ };
250
 
251
+ //
252
+ // Metabox Tabs
253
+ //
254
+ $.fn.spftestimonial_nav_metabox = function () {
255
+ return this.each(function () {
256
 
257
+ var $nav = $(this),
258
+ $links = $nav.find('a'),
259
+ $sections = $nav.parent().find('.spftestimonial-section'),
260
+ unique_id = $nav.data('unique'),
261
+ post_id = $('#post_ID').val() || 'global',
262
+ $last;
263
 
264
+ $links.each(function (index) {
265
 
266
+ $(this).on('click', function (e) {
267
 
268
+ e.preventDefault();
269
 
270
+ var $link = $(this);
271
+ var section_id = $link.data('section');
272
+ $links.removeClass('spftestimonial-active');
273
+ $link.addClass('spftestimonial-active');
274
+ if ($last !== undefined) {
275
+ $last.addClass('hidden');
276
+ }
277
 
278
+ var $section = $sections.eq(index);
279
 
280
+ $section.removeClass('hidden');
281
+ $section.spftestimonial_reload_script();
282
+ SPFTESTIMONIAL.helper.set_cookie('spftestimonial-last-metabox-tab-' + post_id + '-' + unique_id, section_id);
283
 
284
+ $last = $section;
285
 
286
+ });
287
 
288
+ });
289
 
290
+ var get_cookie = SPFTESTIMONIAL.helper.get_cookie('spftestimonial-last-metabox-tab-' + post_id + '-' + unique_id);
291
+ if (get_cookie) {
292
+ $nav.find('a[data-section="' + get_cookie + '"]').trigger('click');
293
+ } else {
294
+ $links.first('a').trigger('click');
295
+ }
296
 
297
+ });
298
+ };
299
 
300
 
301
 
302
+ //
303
+ // Search
304
+ //
305
+ $.fn.spftestimonial_search = function () {
306
+ return this.each(function () {
307
 
308
+ var $this = $(this),
309
+ $input = $this.find('input');
310
 
311
+ $input.on('change keyup', function () {
312
 
313
+ var value = $(this).val(),
314
+ $wrapper = $('.spftestimonial-wrapper'),
315
+ $section = $wrapper.find('.spftestimonial-section'),
316
+ $fields = $section.find('> .spftestimonial-field:not(.spftestimonial-depend-on)'),
317
+ $titles = $fields.find('> .spftestimonial-title, .spftestimonial-search-tags');
318
 
319
+ if (value.length > 3) {
320
 
321
+ $fields.addClass('spftestimonial-metabox-hide');
322
+ $wrapper.addClass('spftestimonial-search-all');
323
 
324
+ $titles.each(function () {
325
 
326
+ var $title = $(this);
327
 
328
+ if ($title.text().match(new RegExp('.*?' + value + '.*?', 'i'))) {
329
 
330
+ var $field = $title.closest('.spftestimonial-field');
331
 
332
+ $field.removeClass('spftestimonial-metabox-hide');
333
+ $field.parent().spftestimonial_reload_script();
334
 
335
+ }
336
 
337
+ });
338
 
339
+ } else {
340
 
341
+ $fields.removeClass('spftestimonial-metabox-hide');
342
+ $wrapper.removeClass('spftestimonial-search-all');
343
 
344
+ }
345
 
346
+ });
347
 
348
+ });
349
+ };
350
 
351
+ //
352
+ // Sticky Header
353
+ //
354
+ $.fn.spftestimonial_sticky = function () {
355
+ return this.each(function () {
356
 
357
+ var $this = $(this),
358
+ $window = $(window),
359
+ $inner = $this.find('.spftestimonial-header-inner'),
360
+ padding = parseInt($inner.css('padding-left')) + parseInt($inner.css('padding-right')),
361
+ offset = 32,
362
+ scrollTop = 0,
363
+ lastTop = 0,
364
+ ticking = false,
365
+ stickyUpdate = function () {
366
 
367
+ var offsetTop = $this.offset().top,
368
+ stickyTop = Math.max(offset, offsetTop - scrollTop),
369
+ winWidth = $window.innerWidth();
370
 
371
+ if (stickyTop <= offset && winWidth > 782) {
372
+ $inner.css({ width: $this.outerWidth() - padding });
373
+ $this.css({ height: $this.outerHeight() }).addClass('spftestimonial-sticky');
374
+ } else {
375
+ $inner.removeAttr('style');
376
+ $this.removeAttr('style').removeClass('spftestimonial-sticky');
377
+ }
378
 
379
+ },
380
+ requestTick = function () {
381
 
382
+ if (!ticking) {
383
+ requestAnimationFrame(function () {
384
+ stickyUpdate();
385
+ ticking = false;
386
+ });
387
+ }
388
 
389
+ ticking = true;
390
 
391
+ },
392
+ onSticky = function () {
393
 
394
+ scrollTop = $window.scrollTop();
395
+ requestTick();
396
 
397
+ };
398
 
399
+ $window.on('scroll resize', onSticky);
400
 
401
+ onSticky();
402
 
403
+ });
404
+ };
405
 
406
+ //
407
+ // Dependency System
408
+ //
409
+ $.fn.spftestimonial_dependency = function () {
410
+ return this.each(function () {
411
 
412
+ var $this = $(this),
413
+ $fields = $this.children('[data-controller]');
414
 
415
+ if ($fields.length) {
416
 
417
+ var normal_ruleset = $.spftestimonial_deps.createRuleset(),
418
+ global_ruleset = $.spftestimonial_deps.createRuleset(),
419
+ normal_depends = [],
420
+ global_depends = [];
421
 
422
+ $fields.each(function () {
423
 
424
+ var $field = $(this),
425
+ controllers = $field.data('controller').split('|'),
426
+ conditions = $field.data('condition').split('|'),
427
+ values = $field.data('value').toString().split('|'),
428
+ is_global = $field.data('depend-global') ? true : false,
429
+ ruleset = (is_global) ? global_ruleset : normal_ruleset;
430
 
431
+ $.each(controllers, function (index, depend_id) {
432
 
433
+ var value = values[index] || '',
434
+ condition = conditions[index] || conditions[0];
435
 
436
+ ruleset = ruleset.createRule('[data-depend-id="' + depend_id + '"]', condition, value);
437
 
438
+ ruleset.include($field);
439
 
440
+ if (is_global) {
441
+ global_depends.push(depend_id);
442
+ } else {
443
+ normal_depends.push(depend_id);
444
+ }
445
 
446
+ });
447
 
448
+ });
449
 
450
+ if (normal_depends.length) {
451
+ $.spftestimonial_deps.enable($this, normal_ruleset, normal_depends);
452
+ }
453
 
454
+ if (global_depends.length) {
455
+ $.spftestimonial_deps.enable(SPFTESTIMONIAL.vars.$body, global_ruleset, global_depends);
456
+ }
457
 
458
+ }
459
 
460
+ });
461
+ };
462
 
463
+ //
464
+ // Field: accordion
465
+ //
466
+ $.fn.spftestimonial_field_accordion = function () {
467
+ return this.each(function () {
468
 
469
+ var $titles = $(this).find('.spftestimonial-accordion-title');
470
 
471
+ $titles.on('click', function () {
472
 
473
+ var $title = $(this),
474
+ $icon = $title.find('.spftestimonial-accordion-icon'),
475
+ $content = $title.next();
476
 
477
+ if ($icon.hasClass('fa-angle-right')) {
478
+ $icon.removeClass('fa-angle-right').addClass('fa-angle-down');
479
+ } else {
480
+ $icon.removeClass('fa-angle-down').addClass('fa-angle-right');
481
+ }
482
 
483
+ if (!$content.data('opened')) {
484
 
485
+ $content.spftestimonial_reload_script();
486
+ $content.data('opened', true);
487
 
488
+ }
489
 
490
+ $content.toggleClass('spftestimonial-accordion-open');
491
 
492
+ });
493
+ if ($(this).hasClass('opened_accordion')) {
494
+ $titles.trigger('click');
495
+ }
496
 
497
+ });
498
+ };
499
 
500
+ //
501
+ // Field: code_editor
502
+ //
503
+ $.fn.spftestimonial_field_code_editor = function () {
504
+ return this.each(function () {
505
 
506
+ if (typeof CodeMirror !== 'function') { return; }
507
 
508
+ var $this = $(this),
509
+ $textarea = $this.find('textarea'),
510
+ $inited = $this.find('.CodeMirror'),
511
+ data_editor = $textarea.data('editor');
512
 
513
+ if ($inited.length) {
514
+ $inited.remove();
515
+ }
516
 
517
+ var interval = setInterval(function () {
518
+ if ($this.is(':visible')) {
519
 
520
+ var code_editor = CodeMirror.fromTextArea($textarea[0], data_editor);
521
 
522
+ // load code-mirror theme css.
523
+ if (data_editor.theme !== 'default' && SPFTESTIMONIAL.vars.code_themes.indexOf(data_editor.theme) === -1) {
524
 
525
+ var $cssLink = $('<link>');
526
 
527
+ $('#spftestimonial-codemirror-css').after($cssLink);
528
 
529
+ $cssLink.attr({
530
+ rel: 'stylesheet',
531
+ id: 'spftestimonial-codemirror-' + data_editor.theme + '-css',
532
+ href: data_editor.cdnURL + '/theme/' + data_editor.theme + '.min.css',
533
+ type: 'text/css',
534
+ media: 'all'
535
+ });
536
 
537
+ SPFTESTIMONIAL.vars.code_themes.push(data_editor.theme);
538
 
539
+ }
540
 
541
+ CodeMirror.modeURL = data_editor.cdnURL + '/mode/%N/%N.min.js';
542
+ CodeMirror.autoLoadMode(code_editor, data_editor.mode);
543
 
544
+ code_editor.on('change', function (editor, event) {
545
+ $textarea.val(code_editor.getValue()).trigger('change');
546
+ });
547
 
548
+ clearInterval(interval);
549
 
550
+ }
551
+ });
552
 
553
+ });
554
+ };
555
 
556
+ //
557
+ // Field: fieldset
558
+ //
559
+ $.fn.spftestimonial_field_fieldset = function () {
560
+ return this.each(function () {
561
+ $(this).find('.spftestimonial-fieldset-content').spftestimonial_reload_script();
562
+ });
563
+ };
564
 
565
 
566
+ //
567
+ // Field: repeater
568
+ //
569
+ $.fn.spftestimonial_field_repeater = function () {
570
+ return this.each(function () {
571
 
572
+ var $this = $(this),
573
+ $fieldset = $this.children('.spftestimonial-fieldset'),
574
+ $repeater = $fieldset.length ? $fieldset : $this,
575
+ $wrapper = $repeater.children('.spftestimonial-repeater-wrapper'),
576
+ $hidden = $repeater.children('.spftestimonial-repeater-hidden'),
577
+ $max = $repeater.children('.spftestimonial-repeater-max'),
578
+ $min = $repeater.children('.spftestimonial-repeater-min'),
579
+ field_id = $wrapper.data('field-id'),
580
+ max = parseInt($wrapper.data('max')),
581
+ min = parseInt($wrapper.data('min'));
582
 
583
+ $wrapper.children('.spftestimonial-repeater-item').children('.spftestimonial-repeater-content').spftestimonial_reload_script();
584
 
585
+ $wrapper.sortable({
586
+ axis: 'y',
587
+ handle: '.spftestimonial-repeater-sort',
588
+ helper: 'original',
589
+ cursor: 'move',
590
+ placeholder: 'widget-placeholder',
591
+ update: function (event, ui) {
592
 
593
+ SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children('.spftestimonial-repeater-item'), field_id);
594
+ // $wrapper.spftestimonial_customizer_refresh();
595
+ // ui.item.spftestimonial_reload_script_retry();
596
 
597
+ }
598
+ });
599
 
600
+ $repeater.children('.spftestimonial-repeater-add').on('click', function (e) {
601
 
602
+ e.preventDefault();
603
 
604
+ var count = $wrapper.children('.spftestimonial-repeater-item').length;
605
 
606
+ $min.hide();
607
 
608
+ if (max && (count + 1) > max) {
609
+ $max.show();
610
+ return;
611
+ }
612
 
613
+ var $cloned_item = $hidden.spftestimonial_clone(true);
614
 
615
+ $cloned_item.removeClass('spftestimonial-repeater-hidden');
616
 
617
+ $cloned_item.find(':input[name!="_pseudo"]').each(function () {
618
+ this.name = this.name.replace('___', '').replace(field_id + '[0]', field_id + '[' + count + ']');
619
+ });
620
 
621
+ $wrapper.append($cloned_item);
622
+ $cloned_item.children('.spftestimonial-repeater-content').spftestimonial_reload_script();
623
+ // $wrapper.spftestimonial_customizer_refresh();
624
+ // $wrapper.spftestimonial_customizer_listen({ closest: true });
625
 
626
+ });
627
 
628
+ var event_clone = function (e) {
629
 
630
+ e.preventDefault();
631
 
632
+ var count = $wrapper.children('.spftestimonial-repeater-item').length;
633
 
634
+ $min.hide();
635
 
636
+ if (max && (count + 1) > max) {
637
+ $max.show();
638
+ return;
639
+ }
640
 
641
+ var $this = $(this),
642
+ $parent = $this.parent().parent().parent(),
643
+ $cloned_content = $parent.children('.spftestimonial-repeater-content').spftestimonial_clone(),
644
+ $cloned_helper = $parent.children('.spftestimonial-repeater-helper').spftestimonial_clone(true),
645
+ $cloned_item = $('<div class="spftestimonial-repeater-item" />');
646
 
647
+ $cloned_item.append($cloned_content);
648
+ $cloned_item.append($cloned_helper);
649
 
650
+ $wrapper.children().eq($parent.index()).after($cloned_item);
651
 
652
+ $cloned_item.children('.spftestimonial-repeater-content').spftestimonial_reload_script();
653
 
654
+ SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children('.spftestimonial-repeater-item'), field_id);
655
 
656
+ // $wrapper.spftestimonial_customizer_refresh();
657
+ // $wrapper.spftestimonial_customizer_listen({ closest: true });
658
 
659
+ };
660
 
661
+ $wrapper.children('.spftestimonial-repeater-item').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-clone', event_clone);
662
+ $repeater.children('.spftestimonial-repeater-hidden').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-clone', event_clone);
663
 
664
+ var event_remove = function (e) {
665
 
666
+ e.preventDefault();
667
 
668
+ var count = $wrapper.children('.spftestimonial-repeater-item').length;
669
 
670
+ $max.hide();
671
+ $min.hide();
672
 
673
+ if (min && (count - 1) < min) {
674
+ $min.show();
675
+ return;
676
+ }
677
 
678
+ $(this).closest('.spftestimonial-repeater-item').remove();
679
 
680
+ SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children('.spftestimonial-repeater-item'), field_id);
681
 
682
+ // $wrapper.spftestimonial_customizer_refresh();
683
 
684
+ };
685
 
686
+ $wrapper.children('.spftestimonial-repeater-item').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-remove', event_remove);
687
+ $repeater.children('.spftestimonial-repeater-hidden').children('.spftestimonial-repeater-helper').on('click', '.spftestimonial-repeater-remove', event_remove);
688
 
689
+ });
690
+ };
691
 
692
+ //
693
+ // Field: sortable
694
+ //
695
+ $.fn.spftestimonial_field_sortable = function () {
696
+ return this.each(function () {
697
 
698
+ var $sortable = $(this).find('.spftestimonial-sortable');
699
 
700
+ $sortable.sortable({
701
+ axis: 'y',
702
+ helper: 'original',
703
+ cursor: 'move',
704
+ placeholder: 'widget-placeholder',
705
+ update: function (event, ui) {
706
+ // $sortable.spftestimonial_customizer_refresh();
707
+ }
708
+ });
709
 
710
+ $sortable.find('.spftestimonial-sortable-content').spftestimonial_reload_script();
711
+ $('.form_fields').find('.spftestimonial-sortable').sortable("disable");
712
 
713
+ });
714
+ };
715
 
716
+ //
717
+ // Field: sorter
718
+ //
719
+ $.fn.spftestimonial_field_sorter = function () {
720
+ return this.each(function () {
721
 
722
+ var $this = $(this),
723
+ $enabled = $this.find('.spftestimonial-enabled'),
724
+ $has_disabled = $this.find('.spftestimonial-disabled'),
725
+ $disabled = ($has_disabled.length) ? $has_disabled : false;
726
 
727
+ $enabled.sortable({
728
+ connectWith: $disabled,
729
+ placeholder: 'ui-sortable-placeholder',
730
+ update: function (event, ui) {
731
 
732
+ var $el = ui.item.find('input');
733
 
734
+ if (ui.item.parent().hasClass('spftestimonial-enabled')) {
735
+ $el.attr('name', $el.attr('name').replace('disabled', 'enabled'));
736
+ } else {
737
+ $el.attr('name', $el.attr('name').replace('enabled', 'disabled'));
738
+ }
739
 
740
+ // $this.spftestimonial_customizer_refresh();
741
 
742
+ }
743
+ });
744
 
745
+ if ($disabled) {
746
 
747
+ $disabled.sortable({
748
+ connectWith: $enabled,
749
+ placeholder: 'ui-sortable-placeholder',
750
+ update: function (event, ui) {
751
+ // $this.spftestimonial_customizer_refresh();
752
+ }
753
+ });
754
 
755
+ }
756
+
757
+ });
758
+ };
759
+
760
+ //
761
+ // Field: spinner
762
+ //
763
+ $.fn.spftestimonial_field_spinner = function () {
764
+ return this.each(function () {
765
+
766
+ var $this = $(this),
767
+ $input = $this.find('input'),
768
+ $inited = $this.find('.ui-button'),
769
+ data = $input.data();
770
+
771
+ if ($inited.length) {
772
+ $inited.remove();
773
+ }
774
+
775
+ $input.spinner({
776
+ min: data.min || 0,
777
+ max: data.max || 100,
778
+ step: data.step || 1,
779
+ create: function (event, ui) {
780
+ if (data.unit) {
781
+ $input.after('<span class="ui-button spftestimonial--unit">' + data.unit + '</span>');
782
+ }
783
+ },
784
+ spin: function (event, ui) {
785
+ $input.val(ui.value).trigger('change');
786
+ }
787
+ });
788
+
789
+ });
790
+ };
791
+
792
+ //
793
+ // Field: switcher
794
+ //
795
+ $.fn.spftestimonial_field_switcher = function () {
796
+ return this.each(function () {
797
+
798
+ var $switcher = $(this).find('.spftestimonial--switcher');
799
+
800
+ $switcher.on('click', function () {
801
+
802
+ var value = 0;
803
+ var $input = $switcher.find('input');
804
+
805
+ if ($switcher.hasClass('spftestimonial--active')) {
806
+ $switcher.removeClass('spftestimonial--active');
807
+ } else {
808
+ value = 1;
809
+ $switcher.addClass('spftestimonial--active');
810
+ }
811
 
812
+ $input.val(value).trigger('change');
813
+
814
+ });
815
+
816
+ });
817
+ };
818
+
819
+ //
820
+ // Field: typography
821
+ //
822
+ $.fn.spftestimonial_field_typography = function () {
823
+ return this.each(function () {
824
+
825
+ var base = this;
826
+ var $this = $(this);
827
+ var loaded_fonts = [];
828
+ var webfonts = spftestimonial_typography_json.webfonts;
829
+ var googlestyles = spftestimonial_typography_json.googlestyles;
830
+ var defaultstyles = spftestimonial_typography_json.defaultstyles;
831
 
832
+ //
833
+ //
834
+ // Sanitize google font subset
835
+ base.sanitize_subset = function (subset) {
836
+ subset = subset.replace('-ext', ' Extended');
837
+ subset = subset.charAt(0).toUpperCase() + subset.slice(1);
838
+ return subset;
839
+ };
840
+
841
+ //
842
+ //
843
+ // Sanitize google font styles (weight and style)
844
+ base.sanitize_style = function (style) {
845
+ return googlestyles[style] ? googlestyles[style] : style;
846
+ };
847
+
848
+ //
849
+ //
850
+ // Load google font
851
+ base.load_google_font = function (font_family, weight, style) {
852
 
853
+ if (font_family && typeof WebFont === 'object') {
854
 
855
+ weight = weight ? weight.replace('normal', '') : '';
856
+ style = style ? style.replace('normal', '') : '';
857
 
858
+ if (weight || style) {
859
+ font_family = font_family + ':' + weight + style;
860
+ }
861
 
862
+ if (loaded_fonts.indexOf(font_family) === -1) {
863
+ WebFont.load({ google: { families: [font_family] } });
864
+ }
865
 
866
+ loaded_fonts.push(font_family);
867
 
868
+ }
869
 
870
+ };
871
 
872
+ //
873
+ //
874
+ // Append select options
875
+ base.append_select_options = function ($select, options, condition, type, is_multi) {
876
 
877
+ $select.find('option').not(':first').remove();
878
 
879
+ var opts = '';
880
 
881
+ $.each(options, function (key, value) {
882
 
883
+ var selected;
884
+ var name = value;
885
 
886
+ // is_multi
887
+ if (is_multi) {
888
+ selected = (condition && condition.indexOf(value) !== -1) ? ' selected' : '';
889
+ } else {
890
+ selected = (condition && condition === value) ? ' selected' : '';
891
+ }
892
 
893
+ if (type === 'subset') {
894
+ name = base.sanitize_subset(value);
895
+ } else if (type === 'style') {
896
+ name = base.sanitize_style(value);
897
+ }
898
 
899
+ opts += '<option value="' + value + '"' + selected + '>' + name + '</option>';
900
 
901
+ });
902
 
903
+ $select.append(opts).trigger('spftestimonial.change').trigger('chosen:updated');
904
 
905
+ };
906
 
907
+ base.init = function () {
908
 
909
+ //
910
+ //
911
+ // Constants
912
+ var selected_styles = [];
913
+ var $typography = $this.find('.spftestimonial--typography');
914
+ var $type = $this.find('.spftestimonial--type');
915
+ var $styles = $this.find('.spftestimonial--block-font-style');
916
+ var unit = $typography.data('unit');
917
+ var line_height_unit = $typography.data('line-height-unit');
918
+ var exclude_fonts = $typography.data('exclude') ? $typography.data('exclude').split(',') : [];
919
 
920
+ //
921
+ //
922
+ // Chosen init
923
+ if ($this.find('.spftestimonial--chosen').length) {
924
 
925
+ var $chosen_selects = $this.find('select');
926
 
927
+ $chosen_selects.each(function () {
928
 
929
+ var $chosen_select = $(this),
930
+ $chosen_inited = $chosen_select.parent().find('.chosen-container');
931
 
932
+ if ($chosen_inited.length) {
933
+ $chosen_inited.remove();
934
+ }
935
 
936
+ $chosen_select.chosen({
937
+ allow_single_deselect: true,
938
+ disable_search_threshold: 15,
939
+ width: '100%'
940
+ });
941
 
942
+ });
943
 
944
+ }
945
 
946
+ //
947
+ //
948
+ // Font family select
949
+ var $font_family_select = $this.find('.spftestimonial--font-family');
950
+ var first_font_family = $font_family_select.val();
951
 
952
+ // Clear default font family select options
953
+ $font_family_select.find('option').not(':first-child').remove();
954
 
955
+ var opts = '';
956
 
957
+ $.each(webfonts, function (type, group) {
958
 
959
+ // Check for exclude fonts
960
+ if (exclude_fonts && exclude_fonts.indexOf(type) !== -1) { return; }
961
 
962
+ opts += '<optgroup label="' + group.label + '">';
963
 
964
+ $.each(group.fonts, function (key, value) {
965
 
966
+ // use key if value is object
967
+ value = (typeof value === 'object') ? key : value;
968
+ var selected = (value === first_font_family) ? ' selected' : '';
969
+ opts += '<option value="' + value + '" data-type="' + type + '"' + selected + '>' + value + '</option>';
970
 
971
+ });
972
 
973
+ opts += '</optgroup>';
974
 
975
+ });
976
 
977
+ // Append google font select options
978
+ $font_family_select.append(opts).trigger('chosen:updated');
979
 
980
+ //
981
+ //
982
+ // Font style select
983
+ var $font_style_block = $this.find('.spftestimonial--block-font-style');
984
 
985
+ if ($font_style_block.length) {
986
 
987
+ var $font_style_select = $this.find('.spftestimonial--font-style-select');
988
+ var first_style_value = $font_style_select.val() ? $font_style_select.val().replace(/normal/g, '') : '';
989
 
990
+ //
991
+ // Font Style on on change listener
992
+ $font_style_select.on('change spftestimonial.change', function (event) {
993
 
994
+ var style_value = $font_style_select.val();
995
 
996
+ // set a default value
997
+ if (!style_value && selected_styles && selected_styles.indexOf('normal') === -1) {
998
+ style_value = selected_styles[0];
999
+ }
1000
 
1001
+ // set font weight, for eg. replacing 800italic to 800
1002
+ var font_normal = (style_value && style_value !== 'italic' && style_value === 'normal') ? 'normal' : '';
1003
+ var font_weight = (style_value && style_value !== 'italic' && style_value !== 'normal') ? style_value.replace('italic', '') : font_normal;
1004
+ var font_style = (style_value && style_value.substr(-6) === 'italic') ? 'italic' : '';
1005
 
1006
+ $this.find('.spftestimonial--font-weight').val(font_weight);
1007
+ $this.find('.spftestimonial--font-style').val(font_style);
1008
 
1009
+ });
1010
 
1011
+ //
1012
+ //
1013
+ // Extra font style select
1014
+ var $extra_font_style_block = $this.find('.spftestimonial--block-extra-styles');
1015
 
1016
+ if ($extra_font_style_block.length) {
1017
+ var $extra_font_style_select = $this.find('.spftestimonial--extra-styles');
1018
+ var first_extra_style_value = $extra_font_style_select.val();
1019
+ }
1020
 
1021
+ }
1022
 
1023
+ //
1024
+ //
1025
+ // Subsets select
1026
+ var $subset_block = $this.find('.spftestimonial--block-subset');
1027
+ if ($subset_block.length) {
1028
+ var $subset_select = $this.find('.spftestimonial--subset');
1029
+ var first_subset_select_value = $subset_select.val();
1030
+ var subset_multi_select = $subset_select.data('multiple') || false;
1031
+ }
1032
 
1033
+ //
1034
+ //
1035
+ // Backup font family
1036
+ var $backup_font_family_block = $this.find('.spftestimonial--block-backup-font-family');
1037
 
1038
+ //
1039
+ //
1040
+ // Font Family on Change Listener
1041
+ $font_family_select.on('change spftestimonial.change', function (event) {
1042
 
1043
+ // Hide subsets on change
1044
+ if ($subset_block.length) {
1045
+ $subset_block.addClass('hidden');
1046
+ }
1047
 
1048
+ // Hide extra font style on change
1049
+ if ($extra_font_style_block.length) {
1050
+ $extra_font_style_block.addClass('hidden');
1051
+ }
1052
 
1053
+ // Hide backup font family on change
1054
+ if ($backup_font_family_block.length) {
1055
+ $backup_font_family_block.addClass('hidden');
1056
+ }
1057
 
1058
+ var $selected = $font_family_select.find(':selected');
1059
+ var value = $selected.val();
1060
+ var type = $selected.data('type');
1061
 
1062
+ if (type && value) {
1063
 
1064
+ // Show backup fonts if font type google or custom
1065
+ if ((type === 'google' || type === 'custom') && $backup_font_family_block.length) {
1066
+ $backup_font_family_block.removeClass('hidden');
1067
+ }
1068
 
1069
+ // Appending font style select options
1070
+ if ($font_style_block.length) {
1071
 
1072
+ // set styles for multi and normal style selectors
1073
+ var styles = defaultstyles;
1074
 
1075
+ // Custom or gogle font styles
1076
+ if (type === 'google' && webfonts[type].fonts[value][0]) {
1077
+ styles = webfonts[type].fonts[value][0];
1078
+ } else if (type === 'custom' && webfonts[type].fonts[value]) {
1079
+ styles = webfonts[type].fonts[value];
1080
+ }
1081
 
1082
+ selected_styles = styles;
1083
 
1084
+ // Set selected style value for avoid load errors
1085
+ var set_auto_style = (styles.indexOf('normal') !== -1) ? 'normal' : styles[0];
1086
+ var set_style_value = (first_style_value && styles.indexOf(first_style_value) !== -1) ? first_style_value : set_auto_style;
1087
 
1088
+ // Append style select options
1089
+ base.append_select_options($font_style_select, styles, set_style_value, 'style');
1090
 
1091
+ // Clear first value
1092
+ first_style_value = false;
1093
 
1094
+ // Show style select after appended
1095
+ $font_style_block.removeClass('hidden');
1096
 
1097
+ // Appending extra font style select options
1098
+ if (type === 'google' && $extra_font_style_block.length && styles.length > 1) {
1099
 
1100
+ // Append extra-style select options
1101
+ base.append_select_options($extra_font_style_select, styles, first_extra_style_value, 'style', true);
1102
 
1103
+ // Clear first value
1104
+ first_extra_style_value = false;
1105
 
1106
+ // Show style select after appended
1107
+ $extra_font_style_block.removeClass('hidden');
1108
 
1109
+ }
1110
 
1111
+ }
1112
 
1113
+ // Appending google fonts subsets select options
1114
+ if (type === 'google' && $subset_block.length && webfonts[type].fonts[value][1]) {
1115
 
1116
+ var subsets = webfonts[type].fonts[value][1];
1117
+ var set_auto_subset = (subsets.length < 2 && subsets[0] !== 'latin') ? subsets[0] : '';
1118
+ var set_subset_value = (first_subset_select_value && subsets.indexOf(first_subset_select_value) !== -1) ? first_subset_select_value : set_auto_subset;
1119
 
1120
+ // check for multiple subset select
1121
+ set_subset_value = (subset_multi_select && first_subset_select_value) ? first_subset_select_value : set_subset_value;
1122
 
1123
+ base.append_select_options($subset_select, subsets, set_subset_value, 'subset', subset_multi_select);
1124
 
1125
+ first_subset_select_value = false;
1126
 
1127
+ $subset_block.removeClass('hidden');
1128
 
1129
+ }
1130
 
1131
+ } else {
1132
 
1133
+ // Clear Styles
1134
+ $styles.find(':input').val('');
1135
 
1136
+ // Clear subsets options if type and value empty
1137
+ if ($subset_block.length) {
1138
+ $subset_select.find('option').not(':first-child').remove();
1139
+ $subset_select.trigger('chosen:updated');
1140
+ }
1141
 
1142
+ // Clear font styles options if type and value empty
1143
+ if ($font_style_block.length) {
1144
+ $font_style_select.find('option').not(':first-child').remove();
1145
+ $font_style_select.trigger('chosen:updated');
1146
+ }
1147
 
1148
+ }
1149
 
1150
+ // Update font type input value
1151
+ $type.val(type);
1152
 
1153
+ }).trigger('spftestimonial.change');
1154
 
1155
+ //
1156
+ //
1157
+ // Preview
1158
+ var $preview_block = $this.find('.spftestimonial--block-preview');
1159
 
1160
+ if ($preview_block.length) {
1161
 
1162
+ var $preview = $this.find('.spftestimonial--preview');
1163
 
1164
+ // Set preview styles on change
1165
+ $this.on('change', SPFTESTIMONIAL.helper.debounce(function (event) {
1166
 
1167
+ $preview_block.removeClass('hidden');
1168
 
1169
+ var font_family = $font_family_select.val(),
1170
+ font_weight = $this.find('.spftestimonial--font-weight').val(),
1171
+ font_style = $this.find('.spftestimonial--font-style').val(),
1172
+ font_size = $this.find('.spftestimonial--font-size').val(),
1173
+ font_variant = $this.find('.spftestimonial--font-variant').val(),
1174
+ line_height = $this.find('.spftestimonial--line-height').val(),
1175
+ text_align = $this.find('.spftestimonial--text-align').val(),
1176
+ text_transform = $this.find('.spftestimonial--text-transform').val(),
1177
+ text_decoration = $this.find('.spftestimonial--text-decoration').val(),
1178
+ text_color = $this.find('.spftestimonial--color').val(),
1179
+ word_spacing = $this.find('.spftestimonial--word-spacing').val(),
1180
+ letter_spacing = $this.find('.spftestimonial--letter-spacing').val(),
1181
+ custom_style = $this.find('.spftestimonial--custom-style').val(),
1182
+ type = $this.find('.spftestimonial--type').val();
1183
 
1184
+ if (type === 'google') {
1185
+ base.load_google_font(font_family, font_weight, font_style);
1186
+ }
1187
 
1188
+ var properties = {};
1189
 
1190
+ if (font_family) { properties.fontFamily = font_family; }
1191
+ if (font_weight) { properties.fontWeight = font_weight; }
1192
+ if (font_style) { properties.fontStyle = font_style; }
1193
+ if (font_variant) { properties.fontVariant = font_variant; }
1194
+ if (font_size) { properties.fontSize = font_size + unit; }
1195
+ if (line_height) { properties.lineHeight = line_height + line_height_unit; }
1196
+ if (letter_spacing) { properties.letterSpacing = letter_spacing + unit; }
1197
+ if (word_spacing) { properties.wordSpacing = word_spacing + unit; }
1198
+ if (text_align) { properties.textAlign = text_align; }
1199
+ if (text_transform) { properties.textTransform = text_transform; }
1200
+ if (text_decoration) { properties.textDecoration = text_decoration; }
1201
+ if (text_color) { properties.color = text_color; }
1202
 
1203
+ $preview.removeAttr('style');
1204
 
1205
+ // Customs style attribute
1206
+ if (custom_style) { $preview.attr('style', custom_style); }
1207
 
1208
+ $preview.css(properties);
1209
 
1210
+ }, 100));
1211
 
1212
+ // Preview black and white backgrounds trigger
1213
+ $preview_block.on('click', function () {
1214
 
1215
+ $preview.toggleClass('spftestimonial--black-background');
1216
 
1217
+ var $toggle = $preview_block.find('.spftestimonial--toggle');
1218
 
1219
+ if ($toggle.hasClass('fa-toggle-off')) {
1220
+ $toggle.removeClass('fa-toggle-off').addClass('fa-toggle-on');
1221
+ } else {
1222
+ $toggle.removeClass('fa-toggle-on').addClass('fa-toggle-off');
1223
+ }
1224
 
1225
+ });
1226
 
1227
+ if (!$preview_block.hasClass('hidden')) {
1228
+ $this.trigger('change');
1229
+ }
1230
 
1231
+ }
1232
 
1233
+ };
1234
 
1235
+ base.init();
1236
 
1237
+ });
1238
+ };
1239
 
1240
+ //
1241
+ // Confirm
1242
+ //
1243
+ $.fn.spftestimonial_confirm = function () {
1244
+ return this.each(function () {
1245
+ $(this).on('click', function (e) {
1246
 
1247
+ var confirm_text = $(this).data('confirm') || window.spftestimonial_vars.i18n.confirm;
1248
+ var confirm_answer = confirm(confirm_text);
1249
 
1250
+ if (confirm_answer) {
1251
+ SPFTESTIMONIAL.vars.is_confirm = true;
1252
+ SPFTESTIMONIAL.vars.form_modified = false;
1253
+ } else {
1254
+ e.preventDefault();
1255
+ return false;
1256
+ }
1257
 
1258
+ });
1259
+ });
1260
+ };
1261
 
1262
+ $.fn.serializeObject = function () {
1263
 
1264
+ var obj = {};
1265
 
1266
+ $.each(this.serializeArray(), function (i, o) {
1267
+ var n = o.name,
1268
+ v = o.value;
1269
 
1270
+ obj[n] = obj[n] === undefined ? v
1271
+ : $.isArray(obj[n]) ? obj[n].concat(v)
1272
+ : [obj[n], v];
1273
+ });
1274
 
1275
+ return obj;
1276
 
1277
+ };
1278
 
1279
+ //
1280
+ // Options Save
1281
+ //
1282
+ $.fn.spftestimonial_save = function () {
1283
+ return this.each(function () {
1284
 
1285
+ var $this = $(this),
1286
+ $buttons = $('.spftestimonial-save'),
1287
+ $panel = $('.spftestimonial-options'),
1288
+ flooding = false,
1289
+ timeout;
1290
 
1291
+ $this.on('click', function (e) {
1292
 
1293
+ if (!flooding) {
1294
 
1295
+ var $text = $this.data('save'),
1296
+ $value = $this.val();
1297
 
1298
+ $buttons.attr('value', $text);
1299
 
1300
+ if ($this.hasClass('spftestimonial-save-ajax')) {
1301
 
1302
+ e.preventDefault();
1303
 
1304
+ $panel.addClass('spftestimonial-saving');
1305
+ $buttons.prop('disabled', true);
1306
 
1307
+ window.wp.ajax.post('spftestimonial_' + $panel.data('unique') + '_ajax_save', {
1308
+ data: $('#spftestimonial-form').serializeJSONSPFTESTIMONIAL()
1309
+ })
1310
+ .done(function (response) {
1311
 
1312
+ // clear errors
1313
+ $('.spftestimonial-error').remove();
1314
 
1315
+ if (Object.keys(response.errors).length) {
1316
 
1317
+ var error_icon = '<i class="spftestimonial-label-error spftestimonial-error">!</i>';
1318
 
1319
+ $.each(response.errors, function (key, error_message) {
1320
 
1321
+ var $field = $('[data-depend-id="' + key + '"]'),
1322
+ $link = $('a[href="#tab=' + $field.closest('.spftestimonial-section').data('section-id') + '"]'),
1323
+ $tab = $link.closest('.spftestimonial-tab-item');
1324
 
1325
+ $field.closest('.spftestimonial-fieldset').append('<p class="spftestimonial-error spftestimonial-error-text">' + error_message + '</p>');
1326
 
1327
+ if (!$link.find('.spftestimonial-error').length) {
1328
+ $link.append(error_icon);
1329
+ }
1330
 
1331
+ if (!$tab.find('.spftestimonial-arrow .spftestimonial-error').length) {
1332
+ $tab.find('.spftestimonial-arrow').append(error_icon);
1333
+ }
1334
+ // $('.spftestimonial-options .spftestimonial-save.spftestimonial-save-ajax').attr('disabled', true);
1335
+ });
1336
 
1337
+ }
1338
 
1339
+ $panel.removeClass('spftestimonial-saving');
1340
+ $buttons.prop('disabled', true).attr('value', 'Changes Saved');
1341
+ flooding = false;
1342
 
1343
+ SPFTESTIMONIAL.vars.form_modified = false;
1344
+ SPFTESTIMONIAL.vars.$form_warning.hide();
1345
 
1346
+ clearTimeout(timeout);
1347
 
1348
+ var $result_success = $('.spftestimonial-form-success');
1349
+ $result_success.empty().append(response.notice).fadeIn('fast', function () {
1350
+ timeout = setTimeout(function () {
1351
+ $result_success.fadeOut('fast');
1352
+ }, 1000);
1353
+ });
1354
 
1355
+ })
1356
+ .fail(function (response) {
1357
+ alert(response.error);
1358
+ });
1359
 
1360
+ } else {
1361
 
1362
+ SPFTESTIMONIAL.vars.form_modified = false;
1363
 
1364
+ }
1365
 
1366
+ }
1367
 
1368
+ flooding = true;
1369
 
1370
+ });
1371
 
1372
+ });
1373
+ };
1374
 
1375
+ //
1376
+ // Option Framework
1377
+ //
1378
+ $.fn.spftestimonial_options = function () {
1379
+ return this.each(function () {
1380
 
1381
+ var $this = $(this),
1382
+ $content = $this.find('.spftestimonial-content'),
1383
+ $form_success = $this.find('.spftestimonial-form-success'),
1384
+ $form_warning = $this.find('.spftestimonial-form-warning'),
1385
+ $save_button = $this.find('.spftestimonial-header .spftestimonial-save');
1386
 
1387
+ SPFTESTIMONIAL.vars.$form_warning = $form_warning;
1388
 
1389
+ // Shows a message white leaving theme options without saving
1390
+ if ($form_warning.length) {
1391
 
1392
+ window.onbeforeunload = function () {
1393
+ return (SPFTESTIMONIAL.vars.form_modified) ? true : undefined;
1394
+ };
1395
 
1396
+ $content.on('change keypress', ':input', function () {
1397
+ if (!SPFTESTIMONIAL.vars.form_modified) {
1398
+ $form_success.hide();
1399
+ $form_warning.fadeIn('fast');
1400
+ SPFTESTIMONIAL.vars.form_modified = true;
1401
+ }
1402
+ });
1403
 
1404
+ }
1405
 
1406
+ if ($form_success.hasClass('spftestimonial-form-show')) {
1407
+ setTimeout(function () {
1408
+ $form_success.fadeOut('fast');
1409
+ }, 1000);
1410
+ }
1411
 
1412
+ $(document).on('keydown',function (event) {
1413
+ if ((event.ctrlKey || event.metaKey) && event.which === 83) {
1414
+ $save_button.trigger('click');
1415
+ event.preventDefault();
1416
+ return false;
1417
+ }
1418
+ });
1419
 
1420
+ });
1421
+ };
1422
 
1423
+ //
1424
+ // WP Color Picker
1425
+ //
1426
+ if (typeof Color === 'function') {
1427
 
1428
+ Color.prototype.toString = function () {
1429
 
1430
+ if (this._alpha < 1) {
1431
+ return this.toCSS('rgba', this._alpha).replace(/\s+/g, '');
1432
+ }
1433
 
1434
+ var hex = parseInt(this._color, 10).toString(16);
1435
 
1436
+ if (this.error) { return ''; }
1437
 
1438
+ if (hex.length < 6) {
1439
+ for (var i = 6 - hex.length - 1; i >= 0; i--) {
1440
+ hex = '0' + hex;
1441
+ }
1442
+ }
1443
 
1444
+ return '#' + hex;
1445
 
1446
+ };
1447
 
1448
+ }
1449
 
1450
+ SPFTESTIMONIAL.funcs.parse_color = function (color) {
1451
 
1452
+ var value = color.replace(/\s+/g, ''),
1453
+ trans = (value.indexOf('rgba') !== -1) ? parseFloat(value.replace(/^.*,(.+)\)/, '$1') * 100) : 100,
1454
+ rgba = (trans < 100) ? true : false;
1455
 
1456
+ return { value: value, transparent: trans, rgba: rgba };
1457
 
1458
+ };
1459
 
1460
+ $.fn.spftestimonial_color = function () {
1461
+ return this.each(function () {
1462
 
1463
+ var $input = $(this),
1464
+ picker_color = SPFTESTIMONIAL.funcs.parse_color($input.val()),
1465
+ palette_color = window.spftestimonial_vars.color_palette.length ? window.spftestimonial_vars.color_palette : true,
1466
+ $container;
1467
 
1468
+ // Destroy and Reinit
1469
+ if ($input.hasClass('wp-color-picker')) {
1470
+ $input.closest('.wp-picker-container').after($input).remove();
1471
+ }
1472
 
1473
+ $input.wpColorPicker({
1474
+ palettes: palette_color,
1475
+ change: function (event, ui) {
1476
 
1477
+ var ui_color_value = ui.color.toString();
1478
 
1479
+ $container.removeClass('spftestimonial--transparent-active');
1480
+ $container.find('.spftestimonial--transparent-offset').css('background-color', ui_color_value);
1481
+ $input.val(ui_color_value).trigger('change');
1482
+
1483
+ },
1484
+ create: function () {
1485
+
1486
+ $container = $input.closest('.wp-picker-container');
1487
+
1488
+ var a8cIris = $input.data('a8cIris'),
1489
+ $transparent_wrap = $('<div class="spftestimonial--transparent-wrap">' +
1490
+ '<div class="spftestimonial--transparent-slider"></div>' +
1491
+ '<div class="spftestimonial--transparent-offset"></div>' +
1492
+ '<div class="spftestimonial--transparent-text"></div>' +
1493
+ '<div class="spftestimonial--transparent-button">transparent <i class="fa fa-toggle-off"></i></div>' +
1494
+ '</div>').appendTo($container.find('.wp-picker-holder')),
1495
+ $transparent_slider = $transparent_wrap.find('.spftestimonial--transparent-slider'),
1496
+ $transparent_text = $transparent_wrap.find('.spftestimonial--transparent-text'),
1497
+ $transparent_offset = $transparent_wrap.find('.spftestimonial--transparent-offset'),
1498
+ $transparent_button = $transparent_wrap.find('.spftestimonial--transparent-button');
1499
+
1500
+ if ($input.val() === 'transparent') {
1501
+ $container.addClass('spftestimonial--transparent-active');
1502
+ }
1503
+
1504
+ $transparent_button.on('click', function () {
1505
+ if ($input.val() !== 'transparent') {
1506
+ $input.val('transparent').trigger('change').removeClass('iris-error');
1507
+ $container.addClass('spftestimonial--transparent-active');
1508
+ } else {
1509
+ $input.val(a8cIris._color.toString()).trigger('change');
1510
+ $container.removeClass('spftestimonial--transparent-active');
1511
+ }
1512
+ });
1513
+
1514
+ $transparent_slider.slider({
1515
+ value: picker_color.transparent,
1516
+ step: 1,
1517
+ min: 0,
1518
+ max: 100,
1519
+ slide: function (event, ui) {
1520
+
1521
+ var slide_value = parseFloat(ui.value / 100);
1522
+ a8cIris._color._alpha = slide_value;
1523
+ $input.wpColorPicker('color', a8cIris._color.toString());
1524
+ $transparent_text.text((slide_value === 1 || slide_value === 0 ? '' : slide_value));
1525
 
1526
+ },
1527
+ create: function () {
1528
 
1529
+ var slide_value = parseFloat(picker_color.transparent / 100),
1530
+ text_value = slide_value < 1 ? slide_value : '';
1531
+
1532
+ $transparent_text.text(text_value);
1533
+ $transparent_offset.css('background-color', picker_color.value);
1534
+
1535
+ $container.on('click', '.wp-picker-clear', function () {
1536
+
1537
+ a8cIris._color._alpha = 1;
1538
+ $transparent_text.text('');
1539
+ $transparent_slider.slider('option', 'value', 100);
1540
+ $container.removeClass('spftestimonial--transparent-active');
1541
+ $input.trigger('change');
1542
 
1543
+ });
1544
 
1545
+ $container.on('click', '.wp-picker-default', function () {
1546
 
1547
+ var default_color = SPFTESTIMONIAL.funcs.parse_color($input.data('default-color')),
1548
+ default_value = parseFloat(default_color.transparent / 100),
1549
+ default_text = default_value < 1 ? default_value : '';
1550
+
1551
+ a8cIris._color._alpha = default_value;
1552
+ $transparent_text.text(default_text);
1553
+ $transparent_slider.slider('option', 'value', default_color.transparent);
1554
+
1555
+ if (default_color.value === 'transparent') {
1556
+ $input.removeClass('iris-error');
1557
+ $container.addClass('spftestimonial--transparent-active');
1558
+ }
1559
+
1560
+ });
1561
+
1562
+ }
1563
+ });
1564
+ }
1565
+ });
1566
+
1567
+ });
1568
+ };
1569
+
1570
+ //
1571
+ // ChosenJS
1572
+ //
1573
+ $.fn.spftestimonial_chosen = function () {
1574
+ return this.each(function () {
1575
+
1576
+ var $this = $(this),
1577
+ $inited = $this.parent().find('.chosen-container'),
1578
+ is_sortable = $this.hasClass('spftestimonial-chosen-sortable') || false,
1579
+ is_ajax = $this.hasClass('spftestimonial-chosen-ajax') || false,
1580
+ is_multiple = $this.attr('multiple') || false,
1581
+ set_width = is_multiple ? '100%' : 'auto',
1582
+ set_options = $.extend({
1583
+ allow_single_deselect: true,
1584
+ disable_search_threshold: 10,
1585
+ width: set_width,
1586
+ no_results_text: window.spftestimonial_vars.i18n.no_results_text,
1587
+ }, $this.data('chosen-settings'));
1588
+
1589
+ if ($inited.length) {
1590
+ $inited.remove();
1591
+ }
1592
+
1593
+ // Chosen ajax
1594
+ if (is_ajax) {
1595
+
1596
+ var set_ajax_options = $.extend({
1597
+ data: {
1598
+ type: 'post',
1599
+ nonce: '',
1600
+ },
1601
+ allow_single_deselect: true,
1602
+ disable_search_threshold: -1,
1603
+ width: '100%',
1604
+ min_length: 3,
1605
+ type_delay: 500,
1606
+ typing_text: window.spftestimonial_vars.i18n.typing_text,
1607
+ searching_text: window.spftestimonial_vars.i18n.searching_text,
1608
+ no_results_text: window.spftestimonial_vars.i18n.no_results_text,
1609
+ }, $this.data('chosen-settings'));
1610
+
1611
+ $this.SPFTESTIMONIALAjaxChosen(set_ajax_options);
1612
+
1613
+ } else {
1614
+
1615
+ $this.chosen(set_options);
1616
+
1617
+ }
1618
+
1619
+ // Chosen keep options order
1620
+ if (is_multiple) {
1621
+
1622
+ var $hidden_select = $this.parent().find('.spftestimonial-hide-select');
1623
+ var $hidden_value = $hidden_select.val() || [];
1624
+
1625
+ $this.on('change', function (obj, result) {
1626
+
1627
+ if (result && result.selected) {
1628
+ $hidden_select.append('<option value="' + result.selected + '" selected="selected">' + result.selected + '</option>');
1629
+ } else if (result && result.deselected) {
1630
+ $hidden_select.find('option[value="' + result.deselected + '"]').remove();
1631
+ }
1632
+
1633
+ // Force customize refresh
1634
+ if (window.wp.customize !== undefined && $hidden_select.children().length === 0 && $hidden_select.data('customize-setting-link')) {
1635
+ window.wp.customize.control($hidden_select.data('customize-setting-link')).setting.set('');
1636
+ }
1637
+
1638
+ $hidden_select.trigger('change');
1639
+
1640
+ });
1641
+
1642
+ // Chosen order abstract
1643
+ $this.SPFTESTIMONIALChosenOrder($hidden_value, true);
1644
+
1645
+ }
1646
+
1647
+ // Chosen sortable
1648
+ if (is_sortable) {
1649
+
1650
+ var $chosen_container = $this.parent().find('.chosen-container');
1651
+ var $chosen_choices = $chosen_container.find('.chosen-choices');
1652
+
1653
+ $chosen_choices.bind('mousedown', function (event) {
1654
+ if ($(event.target).is('span')) {
1655
+ event.stopPropagation();
1656
+ }
1657
+ });
1658
+
1659
+ $chosen_choices.sortable({
1660
+ items: 'li:not(.search-field)',
1661
+ helper: 'orginal',
1662
+ cursor: 'move',
1663
+ placeholder: 'search-choice-placeholder',
1664
+ start: function (e, ui) {
1665
+ ui.placeholder.width(ui.item.innerWidth());
1666
+ ui.placeholder.height(ui.item.innerHeight());
1667
+ },
1668
+ update: function (e, ui) {
1669
+
1670
+ var select_options = '';
1671
+ var chosen_object = $this.data('chosen');
1672
+ var $prev_select = $this.parent().find('.spftestimonial-hide-select');
1673
+
1674
+ $chosen_choices.find('.search-choice-close').each(function () {
1675
+ var option_array_index = $(this).data('option-array-index');
1676
+ $.each(chosen_object.results_data, function (index, data) {
1677
+ if (data.array_index === option_array_index) {
1678
+ select_options += '<option value="' + data.value + '" selected>' + data.value + '</option>';
1679
+ }
1680
+ });
1681
+ });
1682
 
1683
+ $prev_select.children().remove();
1684
+ $prev_select.append(select_options);
1685
+ $prev_select.trigger('change');
1686
 
1687
+ }
1688
+ });
1689
 
1690
+ }
1691
 
1692
+ });
1693
+ };
1694
 
1695
+ //
1696
+ // Helper Checkbox Checker
1697
+ //
1698
+ $.fn.spftestimonial_checkbox = function () {
1699
+ return this.each(function () {
1700
 
1701
+ var $this = $(this),
1702
+ $input = $this.find('.spftestimonial--input'),
1703
+ $checkbox = $this.find('.spftestimonial--checkbox');
1704
 
1705
+ $checkbox.on('click', function () {
1706
+ $input.val(Number($checkbox.prop('checked'))).trigger('change');
1707
+ });
1708
 
1709
+ });
1710
+ };
1711
 
1712
+ //
1713
+ // Siblings
1714
+ //
1715
+ $.fn.spftestimonial_siblings = function () {
1716
+ return this.each(function () {
1717
 
1718
+ var $this = $(this),
1719
+ $siblings = $this.find('.spftestimonial--sibling'),
1720
+ multiple = $this.data('multiple') || false;
1721
 
1722
+ $siblings.on('click', function () {
1723
 
1724
+ var $sibling = $(this);
1725
 
1726
+ if (multiple) {
1727
 
1728
+ if ($sibling.hasClass('spftestimonial--active')) {
1729
+ $sibling.removeClass('spftestimonial--active');
1730
+ $sibling.find('input').prop('checked', false).trigger('change');
1731
+ } else {
1732
+ $sibling.addClass('spftestimonial--active');
1733
+ $sibling.find('input').prop('checked', true).trigger('change');
1734
+ }
1735
 
1736
+ } else {
1737
 
1738
+ $this.find('input').prop('checked', false);
1739
+ $sibling.find('input').prop('checked', true).trigger('change');
1740
+ $sibling.addClass('spftestimonial--active').siblings().removeClass('spftestimonial--active');
1741
 
1742
+ }
1743
 
1744
+ });
1745
 
1746
+ });
1747
+ };
1748
 
1749
+ //
1750
+ // Help Tooltip
1751
+ //
1752
+ $.fn.spftestimonial_help = function () {
1753
+ return this.each(function () {
1754
 
1755
+ var $this = $(this),
1756
+ $tooltip,
1757
+ offset_left;
1758
 
1759
+ $this.on({
1760
+ mouseenter: function () {
1761
 
1762
+ $tooltip = $('<div class="spftestimonial-tooltip"></div>').html($this.find('.spftestimonial-help-text').html()).appendTo('body');
1763
+ offset_left = (SPFTESTIMONIAL.vars.is_rtl) ? ($this.offset().left - $tooltip.outerWidth()) : ($this.offset().left + 24);
1764
 
1765
+ $tooltip.css({
1766
+ top: $this.offset().top - (($tooltip.outerHeight() / 2) - 14),
1767
+ left: offset_left,
1768
+ });
1769
 
1770
+ },
1771
+ mouseleave: function () {
1772
 
1773
+ if ($tooltip !== undefined) {
1774
+ $tooltip.remove();
1775
+ }
1776
 
1777
+ }
1778
 
1779
+ });
1780
 
1781
+ });
1782
+ };
1783
 
1784
 
1785
+ //
1786
+ // Window on resize
1787
+ //
1788
+ SPFTESTIMONIAL.vars.$window.on('resize spftestimonial.resize', SPFTESTIMONIAL.helper.debounce(function (event) {
1789
 
1790
+ var window_width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? SPFTESTIMONIAL.vars.$window.width() : window.innerWidth;
1791
 
1792
+ if (window_width <= 782 && !SPFTESTIMONIAL.vars.onloaded) {
1793
+ $('.spftestimonial-section').spftestimonial_reload_script();
1794
+ SPFTESTIMONIAL.vars.onloaded = true;
1795
+ }
1796
 
1797
+ }, 200)).trigger('spftestimonial.resize');
1798
 
1799
+ //
1800
+ // Reload Plugins
1801
+ //
1802
+ $.fn.spftestimonial_reload_script = function (options) {
1803
 
1804
+ var settings = $.extend({
1805
+ dependency: true,
1806
+ }, options);
1807
 
1808
+ return this.each(function () {
1809
+
1810
+ var $this = $(this);
1811
+
1812
+ // Avoid for conflicts
1813
+ if (!$this.data('inited')) {
1814
+
1815
+ // Field plugins
1816
+ $this.children('.spftestimonial-field-accordion:not(.tfree_pro_only)').spftestimonial_field_accordion();
1817
+ $this.children('.spftestimonial-field-code_editor').spftestimonial_field_code_editor();
1818
+ $this.children('.spftestimonial-field-fieldset').spftestimonial_field_fieldset();
1819
+ $this.children('.spftestimonial-field-repeater').spftestimonial_field_repeater();
1820
+ $this.children('.spftestimonial-field-sortable').spftestimonial_field_sortable();
1821
+ $this.children('.spftestimonial-field-sorter').spftestimonial_field_sorter();
1822
+ $this.children('.spftestimonial-field-spinner').spftestimonial_field_spinner();
1823
+ $this.children('.spftestimonial-field-switcher').spftestimonial_field_switcher();
1824
+ $this.children('.spftestimonial-field-typography').spftestimonial_field_typography();
1825
+
1826
+ // Field colors
1827
+ $this.children('.spftestimonial-field-border').find('.spftestimonial-color').spftestimonial_color();
1828
+ $this.children('.spftestimonial-field-background').find('.spftestimonial-color').spftestimonial_color();
1829
+ $this.children('.spftestimonial-field-color').find('.spftestimonial-color').spftestimonial_color();
1830
+ $this.children('.spftestimonial-field-color_group').find('.spftestimonial-color').spftestimonial_color();
1831
+ $this.children('.spftestimonial-field-link_color').find('.spftestimonial-color').spftestimonial_color();
1832
+ $this.children('.spftestimonial-field-typography').find('.spftestimonial-color').spftestimonial_color();
1833
+
1834
+ // Field chosenjs
1835
+ $this.children('.spftestimonial-field-select').find('.spftestimonial-chosen').spftestimonial_chosen();
1836
+
1837
+ // Field Checkbox
1838
+ $this.children('.spftestimonial-field-checkbox').find('.spftestimonial-checkbox').spftestimonial_checkbox();
1839
+
1840
+ // Field Siblings
1841
+ $this.children('.spftestimonial-field-button_set').find('.spftestimonial-siblings').spftestimonial_siblings();
1842
+ $this.children('.spftestimonial-field-image_select, .spftestimonial-field-icon_select').find('.spftestimonial-siblings').spftestimonial_siblings();
1843
+ $this.children('.spftestimonial-field-palette').find('.spftestimonial-siblings').spftestimonial_siblings();
1844
+
1845
+ // Help Tooptip
1846
+ $this.children('.spftestimonial-field').find('.spftestimonial-help').spftestimonial_help();
1847
+
1848
+ if (settings.dependency) {
1849
+ $this.spftestimonial_dependency();
1850
+ }
1851
+
1852
+ $this.data('inited', true);
1853
+
1854
+ $(document).trigger('spftestimonial-reload-script', $this);
1855
+
1856
+ }
1857
+
1858
+ });
1859
+ };
1860
+
1861
+ //
1862
+ // Document ready and run scripts
1863
+ //
1864
+ $(document).ready(function () {
1865
+
1866
+ $('.spftestimonial-save').spftestimonial_save();
1867
+ $('.spftestimonial-options').spftestimonial_options();
1868
+ $('.spftestimonial-sticky-header').spftestimonial_sticky();
1869
+ $('.spftestimonial-nav-options').spftestimonial_nav_options();
1870
+ $('.spftestimonial-nav-metabox').spftestimonial_nav_metabox();
1871
+ $('.spftestimonial-search').spftestimonial_search();
1872
+ $('.spftestimonial-confirm').spftestimonial_confirm();
1873
+ $('.spftestimonial-expand-all').spftestimonial_expand_all();
1874
+ $('.spftestimonial-onload').spftestimonial_reload_script();
1875
+
1876
+ });
1877
+
1878
+ // Live Preview script for Testimonial-free.
1879
+ // var is_manage_preview = $('body').hasClass('post-type-spt_shortcodes');
1880
+ // var is_form_preview = $('body').hasClass('post-type-spt_testimonial_form');
1881
+
1882
+ // if (is_manage_preview) {
1883
+
1884
+ // }
1885
+ // if (is_form_preview) {
1886
+ // var preview_display = $('#sp_tpro_form_live_preview').hide();
1887
+ // var action = 'sp_testimonial_form_preview';
1888
+ // var nonce = $('#spftestimonial_metabox_noncesp_tpro_form_live_preview').val();
1889
+
1890
+ // }
1891
+ $(document).on('click', '#sp-testimonial-show-preview:contains(Hide)', function (e) {
1892
+ e.preventDefault();
1893
+ var _this = $(this);
1894
+ _this.html('<i class="fa fa-eye" aria-hidden="true"></i> Show Preview');
1895
+ preview_box.html('');
1896
+ preview_display.hide();
1897
+ });
1898
+ var preview_box = $('#sp_tpro-preview-box');
1899
+ var preview_display = $('#sp_tpro_live_preview').hide();
1900
+ var action = 'sp_tpro_preview_meta_box';
1901
+ var nonce = $('#spftestimonial_metabox_noncesp_tpro_shortcode_options').val();
1902
+ $(document).on('click', '#sp-testimonial-show-preview:not(:contains(Hide))', function (e) {
1903
+ e.preventDefault();
1904
+ var previewJS = window.spftestimonial_vars.previewJS;
1905
+ var _data = $('form#post').serialize();
1906
+ var _this = $(this);
1907
+ var data = {
1908
+ action: action,
1909
+ data: _data,
1910
+ ajax_nonce: nonce
1911
+ };
1912
+ $.ajax({
1913
+ type: "POST",
1914
+ url: ajaxurl,
1915
+ data: data,
1916
+ error: function (response) {
1917
+ console.log(response)
1918
+ },
1919
+ success: function (response) {
1920
+
1921
+ preview_display.show();
1922
+ preview_box.html(response);
1923
+ $.getScript(previewJS, function () {
1924
+ _this.html('<i class="fa fa-eye-slash" aria-hidden="true"></i> Hide Preview');
1925
+ $(document).on('keyup change', function (e) {
1926
+ e.preventDefault();
1927
+ _this.html('<i class="fa fa-refresh" aria-hidden="true"></i> Update Preview');
1928
+ });
1929
+ $("html, body").animate({ scrollTop: preview_display.offset().top - 50 }, "slow");
1930
+ });
1931
+ $('.sp-testimonial-preloader').animate({ opacity: 1 }, 600).hide();
1932
+ }
1933
+ })
1934
+ });
1935
+
1936
+ /* Copy to clipboard */
1937
+ $('.sp-testimonial-copy-btn,.tpro-sc-code,.spftestimonial-shortcode-selectable').on('click', function (e) {
1938
+ e.preventDefault();
1939
+ spftestimonial_copyToClipboard($(this));
1940
+ spftestimonial_SelectText($(this));
1941
+ $(this).focus().select();
1942
+ $('.sp-testimonial-after-copy-text').animate({
1943
+ opacity: 1,
1944
+ bottom: 25
1945
+ }, 300);
1946
+ setTimeout(function () {
1947
+ jQuery(".sp-testimonial-after-copy-text").animate({
1948
+ opacity: 0,
1949
+ }, 200);
1950
+ jQuery(".sp-testimonial-after-copy-text").animate({
1951
+ bottom: 0
1952
+ }, 0);
1953
+ }, 2000);
1954
+ });
1955
+ $('.stpro_input').on('click', function (e) {
1956
+ e.preventDefault();
1957
+ /* Get the text field */
1958
+ var copyText = $(this);
1959
+ /* Select the text field */
1960
+ copyText.select();
1961
+ document.execCommand("copy");
1962
+ $('.sp-testimonial-after-copy-text').animate({
1963
+ opacity: 1,
1964
+ bottom: 25
1965
+ }, 300);
1966
+ setTimeout(function () {
1967
+ jQuery(".sp-testimonial-after-copy-text").animate({
1968
+ opacity: 0,
1969
+ }, 200);
1970
+ jQuery(".sp-testimonial-after-copy-text").animate({
1971
+ bottom: 0
1972
+ }, 0);
1973
+ }, 2000);
1974
+ });
1975
+ function spftestimonial_copyToClipboard(element) {
1976
+ var $temp = $("<input>");
1977
+ $("body").append($temp);
1978
+ $temp.val($(element).text()).select();
1979
+ document.execCommand("copy");
1980
+ $temp.remove();
1981
+ }
1982
+ function spftestimonial_SelectText(element) {
1983
+ var r = document.createRange();
1984
+ var w = element.get(0);
1985
+ r.selectNodeContents(w);
1986
+ var sel = window.getSelection();
1987
+ sel.removeAllRanges();
1988
+ sel.addRange(r);
1989
+ }
1990
+ // Testimonial pro export.
1991
+ var $export_type = $('.spt_what_export').find('input:checked').val();
1992
+ $('.spt_what_export').on('change', function () {
1993
+ $export_type = $(this).find('input:checked').val();
1994
+ });
1995
+ // Check is valid JSON string
1996
+ function isValidJSONString(str) {
1997
+ try {
1998
+ JSON.parse(str);
1999
+ } catch (e) {
2000
+ return false;
2001
+ }
2002
+ return true;
2003
+ }
2004
+ $('.spt_export .spftestimonial--button').on('click', function (event) {
2005
+ event.preventDefault();
2006
+ var $shortcode_ids = $('.spt_post_id select').val();
2007
+ var $forms_ids = $('.spt_post_forms_id select').val();
2008
+ var $ex_nonce = $('#spftestimonial_options_noncesp_testimonial_pro_tools').val();
2009
+ if ($export_type === 'all_testimonial') {
2010
+ var data = {
2011
+ action: 'spt_export_shortcodes',
2012
+ lcp_ids: 'all_testimonial',
2013
+ nonce: $ex_nonce,
2014
+ }
2015
+ } else if ('all_spt_shortcodes' === $export_type) {
2016
+ var data = {
2017
+ action: 'spt_export_shortcodes',
2018
+ lcp_ids: 'all_spt_shortcodes',
2019
+ nonce: $ex_nonce,
2020
+ }
2021
+ } else if ('all_spt_form' === $export_type) {
2022
+ var data = {
2023
+ action: 'spt_export_shortcodes',
2024
+ lcp_ids: 'all_spt_form',
2025
+ nonce: $ex_nonce,
2026
+ }
2027
+ } else if ('selected_spt_shortcodes' === $export_type) {
2028
+ var data = {
2029
+ action: 'spt_export_shortcodes',
2030
+ lcp_ids: $shortcode_ids,
2031
+ text_ids: 'select_shortcodes',
2032
+ nonce: $ex_nonce,
2033
+ }
2034
+ } else if ('selected_spt_form' === $export_type) {
2035
+ var data = {
2036
+ action: 'spt_export_shortcodes',
2037
+ lcp_ids: $forms_ids,
2038
+ text_ids: 'select_forms',
2039
+ nonce: $ex_nonce,
2040
+ }
2041
+ } else {
2042
+ $('.spftestimonial-form-result.spftestimonial-form-success').text('No group selected.').show();
2043
+ setTimeout(function () {
2044
+ $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2045
+ }, 3000);
2046
+ }
2047
+ $.post(ajaxurl, data, function (resp) {
2048
+ if (resp) {
2049
+ // Convert JSON Array to string.
2050
+ if (isValidJSONString(resp)) {
2051
+ var json = JSON.stringify(JSON.parse(resp));
2052
+ } else {
2053
+ var json = JSON.stringify(resp);
2054
+ }
2055
+ // var json = JSON.stringify(resp);
2056
+ // Convert JSON string to BLOB.
2057
+ json = [json];
2058
+ var blob = new Blob(json);
2059
+ var link = document.createElement('a');
2060
+ var lcp_time = $.now();
2061
+ link.href = window.URL.createObjectURL(blob);
2062
+ link.download = "testtimonial-pro-export-" + lcp_time + ".json";
2063
+ link.click();
2064
+ $('.spftestimonial-form-result.spftestimonial-form-success').text('Exported successfully!').show();
2065
+ setTimeout(function () {
2066
+ $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2067
+ $('.spt_post_id select').val('').trigger('chosen:updated');
2068
+ $('.spt_post_forms_id select').val('').trigger('chosen:updated');
2069
+ }, 3000);
2070
+ }
2071
+ });
2072
+ });
2073
+ // Testimonial free import.
2074
+ $('.spt_import button.import').on('click', function (event) {
2075
+ event.preventDefault();
2076
+ var lcp_shortcodes = $('#import').prop('files')[0];
2077
+ if ($('#import').val() != '') {
2078
+ var $im_nonce = $('#spftestimonial_options_noncesp_testimonial_pro_tools').val();
2079
+ var reader = new FileReader();
2080
+ reader.readAsText(lcp_shortcodes);
2081
+ reader.onload = function (event) {
2082
+ var jsonObj = JSON.stringify(event.target.result);
2083
+ $.ajax({
2084
+ url: ajaxurl,
2085
+ type: 'POST',
2086
+ data: {
2087
+ shortcode: jsonObj,
2088
+ action: 'spt_import_shortcodes',
2089
+ nonce: $im_nonce,
2090
+ },
2091
+ success: function (resp) {
2092
+ $('.spftestimonial-form-result.spftestimonial-form-success').text('Imported successfully!').show();
2093
+ setTimeout(function () {
2094
+ $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2095
+ $('#import').val('');
2096
+ if (resp.data === 'spt_testimonial') {
2097
+ window.location.replace($('#spt_testimonial_link_redirect').attr('href'));
2098
+ } else if (resp.data === 'spt_testimonial_form') {
2099
+ window.location.replace($('#spt_forms_link_redirect').attr('href'));
2100
+ } else {
2101
+ window.location.replace($('#spt_shortcode_link_redirect').attr('href'));
2102
+ }
2103
+ }, 2000);
2104
+ }
2105
+ });
2106
+ }
2107
+ } else {
2108
+ $('.spftestimonial-form-result.spftestimonial-form-success').text('No exported json file chosen.').show();
2109
+ setTimeout(function () {
2110
+ $('.spftestimonial-form-result.spftestimonial-form-success').hide().text('');
2111
+ }, 3000);
2112
+ }
2113
+ });
2114
+ // Disabled save button.
2115
+ $(document).on('keyup change', '.spftestimonial-options #spftestimonial-form', function (e) {
2116
+ e.preventDefault();
2117
+ $(this).find('.spftestimonial-save.spftestimonial-save-ajax').attr('value', 'Save Settings').attr('disabled', false);
2118
+ });
2119
+ $("select option:contains((Pro))").attr('disabled', true).css('opacity', '0.8');
2120
+ $("label:contains((Pro))").css({ 'pointer-events': 'none' }).css('opacity', '0.8');
2121
  })(jQuery, window, document);
src/Admin/Views/Framework/assets/js/spftestimonial.min.js CHANGED
@@ -1 +1 @@
1
- !function($,window,document,undefined){"use strict";var SPFTESTIMONIAL=SPFTESTIMONIAL||{};SPFTESTIMONIAL.funcs={},SPFTESTIMONIAL.vars={onloaded:!1,$body:$("body"),$window:$(window),$document:$(document),$form_warning:null,is_confirm:!1,form_modified:!1,code_themes:[],is_rtl:$("body").hasClass("rtl")},SPFTESTIMONIAL.helper={uid:function(prefix){return(prefix||"")+Math.random().toString(36).substr(2,9)},preg_quote:function(str){return(str+"").replace(/(\[|\])/g,"\\$1")},name_nested_replace:function($selector,field_id){var checks=[],regex=new RegExp(SPFTESTIMONIAL.helper.preg_quote(field_id+"[\\d+]"),"g");$selector.find(":radio").each((function(){(this.checked||this.orginal_checked)&&(this.orginal_checked=!0)})),$selector.each((function(index){$(this).find(":input").each((function(){this.name=this.name.replace(regex,field_id+"["+index+"]"),this.orginal_checked&&(this.checked=!0)}))}))},debounce:function(callback,threshold,immediate){var timeout;return function(){var context=this,args=arguments,later=function(){timeout=null,immediate||callback.apply(context,args)},callNow=immediate&&!timeout;clearTimeout(timeout),timeout=setTimeout(later,threshold),callNow&&callback.apply(context,args)}},get_cookie:function(name){var e,b,cookie=document.cookie,p=name+"=";if(cookie){if(-1===(b=cookie.indexOf("; "+p))){if(0!==(b=cookie.indexOf(p)))return null}else b+=2;return-1===(e=cookie.indexOf(";",b))&&(e=cookie.length),decodeURIComponent(cookie.substring(b+p.length,e))}},set_cookie:function(name,value,expires,path,domain,secure){var d=new Date;"object"==typeof expires&&expires.toGMTString?expires=expires.toGMTString():parseInt(expires,10)?(d.setTime(d.getTime()+1e3*parseInt(expires,10)),expires=d.toGMTString()):expires="",document.cookie=name+"="+encodeURIComponent(value)+(expires?"; expires="+expires:"")+(path?"; path="+path:"")+(domain?"; domain="+domain:"")+(secure?"; secure":"")},remove_cookie:function(name,path,domain,secure){SPFTESTIMONIAL.helper.set_cookie(name,"",-1e3,path,domain,secure)}},$.fn.spftestimonial_clone=function(){for(var base=$.fn.clone.apply(this,arguments),clone=this.find("select").add(this.filter("select")),cloned=base.find("select").add(base.filter("select")),i=0;i<clone.length;++i)for(var j=0;j<clone[i].options.length;++j)!0===clone[i].options[j].selected&&(cloned[i].options[j].selected=!0);return this.find(":radio").each((function(){this.orginal_checked=this.checked})),base},$.fn.spftestimonial_expand_all=function(){return this.each((function(){$(this).on("click",(function(e){e.preventDefault(),$(".spftestimonial-wrapper").toggleClass("spftestimonial-show-all"),$(".spftestimonial-section").spftestimonial_reload_script(),$(this).find(".fa").toggleClass("fa-indent").toggleClass("fa-outdent")}))}))},$.fn.spftestimonial_nav_options=function(){return this.each((function(){var $nav=$(this),$window=$(window),$wpwrap=$("#wpwrap"),$links=$nav.find("a"),$last;$window.on("hashchange spftestimonial.hashchange",(function(){var hash=window.location.hash.replace("#tab=",""),slug=hash||$links.first().attr("href").replace("#tab=",""),$link=$('[data-tab-id="'+slug+'"]');if($link.length){$link.closest(".spftestimonial-tab-item").addClass("spftestimonial-tab-expanded").siblings().removeClass("spftestimonial-tab-expanded"),$link.next().is("ul")&&(slug=($link=$link.next().find("li").first().find("a")).data("tab-id")),$links.removeClass("spftestimonial-active"),$link.addClass("spftestimonial-active"),$last&&$last.addClass("hidden");var $section=$('[data-section-id="'+slug+'"]');$section.removeClass("hidden"),$section.spftestimonial_reload_script(),$(".spftestimonial-section-id").val($section.index()+1),$last=$section,$wpwrap.hasClass("wp-responsive-open")&&($("html, body").animate({scrollTop:$section.offset().top-50},200),$wpwrap.removeClass("wp-responsive-open"))}})).trigger("spftestimonial.hashchange")}))},$.fn.spftestimonial_nav_metabox=function(){return this.each((function(){var $nav=$(this),$links=$nav.find("a"),$sections=$nav.parent().find(".spftestimonial-section"),unique_id=$nav.data("unique"),post_id=$("#post_ID").val()||"global",$last;$links.each((function(index){$(this).on("click",(function(e){e.preventDefault();var $link=$(this),section_id=$link.data("section");$links.removeClass("spftestimonial-active"),$link.addClass("spftestimonial-active"),void 0!==$last&&$last.addClass("hidden");var $section=$sections.eq(index);$section.removeClass("hidden"),$section.spftestimonial_reload_script(),SPFTESTIMONIAL.helper.set_cookie("spftestimonial-last-metabox-tab-"+post_id+"-"+unique_id,section_id),$last=$section}))}));var get_cookie=SPFTESTIMONIAL.helper.get_cookie("spftestimonial-last-metabox-tab-"+post_id+"-"+unique_id);get_cookie?$nav.find('a[data-section="'+get_cookie+'"]').trigger("click"):$links.first("a").trigger("click")}))},$.fn.spftestimonial_search=function(){return this.each((function(){var $this,$input;$(this).find("input").on("change keyup",(function(){var value=$(this).val(),$wrapper=$(".spftestimonial-wrapper"),$section,$fields=$wrapper.find(".spftestimonial-section").find("> .spftestimonial-field:not(.spftestimonial-depend-on)"),$titles=$fields.find("> .spftestimonial-title, .spftestimonial-search-tags");value.length>3?($fields.addClass("spftestimonial-metabox-hide"),$wrapper.addClass("spftestimonial-search-all"),$titles.each((function(){var $title=$(this);if($title.text().match(new RegExp(".*?"+value+".*?","i"))){var $field=$title.closest(".spftestimonial-field");$field.removeClass("spftestimonial-metabox-hide"),$field.parent().spftestimonial_reload_script()}}))):($fields.removeClass("spftestimonial-metabox-hide"),$wrapper.removeClass("spftestimonial-search-all"))}))}))},$.fn.spftestimonial_sticky=function(){return this.each((function(){var $this=$(this),$window=$(window),$inner=$this.find(".spftestimonial-header-inner"),padding=parseInt($inner.css("padding-left"))+parseInt($inner.css("padding-right")),offset=32,scrollTop=0,lastTop=0,ticking=!1,stickyUpdate=function(){var offsetTop=$this.offset().top,stickyTop=Math.max(32,offsetTop-scrollTop),winWidth=$window.innerWidth();stickyTop<=32&&winWidth>782?($inner.css({width:$this.outerWidth()-padding}),$this.css({height:$this.outerHeight()}).addClass("spftestimonial-sticky")):($inner.removeAttr("style"),$this.removeAttr("style").removeClass("spftestimonial-sticky"))},requestTick=function(){ticking||requestAnimationFrame((function(){stickyUpdate(),ticking=!1})),ticking=!0},onSticky=function(){scrollTop=$window.scrollTop(),requestTick()};$window.on("scroll resize",onSticky),onSticky()}))},$.fn.spftestimonial_dependency=function(){return this.each((function(){var $this=$(this),$fields=$this.children("[data-controller]");if($fields.length){var normal_ruleset=$.spftestimonial_deps.createRuleset(),global_ruleset=$.spftestimonial_deps.createRuleset(),normal_depends=[],global_depends=[];$fields.each((function(){var $field=$(this),controllers=$field.data("controller").split("|"),conditions=$field.data("condition").split("|"),values=$field.data("value").toString().split("|"),is_global=!!$field.data("depend-global"),ruleset=is_global?global_ruleset:normal_ruleset;$.each(controllers,(function(index,depend_id){var value=values[index]||"",condition=conditions[index]||conditions[0];(ruleset=ruleset.createRule('[data-depend-id="'+depend_id+'"]',condition,value)).include($field),is_global?global_depends.push(depend_id):normal_depends.push(depend_id)}))})),normal_depends.length&&$.spftestimonial_deps.enable($this,normal_ruleset,normal_depends),global_depends.length&&$.spftestimonial_deps.enable(SPFTESTIMONIAL.vars.$body,global_ruleset,global_depends)}}))},$.fn.spftestimonial_field_accordion=function(){return this.each((function(){var $titles=$(this).find(".spftestimonial-accordion-title");$titles.on("click",(function(){var $title=$(this),$icon=$title.find(".spftestimonial-accordion-icon"),$content=$title.next();$icon.hasClass("fa-angle-right")?$icon.removeClass("fa-angle-right").addClass("fa-angle-down"):$icon.removeClass("fa-angle-down").addClass("fa-angle-right"),$content.data("opened")||($content.spftestimonial_reload_script(),$content.data("opened",!0)),$content.toggleClass("spftestimonial-accordion-open")})),$(this).hasClass("opened_accordion")&&$titles.trigger("click")}))},$.fn.spftestimonial_field_code_editor=function(){return this.each((function(){if("function"==typeof CodeMirror){var $this=$(this),$textarea=$this.find("textarea"),$inited=$this.find(".CodeMirror"),data_editor=$textarea.data("editor");$inited.length&&$inited.remove();var interval=setInterval((function(){if($this.is(":visible")){var code_editor=CodeMirror.fromTextArea($textarea[0],data_editor);if("default"!==data_editor.theme&&-1===SPFTESTIMONIAL.vars.code_themes.indexOf(data_editor.theme)){var $cssLink=$("<link>");$("#spftestimonial-codemirror-css").after($cssLink),$cssLink.attr({rel:"stylesheet",id:"spftestimonial-codemirror-"+data_editor.theme+"-css",href:data_editor.cdnURL+"/theme/"+data_editor.theme+".min.css",type:"text/css",media:"all"}),SPFTESTIMONIAL.vars.code_themes.push(data_editor.theme)}CodeMirror.modeURL=data_editor.cdnURL+"/mode/%N/%N.min.js",CodeMirror.autoLoadMode(code_editor,data_editor.mode),code_editor.on("change",(function(editor,event){$textarea.val(code_editor.getValue()).trigger("change")})),clearInterval(interval)}}))}}))},$.fn.spftestimonial_field_fieldset=function(){return this.each((function(){$(this).find(".spftestimonial-fieldset-content").spftestimonial_reload_script()}))},$.fn.spftestimonial_field_repeater=function(){return this.each((function(){var $this=$(this),$fieldset=$this.children(".spftestimonial-fieldset"),$repeater=$fieldset.length?$fieldset:$this,$wrapper=$repeater.children(".spftestimonial-repeater-wrapper"),$hidden=$repeater.children(".spftestimonial-repeater-hidden"),$max=$repeater.children(".spftestimonial-repeater-max"),$min=$repeater.children(".spftestimonial-repeater-min"),field_id=$wrapper.data("field-id"),max=parseInt($wrapper.data("max")),min=parseInt($wrapper.data("min"));$wrapper.children(".spftestimonial-repeater-item").children(".spftestimonial-repeater-content").spftestimonial_reload_script(),$wrapper.sortable({axis:"y",handle:".spftestimonial-repeater-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(event,ui){SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children(".spftestimonial-repeater-item"),field_id)}}),$repeater.children(".spftestimonial-repeater-add").on("click",(function(e){e.preventDefault();var count=$wrapper.children(".spftestimonial-repeater-item").length;if($min.hide(),max&&count+1>max)$max.show();else{var $cloned_item=$hidden.spftestimonial_clone(!0);$cloned_item.removeClass("spftestimonial-repeater-hidden"),$cloned_item.find(':input[name!="_pseudo"]').each((function(){this.name=this.name.replace("___","").replace(field_id+"[0]",field_id+"["+count+"]")})),$wrapper.append($cloned_item),$cloned_item.children(".spftestimonial-repeater-content").spftestimonial_reload_script()}}));var event_clone=function(e){e.preventDefault();var count=$wrapper.children(".spftestimonial-repeater-item").length;if($min.hide(),max&&count+1>max)$max.show();else{var $this,$parent=$(this).parent().parent().parent(),$cloned_content=$parent.children(".spftestimonial-repeater-content").spftestimonial_clone(),$cloned_helper=$parent.children(".spftestimonial-repeater-helper").spftestimonial_clone(!0),$cloned_item=$('<div class="spftestimonial-repeater-item" />');$cloned_item.append($cloned_content),$cloned_item.append($cloned_helper),$wrapper.children().eq($parent.index()).after($cloned_item),$cloned_item.children(".spftestimonial-repeater-content").spftestimonial_reload_script(),SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children(".spftestimonial-repeater-item"),field_id)}};$wrapper.children(".spftestimonial-repeater-item").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-clone",event_clone),$repeater.children(".spftestimonial-repeater-hidden").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-clone",event_clone);var event_remove=function(e){e.preventDefault();var count=$wrapper.children(".spftestimonial-repeater-item").length;$max.hide(),$min.hide(),min&&count-1<min?$min.show():($(this).closest(".spftestimonial-repeater-item").remove(),SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children(".spftestimonial-repeater-item"),field_id))};$wrapper.children(".spftestimonial-repeater-item").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-remove",event_remove),$repeater.children(".spftestimonial-repeater-hidden").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-remove",event_remove)}))},$.fn.spftestimonial_field_sortable=function(){return this.each((function(){var $sortable=$(this).find(".spftestimonial-sortable");$sortable.sortable({axis:"y",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(event,ui){}}),$sortable.find(".spftestimonial-sortable-content").spftestimonial_reload_script(),$(".form_fields").find(".spftestimonial-sortable").sortable("disable")}))},$.fn.spftestimonial_field_sorter=function(){return this.each((function(){var $this=$(this),$enabled=$this.find(".spftestimonial-enabled"),$has_disabled=$this.find(".spftestimonial-disabled"),$disabled=!!$has_disabled.length&&$has_disabled;$enabled.sortable({connectWith:$disabled,placeholder:"ui-sortable-placeholder",update:function(event,ui){var $el=ui.item.find("input");ui.item.parent().hasClass("spftestimonial-enabled")?$el.attr("name",$el.attr("name").replace("disabled","enabled")):$el.attr("name",$el.attr("name").replace("enabled","disabled"))}}),$disabled&&$disabled.sortable({connectWith:$enabled,placeholder:"ui-sortable-placeholder",update:function(event,ui){}})}))},$.fn.spftestimonial_field_spinner=function(){return this.each((function(){var $this=$(this),$input=$this.find("input"),$inited=$this.find(".ui-button"),data=$input.data();$inited.length&&$inited.remove(),$input.spinner({min:data.min||0,max:data.max||100,step:data.step||1,create:function(event,ui){data.unit&&$input.after('<span class="ui-button spftestimonial--unit">'+data.unit+"</span>")},spin:function(event,ui){$input.val(ui.value).trigger("change")}})}))},$.fn.spftestimonial_field_switcher=function(){return this.each((function(){var $switcher=$(this).find(".spftestimonial--switcher");$switcher.on("click",(function(){var value=0,$input=$switcher.find("input");$switcher.hasClass("spftestimonial--active")?$switcher.removeClass("spftestimonial--active"):(value=1,$switcher.addClass("spftestimonial--active")),$input.val(value).trigger("change")}))}))},$.fn.spftestimonial_field_typography=function(){return this.each((function(){var base=this,$this=$(this),loaded_fonts=[],webfonts=spftestimonial_typography_json.webfonts,googlestyles=spftestimonial_typography_json.googlestyles,defaultstyles=spftestimonial_typography_json.defaultstyles;base.sanitize_subset=function(subset){return subset=(subset=subset.replace("-ext"," Extended")).charAt(0).toUpperCase()+subset.slice(1)},base.sanitize_style=function(style){return googlestyles[style]?googlestyles[style]:style},base.load_google_font=function(font_family,weight,style){font_family&&"object"==typeof WebFont&&(weight=weight?weight.replace("normal",""):"",style=style?style.replace("normal",""):"",(weight||style)&&(font_family=font_family+":"+weight+style),-1===loaded_fonts.indexOf(font_family)&&WebFont.load({google:{families:[font_family]}}),loaded_fonts.push(font_family))},base.append_select_options=function($select,options,condition,type,is_multi){$select.find("option").not(":first").remove();var opts="";$.each(options,(function(key,value){var selected,name=value;selected=is_multi?condition&&-1!==condition.indexOf(value)?" selected":"":condition&&condition===value?" selected":"","subset"===type?name=base.sanitize_subset(value):"style"===type&&(name=base.sanitize_style(value)),opts+='<option value="'+value+'"'+selected+">"+name+"</option>"})),$select.append(opts).trigger("spftestimonial.change").trigger("chosen:updated")},base.init=function(){var selected_styles=[],$typography=$this.find(".spftestimonial--typography"),$type=$this.find(".spftestimonial--type"),$styles=$this.find(".spftestimonial--block-font-style"),unit=$typography.data("unit"),line_height_unit=$typography.data("line-height-unit"),exclude_fonts=$typography.data("exclude")?$typography.data("exclude").split(","):[],$chosen_selects;$this.find(".spftestimonial--chosen").length&&$this.find("select").each((function(){var $chosen_select=$(this),$chosen_inited=$chosen_select.parent().find(".chosen-container");$chosen_inited.length&&$chosen_inited.remove(),$chosen_select.chosen({allow_single_deselect:!0,disable_search_threshold:15,width:"100%"})}));var $font_family_select=$this.find(".spftestimonial--font-family"),first_font_family=$font_family_select.val();$font_family_select.find("option").not(":first-child").remove();var opts="";$.each(webfonts,(function(type,group){exclude_fonts&&-1!==exclude_fonts.indexOf(type)||(opts+='<optgroup label="'+group.label+'">',$.each(group.fonts,(function(key,value){var selected;opts+='<option value="'+(value="object"==typeof value?key:value)+'" data-type="'+type+'"'+(value===first_font_family?" selected":"")+">"+value+"</option>"})),opts+="</optgroup>")})),$font_family_select.append(opts).trigger("chosen:updated");var $font_style_block=$this.find(".spftestimonial--block-font-style");if($font_style_block.length){var $font_style_select=$this.find(".spftestimonial--font-style-select"),first_style_value=$font_style_select.val()?$font_style_select.val().replace(/normal/g,""):"";$font_style_select.on("change spftestimonial.change",(function(event){var style_value=$font_style_select.val();!style_value&&selected_styles&&-1===selected_styles.indexOf("normal")&&(style_value=selected_styles[0]);var font_normal=style_value&&"italic"!==style_value&&"normal"===style_value?"normal":"",font_weight=style_value&&"italic"!==style_value&&"normal"!==style_value?style_value.replace("italic",""):font_normal,font_style=style_value&&"italic"===style_value.substr(-6)?"italic":"";$this.find(".spftestimonial--font-weight").val(font_weight),$this.find(".spftestimonial--font-style").val(font_style)}));var $extra_font_style_block=$this.find(".spftestimonial--block-extra-styles");if($extra_font_style_block.length)var $extra_font_style_select=$this.find(".spftestimonial--extra-styles"),first_extra_style_value=$extra_font_style_select.val()}var $subset_block=$this.find(".spftestimonial--block-subset");if($subset_block.length)var $subset_select=$this.find(".spftestimonial--subset"),first_subset_select_value=$subset_select.val(),subset_multi_select=$subset_select.data("multiple")||!1;var $backup_font_family_block=$this.find(".spftestimonial--block-backup-font-family");$font_family_select.on("change spftestimonial.change",(function(event){$subset_block.length&&$subset_block.addClass("hidden"),$extra_font_style_block.length&&$extra_font_style_block.addClass("hidden"),$backup_font_family_block.length&&$backup_font_family_block.addClass("hidden");var $selected=$font_family_select.find(":selected"),value=$selected.val(),type=$selected.data("type");if(type&&value){if("google"!==type&&"custom"!==type||!$backup_font_family_block.length||$backup_font_family_block.removeClass("hidden"),$font_style_block.length){var styles=defaultstyles;"google"===type&&webfonts[type].fonts[value][0]?styles=webfonts[type].fonts[value][0]:"custom"===type&&webfonts[type].fonts[value]&&(styles=webfonts[type].fonts[value]),selected_styles=styles;var set_auto_style=-1!==styles.indexOf("normal")?"normal":styles[0],set_style_value=first_style_value&&-1!==styles.indexOf(first_style_value)?first_style_value:set_auto_style;base.append_select_options($font_style_select,styles,set_style_value,"style"),first_style_value=!1,$font_style_block.removeClass("hidden"),"google"===type&&$extra_font_style_block.length&&styles.length>1&&(base.append_select_options($extra_font_style_select,styles,first_extra_style_value,"style",!0),first_extra_style_value=!1,$extra_font_style_block.removeClass("hidden"))}if("google"===type&&$subset_block.length&&webfonts[type].fonts[value][1]){var subsets=webfonts[type].fonts[value][1],set_auto_subset=subsets.length<2&&"latin"!==subsets[0]?subsets[0]:"",set_subset_value=first_subset_select_value&&-1!==subsets.indexOf(first_subset_select_value)?first_subset_select_value:set_auto_subset;set_subset_value=subset_multi_select&&first_subset_select_value?first_subset_select_value:set_subset_value,base.append_select_options($subset_select,subsets,set_subset_value,"subset",subset_multi_select),first_subset_select_value=!1,$subset_block.removeClass("hidden")}}else $styles.find(":input").val(""),$subset_block.length&&($subset_select.find("option").not(":first-child").remove(),$subset_select.trigger("chosen:updated")),$font_style_block.length&&($font_style_select.find("option").not(":first-child").remove(),$font_style_select.trigger("chosen:updated"));$type.val(type)})).trigger("spftestimonial.change");var $preview_block=$this.find(".spftestimonial--block-preview");if($preview_block.length){var $preview=$this.find(".spftestimonial--preview");$this.on("change",SPFTESTIMONIAL.helper.debounce((function(event){$preview_block.removeClass("hidden");var font_family=$font_family_select.val(),font_weight=$this.find(".spftestimonial--font-weight").val(),font_style=$this.find(".spftestimonial--font-style").val(),font_size=$this.find(".spftestimonial--font-size").val(),font_variant=$this.find(".spftestimonial--font-variant").val(),line_height=$this.find(".spftestimonial--line-height").val(),text_align=$this.find(".spftestimonial--text-align").val(),text_transform=$this.find(".spftestimonial--text-transform").val(),text_decoration=$this.find(".spftestimonial--text-decoration").val(),text_color=$this.find(".spftestimonial--color").val(),word_spacing=$this.find(".spftestimonial--word-spacing").val(),letter_spacing=$this.find(".spftestimonial--letter-spacing").val(),custom_style=$this.find(".spftestimonial--custom-style").val(),type;"google"===$this.find(".spftestimonial--type").val()&&base.load_google_font(font_family,font_weight,font_style);var properties={};font_family&&(properties.fontFamily=font_family),font_weight&&(properties.fontWeight=font_weight),font_style&&(properties.fontStyle=font_style),font_variant&&(properties.fontVariant=font_variant),font_size&&(properties.fontSize=font_size+unit),line_height&&(properties.lineHeight=line_height+line_height_unit),letter_spacing&&(properties.letterSpacing=letter_spacing+unit),word_spacing&&(properties.wordSpacing=word_spacing+unit),text_align&&(properties.textAlign=text_align),text_transform&&(properties.textTransform=text_transform),text_decoration&&(properties.textDecoration=text_decoration),text_color&&(properties.color=text_color),$preview.removeAttr("style"),custom_style&&$preview.attr("style",custom_style),$preview.css(properties)}),100)),$preview_block.on("click",(function(){$preview.toggleClass("spftestimonial--black-background");var $toggle=$preview_block.find(".spftestimonial--toggle");$toggle.hasClass("fa-toggle-off")?$toggle.removeClass("fa-toggle-off").addClass("fa-toggle-on"):$toggle.removeClass("fa-toggle-on").addClass("fa-toggle-off")})),$preview_block.hasClass("hidden")||$this.trigger("change")}},base.init()}))},$.fn.spftestimonial_confirm=function(){return this.each((function(){$(this).on("click",(function(e){var confirm_text=$(this).data("confirm")||window.spftestimonial_vars.i18n.confirm,confirm_answer;if(!confirm(confirm_text))return e.preventDefault(),!1;SPFTESTIMONIAL.vars.is_confirm=!0,SPFTESTIMONIAL.vars.form_modified=!1}))}))},$.fn.serializeObject=function(){var obj={};return $.each(this.serializeArray(),(function(i,o){var n=o.name,v=o.value;obj[n]=void 0===obj[n]?v:$.isArray(obj[n])?obj[n].concat(v):[obj[n],v]})),obj},$.fn.spftestimonial_save=function(){return this.each((function(){var $this=$(this),$buttons=$(".spftestimonial-save"),$panel=$(".spftestimonial-options"),flooding=!1,timeout;$this.on("click",(function(e){if(!flooding){var $text=$this.data("save"),$value=$this.val();$buttons.attr("value",$text),$this.hasClass("spftestimonial-save-ajax")?(e.preventDefault(),$panel.addClass("spftestimonial-saving"),$buttons.prop("disabled",!0),window.wp.ajax.post("spftestimonial_"+$panel.data("unique")+"_ajax_save",{data:$("#spftestimonial-form").serializeJSONSPFTESTIMONIAL()}).done((function(response){if($(".spftestimonial-error").remove(),Object.keys(response.errors).length){var error_icon='<i class="spftestimonial-label-error spftestimonial-error">!</i>';$.each(response.errors,(function(key,error_message){var $field=$('[data-depend-id="'+key+'"]'),$link=$('a[href="#tab='+$field.closest(".spftestimonial-section").data("section-id")+'"]'),$tab=$link.closest(".spftestimonial-tab-item");$field.closest(".spftestimonial-fieldset").append('<p class="spftestimonial-error spftestimonial-error-text">'+error_message+"</p>"),$link.find(".spftestimonial-error").length||$link.append(error_icon),$tab.find(".spftestimonial-arrow .spftestimonial-error").length||$tab.find(".spftestimonial-arrow").append(error_icon)}))}$panel.removeClass("spftestimonial-saving"),$buttons.prop("disabled",!0).attr("value","Changes Saved"),flooding=!1,SPFTESTIMONIAL.vars.form_modified=!1,SPFTESTIMONIAL.vars.$form_warning.hide(),clearTimeout(timeout);var $result_success=$(".spftestimonial-form-success");$result_success.empty().append(response.notice).fadeIn("fast",(function(){timeout=setTimeout((function(){$result_success.fadeOut("fast")}),1e3)}))})).fail((function(response){alert(response.error)}))):SPFTESTIMONIAL.vars.form_modified=!1}flooding=!0}))}))},$.fn.spftestimonial_options=function(){return this.each((function(){var $this=$(this),$content=$this.find(".spftestimonial-content"),$form_success=$this.find(".spftestimonial-form-success"),$form_warning=$this.find(".spftestimonial-form-warning"),$save_button=$this.find(".spftestimonial-header .spftestimonial-save");SPFTESTIMONIAL.vars.$form_warning=$form_warning,$form_warning.length&&(window.onbeforeunload=function(){return!!SPFTESTIMONIAL.vars.form_modified||void 0},$content.on("change keypress",":input",(function(){SPFTESTIMONIAL.vars.form_modified||($form_success.hide(),$form_warning.fadeIn("fast"),SPFTESTIMONIAL.vars.form_modified=!0)}))),$form_success.hasClass("spftestimonial-form-show")&&setTimeout((function(){$form_success.fadeOut("fast")}),1e3),$(document).keydown((function(event){if((event.ctrlKey||event.metaKey)&&83===event.which)return $save_button.trigger("click"),event.preventDefault(),!1}))}))},"function"==typeof Color&&(Color.prototype.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var hex=parseInt(this._color,10).toString(16);if(this.error)return"";if(hex.length<6)for(var i=6-hex.length-1;i>=0;i--)hex="0"+hex;return"#"+hex}),SPFTESTIMONIAL.funcs.parse_color=function(color){var value=color.replace(/\s+/g,""),trans=-1!==value.indexOf("rgba")?parseFloat(100*value.replace(/^.*,(.+)\)/,"$1")):100,rgba;return{value:value,transparent:trans,rgba:trans<100}},$.fn.spftestimonial_color=function(){return this.each((function(){var $input=$(this),picker_color=SPFTESTIMONIAL.funcs.parse_color($input.val()),palette_color=!window.spftestimonial_vars.color_palette.length||window.spftestimonial_vars.color_palette,$container;$input.hasClass("wp-color-picker")&&$input.closest(".wp-picker-container").after($input).remove(),$input.wpColorPicker({palettes:palette_color,change:function(event,ui){var ui_color_value=ui.color.toString();$container.removeClass("spftestimonial--transparent-active"),$container.find(".spftestimonial--transparent-offset").css("background-color",ui_color_value),$input.val(ui_color_value).trigger("change")},create:function(){$container=$input.closest(".wp-picker-container");var a8cIris=$input.data("a8cIris"),$transparent_wrap=$('<div class="spftestimonial--transparent-wrap"><div class="spftestimonial--transparent-slider"></div><div class="spftestimonial--transparent-offset"></div><div class="spftestimonial--transparent-text"></div><div class="spftestimonial--transparent-button">transparent <i class="fa fa-toggle-off"></i></div></div>').appendTo($container.find(".wp-picker-holder")),$transparent_slider=$transparent_wrap.find(".spftestimonial--transparent-slider"),$transparent_text=$transparent_wrap.find(".spftestimonial--transparent-text"),$transparent_offset=$transparent_wrap.find(".spftestimonial--transparent-offset"),$transparent_button=$transparent_wrap.find(".spftestimonial--transparent-button");"transparent"===$input.val()&&$container.addClass("spftestimonial--transparent-active"),$transparent_button.on("click",(function(){"transparent"!==$input.val()?($input.val("transparent").trigger("change").removeClass("iris-error"),$container.addClass("spftestimonial--transparent-active")):($input.val(a8cIris._color.toString()).trigger("change"),$container.removeClass("spftestimonial--transparent-active"))})),$transparent_slider.slider({value:picker_color.transparent,step:1,min:0,max:100,slide:function(event,ui){var slide_value=parseFloat(ui.value/100);a8cIris._color._alpha=slide_value,$input.wpColorPicker("color",a8cIris._color.toString()),$transparent_text.text(1===slide_value||0===slide_value?"":slide_value)},create:function(){var slide_value=parseFloat(picker_color.transparent/100),text_value=slide_value<1?slide_value:"";$transparent_text.text(text_value),$transparent_offset.css("background-color",picker_color.value),$container.on("click",".wp-picker-clear",(function(){a8cIris._color._alpha=1,$transparent_text.text(""),$transparent_slider.slider("option","value",100),$container.removeClass("spftestimonial--transparent-active"),$input.trigger("change")})),$container.on("click",".wp-picker-default",(function(){var default_color=SPFTESTIMONIAL.funcs.parse_color($input.data("default-color")),default_value=parseFloat(default_color.transparent/100),default_text=default_value<1?default_value:"";a8cIris._color._alpha=default_value,$transparent_text.text(default_text),$transparent_slider.slider("option","value",default_color.transparent),"transparent"===default_color.value&&($input.removeClass("iris-error"),$container.addClass("spftestimonial--transparent-active"))}))}})}})}))},$.fn.spftestimonial_chosen=function(){return this.each((function(){var $this=$(this),$inited=$this.parent().find(".chosen-container"),is_sortable=$this.hasClass("spftestimonial-chosen-sortable")||!1,is_ajax=$this.hasClass("spftestimonial-chosen-ajax")||!1,is_multiple=$this.attr("multiple")||!1,set_width=is_multiple?"100%":"auto",set_options=$.extend({allow_single_deselect:!0,disable_search_threshold:10,width:set_width,no_results_text:window.spftestimonial_vars.i18n.no_results_text},$this.data("chosen-settings"));if($inited.length&&$inited.remove(),is_ajax){var set_ajax_options=$.extend({data:{type:"post",nonce:""},allow_single_deselect:!0,disable_search_threshold:-1,width:"100%",min_length:3,type_delay:500,typing_text:window.spftestimonial_vars.i18n.typing_text,searching_text:window.spftestimonial_vars.i18n.searching_text,no_results_text:window.spftestimonial_vars.i18n.no_results_text},$this.data("chosen-settings"));$this.SPFTESTIMONIALAjaxChosen(set_ajax_options)}else $this.chosen(set_options);if(is_multiple){var $hidden_select=$this.parent().find(".spftestimonial-hide-select"),$hidden_value=$hidden_select.val()||[];$this.on("change",(function(obj,result){result&&result.selected?$hidden_select.append('<option value="'+result.selected+'" selected="selected">'+result.selected+"</option>"):result&&result.deselected&&$hidden_select.find('option[value="'+result.deselected+'"]').remove(),void 0!==window.wp.customize&&0===$hidden_select.children().length&&$hidden_select.data("customize-setting-link")&&window.wp.customize.control($hidden_select.data("customize-setting-link")).setting.set(""),$hidden_select.trigger("change")})),$this.SPFTESTIMONIALChosenOrder($hidden_value,!0)}if(is_sortable){var $chosen_container,$chosen_choices=$this.parent().find(".chosen-container").find(".chosen-choices");$chosen_choices.bind("mousedown",(function(event){$(event.target).is("span")&&event.stopPropagation()})),$chosen_choices.sortable({items:"li:not(.search-field)",helper:"orginal",cursor:"move",placeholder:"search-choice-placeholder",start:function(e,ui){ui.placeholder.width(ui.item.innerWidth()),ui.placeholder.height(ui.item.innerHeight())},update:function(e,ui){var select_options="",chosen_object=$this.data("chosen"),$prev_select=$this.parent().find(".spftestimonial-hide-select");$chosen_choices.find(".search-choice-close").each((function(){var option_array_index=$(this).data("option-array-index");$.each(chosen_object.results_data,(function(index,data){data.array_index===option_array_index&&(select_options+='<option value="'+data.value+'" selected>'+data.value+"</option>")}))})),$prev_select.children().remove(),$prev_select.append(select_options),$prev_select.trigger("change")}})}}))},$.fn.spftestimonial_checkbox=function(){return this.each((function(){var $this=$(this),$input=$this.find(".spftestimonial--input"),$checkbox=$this.find(".spftestimonial--checkbox");$checkbox.on("click",(function(){$input.val(Number($checkbox.prop("checked"))).trigger("change")}))}))},$.fn.spftestimonial_siblings=function(){return this.each((function(){var $this=$(this),$siblings=$this.find(".spftestimonial--sibling"),multiple=$this.data("multiple")||!1;$siblings.on("click",(function(){var $sibling=$(this);multiple?$sibling.hasClass("spftestimonial--active")?($sibling.removeClass("spftestimonial--active"),$sibling.find("input").prop("checked",!1).trigger("change")):($sibling.addClass("spftestimonial--active"),$sibling.find("input").prop("checked",!0).trigger("change")):($this.find("input").prop("checked",!1),$sibling.find("input").prop("checked",!0).trigger("change"),$sibling.addClass("spftestimonial--active").siblings().removeClass("spftestimonial--active"))}))}))},$.fn.spftestimonial_help=function(){return this.each((function(){var $this=$(this),$tooltip,offset_left;$this.on({mouseenter:function(){$tooltip=$('<div class="spftestimonial-tooltip"></div>').html($this.find(".spftestimonial-help-text").html()).appendTo("body"),offset_left=SPFTESTIMONIAL.vars.is_rtl?$this.offset().left-$tooltip.outerWidth():$this.offset().left+24,$tooltip.css({top:$this.offset().top-($tooltip.outerHeight()/2-14),left:offset_left})},mouseleave:function(){void 0!==$tooltip&&$tooltip.remove()}})}))},SPFTESTIMONIAL.vars.$window.on("resize spftestimonial.resize",SPFTESTIMONIAL.helper.debounce((function(event){var window_width;(navigator.userAgent.indexOf("AppleWebKit/")>-1?SPFTESTIMONIAL.vars.$window.width():window.innerWidth)<=782&&!SPFTESTIMONIAL.vars.onloaded&&($(".spftestimonial-section").spftestimonial_reload_script(),SPFTESTIMONIAL.vars.onloaded=!0)}),200)).trigger("spftestimonial.resize"),$.fn.spftestimonial_reload_script=function(options){var settings=$.extend({dependency:!0},options);return this.each((function(){var $this=$(this);$this.data("inited")||($this.children(".spftestimonial-field-accordion:not(.tfree_pro_only)").spftestimonial_field_accordion(),$this.children(".spftestimonial-field-code_editor").spftestimonial_field_code_editor(),$this.children(".spftestimonial-field-fieldset").spftestimonial_field_fieldset(),$this.children(".spftestimonial-field-repeater").spftestimonial_field_repeater(),$this.children(".spftestimonial-field-sortable").spftestimonial_field_sortable(),$this.children(".spftestimonial-field-sorter").spftestimonial_field_sorter(),$this.children(".spftestimonial-field-spinner").spftestimonial_field_spinner(),$this.children(".spftestimonial-field-switcher").spftestimonial_field_switcher(),$this.children(".spftestimonial-field-typography").spftestimonial_field_typography(),$this.children(".spftestimonial-field-border").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-background").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-color").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-color_group").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-link_color").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-typography").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-select").find(".spftestimonial-chosen").spftestimonial_chosen(),$this.children(".spftestimonial-field-checkbox").find(".spftestimonial-checkbox").spftestimonial_checkbox(),$this.children(".spftestimonial-field-button_set").find(".spftestimonial-siblings").spftestimonial_siblings(),$this.children(".spftestimonial-field-image_select, .spftestimonial-field-icon_select").find(".spftestimonial-siblings").spftestimonial_siblings(),$this.children(".spftestimonial-field-palette").find(".spftestimonial-siblings").spftestimonial_siblings(),$this.children(".spftestimonial-field").find(".spftestimonial-help").spftestimonial_help(),settings.dependency&&$this.spftestimonial_dependency(),$this.data("inited",!0),$(document).trigger("spftestimonial-reload-script",$this))}))},$(document).ready((function(){$(".spftestimonial-save").spftestimonial_save(),$(".spftestimonial-options").spftestimonial_options(),$(".spftestimonial-sticky-header").spftestimonial_sticky(),$(".spftestimonial-nav-options").spftestimonial_nav_options(),$(".spftestimonial-nav-metabox").spftestimonial_nav_metabox(),$(".spftestimonial-search").spftestimonial_search(),$(".spftestimonial-confirm").spftestimonial_confirm(),$(".spftestimonial-expand-all").spftestimonial_expand_all(),$(".spftestimonial-onload").spftestimonial_reload_script()})),$(document).on("click","#sp-testimonial-show-preview:contains(Hide)",(function(e){var _this;e.preventDefault(),$(this).html('<i class="fa fa-eye" aria-hidden="true"></i> Show Preview'),preview_box.html(""),preview_display.hide()}));var preview_box=$("#sp_tpro-preview-box"),preview_display=$("#sp_tpro_live_preview").hide(),action="sp_tpro_preview_meta_box",nonce=$("#spftestimonial_metabox_noncesp_tpro_shortcode_options").val();function spftestimonial_copyToClipboard(element){var $temp=$("<input>");$("body").append($temp),$temp.val($(element).text()).select(),document.execCommand("copy"),$temp.remove()}function spftestimonial_SelectText(element){var r=document.createRange(),w=element.get(0);r.selectNodeContents(w);var sel=window.getSelection();sel.removeAllRanges(),sel.addRange(r)}$(document).on("click","#sp-testimonial-show-preview:not(:contains(Hide))",(function(e){e.preventDefault();var previewJS=window.spftestimonial_vars.previewJS,_data=$("form#post").serialize(),_this=$(this),data={action:action,data:_data,ajax_nonce:nonce};$.ajax({type:"POST",url:ajaxurl,data:data,error:function(response){console.log(response)},success:function(response){preview_display.show(),preview_box.html(response),$.getScript(previewJS,(function(){_this.html('<i class="fa fa-eye-slash" aria-hidden="true"></i> Hide Preview'),$(document).on("keyup change",(function(e){e.preventDefault(),_this.html('<i class="fa fa-refresh" aria-hidden="true"></i> Update Preview')})),$("html, body").animate({scrollTop:preview_display.offset().top-50},"slow")})),$(".sp-testimonial-preloader").animate({opacity:1},600).hide()}})})),$(".sp-testimonial-copy-btn,.tpro-sc-code,.spftestimonial-shortcode-selectable").click((function(e){e.preventDefault(),spftestimonial_copyToClipboard($(this)),spftestimonial_SelectText($(this)),$(this).focus().select(),$(".sp-testimonial-after-copy-text").animate({opacity:1,bottom:25},300),setTimeout((function(){jQuery(".sp-testimonial-after-copy-text").animate({opacity:0},200),jQuery(".sp-testimonial-after-copy-text").animate({bottom:0},0)}),2e3)})),$(".stpro_input").click((function(e){var copyText;e.preventDefault(),$(this).select(),document.execCommand("copy"),$(".sp-testimonial-after-copy-text").animate({opacity:1,bottom:25},300),setTimeout((function(){jQuery(".sp-testimonial-after-copy-text").animate({opacity:0},200),jQuery(".sp-testimonial-after-copy-text").animate({bottom:0},0)}),2e3)}));var $export_type=$(".spt_what_export").find("input:checked").val();function isValidJSONString(str){try{JSON.parse(str)}catch(e){return!1}return!0}$(".spt_what_export").on("change",(function(){$export_type=$(this).find("input:checked").val()})),$(".spt_export .spftestimonial--button").click((function(event){event.preventDefault();var $shortcode_ids=$(".spt_post_id select").val(),$forms_ids=$(".spt_post_forms_id select").val(),$ex_nonce=$("#spftestimonial_options_noncesp_testimonial_pro_tools").val();if("all_testimonial"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:"all_testimonial",nonce:$ex_nonce};else if("all_spt_shortcodes"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:"all_spt_shortcodes",nonce:$ex_nonce};else if("all_spt_form"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:"all_spt_form",nonce:$ex_nonce};else if("selected_spt_shortcodes"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:$shortcode_ids,text_ids:"select_shortcodes",nonce:$ex_nonce};else if("selected_spt_form"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:$forms_ids,text_ids:"select_forms",nonce:$ex_nonce};else $(".spftestimonial-form-result.spftestimonial-form-success").text("No group selected.").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text("")}),3e3);$.post(ajaxurl,data,(function(resp){if(resp){if(isValidJSONString(resp))var json=JSON.stringify(JSON.parse(resp));else var json=JSON.stringify(resp);json=[json];var blob=new Blob(json),link=document.createElement("a"),lcp_time=$.now();link.href=window.URL.createObjectURL(blob),link.download="testtimonial-pro-export-"+lcp_time+".json",link.click(),$(".spftestimonial-form-result.spftestimonial-form-success").text("Exported successfully!").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text(""),$(".spt_post_id select").val("").trigger("chosen:updated"),$(".spt_post_forms_id select").val("").trigger("chosen:updated")}),3e3)}}))})),$(".spt_import button.import").click((function(event){event.preventDefault();var lcp_shortcodes=$("#import").prop("files")[0];if(""!=$("#import").val()){var $im_nonce=$("#spftestimonial_options_noncesp_testimonial_pro_tools").val(),reader=new FileReader;reader.readAsText(lcp_shortcodes),reader.onload=function(event){var jsonObj=JSON.stringify(event.target.result);$.ajax({url:ajaxurl,type:"POST",data:{shortcode:jsonObj,action:"spt_import_shortcodes",nonce:$im_nonce},success:function(resp){$(".spftestimonial-form-result.spftestimonial-form-success").text("Imported successfully!").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text(""),$("#import").val(""),"spt_testimonial"===resp.data?window.location.replace($("#spt_testimonial_link_redirect").attr("href")):"spt_testimonial_form"===resp.data?window.location.replace($("#spt_forms_link_redirect").attr("href")):window.location.replace($("#spt_shortcode_link_redirect").attr("href"))}),2e3)}})}}else $(".spftestimonial-form-result.spftestimonial-form-success").text("No exported json file chosen.").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text("")}),3e3)})),$(document).on("keyup change",".spftestimonial-options #spftestimonial-form",(function(e){e.preventDefault(),$(this).find(".spftestimonial-save.spftestimonial-save-ajax").attr("value","Save Settings").attr("disabled",!1)})),$("select option:contains((Pro))").attr("disabled",!0).css("opacity","0.8"),$("label:contains((Pro))").css({"pointer-events":"none"}).css("opacity","0.8")}(jQuery,window,document);
1
+ !function($,window,document,undefined){"use strict";var SPFTESTIMONIAL=SPFTESTIMONIAL||{};SPFTESTIMONIAL.funcs={},SPFTESTIMONIAL.vars={onloaded:!1,$body:$("body"),$window:$(window),$document:$(document),$form_warning:null,is_confirm:!1,form_modified:!1,code_themes:[],is_rtl:$("body").hasClass("rtl")},SPFTESTIMONIAL.helper={uid:function(prefix){return(prefix||"")+Math.random().toString(36).substr(2,9)},preg_quote:function(str){return(str+"").replace(/(\[|\])/g,"\\$1")},name_nested_replace:function($selector,field_id){var checks=[],regex=new RegExp(SPFTESTIMONIAL.helper.preg_quote(field_id+"[\\d+]"),"g");$selector.find(":radio").each((function(){(this.checked||this.orginal_checked)&&(this.orginal_checked=!0)})),$selector.each((function(index){$(this).find(":input").each((function(){this.name=this.name.replace(regex,field_id+"["+index+"]"),this.orginal_checked&&(this.checked=!0)}))}))},debounce:function(callback,threshold,immediate){var timeout;return function(){var context=this,args=arguments,later=function(){timeout=null,immediate||callback.apply(context,args)},callNow=immediate&&!timeout;clearTimeout(timeout),timeout=setTimeout(later,threshold),callNow&&callback.apply(context,args)}},get_cookie:function(name){var e,b,cookie=document.cookie,p=name+"=";if(cookie){if(-1===(b=cookie.indexOf("; "+p))){if(0!==(b=cookie.indexOf(p)))return null}else b+=2;return-1===(e=cookie.indexOf(";",b))&&(e=cookie.length),decodeURIComponent(cookie.substring(b+p.length,e))}},set_cookie:function(name,value,expires,path,domain,secure){var d=new Date;"object"==typeof expires&&expires.toGMTString?expires=expires.toGMTString():parseInt(expires,10)?(d.setTime(d.getTime()+1e3*parseInt(expires,10)),expires=d.toGMTString()):expires="",document.cookie=name+"="+encodeURIComponent(value)+(expires?"; expires="+expires:"")+(path?"; path="+path:"")+(domain?"; domain="+domain:"")+(secure?"; secure":"")},remove_cookie:function(name,path,domain,secure){SPFTESTIMONIAL.helper.set_cookie(name,"",-1e3,path,domain,secure)}},$.fn.spftestimonial_clone=function(){for(var base=$.fn.clone.apply(this,arguments),clone=this.find("select").add(this.filter("select")),cloned=base.find("select").add(base.filter("select")),i=0;i<clone.length;++i)for(var j=0;j<clone[i].options.length;++j)!0===clone[i].options[j].selected&&(cloned[i].options[j].selected=!0);return this.find(":radio").each((function(){this.orginal_checked=this.checked})),base},$.fn.spftestimonial_expand_all=function(){return this.each((function(){$(this).on("click",(function(e){e.preventDefault(),$(".spftestimonial-wrapper").toggleClass("spftestimonial-show-all"),$(".spftestimonial-section").spftestimonial_reload_script(),$(this).find(".fa").toggleClass("fa-indent").toggleClass("fa-outdent")}))}))},$.fn.spftestimonial_nav_options=function(){return this.each((function(){var $nav=$(this),$window=$(window),$wpwrap=$("#wpwrap"),$links=$nav.find("a"),$last;$window.on("hashchange spftestimonial.hashchange",(function(){var hash=window.location.hash.replace("#tab=",""),slug=hash||$links.first().attr("href").replace("#tab=",""),$link=$('[data-tab-id="'+slug+'"]');if($link.length){$link.closest(".spftestimonial-tab-item").addClass("spftestimonial-tab-expanded").siblings().removeClass("spftestimonial-tab-expanded"),$link.next().is("ul")&&(slug=($link=$link.next().find("li").first().find("a")).data("tab-id")),$links.removeClass("spftestimonial-active"),$link.addClass("spftestimonial-active"),$last&&$last.addClass("hidden");var $section=$('[data-section-id="'+slug+'"]');$section.removeClass("hidden"),$section.spftestimonial_reload_script(),$(".spftestimonial-section-id").val($section.index()+1),$last=$section,$wpwrap.hasClass("wp-responsive-open")&&($("html, body").animate({scrollTop:$section.offset().top-50},200),$wpwrap.removeClass("wp-responsive-open"))}})).trigger("spftestimonial.hashchange")}))},$.fn.spftestimonial_nav_metabox=function(){return this.each((function(){var $nav=$(this),$links=$nav.find("a"),$sections=$nav.parent().find(".spftestimonial-section"),unique_id=$nav.data("unique"),post_id=$("#post_ID").val()||"global",$last;$links.each((function(index){$(this).on("click",(function(e){e.preventDefault();var $link=$(this),section_id=$link.data("section");$links.removeClass("spftestimonial-active"),$link.addClass("spftestimonial-active"),void 0!==$last&&$last.addClass("hidden");var $section=$sections.eq(index);$section.removeClass("hidden"),$section.spftestimonial_reload_script(),SPFTESTIMONIAL.helper.set_cookie("spftestimonial-last-metabox-tab-"+post_id+"-"+unique_id,section_id),$last=$section}))}));var get_cookie=SPFTESTIMONIAL.helper.get_cookie("spftestimonial-last-metabox-tab-"+post_id+"-"+unique_id);get_cookie?$nav.find('a[data-section="'+get_cookie+'"]').trigger("click"):$links.first("a").trigger("click")}))},$.fn.spftestimonial_search=function(){return this.each((function(){var $this,$input;$(this).find("input").on("change keyup",(function(){var value=$(this).val(),$wrapper=$(".spftestimonial-wrapper"),$section,$fields=$wrapper.find(".spftestimonial-section").find("> .spftestimonial-field:not(.spftestimonial-depend-on)"),$titles=$fields.find("> .spftestimonial-title, .spftestimonial-search-tags");value.length>3?($fields.addClass("spftestimonial-metabox-hide"),$wrapper.addClass("spftestimonial-search-all"),$titles.each((function(){var $title=$(this);if($title.text().match(new RegExp(".*?"+value+".*?","i"))){var $field=$title.closest(".spftestimonial-field");$field.removeClass("spftestimonial-metabox-hide"),$field.parent().spftestimonial_reload_script()}}))):($fields.removeClass("spftestimonial-metabox-hide"),$wrapper.removeClass("spftestimonial-search-all"))}))}))},$.fn.spftestimonial_sticky=function(){return this.each((function(){var $this=$(this),$window=$(window),$inner=$this.find(".spftestimonial-header-inner"),padding=parseInt($inner.css("padding-left"))+parseInt($inner.css("padding-right")),offset=32,scrollTop=0,lastTop=0,ticking=!1,stickyUpdate=function(){var offsetTop=$this.offset().top,stickyTop=Math.max(32,offsetTop-scrollTop),winWidth=$window.innerWidth();stickyTop<=32&&winWidth>782?($inner.css({width:$this.outerWidth()-padding}),$this.css({height:$this.outerHeight()}).addClass("spftestimonial-sticky")):($inner.removeAttr("style"),$this.removeAttr("style").removeClass("spftestimonial-sticky"))},requestTick=function(){ticking||requestAnimationFrame((function(){stickyUpdate(),ticking=!1})),ticking=!0},onSticky=function(){scrollTop=$window.scrollTop(),requestTick()};$window.on("scroll resize",onSticky),onSticky()}))},$.fn.spftestimonial_dependency=function(){return this.each((function(){var $this=$(this),$fields=$this.children("[data-controller]");if($fields.length){var normal_ruleset=$.spftestimonial_deps.createRuleset(),global_ruleset=$.spftestimonial_deps.createRuleset(),normal_depends=[],global_depends=[];$fields.each((function(){var $field=$(this),controllers=$field.data("controller").split("|"),conditions=$field.data("condition").split("|"),values=$field.data("value").toString().split("|"),is_global=!!$field.data("depend-global"),ruleset=is_global?global_ruleset:normal_ruleset;$.each(controllers,(function(index,depend_id){var value=values[index]||"",condition=conditions[index]||conditions[0];(ruleset=ruleset.createRule('[data-depend-id="'+depend_id+'"]',condition,value)).include($field),is_global?global_depends.push(depend_id):normal_depends.push(depend_id)}))})),normal_depends.length&&$.spftestimonial_deps.enable($this,normal_ruleset,normal_depends),global_depends.length&&$.spftestimonial_deps.enable(SPFTESTIMONIAL.vars.$body,global_ruleset,global_depends)}}))},$.fn.spftestimonial_field_accordion=function(){return this.each((function(){var $titles=$(this).find(".spftestimonial-accordion-title");$titles.on("click",(function(){var $title=$(this),$icon=$title.find(".spftestimonial-accordion-icon"),$content=$title.next();$icon.hasClass("fa-angle-right")?$icon.removeClass("fa-angle-right").addClass("fa-angle-down"):$icon.removeClass("fa-angle-down").addClass("fa-angle-right"),$content.data("opened")||($content.spftestimonial_reload_script(),$content.data("opened",!0)),$content.toggleClass("spftestimonial-accordion-open")})),$(this).hasClass("opened_accordion")&&$titles.trigger("click")}))},$.fn.spftestimonial_field_code_editor=function(){return this.each((function(){if("function"==typeof CodeMirror){var $this=$(this),$textarea=$this.find("textarea"),$inited=$this.find(".CodeMirror"),data_editor=$textarea.data("editor");$inited.length&&$inited.remove();var interval=setInterval((function(){if($this.is(":visible")){var code_editor=CodeMirror.fromTextArea($textarea[0],data_editor);if("default"!==data_editor.theme&&-1===SPFTESTIMONIAL.vars.code_themes.indexOf(data_editor.theme)){var $cssLink=$("<link>");$("#spftestimonial-codemirror-css").after($cssLink),$cssLink.attr({rel:"stylesheet",id:"spftestimonial-codemirror-"+data_editor.theme+"-css",href:data_editor.cdnURL+"/theme/"+data_editor.theme+".min.css",type:"text/css",media:"all"}),SPFTESTIMONIAL.vars.code_themes.push(data_editor.theme)}CodeMirror.modeURL=data_editor.cdnURL+"/mode/%N/%N.min.js",CodeMirror.autoLoadMode(code_editor,data_editor.mode),code_editor.on("change",(function(editor,event){$textarea.val(code_editor.getValue()).trigger("change")})),clearInterval(interval)}}))}}))},$.fn.spftestimonial_field_fieldset=function(){return this.each((function(){$(this).find(".spftestimonial-fieldset-content").spftestimonial_reload_script()}))},$.fn.spftestimonial_field_repeater=function(){return this.each((function(){var $this=$(this),$fieldset=$this.children(".spftestimonial-fieldset"),$repeater=$fieldset.length?$fieldset:$this,$wrapper=$repeater.children(".spftestimonial-repeater-wrapper"),$hidden=$repeater.children(".spftestimonial-repeater-hidden"),$max=$repeater.children(".spftestimonial-repeater-max"),$min=$repeater.children(".spftestimonial-repeater-min"),field_id=$wrapper.data("field-id"),max=parseInt($wrapper.data("max")),min=parseInt($wrapper.data("min"));$wrapper.children(".spftestimonial-repeater-item").children(".spftestimonial-repeater-content").spftestimonial_reload_script(),$wrapper.sortable({axis:"y",handle:".spftestimonial-repeater-sort",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(event,ui){SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children(".spftestimonial-repeater-item"),field_id)}}),$repeater.children(".spftestimonial-repeater-add").on("click",(function(e){e.preventDefault();var count=$wrapper.children(".spftestimonial-repeater-item").length;if($min.hide(),max&&count+1>max)$max.show();else{var $cloned_item=$hidden.spftestimonial_clone(!0);$cloned_item.removeClass("spftestimonial-repeater-hidden"),$cloned_item.find(':input[name!="_pseudo"]').each((function(){this.name=this.name.replace("___","").replace(field_id+"[0]",field_id+"["+count+"]")})),$wrapper.append($cloned_item),$cloned_item.children(".spftestimonial-repeater-content").spftestimonial_reload_script()}}));var event_clone=function(e){e.preventDefault();var count=$wrapper.children(".spftestimonial-repeater-item").length;if($min.hide(),max&&count+1>max)$max.show();else{var $this,$parent=$(this).parent().parent().parent(),$cloned_content=$parent.children(".spftestimonial-repeater-content").spftestimonial_clone(),$cloned_helper=$parent.children(".spftestimonial-repeater-helper").spftestimonial_clone(!0),$cloned_item=$('<div class="spftestimonial-repeater-item" />');$cloned_item.append($cloned_content),$cloned_item.append($cloned_helper),$wrapper.children().eq($parent.index()).after($cloned_item),$cloned_item.children(".spftestimonial-repeater-content").spftestimonial_reload_script(),SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children(".spftestimonial-repeater-item"),field_id)}};$wrapper.children(".spftestimonial-repeater-item").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-clone",event_clone),$repeater.children(".spftestimonial-repeater-hidden").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-clone",event_clone);var event_remove=function(e){e.preventDefault();var count=$wrapper.children(".spftestimonial-repeater-item").length;$max.hide(),$min.hide(),min&&count-1<min?$min.show():($(this).closest(".spftestimonial-repeater-item").remove(),SPFTESTIMONIAL.helper.name_nested_replace($wrapper.children(".spftestimonial-repeater-item"),field_id))};$wrapper.children(".spftestimonial-repeater-item").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-remove",event_remove),$repeater.children(".spftestimonial-repeater-hidden").children(".spftestimonial-repeater-helper").on("click",".spftestimonial-repeater-remove",event_remove)}))},$.fn.spftestimonial_field_sortable=function(){return this.each((function(){var $sortable=$(this).find(".spftestimonial-sortable");$sortable.sortable({axis:"y",helper:"original",cursor:"move",placeholder:"widget-placeholder",update:function(event,ui){}}),$sortable.find(".spftestimonial-sortable-content").spftestimonial_reload_script(),$(".form_fields").find(".spftestimonial-sortable").sortable("disable")}))},$.fn.spftestimonial_field_sorter=function(){return this.each((function(){var $this=$(this),$enabled=$this.find(".spftestimonial-enabled"),$has_disabled=$this.find(".spftestimonial-disabled"),$disabled=!!$has_disabled.length&&$has_disabled;$enabled.sortable({connectWith:$disabled,placeholder:"ui-sortable-placeholder",update:function(event,ui){var $el=ui.item.find("input");ui.item.parent().hasClass("spftestimonial-enabled")?$el.attr("name",$el.attr("name").replace("disabled","enabled")):$el.attr("name",$el.attr("name").replace("enabled","disabled"))}}),$disabled&&$disabled.sortable({connectWith:$enabled,placeholder:"ui-sortable-placeholder",update:function(event,ui){}})}))},$.fn.spftestimonial_field_spinner=function(){return this.each((function(){var $this=$(this),$input=$this.find("input"),$inited=$this.find(".ui-button"),data=$input.data();$inited.length&&$inited.remove(),$input.spinner({min:data.min||0,max:data.max||100,step:data.step||1,create:function(event,ui){data.unit&&$input.after('<span class="ui-button spftestimonial--unit">'+data.unit+"</span>")},spin:function(event,ui){$input.val(ui.value).trigger("change")}})}))},$.fn.spftestimonial_field_switcher=function(){return this.each((function(){var $switcher=$(this).find(".spftestimonial--switcher");$switcher.on("click",(function(){var value=0,$input=$switcher.find("input");$switcher.hasClass("spftestimonial--active")?$switcher.removeClass("spftestimonial--active"):(value=1,$switcher.addClass("spftestimonial--active")),$input.val(value).trigger("change")}))}))},$.fn.spftestimonial_field_typography=function(){return this.each((function(){var base=this,$this=$(this),loaded_fonts=[],webfonts=spftestimonial_typography_json.webfonts,googlestyles=spftestimonial_typography_json.googlestyles,defaultstyles=spftestimonial_typography_json.defaultstyles;base.sanitize_subset=function(subset){return subset=(subset=subset.replace("-ext"," Extended")).charAt(0).toUpperCase()+subset.slice(1)},base.sanitize_style=function(style){return googlestyles[style]?googlestyles[style]:style},base.load_google_font=function(font_family,weight,style){font_family&&"object"==typeof WebFont&&(weight=weight?weight.replace("normal",""):"",style=style?style.replace("normal",""):"",(weight||style)&&(font_family=font_family+":"+weight+style),-1===loaded_fonts.indexOf(font_family)&&WebFont.load({google:{families:[font_family]}}),loaded_fonts.push(font_family))},base.append_select_options=function($select,options,condition,type,is_multi){$select.find("option").not(":first").remove();var opts="";$.each(options,(function(key,value){var selected,name=value;selected=is_multi?condition&&-1!==condition.indexOf(value)?" selected":"":condition&&condition===value?" selected":"","subset"===type?name=base.sanitize_subset(value):"style"===type&&(name=base.sanitize_style(value)),opts+='<option value="'+value+'"'+selected+">"+name+"</option>"})),$select.append(opts).trigger("spftestimonial.change").trigger("chosen:updated")},base.init=function(){var selected_styles=[],$typography=$this.find(".spftestimonial--typography"),$type=$this.find(".spftestimonial--type"),$styles=$this.find(".spftestimonial--block-font-style"),unit=$typography.data("unit"),line_height_unit=$typography.data("line-height-unit"),exclude_fonts=$typography.data("exclude")?$typography.data("exclude").split(","):[],$chosen_selects;$this.find(".spftestimonial--chosen").length&&$this.find("select").each((function(){var $chosen_select=$(this),$chosen_inited=$chosen_select.parent().find(".chosen-container");$chosen_inited.length&&$chosen_inited.remove(),$chosen_select.chosen({allow_single_deselect:!0,disable_search_threshold:15,width:"100%"})}));var $font_family_select=$this.find(".spftestimonial--font-family"),first_font_family=$font_family_select.val();$font_family_select.find("option").not(":first-child").remove();var opts="";$.each(webfonts,(function(type,group){exclude_fonts&&-1!==exclude_fonts.indexOf(type)||(opts+='<optgroup label="'+group.label+'">',$.each(group.fonts,(function(key,value){var selected;opts+='<option value="'+(value="object"==typeof value?key:value)+'" data-type="'+type+'"'+(value===first_font_family?" selected":"")+">"+value+"</option>"})),opts+="</optgroup>")})),$font_family_select.append(opts).trigger("chosen:updated");var $font_style_block=$this.find(".spftestimonial--block-font-style");if($font_style_block.length){var $font_style_select=$this.find(".spftestimonial--font-style-select"),first_style_value=$font_style_select.val()?$font_style_select.val().replace(/normal/g,""):"";$font_style_select.on("change spftestimonial.change",(function(event){var style_value=$font_style_select.val();!style_value&&selected_styles&&-1===selected_styles.indexOf("normal")&&(style_value=selected_styles[0]);var font_normal=style_value&&"italic"!==style_value&&"normal"===style_value?"normal":"",font_weight=style_value&&"italic"!==style_value&&"normal"!==style_value?style_value.replace("italic",""):font_normal,font_style=style_value&&"italic"===style_value.substr(-6)?"italic":"";$this.find(".spftestimonial--font-weight").val(font_weight),$this.find(".spftestimonial--font-style").val(font_style)}));var $extra_font_style_block=$this.find(".spftestimonial--block-extra-styles");if($extra_font_style_block.length)var $extra_font_style_select=$this.find(".spftestimonial--extra-styles"),first_extra_style_value=$extra_font_style_select.val()}var $subset_block=$this.find(".spftestimonial--block-subset");if($subset_block.length)var $subset_select=$this.find(".spftestimonial--subset"),first_subset_select_value=$subset_select.val(),subset_multi_select=$subset_select.data("multiple")||!1;var $backup_font_family_block=$this.find(".spftestimonial--block-backup-font-family");$font_family_select.on("change spftestimonial.change",(function(event){$subset_block.length&&$subset_block.addClass("hidden"),$extra_font_style_block.length&&$extra_font_style_block.addClass("hidden"),$backup_font_family_block.length&&$backup_font_family_block.addClass("hidden");var $selected=$font_family_select.find(":selected"),value=$selected.val(),type=$selected.data("type");if(type&&value){if("google"!==type&&"custom"!==type||!$backup_font_family_block.length||$backup_font_family_block.removeClass("hidden"),$font_style_block.length){var styles=defaultstyles;"google"===type&&webfonts[type].fonts[value][0]?styles=webfonts[type].fonts[value][0]:"custom"===type&&webfonts[type].fonts[value]&&(styles=webfonts[type].fonts[value]),selected_styles=styles;var set_auto_style=-1!==styles.indexOf("normal")?"normal":styles[0],set_style_value=first_style_value&&-1!==styles.indexOf(first_style_value)?first_style_value:set_auto_style;base.append_select_options($font_style_select,styles,set_style_value,"style"),first_style_value=!1,$font_style_block.removeClass("hidden"),"google"===type&&$extra_font_style_block.length&&styles.length>1&&(base.append_select_options($extra_font_style_select,styles,first_extra_style_value,"style",!0),first_extra_style_value=!1,$extra_font_style_block.removeClass("hidden"))}if("google"===type&&$subset_block.length&&webfonts[type].fonts[value][1]){var subsets=webfonts[type].fonts[value][1],set_auto_subset=subsets.length<2&&"latin"!==subsets[0]?subsets[0]:"",set_subset_value=first_subset_select_value&&-1!==subsets.indexOf(first_subset_select_value)?first_subset_select_value:set_auto_subset;set_subset_value=subset_multi_select&&first_subset_select_value?first_subset_select_value:set_subset_value,base.append_select_options($subset_select,subsets,set_subset_value,"subset",subset_multi_select),first_subset_select_value=!1,$subset_block.removeClass("hidden")}}else $styles.find(":input").val(""),$subset_block.length&&($subset_select.find("option").not(":first-child").remove(),$subset_select.trigger("chosen:updated")),$font_style_block.length&&($font_style_select.find("option").not(":first-child").remove(),$font_style_select.trigger("chosen:updated"));$type.val(type)})).trigger("spftestimonial.change");var $preview_block=$this.find(".spftestimonial--block-preview");if($preview_block.length){var $preview=$this.find(".spftestimonial--preview");$this.on("change",SPFTESTIMONIAL.helper.debounce((function(event){$preview_block.removeClass("hidden");var font_family=$font_family_select.val(),font_weight=$this.find(".spftestimonial--font-weight").val(),font_style=$this.find(".spftestimonial--font-style").val(),font_size=$this.find(".spftestimonial--font-size").val(),font_variant=$this.find(".spftestimonial--font-variant").val(),line_height=$this.find(".spftestimonial--line-height").val(),text_align=$this.find(".spftestimonial--text-align").val(),text_transform=$this.find(".spftestimonial--text-transform").val(),text_decoration=$this.find(".spftestimonial--text-decoration").val(),text_color=$this.find(".spftestimonial--color").val(),word_spacing=$this.find(".spftestimonial--word-spacing").val(),letter_spacing=$this.find(".spftestimonial--letter-spacing").val(),custom_style=$this.find(".spftestimonial--custom-style").val(),type;"google"===$this.find(".spftestimonial--type").val()&&base.load_google_font(font_family,font_weight,font_style);var properties={};font_family&&(properties.fontFamily=font_family),font_weight&&(properties.fontWeight=font_weight),font_style&&(properties.fontStyle=font_style),font_variant&&(properties.fontVariant=font_variant),font_size&&(properties.fontSize=font_size+unit),line_height&&(properties.lineHeight=line_height+line_height_unit),letter_spacing&&(properties.letterSpacing=letter_spacing+unit),word_spacing&&(properties.wordSpacing=word_spacing+unit),text_align&&(properties.textAlign=text_align),text_transform&&(properties.textTransform=text_transform),text_decoration&&(properties.textDecoration=text_decoration),text_color&&(properties.color=text_color),$preview.removeAttr("style"),custom_style&&$preview.attr("style",custom_style),$preview.css(properties)}),100)),$preview_block.on("click",(function(){$preview.toggleClass("spftestimonial--black-background");var $toggle=$preview_block.find(".spftestimonial--toggle");$toggle.hasClass("fa-toggle-off")?$toggle.removeClass("fa-toggle-off").addClass("fa-toggle-on"):$toggle.removeClass("fa-toggle-on").addClass("fa-toggle-off")})),$preview_block.hasClass("hidden")||$this.trigger("change")}},base.init()}))},$.fn.spftestimonial_confirm=function(){return this.each((function(){$(this).on("click",(function(e){var confirm_text=$(this).data("confirm")||window.spftestimonial_vars.i18n.confirm,confirm_answer;if(!confirm(confirm_text))return e.preventDefault(),!1;SPFTESTIMONIAL.vars.is_confirm=!0,SPFTESTIMONIAL.vars.form_modified=!1}))}))},$.fn.serializeObject=function(){var obj={};return $.each(this.serializeArray(),(function(i,o){var n=o.name,v=o.value;obj[n]=void 0===obj[n]?v:$.isArray(obj[n])?obj[n].concat(v):[obj[n],v]})),obj},$.fn.spftestimonial_save=function(){return this.each((function(){var $this=$(this),$buttons=$(".spftestimonial-save"),$panel=$(".spftestimonial-options"),flooding=!1,timeout;$this.on("click",(function(e){if(!flooding){var $text=$this.data("save"),$value=$this.val();$buttons.attr("value",$text),$this.hasClass("spftestimonial-save-ajax")?(e.preventDefault(),$panel.addClass("spftestimonial-saving"),$buttons.prop("disabled",!0),window.wp.ajax.post("spftestimonial_"+$panel.data("unique")+"_ajax_save",{data:$("#spftestimonial-form").serializeJSONSPFTESTIMONIAL()}).done((function(response){if($(".spftestimonial-error").remove(),Object.keys(response.errors).length){var error_icon='<i class="spftestimonial-label-error spftestimonial-error">!</i>';$.each(response.errors,(function(key,error_message){var $field=$('[data-depend-id="'+key+'"]'),$link=$('a[href="#tab='+$field.closest(".spftestimonial-section").data("section-id")+'"]'),$tab=$link.closest(".spftestimonial-tab-item");$field.closest(".spftestimonial-fieldset").append('<p class="spftestimonial-error spftestimonial-error-text">'+error_message+"</p>"),$link.find(".spftestimonial-error").length||$link.append(error_icon),$tab.find(".spftestimonial-arrow .spftestimonial-error").length||$tab.find(".spftestimonial-arrow").append(error_icon)}))}$panel.removeClass("spftestimonial-saving"),$buttons.prop("disabled",!0).attr("value","Changes Saved"),flooding=!1,SPFTESTIMONIAL.vars.form_modified=!1,SPFTESTIMONIAL.vars.$form_warning.hide(),clearTimeout(timeout);var $result_success=$(".spftestimonial-form-success");$result_success.empty().append(response.notice).fadeIn("fast",(function(){timeout=setTimeout((function(){$result_success.fadeOut("fast")}),1e3)}))})).fail((function(response){alert(response.error)}))):SPFTESTIMONIAL.vars.form_modified=!1}flooding=!0}))}))},$.fn.spftestimonial_options=function(){return this.each((function(){var $this=$(this),$content=$this.find(".spftestimonial-content"),$form_success=$this.find(".spftestimonial-form-success"),$form_warning=$this.find(".spftestimonial-form-warning"),$save_button=$this.find(".spftestimonial-header .spftestimonial-save");SPFTESTIMONIAL.vars.$form_warning=$form_warning,$form_warning.length&&(window.onbeforeunload=function(){return!!SPFTESTIMONIAL.vars.form_modified||void 0},$content.on("change keypress",":input",(function(){SPFTESTIMONIAL.vars.form_modified||($form_success.hide(),$form_warning.fadeIn("fast"),SPFTESTIMONIAL.vars.form_modified=!0)}))),$form_success.hasClass("spftestimonial-form-show")&&setTimeout((function(){$form_success.fadeOut("fast")}),1e3),$(document).on("keydown",(function(event){if((event.ctrlKey||event.metaKey)&&83===event.which)return $save_button.trigger("click"),event.preventDefault(),!1}))}))},"function"==typeof Color&&(Color.prototype.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var hex=parseInt(this._color,10).toString(16);if(this.error)return"";if(hex.length<6)for(var i=6-hex.length-1;i>=0;i--)hex="0"+hex;return"#"+hex}),SPFTESTIMONIAL.funcs.parse_color=function(color){var value=color.replace(/\s+/g,""),trans=-1!==value.indexOf("rgba")?parseFloat(100*value.replace(/^.*,(.+)\)/,"$1")):100,rgba;return{value:value,transparent:trans,rgba:trans<100}},$.fn.spftestimonial_color=function(){return this.each((function(){var $input=$(this),picker_color=SPFTESTIMONIAL.funcs.parse_color($input.val()),palette_color=!window.spftestimonial_vars.color_palette.length||window.spftestimonial_vars.color_palette,$container;$input.hasClass("wp-color-picker")&&$input.closest(".wp-picker-container").after($input).remove(),$input.wpColorPicker({palettes:palette_color,change:function(event,ui){var ui_color_value=ui.color.toString();$container.removeClass("spftestimonial--transparent-active"),$container.find(".spftestimonial--transparent-offset").css("background-color",ui_color_value),$input.val(ui_color_value).trigger("change")},create:function(){$container=$input.closest(".wp-picker-container");var a8cIris=$input.data("a8cIris"),$transparent_wrap=$('<div class="spftestimonial--transparent-wrap"><div class="spftestimonial--transparent-slider"></div><div class="spftestimonial--transparent-offset"></div><div class="spftestimonial--transparent-text"></div><div class="spftestimonial--transparent-button">transparent <i class="fa fa-toggle-off"></i></div></div>').appendTo($container.find(".wp-picker-holder")),$transparent_slider=$transparent_wrap.find(".spftestimonial--transparent-slider"),$transparent_text=$transparent_wrap.find(".spftestimonial--transparent-text"),$transparent_offset=$transparent_wrap.find(".spftestimonial--transparent-offset"),$transparent_button=$transparent_wrap.find(".spftestimonial--transparent-button");"transparent"===$input.val()&&$container.addClass("spftestimonial--transparent-active"),$transparent_button.on("click",(function(){"transparent"!==$input.val()?($input.val("transparent").trigger("change").removeClass("iris-error"),$container.addClass("spftestimonial--transparent-active")):($input.val(a8cIris._color.toString()).trigger("change"),$container.removeClass("spftestimonial--transparent-active"))})),$transparent_slider.slider({value:picker_color.transparent,step:1,min:0,max:100,slide:function(event,ui){var slide_value=parseFloat(ui.value/100);a8cIris._color._alpha=slide_value,$input.wpColorPicker("color",a8cIris._color.toString()),$transparent_text.text(1===slide_value||0===slide_value?"":slide_value)},create:function(){var slide_value=parseFloat(picker_color.transparent/100),text_value=slide_value<1?slide_value:"";$transparent_text.text(text_value),$transparent_offset.css("background-color",picker_color.value),$container.on("click",".wp-picker-clear",(function(){a8cIris._color._alpha=1,$transparent_text.text(""),$transparent_slider.slider("option","value",100),$container.removeClass("spftestimonial--transparent-active"),$input.trigger("change")})),$container.on("click",".wp-picker-default",(function(){var default_color=SPFTESTIMONIAL.funcs.parse_color($input.data("default-color")),default_value=parseFloat(default_color.transparent/100),default_text=default_value<1?default_value:"";a8cIris._color._alpha=default_value,$transparent_text.text(default_text),$transparent_slider.slider("option","value",default_color.transparent),"transparent"===default_color.value&&($input.removeClass("iris-error"),$container.addClass("spftestimonial--transparent-active"))}))}})}})}))},$.fn.spftestimonial_chosen=function(){return this.each((function(){var $this=$(this),$inited=$this.parent().find(".chosen-container"),is_sortable=$this.hasClass("spftestimonial-chosen-sortable")||!1,is_ajax=$this.hasClass("spftestimonial-chosen-ajax")||!1,is_multiple=$this.attr("multiple")||!1,set_width=is_multiple?"100%":"auto",set_options=$.extend({allow_single_deselect:!0,disable_search_threshold:10,width:set_width,no_results_text:window.spftestimonial_vars.i18n.no_results_text},$this.data("chosen-settings"));if($inited.length&&$inited.remove(),is_ajax){var set_ajax_options=$.extend({data:{type:"post",nonce:""},allow_single_deselect:!0,disable_search_threshold:-1,width:"100%",min_length:3,type_delay:500,typing_text:window.spftestimonial_vars.i18n.typing_text,searching_text:window.spftestimonial_vars.i18n.searching_text,no_results_text:window.spftestimonial_vars.i18n.no_results_text},$this.data("chosen-settings"));$this.SPFTESTIMONIALAjaxChosen(set_ajax_options)}else $this.chosen(set_options);if(is_multiple){var $hidden_select=$this.parent().find(".spftestimonial-hide-select"),$hidden_value=$hidden_select.val()||[];$this.on("change",(function(obj,result){result&&result.selected?$hidden_select.append('<option value="'+result.selected+'" selected="selected">'+result.selected+"</option>"):result&&result.deselected&&$hidden_select.find('option[value="'+result.deselected+'"]').remove(),void 0!==window.wp.customize&&0===$hidden_select.children().length&&$hidden_select.data("customize-setting-link")&&window.wp.customize.control($hidden_select.data("customize-setting-link")).setting.set(""),$hidden_select.trigger("change")})),$this.SPFTESTIMONIALChosenOrder($hidden_value,!0)}if(is_sortable){var $chosen_container,$chosen_choices=$this.parent().find(".chosen-container").find(".chosen-choices");$chosen_choices.bind("mousedown",(function(event){$(event.target).is("span")&&event.stopPropagation()})),$chosen_choices.sortable({items:"li:not(.search-field)",helper:"orginal",cursor:"move",placeholder:"search-choice-placeholder",start:function(e,ui){ui.placeholder.width(ui.item.innerWidth()),ui.placeholder.height(ui.item.innerHeight())},update:function(e,ui){var select_options="",chosen_object=$this.data("chosen"),$prev_select=$this.parent().find(".spftestimonial-hide-select");$chosen_choices.find(".search-choice-close").each((function(){var option_array_index=$(this).data("option-array-index");$.each(chosen_object.results_data,(function(index,data){data.array_index===option_array_index&&(select_options+='<option value="'+data.value+'" selected>'+data.value+"</option>")}))})),$prev_select.children().remove(),$prev_select.append(select_options),$prev_select.trigger("change")}})}}))},$.fn.spftestimonial_checkbox=function(){return this.each((function(){var $this=$(this),$input=$this.find(".spftestimonial--input"),$checkbox=$this.find(".spftestimonial--checkbox");$checkbox.on("click",(function(){$input.val(Number($checkbox.prop("checked"))).trigger("change")}))}))},$.fn.spftestimonial_siblings=function(){return this.each((function(){var $this=$(this),$siblings=$this.find(".spftestimonial--sibling"),multiple=$this.data("multiple")||!1;$siblings.on("click",(function(){var $sibling=$(this);multiple?$sibling.hasClass("spftestimonial--active")?($sibling.removeClass("spftestimonial--active"),$sibling.find("input").prop("checked",!1).trigger("change")):($sibling.addClass("spftestimonial--active"),$sibling.find("input").prop("checked",!0).trigger("change")):($this.find("input").prop("checked",!1),$sibling.find("input").prop("checked",!0).trigger("change"),$sibling.addClass("spftestimonial--active").siblings().removeClass("spftestimonial--active"))}))}))},$.fn.spftestimonial_help=function(){return this.each((function(){var $this=$(this),$tooltip,offset_left;$this.on({mouseenter:function(){$tooltip=$('<div class="spftestimonial-tooltip"></div>').html($this.find(".spftestimonial-help-text").html()).appendTo("body"),offset_left=SPFTESTIMONIAL.vars.is_rtl?$this.offset().left-$tooltip.outerWidth():$this.offset().left+24,$tooltip.css({top:$this.offset().top-($tooltip.outerHeight()/2-14),left:offset_left})},mouseleave:function(){void 0!==$tooltip&&$tooltip.remove()}})}))},SPFTESTIMONIAL.vars.$window.on("resize spftestimonial.resize",SPFTESTIMONIAL.helper.debounce((function(event){var window_width;(navigator.userAgent.indexOf("AppleWebKit/")>-1?SPFTESTIMONIAL.vars.$window.width():window.innerWidth)<=782&&!SPFTESTIMONIAL.vars.onloaded&&($(".spftestimonial-section").spftestimonial_reload_script(),SPFTESTIMONIAL.vars.onloaded=!0)}),200)).trigger("spftestimonial.resize"),$.fn.spftestimonial_reload_script=function(options){var settings=$.extend({dependency:!0},options);return this.each((function(){var $this=$(this);$this.data("inited")||($this.children(".spftestimonial-field-accordion:not(.tfree_pro_only)").spftestimonial_field_accordion(),$this.children(".spftestimonial-field-code_editor").spftestimonial_field_code_editor(),$this.children(".spftestimonial-field-fieldset").spftestimonial_field_fieldset(),$this.children(".spftestimonial-field-repeater").spftestimonial_field_repeater(),$this.children(".spftestimonial-field-sortable").spftestimonial_field_sortable(),$this.children(".spftestimonial-field-sorter").spftestimonial_field_sorter(),$this.children(".spftestimonial-field-spinner").spftestimonial_field_spinner(),$this.children(".spftestimonial-field-switcher").spftestimonial_field_switcher(),$this.children(".spftestimonial-field-typography").spftestimonial_field_typography(),$this.children(".spftestimonial-field-border").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-background").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-color").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-color_group").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-link_color").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-typography").find(".spftestimonial-color").spftestimonial_color(),$this.children(".spftestimonial-field-select").find(".spftestimonial-chosen").spftestimonial_chosen(),$this.children(".spftestimonial-field-checkbox").find(".spftestimonial-checkbox").spftestimonial_checkbox(),$this.children(".spftestimonial-field-button_set").find(".spftestimonial-siblings").spftestimonial_siblings(),$this.children(".spftestimonial-field-image_select, .spftestimonial-field-icon_select").find(".spftestimonial-siblings").spftestimonial_siblings(),$this.children(".spftestimonial-field-palette").find(".spftestimonial-siblings").spftestimonial_siblings(),$this.children(".spftestimonial-field").find(".spftestimonial-help").spftestimonial_help(),settings.dependency&&$this.spftestimonial_dependency(),$this.data("inited",!0),$(document).trigger("spftestimonial-reload-script",$this))}))},$(document).ready((function(){$(".spftestimonial-save").spftestimonial_save(),$(".spftestimonial-options").spftestimonial_options(),$(".spftestimonial-sticky-header").spftestimonial_sticky(),$(".spftestimonial-nav-options").spftestimonial_nav_options(),$(".spftestimonial-nav-metabox").spftestimonial_nav_metabox(),$(".spftestimonial-search").spftestimonial_search(),$(".spftestimonial-confirm").spftestimonial_confirm(),$(".spftestimonial-expand-all").spftestimonial_expand_all(),$(".spftestimonial-onload").spftestimonial_reload_script()})),$(document).on("click","#sp-testimonial-show-preview:contains(Hide)",(function(e){var _this;e.preventDefault(),$(this).html('<i class="fa fa-eye" aria-hidden="true"></i> Show Preview'),preview_box.html(""),preview_display.hide()}));var preview_box=$("#sp_tpro-preview-box"),preview_display=$("#sp_tpro_live_preview").hide(),action="sp_tpro_preview_meta_box",nonce=$("#spftestimonial_metabox_noncesp_tpro_shortcode_options").val();function spftestimonial_copyToClipboard(element){var $temp=$("<input>");$("body").append($temp),$temp.val($(element).text()).select(),document.execCommand("copy"),$temp.remove()}function spftestimonial_SelectText(element){var r=document.createRange(),w=element.get(0);r.selectNodeContents(w);var sel=window.getSelection();sel.removeAllRanges(),sel.addRange(r)}$(document).on("click","#sp-testimonial-show-preview:not(:contains(Hide))",(function(e){e.preventDefault();var previewJS=window.spftestimonial_vars.previewJS,_data=$("form#post").serialize(),_this=$(this),data={action:action,data:_data,ajax_nonce:nonce};$.ajax({type:"POST",url:ajaxurl,data:data,error:function(response){console.log(response)},success:function(response){preview_display.show(),preview_box.html(response),$.getScript(previewJS,(function(){_this.html('<i class="fa fa-eye-slash" aria-hidden="true"></i> Hide Preview'),$(document).on("keyup change",(function(e){e.preventDefault(),_this.html('<i class="fa fa-refresh" aria-hidden="true"></i> Update Preview')})),$("html, body").animate({scrollTop:preview_display.offset().top-50},"slow")})),$(".sp-testimonial-preloader").animate({opacity:1},600).hide()}})})),$(".sp-testimonial-copy-btn,.tpro-sc-code,.spftestimonial-shortcode-selectable").on("click",(function(e){e.preventDefault(),spftestimonial_copyToClipboard($(this)),spftestimonial_SelectText($(this)),$(this).focus().select(),$(".sp-testimonial-after-copy-text").animate({opacity:1,bottom:25},300),setTimeout((function(){jQuery(".sp-testimonial-after-copy-text").animate({opacity:0},200),jQuery(".sp-testimonial-after-copy-text").animate({bottom:0},0)}),2e3)})),$(".stpro_input").on("click",(function(e){var copyText;e.preventDefault(),$(this).select(),document.execCommand("copy"),$(".sp-testimonial-after-copy-text").animate({opacity:1,bottom:25},300),setTimeout((function(){jQuery(".sp-testimonial-after-copy-text").animate({opacity:0},200),jQuery(".sp-testimonial-after-copy-text").animate({bottom:0},0)}),2e3)}));var $export_type=$(".spt_what_export").find("input:checked").val();function isValidJSONString(str){try{JSON.parse(str)}catch(e){return!1}return!0}$(".spt_what_export").on("change",(function(){$export_type=$(this).find("input:checked").val()})),$(".spt_export .spftestimonial--button").on("click",(function(event){event.preventDefault();var $shortcode_ids=$(".spt_post_id select").val(),$forms_ids=$(".spt_post_forms_id select").val(),$ex_nonce=$("#spftestimonial_options_noncesp_testimonial_pro_tools").val();if("all_testimonial"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:"all_testimonial",nonce:$ex_nonce};else if("all_spt_shortcodes"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:"all_spt_shortcodes",nonce:$ex_nonce};else if("all_spt_form"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:"all_spt_form",nonce:$ex_nonce};else if("selected_spt_shortcodes"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:$shortcode_ids,text_ids:"select_shortcodes",nonce:$ex_nonce};else if("selected_spt_form"===$export_type)var data={action:"spt_export_shortcodes",lcp_ids:$forms_ids,text_ids:"select_forms",nonce:$ex_nonce};else $(".spftestimonial-form-result.spftestimonial-form-success").text("No group selected.").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text("")}),3e3);$.post(ajaxurl,data,(function(resp){if(resp){if(isValidJSONString(resp))var json=JSON.stringify(JSON.parse(resp));else var json=JSON.stringify(resp);json=[json];var blob=new Blob(json),link=document.createElement("a"),lcp_time=$.now();link.href=window.URL.createObjectURL(blob),link.download="testtimonial-pro-export-"+lcp_time+".json",link.click(),$(".spftestimonial-form-result.spftestimonial-form-success").text("Exported successfully!").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text(""),$(".spt_post_id select").val("").trigger("chosen:updated"),$(".spt_post_forms_id select").val("").trigger("chosen:updated")}),3e3)}}))})),$(".spt_import button.import").on("click",(function(event){event.preventDefault();var lcp_shortcodes=$("#import").prop("files")[0];if(""!=$("#import").val()){var $im_nonce=$("#spftestimonial_options_noncesp_testimonial_pro_tools").val(),reader=new FileReader;reader.readAsText(lcp_shortcodes),reader.onload=function(event){var jsonObj=JSON.stringify(event.target.result);$.ajax({url:ajaxurl,type:"POST",data:{shortcode:jsonObj,action:"spt_import_shortcodes",nonce:$im_nonce},success:function(resp){$(".spftestimonial-form-result.spftestimonial-form-success").text("Imported successfully!").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text(""),$("#import").val(""),"spt_testimonial"===resp.data?window.location.replace($("#spt_testimonial_link_redirect").attr("href")):"spt_testimonial_form"===resp.data?window.location.replace($("#spt_forms_link_redirect").attr("href")):window.location.replace($("#spt_shortcode_link_redirect").attr("href"))}),2e3)}})}}else $(".spftestimonial-form-result.spftestimonial-form-success").text("No exported json file chosen.").show(),setTimeout((function(){$(".spftestimonial-form-result.spftestimonial-form-success").hide().text("")}),3e3)})),$(document).on("keyup change",".spftestimonial-options #spftestimonial-form",(function(e){e.preventDefault(),$(this).find(".spftestimonial-save.spftestimonial-save-ajax").attr("value","Save Settings").attr("disabled",!1)})),$("select option:contains((Pro))").attr("disabled",!0).css("opacity","0.8"),$("label:contains((Pro))").css({"pointer-events":"none"}).css("opacity","0.8")}(jQuery,window,document);
src/Admin/assets/css/admin.css CHANGED
@@ -602,9 +602,7 @@ div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer a.button {
602
  float: left;
603
  line-height: 90px;
604
  text-align: center;
605
- width: 100px;
606
- height: 100px;
607
- margin-right: 15px;
608
  }
609
 
610
  #sp-testimonial-review-notice .sp-testimonial-plugin-icon img {
@@ -776,4 +774,20 @@ div#sp_tpro_live_preview {
776
  }
777
  .block-editor-page .editor-styles-wrapper i{
778
  font-style: normal;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  }
602
  float: left;
603
  line-height: 90px;
604
  text-align: center;
605
+ width: 125px;
 
 
606
  }
607
 
608
  #sp-testimonial-review-notice .sp-testimonial-plugin-icon img {
774
  }
775
  .block-editor-page .editor-styles-wrapper i{
776
  font-style: normal;
777
+ }
778
+
779
+ /* Go Pro Menu */
780
+ #adminmenu #menu-posts-spt_testimonial li:nth-child(8) a,
781
+ #adminmenu #menu-posts-spt_testimonial li:nth-child(8) a:hover {
782
+ color:#11b916;
783
+ font-weight: 700;
784
+ }
785
+ #adminmenu #menu-posts-spt_testimonial li a .sp-go-pro-icon {
786
+ background-image: url(../images/rocket.svg);
787
+ width: 20px;
788
+ height: 20px;
789
+ display: block;
790
+ float: left;
791
+ margin-right: 1px;
792
+ margin-left: -2px;
793
  }
src/Admin/assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .text-center{text-align:center}.spt-main-class .spftestimonial-header-inner h1{color:#444;font-size:22px;font-weight:600}.spt-main-class .spftestimonial-sticky .spftestimonial-header-inner{z-index:20}.spt-main-class .spftestimonial-metabox .spftestimonial-nav{position:inherit;float:none;width:100%;background:#f1f1f1}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li{display:inline-block}.spt-main-class .spftestimonial-nav ul li a{text-transform:uppercase;font-weight:600}.spt-main-class .spftestimonial-metabox .spftestimonial-content{margin-left:0}.spt-main-class .spftestimonial-metabox{margin:-6px -12px -12px -12px}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li a{background-color:#1595ce;font-size:14px;padding:15px 15px;line-height:1.4;color:#fff;border-right:1px solid #e2e2e1;font-weight:600;border-bottom:0}#sp_tpro_shortcode_options_new .spftestimonial-metabox .spftestimonial-nav ul li a{font-size:13px;text-transform:uppercase;padding:16px 15px}.spt-main-class .spftestimonial-nav ul li .spftestimonial-active:after{display:none}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li .spftestimonial-active{color:#444;background-color:#fff;box-shadow:0 3px 0 0 #1595ce inset}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li .spftestimonial-active .fa{color:#1595ce}.spt-main-class .spftestimonial-metabox .spftestimonial-nav-background{display:none}.spt-main-class.spftestimonial-theme-light .spftestimonial-container{border:1px solid #ccd0d4}.spt-main-class.spftestimonial-theme-light .spftestimonial-header-inner{border-bottom:1px solid #ccd0d4}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav ul li a{color:#464646;background-color:#f5f5f5;border-top:0;border-right:0;border-bottom:1px solid #ccd0d4!important;margin-bottom:0;padding:15px 15px}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav ul li .spftestimonial-active{box-shadow:3px 0 0 0 #1595ce inset;background-color:#fff;color:#1595ce}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav ul ul li a{background-color:#f8fdff;padding:13px 15px 13px 24px}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav-background{border-right:1px solid #ccd0d4}.spt-main-class .spftestimonial-desc-text,.spt-main-class .spftestimonial-text-subtitle{font-style:italic}.spftestimonial-metabox .sp-tpro-banner{background-color:#0a73a7;padding:22px 28px;overflow:hidden;background-image:-webkit-gradient(linear,left top,right top,from(#0a73a7),to(#1595ce));background-image:linear-gradient(to right,#0a73a7,#1595ce)}.spftestimonial-metabox .sp-tpro-logo{float:left}.spftestimonial-metabox .sp-tpro-logo img{display:block;width:182px}.spftestimonial-metabox .sp-tpro-short-links{float:right;line-height:30px}.spftestimonial-metabox .sp-tpro-short-links a{color:#fff;text-decoration:none;margin-left:16px;font-size:15px;font-weight:600}.spftestimonial-metabox .sp-tpro-short-links a i.fa{margin-right:7px}.sp-testimonial-shortcode-divider{height:20px;background:#f1f1f1;border-top:1px solid #ddd}.spftestimonial-metabox .tpro_shortcode{display:inline-flex;width:100%;background-color:#fffdfd}.tpro_shortcode .tpro-col-lg-6{border-right:1px solid #ddd;width:50%}.tpro_shortcode .tpro-col-lg-6 .tpro_shortcode_content{padding:42px 16px}.tpro_shortcode .tpro-col-lg-6:last-child .tpro_shortcode_content{padding:42px 16px 0 16px}.shortcode.column-shortcode .sp_tfree_input{border:1px solid #cbcbcb;cursor:pointer}.tpro_shortcode .tpro-col-lg-6 .tpro_shortcode_content .tpro-sc-code{background-color:rgba(82,179,217,.11);padding:10px 15px 10px 30px;display:inline-block;border:1px solid #d1e4ef;border-radius:2px;cursor:pointer;background-image:url(../images/copy.svg);background-size:16px;background-position:10px center;background-repeat:no-repeat}.tpro_shortcode .tpro-col-lg-6:last-child{border-right:none}.tpro_shortcode .tpro-col-lg-6 .tpro-shortcode-title{font-weight:500;font-size:17px!important;padding-top:0!important;color:#4c5158}.tpro_shortcode .tpro-col-lg-6 p{margin-top:2px;color:#4c5158}.tpro_shortcode .tpro-col-lg-6 .back-image{max-width:100%;display:block;margin:0 auto}.tpro_shortcode .tpro-col-lg-6 textarea{border-color:transparent;box-shadow:none;background-color:#eee;padding:4px 6px;resize:none;text-align:center;max-width:100%}.post-type-spt_shortcodes td.shortcode.column-shortcode input{border-width:1px;border-style:solid;border-color:#cbcbcb;cursor:pointer}@media (max-width:1200px){.spftestimonial-metabox .tpro_shortcode{display:block}.tpro_shortcode .tpro-col-lg-6{width:100%;display:block;border-bottom:1px solid #ddd;border-right:none}.tpro_shortcode .tpro-col-lg-6:last-child{padding-bottom:42px}}.sp-testimonial-shortcode{background-color:rgba(82,179,217,.11);padding:8px 12px;display:inline-block;margin-left:8px}.selectable{-webkit-touch-callout:all;-webkit-user-select:all;-khtml-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}.js #sp_tpro_meta_options.postbox .handlediv,.js #sp_tpro_meta_options.postbox .hndle,.js #sp_tpro_meta_options.postbox .postbox-header,.js #sp_tpro_shortcode_options.postbox .handlediv,.js #sp_tpro_shortcode_options.postbox .hndle,.js #sp_tpro_shortcode_options.postbox .postbox-header{display:none}.sp-testimonial-font-color .wp-picker-container,.sp-testimonial-font-load .spftestimonial--switcher,.spftestimonial-field-typography .spftestimonial--block .chosen-container,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--font-size,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--letter-spacing,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--line-height,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-bottom,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-left,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-right,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-top{pointer-events:none;opacity:.6}.sp-testimonial-text-center{text-align:center}div.sp-testimonial-help .wp-badge{border:none;background:url(../images/icon-256.png) right no-repeat;background-size:128px 128px;box-shadow:none;height:auto;padding-top:128px}.about-wrap.sp-testimonial-help [class$="-col"]{display:flex;justify-content:space-between;flex-wrap:wrap}.about-wrap [class$="-col"]{display:flex;justify-content:space-between;flex-wrap:wrap}.sp-testimonial-help [class$="-col"] .col{flex:1;align-self:flex-start}.sp-testimonial-help .col{margin-top:40px}.sp-testimonial-help.about-wrap [class$="-col"] .col+.col{margin-left:0}.sp-testimonial-help.about-wrap .help-section[class$="-col"] .col+.col{margin-left:20px}div.sp-testimonial-help .headline-feature.feature-video{position:relative;margin:40px 0;padding-bottom:56.25%;width:100%;max-width:100%;height:0;text-align:center}div.sp-testimonial-help .headline-feature.feature-video iframe{position:absolute;top:0;left:0;width:100%;height:100%}div.sp-testimonial-help .feature-section .sp-testimonial-feature{background-color:#fff;padding:20px 20px;border:1px solid #ddd}div.sp-testimonial-help .feature-section .sp-testimonial-feature h3{font-size:16px;margin-top:18px}div.sp-testimonial-help .feature-section i.sp-testimonial-font-icon{font-size:30px;display:block;color:#1595ce}div.sp-testimonial-help .sp-testimonial-features .feature-section span.dashicons{font-size:22px;color:#fff;background-color:#1595ce;width:28px;height:28px;line-height:28px;border-radius:50%;margin-right:10px}div.sp-testimonial-help .sp-testimonial-features .feature-section{margin-bottom:40px;margin-left:-2%}div.sp-testimonial-help .sp-testimonial-features .feature-section .sp-testimonial-feature h3{margin-top:0}div.sp-testimonial-help .sp-testimonial-features .feature-section .sp-testimonial-feature p{margin-bottom:0}div.sp-testimonial-help .sp-testimonial-features .feature-section .sp-testimonial-feature{box-shadow:0 0 10px 0 #ddd;margin:4px;border:0 solid}div.sp-testimonial-help .sp-testimonial-features .feature-section.three-col .col{min-width:31.3%;max-width:31.3%;margin-top:20px;padding-left:2%}div.sp-testimonial-help .sp-testimonial-features .sp-testimonial-subtitle{font-size:1.2em;margin-bottom:26px}div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer{position:fixed;bottom:0;background:#fff;width:calc(100% - 195px);z-index:9;margin-left:-25px;text-align:center;border:1px solid #dfdfdf;padding:15px 0;border-bottom:none}div.sp-testimonial-help .sp-testimonial-features h2{font-size:2.5em;font-weight:400}div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer h3{margin-top:17px;margin-bottom:20px}div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer a.button{margin:0 8px}.sp-testimonial-upgrade>h1{font-size:2.5em;color:#444;font-weight:300}.sp-testimonial-upgrade>h1 span{font-weight:400}.sp-testimonial-upgrade .about-text{margin-bottom:0}.sp-testimonial-upgrade ul{margin-top:0}.about-wrap.sp-testimonial-upgrade .about-text{min-height:60px}.about-wrap.sp-testimonial-upgrade hr{order:0;height:0;margin:0;border-top:1px solid rgba(0,0,0,.1)}.sp-testimonial-upgrade .sp-testimonial-features .feature-section{margin-bottom:40px;display:flex;flex-wrap:wrap}.sp-testimonial-upgrade .sp-testimonial-features .feature-section .sp-testimonial-feature h3{margin-top:0}.sp-testimonial-upgrade .sp-testimonial-features .feature-section .sp-testimonial-feature p{margin-bottom:0}.sp-testimonial-upgrade .sp-testimonial-features .feature-section .sp-testimonial-feature{box-shadow:0 0 10px 0 #ddd;margin:4px;border:0 solid}.sp-testimonial-upgrade .sp-testimonial-features .feature-section.three-col .col{min-width:32%;max-width:32%;margin-top:20px;display:flex;align-self:auto}.sp-testimonial-upgrade .sp-testimonial-features .sp-testimonial-subtitle{font-size:1.2em;margin-bottom:26px}.sp-testimonial-upgrade .sp-testimonial-features h2,.sp-testimonial-upgrade .sp-tfree-promo-video-title{font-size:2.2em;font-weight:400}.sp-testimonial-join-community h2{font-size:2em}.sp-testimonial-upgrade .sp-testimonial-upgrade-sticky-footer h3{margin-top:17px;margin-bottom:20px}.sp-testimonial-upgrade .sp-testimonial-upgrade-sticky-footer a.button{margin:0 8px}.sp-testimonial-upgrade .sp-testimonial-upgrade-btn{display:inline-block;padding:0 20px 0 0}.sp-testimonial-upgrade .sp-testimonial-upgrade-btn a,.sp-testimonial-upgrade a.sp-testimonial-upgrade-btn{text-decoration:none;text-align:center;font-size:16px}.sp-testimonial-upgrade .sp-testimonial-upgrade-btn a:focus{outline:0}.sp-testimonial-upgrade a.sp-testimonial-upgrade-btn,.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn:first-child a{background:#1595ce;padding:0 15px;line-height:46px;display:block;color:#fff;border-radius:3px;font-weight:500}.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn:last-child a{text-decoration:underline}.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn a i{margin-left:4px}.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn:last-child a i{font-size:14px}.sp-testimonial-upgrade a.sp-testimonial-upgrade-btn{display:inline-block}#sp-testimonial-review-notice{padding:15px 15px 15px 0;background-color:#fff;border-radius:3px;margin:20px 20px 0 0;margin-bottom:20px}#sp-testimonial-review-notice .sp-testimonial-plugin-icon{float:left;line-height:90px;text-align:center;width:100px;height:100px;margin-right:15px}#sp-testimonial-review-notice .sp-testimonial-plugin-icon img{max-width:83px;vertical-align:middle}#sp-testimonial-review-notice .sp-testimonial-notice-text{overflow:hidden}#sp-testimonial-review-notice .sp-testimonial-notice-text h3{font-size:24px;margin:0 0 5px;font-weight:400;line-height:1}#sp-testimonial-review-notice .sp-testimonial-notice-text p{margin:10px 0 10px 0;font-size:13px}#sp-testimonial-review-notice .sp-testimonial-notice-text p.sp-testimonial-review-actions{margin:10px 0 2px 0}#sp-testimonial-review-notice .sp-testimonial-notice-text .sp-testimonial-review-actions a{text-decoration:none;margin-right:8px;color:#63a37b;display:inline-block;position:relative}#sp-testimonial-review-notice .sp-testimonial-notice-text .sp-testimonial-review-actions a span{padding-right:2px}#sp-testimonial-review-notice .sp-testimonial-notice-text .sp-testimonial-review-actions a.button{color:#fff}@media (max-width:960px){div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer{width:calc(100%)}}@media screen and (max-width:782px){div.sp-testimonial-help .three-col .col{min-width:48%!important;max-width:48%!important;margin-left:0!important}}@media (max-width:500px){div.sp-testimonial-help .wp-badge{background-position-x:center}div.sp-testimonial-help .three-col .col{min-width:100%!important;max-width:100%!important;margin-top:1em}}.post-type-spt_shortcodes td.shortcode.column-shortcode input{border:1px solid #cbcbcb}.sp-testimonial-copy-btn{display:inline-block;height:15px;line-height:38px;margin-bottom:-4px;margin-right:-30px;cursor:pointer;position:relative;z-index:99}.sp-testimonial-after-copy-text{bottom:0;opacity:0;z-index:9999999;position:fixed;width:230px;left:180px;text-align:center;padding:15px 15px;line-height:15px;color:#fff;border-radius:3px;background:#32373c;border:1px solid #32373c}.sp-testimonial-after-copy-text .fa-check-circle{font-size:14px;margin-right:2px;color:#5db62e}.post-type-spt_shortcodes #sp-testimonial-show-preview{position:fixed;right:144px;bottom:30px;z-index:1001;width:155px;text-align:center;padding:10px 0;background:#54b154;color:#fff;border-radius:3px;text-decoration:none;display:block;font-weight:500;text-transform:uppercase;letter-spacing:.2px;margin:0;box-sizing:border-box;border-color:#44a944;overflow:hidden}.post-type-spt_testimonial #sp-testimonial-show-preview,.post-type-spt_testimonial_form #sp-testimonial-show-preview{display:none}div#sp_tpro_live_preview{padding:0;margin:-7px -13px 6px}#sp_tpro_shortcode_options.postbox #sp_tpro_live_preview .postbox-header{display:block}.sp-testimonial-column-image{width:50px;height:auto}.sprtf-gutenberg-shortcode.editor-styles-wrapper{padding:0;line-height:24px}.editor-styles-wrapper .sprtf_block_shortcode img{box-shadow:none}.block-editor-page .editor-styles-wrapper select.sprtf-shortcode-selector,.block-editor-page select.sprtf-shortcode-selector,.block-editor-page select.sprtf-shortcode-selector:focus,.block-editor-page select.sprtf-shortcode-selector:focus-visible{width:250px;padding:5px;border:1px solid #ccc;font-size:13px;padding-right:25px}.block-editor-page .editor-styles-wrapper i{font-style:normal}
1
+ .text-center{text-align:center}.spt-main-class .spftestimonial-header-inner h1{color:#444;font-size:22px;font-weight:600}.spt-main-class .spftestimonial-sticky .spftestimonial-header-inner{z-index:20}.spt-main-class .spftestimonial-metabox .spftestimonial-nav{position:inherit;float:none;width:100%;background:#f1f1f1}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li{display:inline-block}.spt-main-class .spftestimonial-nav ul li a{text-transform:uppercase;font-weight:600}.spt-main-class .spftestimonial-metabox .spftestimonial-content{margin-left:0}.spt-main-class .spftestimonial-metabox{margin:-6px -12px -12px -12px}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li a{background-color:#1595ce;font-size:14px;padding:15px 15px;line-height:1.4;color:#fff;border-right:1px solid #e2e2e1;font-weight:600;border-bottom:0}#sp_tpro_shortcode_options_new .spftestimonial-metabox .spftestimonial-nav ul li a{font-size:13px;text-transform:uppercase;padding:16px 15px}.spt-main-class .spftestimonial-nav ul li .spftestimonial-active:after{display:none}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li .spftestimonial-active{color:#444;background-color:#fff;box-shadow:0 3px 0 0 #1595ce inset}.spt-main-class .spftestimonial-metabox .spftestimonial-nav ul li .spftestimonial-active .fa{color:#1595ce}.spt-main-class .spftestimonial-metabox .spftestimonial-nav-background{display:none}.spt-main-class.spftestimonial-theme-light .spftestimonial-container{border:1px solid #ccd0d4}.spt-main-class.spftestimonial-theme-light .spftestimonial-header-inner{border-bottom:1px solid #ccd0d4}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav ul li a{color:#464646;background-color:#f5f5f5;border-top:0;border-right:0;border-bottom:1px solid #ccd0d4!important;margin-bottom:0;padding:15px 15px}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav ul li .spftestimonial-active{box-shadow:3px 0 0 0 #1595ce inset;background-color:#fff;color:#1595ce}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav ul ul li a{background-color:#f8fdff;padding:13px 15px 13px 24px}.spt-main-class.spftestimonial-theme-light .spftestimonial-nav-background{border-right:1px solid #ccd0d4}.spt-main-class .spftestimonial-desc-text,.spt-main-class .spftestimonial-text-subtitle{font-style:italic}.spftestimonial-metabox .sp-tpro-banner{background-color:#0a73a7;padding:22px 28px;overflow:hidden;background-image:-webkit-gradient(linear,left top,right top,from(#0a73a7),to(#1595ce));background-image:linear-gradient(to right,#0a73a7,#1595ce)}.spftestimonial-metabox .sp-tpro-logo{float:left}.spftestimonial-metabox .sp-tpro-logo img{display:block;width:182px}.spftestimonial-metabox .sp-tpro-short-links{float:right;line-height:30px}.spftestimonial-metabox .sp-tpro-short-links a{color:#fff;text-decoration:none;margin-left:16px;font-size:15px;font-weight:600}.spftestimonial-metabox .sp-tpro-short-links a i.fa{margin-right:7px}.sp-testimonial-shortcode-divider{height:20px;background:#f1f1f1;border-top:1px solid #ddd}.spftestimonial-metabox .tpro_shortcode{display:inline-flex;width:100%;background-color:#fffdfd}.tpro_shortcode .tpro-col-lg-6{border-right:1px solid #ddd;width:50%}.tpro_shortcode .tpro-col-lg-6 .tpro_shortcode_content{padding:42px 16px}.tpro_shortcode .tpro-col-lg-6:last-child .tpro_shortcode_content{padding:42px 16px 0 16px}.shortcode.column-shortcode .sp_tfree_input{border:1px solid #cbcbcb;cursor:pointer}.tpro_shortcode .tpro-col-lg-6 .tpro_shortcode_content .tpro-sc-code{background-color:rgba(82,179,217,.11);padding:10px 15px 10px 30px;display:inline-block;border:1px solid #d1e4ef;border-radius:2px;cursor:pointer;background-image:url(../images/copy.svg);background-size:16px;background-position:10px center;background-repeat:no-repeat}.tpro_shortcode .tpro-col-lg-6:last-child{border-right:none}.tpro_shortcode .tpro-col-lg-6 .tpro-shortcode-title{font-weight:500;font-size:17px!important;padding-top:0!important;color:#4c5158}.tpro_shortcode .tpro-col-lg-6 p{margin-top:2px;color:#4c5158}.tpro_shortcode .tpro-col-lg-6 .back-image{max-width:100%;display:block;margin:0 auto}.tpro_shortcode .tpro-col-lg-6 textarea{border-color:transparent;box-shadow:none;background-color:#eee;padding:4px 6px;resize:none;text-align:center;max-width:100%}.post-type-spt_shortcodes td.shortcode.column-shortcode input{border-width:1px;border-style:solid;border-color:#cbcbcb;cursor:pointer}@media (max-width:1200px){.spftestimonial-metabox .tpro_shortcode{display:block}.tpro_shortcode .tpro-col-lg-6{width:100%;display:block;border-bottom:1px solid #ddd;border-right:none}.tpro_shortcode .tpro-col-lg-6:last-child{padding-bottom:42px}}.sp-testimonial-shortcode{background-color:rgba(82,179,217,.11);padding:8px 12px;display:inline-block;margin-left:8px}.selectable{-webkit-touch-callout:all;-webkit-user-select:all;-khtml-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}.js #sp_tpro_meta_options.postbox .handlediv,.js #sp_tpro_meta_options.postbox .hndle,.js #sp_tpro_meta_options.postbox .postbox-header,.js #sp_tpro_shortcode_options.postbox .handlediv,.js #sp_tpro_shortcode_options.postbox .hndle,.js #sp_tpro_shortcode_options.postbox .postbox-header{display:none}.sp-testimonial-font-color .wp-picker-container,.sp-testimonial-font-load .spftestimonial--switcher,.spftestimonial-field-typography .spftestimonial--block .chosen-container,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--font-size,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--letter-spacing,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--line-height,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-bottom,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-left,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-right,.spftestimonial-field-typography .spftestimonial--block input.spftestimonial--margin-top{pointer-events:none;opacity:.6}.sp-testimonial-text-center{text-align:center}div.sp-testimonial-help .wp-badge{border:none;background:url(../images/icon-256.png) right no-repeat;background-size:128px 128px;box-shadow:none;height:auto;padding-top:128px}.about-wrap.sp-testimonial-help [class$="-col"]{display:flex;justify-content:space-between;flex-wrap:wrap}.about-wrap [class$="-col"]{display:flex;justify-content:space-between;flex-wrap:wrap}.sp-testimonial-help [class$="-col"] .col{flex:1;align-self:flex-start}.sp-testimonial-help .col{margin-top:40px}.sp-testimonial-help.about-wrap [class$="-col"] .col+.col{margin-left:0}.sp-testimonial-help.about-wrap .help-section[class$="-col"] .col+.col{margin-left:20px}div.sp-testimonial-help .headline-feature.feature-video{position:relative;margin:40px 0;padding-bottom:56.25%;width:100%;max-width:100%;height:0;text-align:center}div.sp-testimonial-help .headline-feature.feature-video iframe{position:absolute;top:0;left:0;width:100%;height:100%}div.sp-testimonial-help .feature-section .sp-testimonial-feature{background-color:#fff;padding:20px 20px;border:1px solid #ddd}div.sp-testimonial-help .feature-section .sp-testimonial-feature h3{font-size:16px;margin-top:18px}div.sp-testimonial-help .feature-section i.sp-testimonial-font-icon{font-size:30px;display:block;color:#1595ce}div.sp-testimonial-help .sp-testimonial-features .feature-section span.dashicons{font-size:22px;color:#fff;background-color:#1595ce;width:28px;height:28px;line-height:28px;border-radius:50%;margin-right:10px}div.sp-testimonial-help .sp-testimonial-features .feature-section{margin-bottom:40px;margin-left:-2%}div.sp-testimonial-help .sp-testimonial-features .feature-section .sp-testimonial-feature h3{margin-top:0}div.sp-testimonial-help .sp-testimonial-features .feature-section .sp-testimonial-feature p{margin-bottom:0}div.sp-testimonial-help .sp-testimonial-features .feature-section .sp-testimonial-feature{box-shadow:0 0 10px 0 #ddd;margin:4px;border:0 solid}div.sp-testimonial-help .sp-testimonial-features .feature-section.three-col .col{min-width:31.3%;max-width:31.3%;margin-top:20px;padding-left:2%}div.sp-testimonial-help .sp-testimonial-features .sp-testimonial-subtitle{font-size:1.2em;margin-bottom:26px}div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer{position:fixed;bottom:0;background:#fff;width:calc(100% - 195px);z-index:9;margin-left:-25px;text-align:center;border:1px solid #dfdfdf;padding:15px 0;border-bottom:none}div.sp-testimonial-help .sp-testimonial-features h2{font-size:2.5em;font-weight:400}div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer h3{margin-top:17px;margin-bottom:20px}div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer a.button{margin:0 8px}.sp-testimonial-upgrade>h1{font-size:2.5em;color:#444;font-weight:300}.sp-testimonial-upgrade>h1 span{font-weight:400}.sp-testimonial-upgrade .about-text{margin-bottom:0}.sp-testimonial-upgrade ul{margin-top:0}.about-wrap.sp-testimonial-upgrade .about-text{min-height:60px}.about-wrap.sp-testimonial-upgrade hr{order:0;height:0;margin:0;border-top:1px solid rgba(0,0,0,.1)}.sp-testimonial-upgrade .sp-testimonial-features .feature-section{margin-bottom:40px;display:flex;flex-wrap:wrap}.sp-testimonial-upgrade .sp-testimonial-features .feature-section .sp-testimonial-feature h3{margin-top:0}.sp-testimonial-upgrade .sp-testimonial-features .feature-section .sp-testimonial-feature p{margin-bottom:0}.sp-testimonial-upgrade .sp-testimonial-features .feature-section .sp-testimonial-feature{box-shadow:0 0 10px 0 #ddd;margin:4px;border:0 solid}.sp-testimonial-upgrade .sp-testimonial-features .feature-section.three-col .col{min-width:32%;max-width:32%;margin-top:20px;display:flex;align-self:auto}.sp-testimonial-upgrade .sp-testimonial-features .sp-testimonial-subtitle{font-size:1.2em;margin-bottom:26px}.sp-testimonial-upgrade .sp-testimonial-features h2,.sp-testimonial-upgrade .sp-tfree-promo-video-title{font-size:2.2em;font-weight:400}.sp-testimonial-join-community h2{font-size:2em}.sp-testimonial-upgrade .sp-testimonial-upgrade-sticky-footer h3{margin-top:17px;margin-bottom:20px}.sp-testimonial-upgrade .sp-testimonial-upgrade-sticky-footer a.button{margin:0 8px}.sp-testimonial-upgrade .sp-testimonial-upgrade-btn{display:inline-block;padding:0 20px 0 0}.sp-testimonial-upgrade .sp-testimonial-upgrade-btn a,.sp-testimonial-upgrade a.sp-testimonial-upgrade-btn{text-decoration:none;text-align:center;font-size:16px}.sp-testimonial-upgrade .sp-testimonial-upgrade-btn a:focus{outline:0}.sp-testimonial-upgrade a.sp-testimonial-upgrade-btn,.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn:first-child a{background:#1595ce;padding:0 15px;line-height:46px;display:block;color:#fff;border-radius:3px;font-weight:500}.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn:last-child a{text-decoration:underline}.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn a i{margin-left:4px}.sp-testimonial-upgrade ul li.sp-testimonial-upgrade-btn:last-child a i{font-size:14px}.sp-testimonial-upgrade a.sp-testimonial-upgrade-btn{display:inline-block}#sp-testimonial-review-notice{padding:15px 15px 15px 0;background-color:#fff;border-radius:3px;margin:20px 20px 0 0;margin-bottom:20px}#sp-testimonial-review-notice .sp-testimonial-plugin-icon{float:left;line-height:90px;text-align:center;width:125px}#sp-testimonial-review-notice .sp-testimonial-plugin-icon img{max-width:83px;vertical-align:middle}#sp-testimonial-review-notice .sp-testimonial-notice-text{overflow:hidden}#sp-testimonial-review-notice .sp-testimonial-notice-text h3{font-size:24px;margin:0 0 5px;font-weight:400;line-height:1}#sp-testimonial-review-notice .sp-testimonial-notice-text p{margin:10px 0 10px 0;font-size:13px}#sp-testimonial-review-notice .sp-testimonial-notice-text p.sp-testimonial-review-actions{margin:10px 0 2px 0}#sp-testimonial-review-notice .sp-testimonial-notice-text .sp-testimonial-review-actions a{text-decoration:none;margin-right:8px;color:#63a37b;display:inline-block;position:relative}#sp-testimonial-review-notice .sp-testimonial-notice-text .sp-testimonial-review-actions a span{padding-right:2px}#sp-testimonial-review-notice .sp-testimonial-notice-text .sp-testimonial-review-actions a.button{color:#fff}@media (max-width:960px){div.sp-testimonial-help .sp-testimonial-upgrade-sticky-footer{width:calc(100%)}}@media screen and (max-width:782px){div.sp-testimonial-help .three-col .col{min-width:48%!important;max-width:48%!important;margin-left:0!important}}@media (max-width:500px){div.sp-testimonial-help .wp-badge{background-position-x:center}div.sp-testimonial-help .three-col .col{min-width:100%!important;max-width:100%!important;margin-top:1em}}.post-type-spt_shortcodes td.shortcode.column-shortcode input{border:1px solid #cbcbcb}.sp-testimonial-copy-btn{display:inline-block;height:15px;line-height:38px;margin-bottom:-4px;margin-right:-30px;cursor:pointer;position:relative;z-index:99}.sp-testimonial-after-copy-text{bottom:0;opacity:0;z-index:9999999;position:fixed;width:230px;left:180px;text-align:center;padding:15px 15px;line-height:15px;color:#fff;border-radius:3px;background:#32373c;border:1px solid #32373c}.sp-testimonial-after-copy-text .fa-check-circle{font-size:14px;margin-right:2px;color:#5db62e}.post-type-spt_shortcodes #sp-testimonial-show-preview{position:fixed;right:144px;bottom:30px;z-index:1001;width:155px;text-align:center;padding:10px 0;background:#54b154;color:#fff;border-radius:3px;text-decoration:none;display:block;font-weight:500;text-transform:uppercase;letter-spacing:.2px;margin:0;box-sizing:border-box;border-color:#44a944;overflow:hidden}.post-type-spt_testimonial #sp-testimonial-show-preview,.post-type-spt_testimonial_form #sp-testimonial-show-preview{display:none}div#sp_tpro_live_preview{padding:0;margin:-7px -13px 6px}#sp_tpro_shortcode_options.postbox #sp_tpro_live_preview .postbox-header{display:block}.sp-testimonial-column-image{width:50px;height:auto}.sprtf-gutenberg-shortcode.editor-styles-wrapper{padding:0;line-height:24px}.editor-styles-wrapper .sprtf_block_shortcode img{box-shadow:none}.block-editor-page .editor-styles-wrapper select.sprtf-shortcode-selector,.block-editor-page select.sprtf-shortcode-selector,.block-editor-page select.sprtf-shortcode-selector:focus,.block-editor-page select.sprtf-shortcode-selector:focus-visible{width:250px;padding:5px;border:1px solid #ccc;font-size:13px;padding-right:25px}.block-editor-page .editor-styles-wrapper i{font-style:normal}#adminmenu #menu-posts-spt_testimonial li:nth-child(8) a,#adminmenu #menu-posts-spt_testimonial li:nth-child(8) a:hover{color:#11b916;font-weight:700}#adminmenu #menu-posts-spt_testimonial li a .sp-go-pro-icon{background-image:url(../images/rocket.svg);width:20px;height:20px;display:block;float:left;margin-right:1px;margin-left:-2px}
src/Admin/assets/images/rocket.svg ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="20px" height="20px" version="1.1" viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
3
+ <g fill="#11b916">
4
+ <path d="m975 243.75c0-10.352-8.4375-18.75-18.75-18.75-140.77 0.26172-250.05 6.3008-393.75 150-41.176 41.176-73.801 85.164-99.562 127.35-60.637-34.539-138.49-15.824-175.99 43.836l-58.836 93.75c-7.7266 12.301-3.3359 17.137 10.426 12.602 31.352-10.312 89.664-22.949 155.4-4.7617-8.3984 23.961-13.648 42.824-16.387 53.812-1.5391 6.0391 1.0117 14.512 5.3984 18.898l96.602 96.602c4.3867 4.3867 12.863 6.9375 18.863 5.3984 10.988-2.7383 29.852-7.9883 53.852-16.426 18.188 65.773 5.5859 124.09-4.7266 155.44-4.5391 13.727 0.30078 18.113 12.562 10.387l93.75-58.801c59.625-37.5 78.414-115.31 43.836-175.99 42.148-25.797 86.137-58.422 127.31-99.598 143.7-143.7 149.74-252.98 150-393.75zm-225 281.25c-41.398 0-75-33.602-75-75s33.602-75 75-75 75 33.602 75 75-33.602 75-75 75z"/>
5
+ <path d="m337.5 862.5c-37.5-37.5 0-112.5 0-112.5-98.477 32.812-82.051 137.48-88.949 188.25-1.4258 10.238 3 14.664 13.273 13.273 50.699-6.9727 155.36 9.4531 188.18-89.023 0 0-75 37.5-112.5 0z"/>
6
+ </g>
7
+ </svg>
src/Includes/TFREE_Functions.php CHANGED
@@ -87,7 +87,7 @@ class TFREE_Functions {
87
  add_submenu_page(
88
  'edit.php?post_type=spt_testimonial',
89
  __( 'Real Testimonials Pro', 'testimonial-free' ),
90
- '<span style="color:#f5dd11;">Upgrade To Pro</span>',
91
  'manage_options',
92
  $landing_page
93
  );
@@ -118,7 +118,7 @@ class TFREE_Functions {
118
  <div class="header-area">
119
  <div class="container">
120
  <div class="header-logo">
121
- <img src="<?php echo esc_url( SP_TFREE_URL . 'Admin/assets/images/testimonial-logo-2.svg' ); ?>" alt="">
122
  <span><?php echo esc_html( SP_TFREE_VERSION ); ?></span>
123
  </div>
124
  <div class="header-content">
87
  add_submenu_page(
88
  'edit.php?post_type=spt_testimonial',
89
  __( 'Real Testimonials Pro', 'testimonial-free' ),
90
+ '<span class="sp-go-pro-icon"></span>Go Pro',
91
  'manage_options',
92
  $landing_page
93
  );
118
  <div class="header-area">
119
  <div class="container">
120
  <div class="header-logo">
121
+ <img src="<?php echo esc_url( SP_TFREE_URL . 'Admin/assets/images/Testimonial-logo-2.svg' ); ?>" alt="">
122
  <span><?php echo esc_html( SP_TFREE_VERSION ); ?></span>
123
  </div>
124
  <div class="header-content">
testimonial-free.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Real Testimonials
13
  * Plugin URI: https://shapedplugin.com/real-testimonials/?ref=1
14
  * Description: Most Customizable and Powerful Testimonials Showcase Plugin for WordPress that allows you to manage and display Testimonials or Reviews on any page or widget.
15
- * Version: 2.5.7
16
  * Author: ShapedPlugin
17
  * Author URI: https://shapedplugin.com/
18
  * Text Domain: testimonial-free
@@ -37,7 +37,7 @@ function is_testimonial_pro_active() {
37
  }
38
 
39
  define( 'SP_TFREE_NAME', 'Real Testimonials' );
40
- define( 'SP_TFREE_VERSION', '2.5.7' );
41
  define( 'SP_TFREE_PATH', plugin_dir_path( __FILE__ ) . 'src/' );
42
  define( 'SP_TFREE_URL', plugin_dir_url( __FILE__ ) . 'src/' );
43
  define( 'SP_TFREE_BASENAME', plugin_basename( __FILE__ ) );
12
  * Plugin Name: Real Testimonials
13
  * Plugin URI: https://shapedplugin.com/real-testimonials/?ref=1
14
  * Description: Most Customizable and Powerful Testimonials Showcase Plugin for WordPress that allows you to manage and display Testimonials or Reviews on any page or widget.
15
+ * Version: 2.5.8
16
  * Author: ShapedPlugin
17
  * Author URI: https://shapedplugin.com/
18
  * Text Domain: testimonial-free
37
  }
38
 
39
  define( 'SP_TFREE_NAME', 'Real Testimonials' );
40
+ define( 'SP_TFREE_VERSION', '2.5.8' );
41
  define( 'SP_TFREE_PATH', plugin_dir_path( __FILE__ ) . 'src/' );
42
  define( 'SP_TFREE_URL', plugin_dir_url( __FILE__ ) . 'src/' );
43
  define( 'SP_TFREE_BASENAME', plugin_basename( __FILE__ ) );