Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-admin/js
File: customize-widgets.js
* @return {number}
[1500] Fix | Delete
*/
[1501] Fix | Delete
getWidgetSidebarPosition: function() {
[1502] Fix | Delete
var sidebarWidgetIds, position;
[1503] Fix | Delete
[1504] Fix | Delete
sidebarWidgetIds = this.getSidebarWidgetsControl().setting();
[1505] Fix | Delete
position = _.indexOf( sidebarWidgetIds, this.params.widget_id );
[1506] Fix | Delete
[1507] Fix | Delete
if ( position === -1 ) {
[1508] Fix | Delete
return;
[1509] Fix | Delete
}
[1510] Fix | Delete
[1511] Fix | Delete
return position;
[1512] Fix | Delete
},
[1513] Fix | Delete
[1514] Fix | Delete
/**
[1515] Fix | Delete
* Move widget up one in the sidebar
[1516] Fix | Delete
*/
[1517] Fix | Delete
moveUp: function() {
[1518] Fix | Delete
this._moveWidgetByOne( -1 );
[1519] Fix | Delete
},
[1520] Fix | Delete
[1521] Fix | Delete
/**
[1522] Fix | Delete
* Move widget up one in the sidebar
[1523] Fix | Delete
*/
[1524] Fix | Delete
moveDown: function() {
[1525] Fix | Delete
this._moveWidgetByOne( 1 );
[1526] Fix | Delete
},
[1527] Fix | Delete
[1528] Fix | Delete
/**
[1529] Fix | Delete
* @private
[1530] Fix | Delete
*
[1531] Fix | Delete
* @param {number} offset 1|-1
[1532] Fix | Delete
*/
[1533] Fix | Delete
_moveWidgetByOne: function( offset ) {
[1534] Fix | Delete
var i, sidebarWidgetsSetting, sidebarWidgetIds, adjacentWidgetId;
[1535] Fix | Delete
[1536] Fix | Delete
i = this.getWidgetSidebarPosition();
[1537] Fix | Delete
[1538] Fix | Delete
sidebarWidgetsSetting = this.getSidebarWidgetsControl().setting;
[1539] Fix | Delete
sidebarWidgetIds = Array.prototype.slice.call( sidebarWidgetsSetting() ); // Clone.
[1540] Fix | Delete
adjacentWidgetId = sidebarWidgetIds[i + offset];
[1541] Fix | Delete
sidebarWidgetIds[i + offset] = this.params.widget_id;
[1542] Fix | Delete
sidebarWidgetIds[i] = adjacentWidgetId;
[1543] Fix | Delete
[1544] Fix | Delete
sidebarWidgetsSetting( sidebarWidgetIds );
[1545] Fix | Delete
},
[1546] Fix | Delete
[1547] Fix | Delete
/**
[1548] Fix | Delete
* Toggle visibility of the widget move area
[1549] Fix | Delete
*
[1550] Fix | Delete
* @param {boolean} [showOrHide]
[1551] Fix | Delete
*/
[1552] Fix | Delete
toggleWidgetMoveArea: function( showOrHide ) {
[1553] Fix | Delete
var self = this, $moveWidgetArea;
[1554] Fix | Delete
[1555] Fix | Delete
$moveWidgetArea = this.container.find( '.move-widget-area' );
[1556] Fix | Delete
[1557] Fix | Delete
if ( typeof showOrHide === 'undefined' ) {
[1558] Fix | Delete
showOrHide = ! $moveWidgetArea.hasClass( 'active' );
[1559] Fix | Delete
}
[1560] Fix | Delete
[1561] Fix | Delete
if ( showOrHide ) {
[1562] Fix | Delete
// Reset the selected sidebar.
[1563] Fix | Delete
$moveWidgetArea.find( '.selected' ).removeClass( 'selected' );
[1564] Fix | Delete
[1565] Fix | Delete
$moveWidgetArea.find( 'li' ).filter( function() {
[1566] Fix | Delete
return $( this ).data( 'id' ) === self.params.sidebar_id;
[1567] Fix | Delete
} ).addClass( 'selected' );
[1568] Fix | Delete
[1569] Fix | Delete
this.container.find( '.move-widget-btn' ).prop( 'disabled', true );
[1570] Fix | Delete
}
[1571] Fix | Delete
[1572] Fix | Delete
$moveWidgetArea.toggleClass( 'active', showOrHide );
[1573] Fix | Delete
},
[1574] Fix | Delete
[1575] Fix | Delete
/**
[1576] Fix | Delete
* Highlight the widget control and section
[1577] Fix | Delete
*/
[1578] Fix | Delete
highlightSectionAndControl: function() {
[1579] Fix | Delete
var $target;
[1580] Fix | Delete
[1581] Fix | Delete
if ( this.container.is( ':hidden' ) ) {
[1582] Fix | Delete
$target = this.container.closest( '.control-section' );
[1583] Fix | Delete
} else {
[1584] Fix | Delete
$target = this.container;
[1585] Fix | Delete
}
[1586] Fix | Delete
[1587] Fix | Delete
$( '.highlighted' ).removeClass( 'highlighted' );
[1588] Fix | Delete
$target.addClass( 'highlighted' );
[1589] Fix | Delete
[1590] Fix | Delete
setTimeout( function() {
[1591] Fix | Delete
$target.removeClass( 'highlighted' );
[1592] Fix | Delete
}, 500 );
[1593] Fix | Delete
}
[1594] Fix | Delete
} );
[1595] Fix | Delete
[1596] Fix | Delete
/**
[1597] Fix | Delete
* wp.customize.Widgets.WidgetsPanel
[1598] Fix | Delete
*
[1599] Fix | Delete
* Customizer panel containing the widget area sections.
[1600] Fix | Delete
*
[1601] Fix | Delete
* @since 4.4.0
[1602] Fix | Delete
*
[1603] Fix | Delete
* @class wp.customize.Widgets.WidgetsPanel
[1604] Fix | Delete
* @augments wp.customize.Panel
[1605] Fix | Delete
*/
[1606] Fix | Delete
api.Widgets.WidgetsPanel = api.Panel.extend(/** @lends wp.customize.Widgets.WigetsPanel.prototype */{
[1607] Fix | Delete
[1608] Fix | Delete
/**
[1609] Fix | Delete
* Add and manage the display of the no-rendered-areas notice.
[1610] Fix | Delete
*
[1611] Fix | Delete
* @since 4.4.0
[1612] Fix | Delete
*/
[1613] Fix | Delete
ready: function () {
[1614] Fix | Delete
var panel = this;
[1615] Fix | Delete
[1616] Fix | Delete
api.Panel.prototype.ready.call( panel );
[1617] Fix | Delete
[1618] Fix | Delete
panel.deferred.embedded.done(function() {
[1619] Fix | Delete
var panelMetaContainer, noticeContainer, updateNotice, getActiveSectionCount, shouldShowNotice;
[1620] Fix | Delete
panelMetaContainer = panel.container.find( '.panel-meta' );
[1621] Fix | Delete
[1622] Fix | Delete
// @todo This should use the Notifications API introduced to panels. See <https://core.trac.wordpress.org/ticket/38794>.
[1623] Fix | Delete
noticeContainer = $( '<div></div>', {
[1624] Fix | Delete
'class': 'no-widget-areas-rendered-notice',
[1625] Fix | Delete
'role': 'alert'
[1626] Fix | Delete
});
[1627] Fix | Delete
panelMetaContainer.append( noticeContainer );
[1628] Fix | Delete
[1629] Fix | Delete
/**
[1630] Fix | Delete
* Get the number of active sections in the panel.
[1631] Fix | Delete
*
[1632] Fix | Delete
* @return {number} Number of active sidebar sections.
[1633] Fix | Delete
*/
[1634] Fix | Delete
getActiveSectionCount = function() {
[1635] Fix | Delete
return _.filter( panel.sections(), function( section ) {
[1636] Fix | Delete
return 'sidebar' === section.params.type && section.active();
[1637] Fix | Delete
} ).length;
[1638] Fix | Delete
};
[1639] Fix | Delete
[1640] Fix | Delete
/**
[1641] Fix | Delete
* Determine whether or not the notice should be displayed.
[1642] Fix | Delete
*
[1643] Fix | Delete
* @return {boolean}
[1644] Fix | Delete
*/
[1645] Fix | Delete
shouldShowNotice = function() {
[1646] Fix | Delete
var activeSectionCount = getActiveSectionCount();
[1647] Fix | Delete
if ( 0 === activeSectionCount ) {
[1648] Fix | Delete
return true;
[1649] Fix | Delete
} else {
[1650] Fix | Delete
return activeSectionCount !== api.Widgets.data.registeredSidebars.length;
[1651] Fix | Delete
}
[1652] Fix | Delete
};
[1653] Fix | Delete
[1654] Fix | Delete
/**
[1655] Fix | Delete
* Update the notice.
[1656] Fix | Delete
*
[1657] Fix | Delete
* @return {void}
[1658] Fix | Delete
*/
[1659] Fix | Delete
updateNotice = function() {
[1660] Fix | Delete
var activeSectionCount = getActiveSectionCount(), someRenderedMessage, nonRenderedAreaCount, registeredAreaCount;
[1661] Fix | Delete
noticeContainer.empty();
[1662] Fix | Delete
[1663] Fix | Delete
registeredAreaCount = api.Widgets.data.registeredSidebars.length;
[1664] Fix | Delete
if ( activeSectionCount !== registeredAreaCount ) {
[1665] Fix | Delete
[1666] Fix | Delete
if ( 0 !== activeSectionCount ) {
[1667] Fix | Delete
nonRenderedAreaCount = registeredAreaCount - activeSectionCount;
[1668] Fix | Delete
someRenderedMessage = l10n.someAreasShown[ nonRenderedAreaCount ];
[1669] Fix | Delete
} else {
[1670] Fix | Delete
someRenderedMessage = l10n.noAreasShown;
[1671] Fix | Delete
}
[1672] Fix | Delete
if ( someRenderedMessage ) {
[1673] Fix | Delete
noticeContainer.append( $( '<p></p>', {
[1674] Fix | Delete
text: someRenderedMessage
[1675] Fix | Delete
} ) );
[1676] Fix | Delete
}
[1677] Fix | Delete
[1678] Fix | Delete
noticeContainer.append( $( '<p></p>', {
[1679] Fix | Delete
text: l10n.navigatePreview
[1680] Fix | Delete
} ) );
[1681] Fix | Delete
}
[1682] Fix | Delete
};
[1683] Fix | Delete
updateNotice();
[1684] Fix | Delete
[1685] Fix | Delete
/*
[1686] Fix | Delete
* Set the initial visibility state for rendered notice.
[1687] Fix | Delete
* Update the visibility of the notice whenever a reflow happens.
[1688] Fix | Delete
*/
[1689] Fix | Delete
noticeContainer.toggle( shouldShowNotice() );
[1690] Fix | Delete
api.previewer.deferred.active.done( function () {
[1691] Fix | Delete
noticeContainer.toggle( shouldShowNotice() );
[1692] Fix | Delete
});
[1693] Fix | Delete
api.bind( 'pane-contents-reflowed', function() {
[1694] Fix | Delete
var duration = ( 'resolved' === api.previewer.deferred.active.state() ) ? 'fast' : 0;
[1695] Fix | Delete
updateNotice();
[1696] Fix | Delete
if ( shouldShowNotice() ) {
[1697] Fix | Delete
noticeContainer.slideDown( duration );
[1698] Fix | Delete
} else {
[1699] Fix | Delete
noticeContainer.slideUp( duration );
[1700] Fix | Delete
}
[1701] Fix | Delete
});
[1702] Fix | Delete
});
[1703] Fix | Delete
},
[1704] Fix | Delete
[1705] Fix | Delete
/**
[1706] Fix | Delete
* Allow an active widgets panel to be contextually active even when it has no active sections (widget areas).
[1707] Fix | Delete
*
[1708] Fix | Delete
* This ensures that the widgets panel appears even when there are no
[1709] Fix | Delete
* sidebars displayed on the URL currently being previewed.
[1710] Fix | Delete
*
[1711] Fix | Delete
* @since 4.4.0
[1712] Fix | Delete
*
[1713] Fix | Delete
* @return {boolean}
[1714] Fix | Delete
*/
[1715] Fix | Delete
isContextuallyActive: function() {
[1716] Fix | Delete
var panel = this;
[1717] Fix | Delete
return panel.active();
[1718] Fix | Delete
}
[1719] Fix | Delete
});
[1720] Fix | Delete
[1721] Fix | Delete
/**
[1722] Fix | Delete
* wp.customize.Widgets.SidebarSection
[1723] Fix | Delete
*
[1724] Fix | Delete
* Customizer section representing a widget area widget
[1725] Fix | Delete
*
[1726] Fix | Delete
* @since 4.1.0
[1727] Fix | Delete
*
[1728] Fix | Delete
* @class wp.customize.Widgets.SidebarSection
[1729] Fix | Delete
* @augments wp.customize.Section
[1730] Fix | Delete
*/
[1731] Fix | Delete
api.Widgets.SidebarSection = api.Section.extend(/** @lends wp.customize.Widgets.SidebarSection.prototype */{
[1732] Fix | Delete
[1733] Fix | Delete
/**
[1734] Fix | Delete
* Sync the section's active state back to the Backbone model's is_rendered attribute
[1735] Fix | Delete
*
[1736] Fix | Delete
* @since 4.1.0
[1737] Fix | Delete
*/
[1738] Fix | Delete
ready: function () {
[1739] Fix | Delete
var section = this, registeredSidebar;
[1740] Fix | Delete
api.Section.prototype.ready.call( this );
[1741] Fix | Delete
registeredSidebar = api.Widgets.registeredSidebars.get( section.params.sidebarId );
[1742] Fix | Delete
section.active.bind( function ( active ) {
[1743] Fix | Delete
registeredSidebar.set( 'is_rendered', active );
[1744] Fix | Delete
});
[1745] Fix | Delete
registeredSidebar.set( 'is_rendered', section.active() );
[1746] Fix | Delete
}
[1747] Fix | Delete
});
[1748] Fix | Delete
[1749] Fix | Delete
/**
[1750] Fix | Delete
* wp.customize.Widgets.SidebarControl
[1751] Fix | Delete
*
[1752] Fix | Delete
* Customizer control for widgets.
[1753] Fix | Delete
* Note that 'sidebar_widgets' must match the WP_Widget_Area_Customize_Control::$type
[1754] Fix | Delete
*
[1755] Fix | Delete
* @since 3.9.0
[1756] Fix | Delete
*
[1757] Fix | Delete
* @class wp.customize.Widgets.SidebarControl
[1758] Fix | Delete
* @augments wp.customize.Control
[1759] Fix | Delete
*/
[1760] Fix | Delete
api.Widgets.SidebarControl = api.Control.extend(/** @lends wp.customize.Widgets.SidebarControl.prototype */{
[1761] Fix | Delete
[1762] Fix | Delete
/**
[1763] Fix | Delete
* Set up the control
[1764] Fix | Delete
*/
[1765] Fix | Delete
ready: function() {
[1766] Fix | Delete
this.$controlSection = this.container.closest( '.control-section' );
[1767] Fix | Delete
this.$sectionContent = this.container.closest( '.accordion-section-content' );
[1768] Fix | Delete
[1769] Fix | Delete
this._setupModel();
[1770] Fix | Delete
this._setupSortable();
[1771] Fix | Delete
this._setupAddition();
[1772] Fix | Delete
this._applyCardinalOrderClassNames();
[1773] Fix | Delete
},
[1774] Fix | Delete
[1775] Fix | Delete
/**
[1776] Fix | Delete
* Update ordering of widget control forms when the setting is updated
[1777] Fix | Delete
*/
[1778] Fix | Delete
_setupModel: function() {
[1779] Fix | Delete
var self = this;
[1780] Fix | Delete
[1781] Fix | Delete
this.setting.bind( function( newWidgetIds, oldWidgetIds ) {
[1782] Fix | Delete
var widgetFormControls, removedWidgetIds, priority;
[1783] Fix | Delete
[1784] Fix | Delete
removedWidgetIds = _( oldWidgetIds ).difference( newWidgetIds );
[1785] Fix | Delete
[1786] Fix | Delete
// Filter out any persistent widget IDs for widgets which have been deactivated.
[1787] Fix | Delete
newWidgetIds = _( newWidgetIds ).filter( function( newWidgetId ) {
[1788] Fix | Delete
var parsedWidgetId = parseWidgetId( newWidgetId );
[1789] Fix | Delete
[1790] Fix | Delete
return !! api.Widgets.availableWidgets.findWhere( { id_base: parsedWidgetId.id_base } );
[1791] Fix | Delete
} );
[1792] Fix | Delete
[1793] Fix | Delete
widgetFormControls = _( newWidgetIds ).map( function( widgetId ) {
[1794] Fix | Delete
var widgetFormControl = api.Widgets.getWidgetFormControlForWidget( widgetId );
[1795] Fix | Delete
[1796] Fix | Delete
if ( ! widgetFormControl ) {
[1797] Fix | Delete
widgetFormControl = self.addWidget( widgetId );
[1798] Fix | Delete
}
[1799] Fix | Delete
[1800] Fix | Delete
return widgetFormControl;
[1801] Fix | Delete
} );
[1802] Fix | Delete
[1803] Fix | Delete
// Sort widget controls to their new positions.
[1804] Fix | Delete
widgetFormControls.sort( function( a, b ) {
[1805] Fix | Delete
var aIndex = _.indexOf( newWidgetIds, a.params.widget_id ),
[1806] Fix | Delete
bIndex = _.indexOf( newWidgetIds, b.params.widget_id );
[1807] Fix | Delete
return aIndex - bIndex;
[1808] Fix | Delete
});
[1809] Fix | Delete
[1810] Fix | Delete
priority = 0;
[1811] Fix | Delete
_( widgetFormControls ).each( function ( control ) {
[1812] Fix | Delete
control.priority( priority );
[1813] Fix | Delete
control.section( self.section() );
[1814] Fix | Delete
priority += 1;
[1815] Fix | Delete
});
[1816] Fix | Delete
self.priority( priority ); // Make sure sidebar control remains at end.
[1817] Fix | Delete
[1818] Fix | Delete
// Re-sort widget form controls (including widgets form other sidebars newly moved here).
[1819] Fix | Delete
self._applyCardinalOrderClassNames();
[1820] Fix | Delete
[1821] Fix | Delete
// If the widget was dragged into the sidebar, make sure the sidebar_id param is updated.
[1822] Fix | Delete
_( widgetFormControls ).each( function( widgetFormControl ) {
[1823] Fix | Delete
widgetFormControl.params.sidebar_id = self.params.sidebar_id;
[1824] Fix | Delete
} );
[1825] Fix | Delete
[1826] Fix | Delete
// Cleanup after widget removal.
[1827] Fix | Delete
_( removedWidgetIds ).each( function( removedWidgetId ) {
[1828] Fix | Delete
[1829] Fix | Delete
// Using setTimeout so that when moving a widget to another sidebar,
[1830] Fix | Delete
// the other sidebars_widgets settings get a chance to update.
[1831] Fix | Delete
setTimeout( function() {
[1832] Fix | Delete
var removedControl, wasDraggedToAnotherSidebar, inactiveWidgets, removedIdBase,
[1833] Fix | Delete
widget, isPresentInAnotherSidebar = false;
[1834] Fix | Delete
[1835] Fix | Delete
// Check if the widget is in another sidebar.
[1836] Fix | Delete
api.each( function( otherSetting ) {
[1837] Fix | Delete
if ( otherSetting.id === self.setting.id || 0 !== otherSetting.id.indexOf( 'sidebars_widgets[' ) || otherSetting.id === 'sidebars_widgets[wp_inactive_widgets]' ) {
[1838] Fix | Delete
return;
[1839] Fix | Delete
}
[1840] Fix | Delete
[1841] Fix | Delete
var otherSidebarWidgets = otherSetting(), i;
[1842] Fix | Delete
[1843] Fix | Delete
i = _.indexOf( otherSidebarWidgets, removedWidgetId );
[1844] Fix | Delete
if ( -1 !== i ) {
[1845] Fix | Delete
isPresentInAnotherSidebar = true;
[1846] Fix | Delete
}
[1847] Fix | Delete
} );
[1848] Fix | Delete
[1849] Fix | Delete
// If the widget is present in another sidebar, abort!
[1850] Fix | Delete
if ( isPresentInAnotherSidebar ) {
[1851] Fix | Delete
return;
[1852] Fix | Delete
}
[1853] Fix | Delete
[1854] Fix | Delete
removedControl = api.Widgets.getWidgetFormControlForWidget( removedWidgetId );
[1855] Fix | Delete
[1856] Fix | Delete
// Detect if widget control was dragged to another sidebar.
[1857] Fix | Delete
wasDraggedToAnotherSidebar = removedControl && $.contains( document, removedControl.container[0] ) && ! $.contains( self.$sectionContent[0], removedControl.container[0] );
[1858] Fix | Delete
[1859] Fix | Delete
// Delete any widget form controls for removed widgets.
[1860] Fix | Delete
if ( removedControl && ! wasDraggedToAnotherSidebar ) {
[1861] Fix | Delete
api.control.remove( removedControl.id );
[1862] Fix | Delete
removedControl.container.remove();
[1863] Fix | Delete
}
[1864] Fix | Delete
[1865] Fix | Delete
// Move widget to inactive widgets sidebar (move it to Trash) if has been previously saved.
[1866] Fix | Delete
// This prevents the inactive widgets sidebar from overflowing with throwaway widgets.
[1867] Fix | Delete
if ( api.Widgets.savedWidgetIds[removedWidgetId] ) {
[1868] Fix | Delete
inactiveWidgets = api.value( 'sidebars_widgets[wp_inactive_widgets]' )().slice();
[1869] Fix | Delete
inactiveWidgets.push( removedWidgetId );
[1870] Fix | Delete
api.value( 'sidebars_widgets[wp_inactive_widgets]' )( _( inactiveWidgets ).unique() );
[1871] Fix | Delete
}
[1872] Fix | Delete
[1873] Fix | Delete
// Make old single widget available for adding again.
[1874] Fix | Delete
removedIdBase = parseWidgetId( removedWidgetId ).id_base;
[1875] Fix | Delete
widget = api.Widgets.availableWidgets.findWhere( { id_base: removedIdBase } );
[1876] Fix | Delete
if ( widget && ! widget.get( 'is_multi' ) ) {
[1877] Fix | Delete
widget.set( 'is_disabled', false );
[1878] Fix | Delete
}
[1879] Fix | Delete
} );
[1880] Fix | Delete
[1881] Fix | Delete
} );
[1882] Fix | Delete
} );
[1883] Fix | Delete
},
[1884] Fix | Delete
[1885] Fix | Delete
/**
[1886] Fix | Delete
* Allow widgets in sidebar to be re-ordered, and for the order to be previewed
[1887] Fix | Delete
*/
[1888] Fix | Delete
_setupSortable: function() {
[1889] Fix | Delete
var self = this;
[1890] Fix | Delete
[1891] Fix | Delete
this.isReordering = false;
[1892] Fix | Delete
[1893] Fix | Delete
/**
[1894] Fix | Delete
* Update widget order setting when controls are re-ordered
[1895] Fix | Delete
*/
[1896] Fix | Delete
this.$sectionContent.sortable( {
[1897] Fix | Delete
items: '> .customize-control-widget_form',
[1898] Fix | Delete
handle: '.widget-top',
[1899] Fix | Delete
axis: 'y',
[1900] Fix | Delete
tolerance: 'pointer',
[1901] Fix | Delete
connectWith: '.accordion-section-content:has(.customize-control-sidebar_widgets)',
[1902] Fix | Delete
update: function() {
[1903] Fix | Delete
var widgetContainerIds = self.$sectionContent.sortable( 'toArray' ), widgetIds;
[1904] Fix | Delete
[1905] Fix | Delete
widgetIds = $.map( widgetContainerIds, function( widgetContainerId ) {
[1906] Fix | Delete
return $( '#' + widgetContainerId ).find( ':input[name=widget-id]' ).val();
[1907] Fix | Delete
} );
[1908] Fix | Delete
[1909] Fix | Delete
self.setting( widgetIds );
[1910] Fix | Delete
}
[1911] Fix | Delete
} );
[1912] Fix | Delete
[1913] Fix | Delete
/**
[1914] Fix | Delete
* Expand other Customizer sidebar section when dragging a control widget over it,
[1915] Fix | Delete
* allowing the control to be dropped into another section
[1916] Fix | Delete
*/
[1917] Fix | Delete
this.$controlSection.find( '.accordion-section-title' ).droppable({
[1918] Fix | Delete
accept: '.customize-control-widget_form',
[1919] Fix | Delete
over: function() {
[1920] Fix | Delete
var section = api.section( self.section.get() );
[1921] Fix | Delete
section.expand({
[1922] Fix | Delete
allowMultiple: true, // Prevent the section being dragged from to be collapsed.
[1923] Fix | Delete
completeCallback: function () {
[1924] Fix | Delete
// @todo It is not clear when refreshPositions should be called on which sections, or if it is even needed.
[1925] Fix | Delete
api.section.each( function ( otherSection ) {
[1926] Fix | Delete
if ( otherSection.container.find( '.customize-control-sidebar_widgets' ).length ) {
[1927] Fix | Delete
otherSection.container.find( '.accordion-section-content:first' ).sortable( 'refreshPositions' );
[1928] Fix | Delete
}
[1929] Fix | Delete
} );
[1930] Fix | Delete
}
[1931] Fix | Delete
});
[1932] Fix | Delete
}
[1933] Fix | Delete
});
[1934] Fix | Delete
[1935] Fix | Delete
/**
[1936] Fix | Delete
* Keyboard-accessible reordering
[1937] Fix | Delete
*/
[1938] Fix | Delete
this.container.find( '.reorder-toggle' ).on( 'click', function() {
[1939] Fix | Delete
self.toggleReordering( ! self.isReordering );
[1940] Fix | Delete
} );
[1941] Fix | Delete
},
[1942] Fix | Delete
[1943] Fix | Delete
/**
[1944] Fix | Delete
* Set up UI for adding a new widget
[1945] Fix | Delete
*/
[1946] Fix | Delete
_setupAddition: function() {
[1947] Fix | Delete
var self = this;
[1948] Fix | Delete
[1949] Fix | Delete
this.container.find( '.add-new-widget' ).on( 'click', function() {
[1950] Fix | Delete
var addNewWidgetBtn = $( this );
[1951] Fix | Delete
[1952] Fix | Delete
if ( self.$sectionContent.hasClass( 'reordering' ) ) {
[1953] Fix | Delete
return;
[1954] Fix | Delete
}
[1955] Fix | Delete
[1956] Fix | Delete
if ( ! $( 'body' ).hasClass( 'adding-widget' ) ) {
[1957] Fix | Delete
addNewWidgetBtn.attr( 'aria-expanded', 'true' );
[1958] Fix | Delete
api.Widgets.availableWidgetsPanel.open( self );
[1959] Fix | Delete
} else {
[1960] Fix | Delete
addNewWidgetBtn.attr( 'aria-expanded', 'false' );
[1961] Fix | Delete
api.Widgets.availableWidgetsPanel.close();
[1962] Fix | Delete
}
[1963] Fix | Delete
} );
[1964] Fix | Delete
},
[1965] Fix | Delete
[1966] Fix | Delete
/**
[1967] Fix | Delete
* Add classes to the widget_form controls to assist with styling
[1968] Fix | Delete
*/
[1969] Fix | Delete
_applyCardinalOrderClassNames: function() {
[1970] Fix | Delete
var widgetControls = [];
[1971] Fix | Delete
_.each( this.setting(), function ( widgetId ) {
[1972] Fix | Delete
var widgetControl = api.Widgets.getWidgetFormControlForWidget( widgetId );
[1973] Fix | Delete
if ( widgetControl ) {
[1974] Fix | Delete
widgetControls.push( widgetControl );
[1975] Fix | Delete
}
[1976] Fix | Delete
});
[1977] Fix | Delete
[1978] Fix | Delete
if ( 0 === widgetControls.length || ( 1 === api.Widgets.registeredSidebars.length && widgetControls.length <= 1 ) ) {
[1979] Fix | Delete
this.container.find( '.reorder-toggle' ).hide();
[1980] Fix | Delete
return;
[1981] Fix | Delete
} else {
[1982] Fix | Delete
this.container.find( '.reorder-toggle' ).show();
[1983] Fix | Delete
}
[1984] Fix | Delete
[1985] Fix | Delete
$( widgetControls ).each( function () {
[1986] Fix | Delete
$( this.container )
[1987] Fix | Delete
.removeClass( 'first-widget' )
[1988] Fix | Delete
.removeClass( 'last-widget' )
[1989] Fix | Delete
.find( '.move-widget-down, .move-widget-up' ).prop( 'tabIndex', 0 );
[1990] Fix | Delete
});
[1991] Fix | Delete
[1992] Fix | Delete
_.first( widgetControls ).container
[1993] Fix | Delete
.addClass( 'first-widget' )
[1994] Fix | Delete
.find( '.move-widget-up' ).prop( 'tabIndex', -1 );
[1995] Fix | Delete
[1996] Fix | Delete
_.last( widgetControls ).container
[1997] Fix | Delete
.addClass( 'last-widget' )
[1998] Fix | Delete
.find( '.move-widget-down' ).prop( 'tabIndex', -1 );
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function