PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.8
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.8
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 / add-ons-free / labels-edit / assets / js / init.js

init.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.8, at add-ons-free/labels-edit/assets/js/init.js

70 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery( document ).ready( function() {
2 wppb_le_chosen();
3 wppb_le_select_option();
4 wppb_le_textarea_option();
5 } );
6
7 function wppb_le_chosen() {
8 jQuery( ".chosen-select, .mb-select" ).chosen( {
9 disable_search_threshold: 5,
10 no_results_text: "Nothing found!",
11 width: "80%"
12 } );
13 }
14
15 function wppb_le_select_option() {
16 jQuery( document ).on( 'change', '#pble-label', function() {
17 wppb_le_description( jQuery( this ) );
18 } );
19 }
20
21 function wppb_le_description( $this ) {
22 if( $this.val() == "" ) {
23 $this.siblings( '.description' ).text( "Here you will see the default label so you can copy it." );
24 } else {
25 $this.siblings( '.description' ).text( $this.val() );
26 }
27 }
28
29 function wppb_le_textarea_option() {
30 jQuery( document ).on( 'change', '.wck-add-form #pble-label', function() {
31 wppb_le_textarea( jQuery( this ) );
32 } );
33 }
34
35 function wppb_le_textarea( $this ) {
36 jQuery( '.wck-add-form .mb-textarea' ).text( $this.val() );
37 }
38
39 function wppb_le_delete_all_fields(event, delete_all_button_id, nonce) {
40 event.preventDefault();
41 $deleteButton = jQuery('#' + delete_all_button_id);
42
43 var response = confirm( "Are you sure you want to delete all items?" );
44
45 if( response == true ) {
46 $tableParent = $deleteButton.parents('table');
47
48 var meta = $tableParent.attr('id').replace('container_', '');
49 var post_id = parseInt( $tableParent.attr('post') );
50
51 $tableParent.parent().css({'opacity':'0.4', 'position':'relative'}).append('<div id="mb-ajax-loading"></div>');
52
53 jQuery.post( ajaxurl, { action: "pble_delete_all_fields", meta: meta, id: post_id, _ajax_nonce: nonce }, function(response) {
54
55 /* refresh the list */
56 jQuery.post( wppbWckAjaxurl, { action: "wck_refresh_list"+meta, meta: meta, id: post_id}, function(response) {
57 jQuery('#container_'+meta).replaceWith(response);
58 $tableParent = jQuery('#container_'+meta);
59
60 $tableParent.find('tbody td').css('width', function(){ return jQuery(this).width() });
61
62 mb_sortable_elements();
63 $tableParent.parent().css('opacity','1');
64
65 jQuery('#mb-ajax-loading').remove();
66 });
67
68 });
69 }
70 }