1jQuery(document).ready(function() { 2 3 jQuery('.um-profile.um-viewing .um-profile-body .um-row').each(function(){ 4 var this_row = jQuery(this); 5 if ( this_row.find('.um-field').length == 0 ) { 6 this_row.prev('.um-row-heading').remove(); 7 this_row.remove(); 8 } 9 }); 10 11 if ( jQuery('.um-profile.um-viewing .um-profile-body').length && jQuery('.um-profile.um-viewing .um-profile-body').find('.um-field').length == 0 ) { 12 jQuery('.um-profile.um-viewing .um-profile-body').find('.um-row-heading,.um-row').remove(); 13 jQuery('.um-profile-note').show(); 14 } 15 16 jQuery( document.body ).on( 'click', '.um-profile-save', function(e){ 17 e.preventDefault(); 18 jQuery(this).parents('.um.um-profile.um-editing').find('form').trigger('submit'); 19 return false; 20 }); 21 22 jQuery( document.body ).on( 'click', '.um-profile-edit-a', function(e){ 23 jQuery(this).addClass('active'); 24 }); 25 26 jQuery( document.body ).on( 'click', '.um-cover a.um-cover-add, .um-photo a', function(e){ 27 e.preventDefault(); 28 }); 29 30 jQuery( document.body ).on('click', '.um-photo-modal', function(e){ 31 e.preventDefault(); 32 var photo_src = jQuery(this).attr('data-src'); 33 um_new_modal('um_view_photo', 'fit', true, photo_src ); 34 return false; 35 }); 36 37 jQuery(document.body).on('click', '.um-reset-profile-photo', function(e) { 38 let $obj = jQuery(this); 39 let user_id = $obj.data('user_id'); 40 41 let $dropdownItem = $obj.parents('ul').find('.um-manual-trigger[data-parent=".um-profile-photo"]'); 42 let altText = $dropdownItem.data('alt_text'); 43 $dropdownItem.data( 'alt_text', $dropdownItem.text() ).text( altText ); 44 45 jQuery('.um-profile-photo-img img').attr( 'src', $obj.data( 'default_src' ) ); 46 47 jQuery.ajax({ 48 url: wp.ajax.settings.url, 49 type: 'post', 50 data: { 51 action:'um_delete_profile_photo', 52 user_id: user_id, 53 nonce: um_scripts.nonce 54 }, 55 success: function() { 56 $obj.removeClass('um-is-visible').hide(); 57 } 58 }); 59 60 UM.dropdown.hideAll(); 61 return false; 62 }); 63 64 jQuery(document.body).on('click', '.um-reset-cover-photo', function(e){ 65 let $obj = jQuery(this); 66 let user_id = $obj.data('user_id'); 67 68 let $dropdownItem = $obj.parents('ul').find('.um-manual-trigger[data-parent=".um-cover"]'); 69 let altText = $dropdownItem.data('alt_text'); 70 $dropdownItem.data( 'alt_text', $dropdownItem.text() ).text( altText ); 71 72 jQuery('.um-cover-overlay').hide(); 73 jQuery('.um-cover-e').html('<a href="javascript:void(0);" class="um-cover-add" style="height: 370px;"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="' + wp.i18n.__( 'Upload a cover photo', 'ultimate-member' ) + '"></i></span></a>'); 74 75 um_responsive(); 76 77 jQuery.ajax({ 78 url: wp.ajax.settings.url, 79 type: 'post', 80 data: { 81 action: 'um_delete_cover_photo', 82 user_id: user_id, 83 nonce: um_scripts.nonce 84 }, 85 success: function() { 86 $obj.removeClass('um-is-visible').hide(); 87 } 88 }); 89 90 UM.dropdown.hideAll(); 91 return false; 92 }); 93 94 // Bio characters limit 95 jQuery( document.body ).on( 'change keyup', '#um-meta-bio', function() { 96 if ( typeof jQuery(this).val() !== 'undefined' ) { 97 let um_bio_limit = jQuery(this).data( 'character-limit' ); 98 let bio_html = jQuery(this).data( 'html' ); 99 100 let remaining = um_bio_limit - jQuery(this).val().length; 101 if ( parseInt( bio_html ) === 1 ) { 102 remaining = um_bio_limit - jQuery(this).val().replace(/(<([^>]+)>)/ig,'').length; 103 } 104 105 remaining = remaining < 0 ? 0 : remaining; 106 107 jQuery( 'span.um-meta-bio-character span.um-bio-limit' ).text( remaining ); 108 let color = remaining < 5 ? 'red' : ''; 109 jQuery('span.um-meta-bio-character').css( 'color', color ); 110 } 111 }); 112 jQuery( '#um-meta-bio' ).trigger('change'); 113 114 // Biography (description) fields syncing. 115 jQuery( '.um-profile form' ).each( function () { 116 let descKey = jQuery(this).data('description_key'); 117 if ( jQuery(this).find( 'textarea[name="' + descKey + '"]' ).length ) { 118 jQuery( document.body ).on( 'change input', 'textarea[name="' + descKey + '"]', function ( e ) { 119 jQuery(this).parents( 'form' ).find( 'textarea[name="' + descKey + '"]' ).each( function() { 120 jQuery(this).val( e.currentTarget.value ); 121 if ( jQuery('#um-meta-bio')[0] !== e.currentTarget && jQuery('#um-meta-bio')[0] === jQuery(this)[0] ) { 122 jQuery(this).trigger('change'); 123 } 124 }); 125 }); 126 } 127 }); 128 129 130 jQuery( '.um-profile-edit a.um_delete-item' ).on( 'click', function(e) { 131 e.preventDefault(); 132 133 if ( ! confirm( wp.i18n.__( 'Are you sure that you want to delete this user?', 'ultimate-member' ) ) ) { 134 return false;
135 } 136 }); 137 138 /** 139 * Fix profile nav links for iPhone 140 * @see https://www.html5rocks.com/en/mobile/touchandmouse/ 141 */ 142 jQuery( '.um-profile-nav a' ).on( 'touchend', function(e) { 143 jQuery( e.currentTarget).trigger( "click" ); 144 }); 145});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.