Changeset 12528
- Timestamp:
- 01/18/2020 12:42:34 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/admin/js/admin.js
r11547 r12528 60 60 holder.appendChild( newDiv ); 61 61 62 // re-initialize the sortable ui62 // Re-initialize the sortable ui. 63 63 enableSortableFieldOptions( forWhat ); 64 64 65 // set focus on newly created element65 // Set focus on newly created element. 66 66 document.getElementById(forWhat + '_option' + theId).focus(); 67 67 … … 105 105 106 106 document.getElementById( id ).style.display = 'none'; 107 // the field id is [fieldtype]option[iterator] and not [fieldtype]div[iterator]107 // The field id is [fieldtype]option[iterator] and not [fieldtype]div[iterator]. 108 108 var field_id = id.replace( 'div', 'option' ); 109 109 document.getElementById( field_id ).value = ''; … … 191 191 jQuery( document ).ready( function() { 192 192 193 // Set focus in Field Title, if we're on the right page 193 // Set focus in Field Title, if we're on the right page. 194 194 jQuery( '#bp-xprofile-add-field #title' ).focus(); 195 195 … … 200 200 } ); 201 201 202 // Set up deleting options ajax 202 // Set up deleting options ajax. 203 203 jQuery( 'a.ajax-option-delete' ).on( 'click', function() { 204 204 var theId = this.id.split( '-' ); … … 214 214 } ); 215 215 216 // Set up the sort order change actions 216 // Set up the sort order change actions. 217 217 jQuery( '[id^="sort_order_"]' ).change(function() { 218 218 if ( jQuery( this ).val() !== 'custom' ) { … … 223 223 }); 224 224 225 // Show object if JS is enabled 225 // Show object if JS is enabled. 226 226 jQuery( 'ul#field-group-tabs' ).show(); 227 227 228 // Allow reordering of field group tabs 228 // Allow reordering of field group tabs. 229 229 jQuery( 'ul#field-group-tabs' ).sortable( { 230 230 cursor: 'move', … … 245 245 }).disableSelection(); 246 246 247 // Allow reordering of fields within groups 247 // Allow reordering of fields within groups. 248 248 jQuery( 'fieldset.field-group' ).sortable({ 249 249 cursor: 'move', … … 264 264 }) 265 265 266 // Disallow text selection 266 // Disallow text selection. 267 267 .disableSelection(); 268 268 269 // Allow reordering of field options 269 // Allow reordering of field options. 270 270 enableSortableFieldOptions( jQuery('#fieldtype :selected').val() ); 271 271 272 // Handle title placeholder text the WordPress way 272 // Handle title placeholder text the WordPress way. 273 273 titleHint( 'title' ); 274 274 … … 314 314 } ); 315 315 316 // tabs init with a custom tab template and an "add" callback filling in the content 316 // tabs init with a custom tab template and an "add" callback filling in the content. 317 317 var $tab_items, 318 318 $tabs = jQuery( '#tabs' ).tabs(); … … 328 328 tolerance: 'pointer', 329 329 330 // When field is dropped on tab 330 // When field is dropped on tab. 331 331 drop: function( ev, ui ) { 332 332 var $item = jQuery(this), // The tab 333 333 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); // The tab body 334 334 335 // Remove helper class 335 // Remove helper class. 336 336 jQuery($item).removeClass( 'drop-candidate' ); 337 337 338 // Hide field, change selected tab, and show new placement 338 // Hide field, change selected tab, and show new placement. 339 339 ui.draggable.hide( 'slow', function() { 340 340 341 // Select new tab as current 341 // Select new tab as current. 342 342 $tabs.tabs( 'option', 'active', $tab_items.index( $item ) ); 343 343 344 // Show new placement 344 // Show new placement. 345 345 jQuery(this).appendTo($list).show( 'slow' ).animate( {opacity: '1'}, 500 ); 346 346 347 // Refresh $list variable 347 // Refresh $list variable. 348 348 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 349 349 jQuery($list).find( 'p.nofields' ).hide( 'slow' ); 350 350 351 // Ajax update field locations and orders 351 // Ajax update field locations and orders. 352 352 jQuery.post( ajaxurl, { 353 353 action: 'xprofile_reorder_fields',
Note: See TracChangeset
for help on using the changeset viewer.