PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.6
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.6
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / assets / js / jquery-pb-sitewide.js

jquery-pb-sitewide.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.6, at assets/js/jquery-pb-sitewide.js

414 lines 23.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Add a negative letter spacing to Profile Builder email customizer menus.
3 */
4
5 jQuery( document ).ready(function(){
6 jQuery('li a[href$="admin-email-customizer"]').css("letter-spacing", "-0.7px");
7 jQuery('li a[href$="user-email-customizer"]').css("letter-spacing", "-0.7px");
8 });
9
10 /*
11 * Set the width of the shortcode input based on an element that
12 * has the width of its contents
13 */
14 function setShortcodeInputWidth( $inputField ) {
15 var tempSpan = document.createElement('span');
16 tempSpan.className = "wppb-shortcode-temp";
17 tempSpan.innerHTML = $inputField.val();
18 document.body.appendChild(tempSpan);
19 var tempWidth = tempSpan.scrollWidth;
20 document.body.removeChild(tempSpan);
21
22 $inputField.outerWidth( tempWidth );
23 }
24
25 jQuery( document ).ready( function() {
26
27 jQuery('.wppb-shortcode.input').each( function() {
28 setShortcodeInputWidth( jQuery(this) );
29 });
30
31 jQuery('.wppb-shortcode.textarea').each( function() {
32 jQuery(this).outerHeight( jQuery(this)[0].scrollHeight + parseInt( jQuery(this).css('border-top-width') ) * 2 );
33 });
34
35 jQuery('.wppb-shortcode').on('click', function() {
36 this.select();
37 });
38 });
39
40
41 /* make sure that we don;t leave the page without having a title in the Post Title field, otherwise we loose data */
42 jQuery( function(){
43 if( jQuery( 'body').hasClass('post-new-php') ){
44
45 if( jQuery( 'body').hasClass('post-type-wppb-rf-cpt') || jQuery( 'body').hasClass('post-type-wppb-epf-cpt') || jQuery( 'body').hasClass('post-type-wppb-ul-cpt') ){
46
47 if( jQuery('#title').val() == '' ){
48 jQuery(window).on('beforeunload',function() {
49 return "This page is asking you to confirm that you want to leave - data you have entered may not be saved";
50 });
51 }
52
53 /* remove beforeunload event when entering a title or pressing the puclish button */
54 jQuery( '#title').on( 'keypress', function() {
55 jQuery(window).off('beforeunload');
56 });
57 jQuery( '#publish').on('click', function() {
58 jQuery(window).off('beforeunload');
59 });
60 }
61 }
62 });
63
64
65 /* show hide fields based on selected options */
66 jQuery( function(){
67 jQuery( '#wppb-rf-settings-args').on('change', '#redirect', function(){
68 if( jQuery(this).val() == 'Yes' ){
69 jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).show();
70 }
71 else{
72 jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).hide();
73 }
74 });
75
76 jQuery( '#wppb-epf-settings-args').on('change', '#redirect', function(){
77 if( jQuery(this).val() == 'Yes' ){
78 jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).show();
79 }
80 else{
81 jQuery( '.row-url, .row-display-messages', jQuery(this).parent().parent().parent()).hide();
82 }
83 });
84
85
86 jQuery( '#wppb-ul-settings-args').on('click', '#visible-only-to-logged-in-users_yes', function(){
87 jQuery( '.row-visible-to-following-roles', jQuery(this).parent().parent().parent().parent().parent().parent()).toggle();
88 });
89
90 jQuery( '#wppb-ul-faceted-args').on('change', '#facet-type', function(){
91 if( jQuery(this).val() == 'checkboxes' ){
92 jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).show();
93 }else if( jQuery(this).val() == 'select_multiple' ){
94 jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).hide();
95 jQuery( '.row-facet-behaviour #facet-behaviour', jQuery(this).parent().parent().parent()).val('expand');
96 }
97 else{
98 jQuery( '.row-facet-behaviour, .row-facet-limit', jQuery(this).parent().parent().parent()).hide();
99 jQuery( '.row-facet-behaviour #facet-behaviour', jQuery(this).parent().parent().parent()).val('narrow');
100 }
101 if( jQuery(this).val() == 'search' ){
102 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_country"] ').hide();
103 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_country"] ').hide();
104 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_state"] ').hide();
105 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_state"] ').hide();
106 }
107 else {
108 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_country"] ').show();
109 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_country"] ').show();
110 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="billing_state"] ').show();
111 jQuery( '#wppb-ul-faceted-args .row-facet-meta #facet-meta option[value="shipping_state"] ').show()
112 }
113
114 });
115
116 });
117
118 /*
119 * Dialog boxes throughout Profile Builder
120 */
121 jQuery( function() {
122 if ( jQuery.fn.dialog ) {
123 jQuery('.wppb-modal-box').dialog({
124 autoOpen: false,
125 modal: true,
126 draggable: false,
127 minWidth: 450,
128 minHeight: 450
129 });
130
131 jQuery('.wppb-open-modal-box').on('click', function (e) {
132 e.preventDefault();
133 jQuery('#' + jQuery(this).attr('href')).dialog('open');
134 });
135 }
136 });
137
138 /*
139 * Private Website Settings page
140 */
141
142 jQuery( function() {
143 if( jQuery( '.wppb-private-website' ).length != 0 ) {
144
145 wppbSelect2.call( jQuery('#private-website-redirect-to-login') );
146 wppbSelect2.call( jQuery('#private-website-allowed-pages') );
147
148 wppbDisablePrivatePageOptions(jQuery('#private-website-enable').val());
149
150 jQuery('#private-website-enable').on('change', function () {
151 wppbDisablePrivatePageOptions(jQuery(this).val());
152 });
153
154
155 function wppbDisablePrivatePageOptions(value) {
156 if (value == 'no') {
157 jQuery('#private-website-redirect-to-login').closest('tr').addClass("wppb-disabled");
158 jQuery('#private-website-allowed-pages').closest('tr').addClass("wppb-disabled");
159 jQuery('#private-website-menu-hide').addClass("wppb-disabled");
160 jQuery('#private-website-disable-rest-api').addClass("wppb-disabled");
161 jQuery('#private-website-allowed-paths').addClass("wppb-disabled");
162 }
163 else if (value == 'yes') {
164 jQuery('#private-website-redirect-to-login').closest('tr').removeClass("wppb-disabled");
165 jQuery('#private-website-allowed-pages').closest('tr').removeClass("wppb-disabled");
166 jQuery('#private-website-menu-hide').removeClass("wppb-disabled");
167 jQuery('#private-website-disable-rest-api').removeClass("wppb-disabled");
168 jQuery('#private-website-allowed-paths').removeClass("wppb-disabled");
169 }
170 }
171 }
172 });
173
174 /*
175 * Login Widget trigger html validation
176 */
177 jQuery( function() {
178 if( jQuery( ".widgets-php" ).length != 0 ){//should be in the admin widgets page
179 jQuery("#wpbody").on("click", ".widget-control-save", function () {
180 if (jQuery('.wppb-widget-url-field', jQuery(this).closest('form')).length != 0) {//we are in the PB widget
181 jQuery('.wppb-widget-url-field', jQuery(this).closest('form')).each(function () {
182 jQuery(this)[0].reportValidity();//reportValidity is the function that triggers the default html validation
183 });
184 }
185 });
186 }
187 });
188
189
190 /*
191 * Advanced Settings page (Toolbox)
192 */
193
194 jQuery( function() {
195 if( jQuery('body.profile-builder_page_profile-builder-toolbox-settings').length != 0 ) {
196
197 wppbSelect2.call( jQuery('#toolbox-bypass-ec') );
198
199 wppbSelect2.call( jQuery('#toolbox-restricted-emails'), {
200 tags: true,
201 width: '100%'
202 });
203
204 jQuery('.wppb-toolbox-switch').on('click', function () {
205 if (jQuery(this).prop('checked'))
206 jQuery('.wppb-toolbox-accordion').show();
207 else
208 jQuery('.wppb-toolbox-accordion').hide();
209 });
210
211 jQuery('#wppb-toolbox-send-credentials-hide').on('click', function () {
212 if (jQuery(this).prop('checked'))
213 jQuery('#toolbox-send-credentials-text').parent().hide();
214 else
215 jQuery('#toolbox-send-credentials-text').parent().show();
216 });
217
218 jQuery('#wppb-toolbox-redirect-users-hide').on('click', function () {
219 if (jQuery(this).prop('checked'))
220 jQuery('#toolbox-redirect-users-url').parent().show();
221 else
222 jQuery('#toolbox-redirect-users-url').parent().hide();
223 });
224
225
226 if (jQuery('.wppb-toolbox-switch').prop('checked'))
227 jQuery('.wppb-toolbox-accordion').show();
228
229 if (jQuery('#wppb-toolbox-send-credentials-hide').prop('checked'))
230 jQuery('#toolbox-send-credentials-text').parent().hide();
231
232 if (jQuery('#wppb-toolbox-redirect-users-hide').prop('checked'))
233 jQuery('#toolbox-redirect-users-url').parent().show();
234 }
235 });
236
237 // Fix for Select2 search not focusing
238 jQuery(document).on('select2:open', function() {
239 let allSelect2Found = document.querySelectorAll('.select2-container--open .select2-search__field');
240 allSelect2Found[allSelect2Found.length - 1].focus();
241 });
242
243 /**
244 * Add Link to PB Docs next to page/setting titles
245 * */
246 jQuery(document).ready( function () {
247 // email customizer
248 jQuery('.wp-admin.profile-builder_page_user-email-customizer .wrap > h2').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-email-customizer/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
249 jQuery('.wp-admin.profile-builder_page_admin-email-customizer .wrap > h2').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/admin-email-customizer/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
250
251 // roles editor
252 jQuery('.wp-admin.post-type-wppb-roles-editor .wrap h1.wp-heading-inline').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/general-settings/roles-editor/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
253
254 // manage form fields
255 jQuery('.wp-admin.profile-builder_page_manage-fields .wrap > h2').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/manage-user-fields/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
256 jQuery('html').on('wpbFormMetaLoaded', function() {
257 // conditional logic
258 jQuery('.wp-admin.profile-builder_page_manage-fields .update_container_wppb_manage_fields ul.mb-list-entry-fields li.row-conditional-logic-enabled .mb-right-column label').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/manage-user-fields/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Conditional_Logic" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 10px"></a>');
259 // visibility
260 jQuery('.wp-admin.profile-builder_page_manage-fields .update_container_wppb_manage_fields ul.mb-list-entry-fields li.row-visibility .mb-right-column').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/field-visibility/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Visibility" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 10px"></a>');
261 // user role visibility
262 jQuery('.wp-admin.profile-builder_page_manage-fields .update_container_wppb_manage_fields ul.mb-list-entry-fields li.row-user-role-visibility .mb-right-column .wck-checkboxes').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/field-visibility/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#User_Role_Visibility" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
263 // location visibility
264 jQuery('.wp-admin.profile-builder_page_manage-fields .update_container_wppb_manage_fields ul.mb-list-entry-fields li.row-location-visibility .mb-right-column .wck-checkboxes').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/field-visibility/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Location_Visibility" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
265 // admin approval
266 jQuery('.wp-admin.profile-builder_page_manage-fields .update_container_wppb_manage_fields ul.mb-list-entry-fields li.row-edit-profile-approved-by-admin .mb-right-column .wck-checkboxes label').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/edit-profile-approved-by-admin/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 10px"></a>');
267 });
268
269 // register forms
270 jQuery('.wp-admin.post-type-wppb-rf-cpt .wrap h1.wp-heading-inline').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/multiple-registration-forms/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
271
272 // edit profile forms
273 jQuery('.wp-admin.post-type-wppb-epf-cpt .wrap h1.wp-heading-inline').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/multiple-edit-profile-forms/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
274
275 // user-listing
276 jQuery('.wp-admin.post-type-wppb-ul-cpt .wrap h1.wp-heading-inline').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
277 // ul settings
278 jQuery('.wp-admin.post-type-wppb-ul-cpt #wppb_ul_page_settings').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#User_Listing_Settings" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
279 // ul faceted menus
280 jQuery('.wp-admin.post-type-wppb-ul-cpt #wppb_ul_faceted_settings').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Faceted_Menus" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
281 // ul search settings
282 jQuery('.wp-admin.post-type-wppb-ul-cpt #wppb_ul_search_settings').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Search_Settings" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
283 // ul themes
284 jQuery('.wp-admin.post-type-wppb-ul-cpt #wppb-ul-themes-settings .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Themes" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
285 // ul all users template
286 jQuery('.wp-admin.post-type-wppb-ul-cpt #wppb-ul-templates .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#The_All-Userlisting_Template" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
287 // ul single user template
288 jQuery('.wp-admin.post-type-wppb-ul-cpt #wppb-single-ul-templates .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/user-listing/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#The_Single-Userlisting_Template" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
289
290 // custom redirects
291 jQuery('.wp-admin.profile-builder_page_custom-redirects .wrap > h2').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/custom-redirects/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
292 // cr individual user
293 jQuery('.wp-admin.profile-builder_page_custom-redirects #wppb_custom_redirects_user .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/custom-redirects/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Individual_User_Redirects" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
294 // cr user role based
295 jQuery('.wp-admin.profile-builder_page_custom-redirects #wppb_custom_redirects_role .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/custom-redirects/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#User_Role_based_Redirects" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
296 // cr global
297 jQuery('.wp-admin.profile-builder_page_custom-redirects #wppb_custom_redirects_global .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/custom-redirects/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Global_Redirects" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
298 // cr default wp pages
299 jQuery('.wp-admin.profile-builder_page_custom-redirects #wppb_custom_redirects_default_wp_pages .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/modules/custom-redirects/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs#Redirect_Default_WordPress_Forms_and_Pages" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
300
301 // social connect
302 jQuery('.wp-admin.profile-builder_page_wppb-social-connect .wrap > h2').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/social-connect/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
303
304 // multi-step forms
305 jQuery('.wp-admin.profile-builder_page_manage-fields #wppb-msf-side .inside').prepend('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/multi-step-forms/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>');
306
307 // labels edit
308 jQuery('.wp-admin.profile-builder_page_pb-labels-edit .wrap > h2').append('<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/labels-edit/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px"></a>');
309 });
310
311
312 /**
313 * Form Designs Feature --> Admin UI
314 *
315 * - Activate new Design
316 * - Preview Modal
317 * - Modal Image Slider controls
318 *
319 * */
320
321 jQuery( document ).ready(function(){
322
323 // Activate Design
324 jQuery('.wppb-forms-design-activate button.activate').click(function ( element ) {
325 let themeID, i, allDesigns;
326
327 themeID = jQuery(element.target).data('theme-id');
328
329 jQuery('#wppb-active-form-design').val(themeID);
330
331 allDesigns = jQuery('.wppb-forms-design');
332 for (i = 0; i < allDesigns.length; i++) {
333 if ( jQuery(allDesigns[i]).hasClass('active')) {
334 jQuery('.wppb-forms-design-title strong', allDesigns[i] ).hide();
335 jQuery(allDesigns[i]).removeClass('active');
336 }
337 }
338 jQuery('#wppb-forms-design-browser .wppb-forms-design#'+themeID).addClass('active');
339
340 });
341
342 jQuery('.wppb-forms-design-preview').click(function (e) {
343 let themeID = e.target.id.replace('-info', '');
344 displayDesignPreviewModal(themeID);
345 });
346
347 jQuery('.wppb-slideshow-button').click(function (e) {
348 let themeID = jQuery(e.target).data('theme-id'),
349 direction = jQuery(e.target).data('slideshow-direction'),
350 currentSlide = jQuery('#modal-' + themeID + ' .wppb-forms-design-preview-image.active'),
351 changeSlideshowImage = window[direction+'SlideshowImage'];
352
353 changeSlideshowImage(currentSlide,themeID);
354 });
355
356 });
357
358 function displayDesignPreviewModal( themeID ) {
359 jQuery('#modal-' + themeID).dialog({
360 resizable: false,
361 height: 'auto',
362 width: 1200,
363 modal: true,
364 closeOnEscape: true,
365 open: function () {
366 jQuery('.ui-widget-overlay').bind('click',function () {
367 jQuery('#modal-' + themeID).dialog('close');
368 })
369 },
370 close: function () {
371 let allImages = jQuery('.wppb-forms-design-preview-image');
372
373 allImages.each( function() {
374 if ( jQuery(this).is(':first-child') && !jQuery(this).hasClass('active') ) {
375 jQuery(this).addClass('active');
376 }
377 else if ( !jQuery(this).is(':first-child') ) {
378 jQuery(this).removeClass('active');
379 }
380 });
381
382 jQuery('.wppb-forms-design-sildeshow-previous').addClass('disabled');
383 jQuery('.wppb-forms-design-sildeshow-next').removeClass('disabled');
384 }
385 });
386 return false;
387 }
388
389 function nextSlideshowImage( currentSlide, themeID ){
390 if ( currentSlide.next().length > 0 ) {
391 currentSlide.removeClass('active');
392 currentSlide.next().addClass('active');
393
394 jQuery('#modal-' + themeID + ' .wppb-forms-design-sildeshow-previous').removeClass('disabled');
395
396 if ( currentSlide.next().next().length <= 0 )
397 jQuery('#modal-' + themeID + ' .wppb-forms-design-sildeshow-next').addClass('disabled');
398
399 }
400 }
401
402 function previousSlideshowImage( currentSlide, themeID ){
403 if ( currentSlide.prev().length > 0 ) {
404 currentSlide.removeClass('active');
405 currentSlide.prev().addClass('active');
406
407 jQuery('#modal-' + themeID + ' .wppb-forms-design-sildeshow-next').removeClass('disabled');
408
409 if ( currentSlide.prev().prev().length <= 0 )
410 jQuery('#modal-' + themeID + ' .wppb-forms-design-sildeshow-previous').addClass('disabled');
411
412 }
413 }
414