Changeset 37347 for trunk/src/wp-admin/js/customize-nav-menus.js
- Timestamp:
- 05/02/2016 07:52:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-nav-menus.js
r36908 r37347 994 994 initialize: function( id, options ) { 995 995 var control = this; 996 control.expanded = new api.Value( false ); 997 control.expandedArgumentsQueue = []; 998 control.expanded.bind( function( expanded ) { 999 var args = control.expandedArgumentsQueue.shift(); 1000 args = $.extend( {}, control.defaultExpandedArguments, args ); 1001 control.onChangeExpanded( expanded, args ); 1002 }); 996 1003 api.Control.prototype.initialize.call( control, id, options ); 997 1004 control.active.validate = function() { … … 1371 1378 1372 1379 /** 1380 * @since 4.6.0 1381 * 1382 * @param {Boolean} expanded 1383 * @param {Object} [params] 1384 * @returns {Boolean} false if state already applied 1385 */ 1386 _toggleExpanded: api.Section.prototype._toggleExpanded, 1387 1388 /** 1389 * @since 4.6.0 1390 * 1391 * @param {Object} [params] 1392 * @returns {Boolean} false if already expanded 1393 */ 1394 expand: api.Section.prototype.expand, 1395 1396 /** 1373 1397 * Expand the menu item form control. 1374 1398 * … … 1379 1403 */ 1380 1404 expandForm: function( params ) { 1381 this.toggleForm( true, params ); 1382 }, 1405 this.expand( params ); 1406 }, 1407 1408 /** 1409 * @since 4.6.0 1410 * 1411 * @param {Object} [params] 1412 * @returns {Boolean} false if already collapsed 1413 */ 1414 collapse: api.Section.prototype.collapse, 1383 1415 1384 1416 /** … … 1391 1423 */ 1392 1424 collapseForm: function( params ) { 1393 this. toggleForm( false,params );1425 this.collapse( params ); 1394 1426 }, 1395 1427 … … 1397 1429 * Expand or collapse the menu item control. 1398 1430 * 1431 * @deprecated this is poor naming, and it is better to directly set control.expanded( showOrHide ) 1399 1432 * @since 4.5.0 Added params.completeCallback. 1400 1433 * … … 1404 1437 */ 1405 1438 toggleForm: function( showOrHide, params ) { 1439 if ( typeof showOrHide === 'undefined' ) { 1440 showOrHide = ! this.expanded(); 1441 } 1442 if ( showOrHide ) { 1443 this.expand( params ); 1444 } else { 1445 this.collapse( params ); 1446 } 1447 }, 1448 1449 /** 1450 * Expand or collapse the menu item control. 1451 * 1452 * @since 4.6.0 1453 * @param {boolean} [showOrHide] - If not supplied, will be inverse of current visibility 1454 * @param {Object} [params] - Optional params. 1455 * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating. 1456 */ 1457 onChangeExpanded: function( showOrHide, params ) { 1406 1458 var self = this, $menuitem, $inside, complete; 1407 1459
Note: See TracChangeset
for help on using the changeset viewer.