Edit File by line
/home/barbar84/www/wp-admin/js
File: theme.js
event.preventDefault();
[500] Fix | Delete
[501] Fix | Delete
event = event || window.event;
[502] Fix | Delete
[503] Fix | Delete
// Set focus to current theme.
[504] Fix | Delete
themes.focusedTheme = this.$el;
[505] Fix | Delete
[506] Fix | Delete
// Construct a new Preview view.
[507] Fix | Delete
themes.preview = preview = new themes.view.Preview({
[508] Fix | Delete
model: this.model
[509] Fix | Delete
});
[510] Fix | Delete
[511] Fix | Delete
// Render the view and append it.
[512] Fix | Delete
preview.render();
[513] Fix | Delete
this.setNavButtonsState();
[514] Fix | Delete
[515] Fix | Delete
// Hide previous/next navigation if there is only one theme.
[516] Fix | Delete
if ( this.model.collection.length === 1 ) {
[517] Fix | Delete
preview.$el.addClass( 'no-navigation' );
[518] Fix | Delete
} else {
[519] Fix | Delete
preview.$el.removeClass( 'no-navigation' );
[520] Fix | Delete
}
[521] Fix | Delete
[522] Fix | Delete
// Append preview.
[523] Fix | Delete
$( 'div.wrap' ).append( preview.el );
[524] Fix | Delete
[525] Fix | Delete
// Listen to our preview object
[526] Fix | Delete
// for `theme:next` and `theme:previous` events.
[527] Fix | Delete
this.listenTo( preview, 'theme:next', function() {
[528] Fix | Delete
[529] Fix | Delete
// Keep local track of current theme model.
[530] Fix | Delete
current = self.model;
[531] Fix | Delete
[532] Fix | Delete
// If we have ventured away from current model update the current model position.
[533] Fix | Delete
if ( ! _.isUndefined( self.current ) ) {
[534] Fix | Delete
current = self.current;
[535] Fix | Delete
}
[536] Fix | Delete
[537] Fix | Delete
// Get next theme model.
[538] Fix | Delete
self.current = self.model.collection.at( self.model.collection.indexOf( current ) + 1 );
[539] Fix | Delete
[540] Fix | Delete
// If we have no more themes, bail.
[541] Fix | Delete
if ( _.isUndefined( self.current ) ) {
[542] Fix | Delete
self.options.parent.parent.trigger( 'theme:end' );
[543] Fix | Delete
return self.current = current;
[544] Fix | Delete
}
[545] Fix | Delete
[546] Fix | Delete
preview.model = self.current;
[547] Fix | Delete
[548] Fix | Delete
// Render and append.
[549] Fix | Delete
preview.render();
[550] Fix | Delete
this.setNavButtonsState();
[551] Fix | Delete
$( '.next-theme' ).trigger( 'focus' );
[552] Fix | Delete
})
[553] Fix | Delete
.listenTo( preview, 'theme:previous', function() {
[554] Fix | Delete
[555] Fix | Delete
// Keep track of current theme model.
[556] Fix | Delete
current = self.model;
[557] Fix | Delete
[558] Fix | Delete
// Bail early if we are at the beginning of the collection.
[559] Fix | Delete
if ( self.model.collection.indexOf( self.current ) === 0 ) {
[560] Fix | Delete
return;
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
// If we have ventured away from current model update the current model position.
[564] Fix | Delete
if ( ! _.isUndefined( self.current ) ) {
[565] Fix | Delete
current = self.current;
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
// Get previous theme model.
[569] Fix | Delete
self.current = self.model.collection.at( self.model.collection.indexOf( current ) - 1 );
[570] Fix | Delete
[571] Fix | Delete
// If we have no more themes, bail.
[572] Fix | Delete
if ( _.isUndefined( self.current ) ) {
[573] Fix | Delete
return;
[574] Fix | Delete
}
[575] Fix | Delete
[576] Fix | Delete
preview.model = self.current;
[577] Fix | Delete
[578] Fix | Delete
// Render and append.
[579] Fix | Delete
preview.render();
[580] Fix | Delete
this.setNavButtonsState();
[581] Fix | Delete
$( '.previous-theme' ).trigger( 'focus' );
[582] Fix | Delete
});
[583] Fix | Delete
[584] Fix | Delete
this.listenTo( preview, 'preview:close', function() {
[585] Fix | Delete
self.current = self.model;
[586] Fix | Delete
});
[587] Fix | Delete
[588] Fix | Delete
},
[589] Fix | Delete
[590] Fix | Delete
// Handles .disabled classes for previous/next buttons in theme installer preview.
[591] Fix | Delete
setNavButtonsState: function() {
[592] Fix | Delete
var $themeInstaller = $( '.theme-install-overlay' ),
[593] Fix | Delete
current = _.isUndefined( this.current ) ? this.model : this.current,
[594] Fix | Delete
previousThemeButton = $themeInstaller.find( '.previous-theme' ),
[595] Fix | Delete
nextThemeButton = $themeInstaller.find( '.next-theme' );
[596] Fix | Delete
[597] Fix | Delete
// Disable previous at the zero position.
[598] Fix | Delete
if ( 0 === this.model.collection.indexOf( current ) ) {
[599] Fix | Delete
previousThemeButton
[600] Fix | Delete
.addClass( 'disabled' )
[601] Fix | Delete
.prop( 'disabled', true );
[602] Fix | Delete
[603] Fix | Delete
nextThemeButton.trigger( 'focus' );
[604] Fix | Delete
}
[605] Fix | Delete
[606] Fix | Delete
// Disable next if the next model is undefined.
[607] Fix | Delete
if ( _.isUndefined( this.model.collection.at( this.model.collection.indexOf( current ) + 1 ) ) ) {
[608] Fix | Delete
nextThemeButton
[609] Fix | Delete
.addClass( 'disabled' )
[610] Fix | Delete
.prop( 'disabled', true );
[611] Fix | Delete
[612] Fix | Delete
previousThemeButton.trigger( 'focus' );
[613] Fix | Delete
}
[614] Fix | Delete
},
[615] Fix | Delete
[616] Fix | Delete
installTheme: function( event ) {
[617] Fix | Delete
var _this = this;
[618] Fix | Delete
[619] Fix | Delete
event.preventDefault();
[620] Fix | Delete
[621] Fix | Delete
wp.updates.maybeRequestFilesystemCredentials( event );
[622] Fix | Delete
[623] Fix | Delete
$( document ).on( 'wp-theme-install-success', function( event, response ) {
[624] Fix | Delete
if ( _this.model.get( 'id' ) === response.slug ) {
[625] Fix | Delete
_this.model.set( { 'installed': true } );
[626] Fix | Delete
}
[627] Fix | Delete
} );
[628] Fix | Delete
[629] Fix | Delete
wp.updates.installTheme( {
[630] Fix | Delete
slug: $( event.target ).data( 'slug' )
[631] Fix | Delete
} );
[632] Fix | Delete
},
[633] Fix | Delete
[634] Fix | Delete
updateTheme: function( event ) {
[635] Fix | Delete
var _this = this;
[636] Fix | Delete
[637] Fix | Delete
if ( ! this.model.get( 'hasPackage' ) ) {
[638] Fix | Delete
return;
[639] Fix | Delete
}
[640] Fix | Delete
[641] Fix | Delete
event.preventDefault();
[642] Fix | Delete
[643] Fix | Delete
wp.updates.maybeRequestFilesystemCredentials( event );
[644] Fix | Delete
[645] Fix | Delete
$( document ).on( 'wp-theme-update-success', function( event, response ) {
[646] Fix | Delete
_this.model.off( 'change', _this.render, _this );
[647] Fix | Delete
if ( _this.model.get( 'id' ) === response.slug ) {
[648] Fix | Delete
_this.model.set( {
[649] Fix | Delete
hasUpdate: false,
[650] Fix | Delete
version: response.newVersion
[651] Fix | Delete
} );
[652] Fix | Delete
}
[653] Fix | Delete
_this.model.on( 'change', _this.render, _this );
[654] Fix | Delete
} );
[655] Fix | Delete
[656] Fix | Delete
wp.updates.updateTheme( {
[657] Fix | Delete
slug: $( event.target ).parents( 'div.theme' ).first().data( 'slug' )
[658] Fix | Delete
} );
[659] Fix | Delete
}
[660] Fix | Delete
});
[661] Fix | Delete
[662] Fix | Delete
// Theme Details view.
[663] Fix | Delete
// Sets up a modal overlay with the expanded theme data.
[664] Fix | Delete
themes.view.Details = wp.Backbone.View.extend({
[665] Fix | Delete
[666] Fix | Delete
// Wrap theme data on a div.theme element.
[667] Fix | Delete
className: 'theme-overlay',
[668] Fix | Delete
[669] Fix | Delete
events: {
[670] Fix | Delete
'click': 'collapse',
[671] Fix | Delete
'click .delete-theme': 'deleteTheme',
[672] Fix | Delete
'click .left': 'previousTheme',
[673] Fix | Delete
'click .right': 'nextTheme',
[674] Fix | Delete
'click #update-theme': 'updateTheme',
[675] Fix | Delete
'click .toggle-auto-update': 'autoupdateState'
[676] Fix | Delete
},
[677] Fix | Delete
[678] Fix | Delete
// The HTML template for the theme overlay.
[679] Fix | Delete
html: themes.template( 'theme-single' ),
[680] Fix | Delete
[681] Fix | Delete
render: function() {
[682] Fix | Delete
var data = this.model.toJSON();
[683] Fix | Delete
this.$el.html( this.html( data ) );
[684] Fix | Delete
// Renders active theme styles.
[685] Fix | Delete
this.activeTheme();
[686] Fix | Delete
// Set up navigation events.
[687] Fix | Delete
this.navigation();
[688] Fix | Delete
// Checks screenshot size.
[689] Fix | Delete
this.screenshotCheck( this.$el );
[690] Fix | Delete
// Contain "tabbing" inside the overlay.
[691] Fix | Delete
this.containFocus( this.$el );
[692] Fix | Delete
},
[693] Fix | Delete
[694] Fix | Delete
// Adds a class to the currently active theme
[695] Fix | Delete
// and to the overlay in detailed view mode.
[696] Fix | Delete
activeTheme: function() {
[697] Fix | Delete
// Check the model has the active property.
[698] Fix | Delete
this.$el.toggleClass( 'active', this.model.get( 'active' ) );
[699] Fix | Delete
},
[700] Fix | Delete
[701] Fix | Delete
// Set initial focus and constrain tabbing within the theme browser modal.
[702] Fix | Delete
containFocus: function( $el ) {
[703] Fix | Delete
[704] Fix | Delete
// Set initial focus on the primary action control.
[705] Fix | Delete
_.delay( function() {
[706] Fix | Delete
$( '.theme-overlay' ).trigger( 'focus' );
[707] Fix | Delete
}, 100 );
[708] Fix | Delete
[709] Fix | Delete
// Constrain tabbing within the modal.
[710] Fix | Delete
$el.on( 'keydown.wp-themes', function( event ) {
[711] Fix | Delete
var $firstFocusable = $el.find( '.theme-header button:not(.disabled)' ).first(),
[712] Fix | Delete
$lastFocusable = $el.find( '.theme-actions a:visible' ).last();
[713] Fix | Delete
[714] Fix | Delete
// Check for the Tab key.
[715] Fix | Delete
if ( 9 === event.which ) {
[716] Fix | Delete
if ( $firstFocusable[0] === event.target && event.shiftKey ) {
[717] Fix | Delete
$lastFocusable.trigger( 'focus' );
[718] Fix | Delete
event.preventDefault();
[719] Fix | Delete
} else if ( $lastFocusable[0] === event.target && ! event.shiftKey ) {
[720] Fix | Delete
$firstFocusable.trigger( 'focus' );
[721] Fix | Delete
event.preventDefault();
[722] Fix | Delete
}
[723] Fix | Delete
}
[724] Fix | Delete
});
[725] Fix | Delete
},
[726] Fix | Delete
[727] Fix | Delete
// Single theme overlay screen.
[728] Fix | Delete
// It's shown when clicking a theme.
[729] Fix | Delete
collapse: function( event ) {
[730] Fix | Delete
var self = this,
[731] Fix | Delete
scroll;
[732] Fix | Delete
[733] Fix | Delete
event = event || window.event;
[734] Fix | Delete
[735] Fix | Delete
// Prevent collapsing detailed view when there is only one theme available.
[736] Fix | Delete
if ( themes.data.themes.length === 1 ) {
[737] Fix | Delete
return;
[738] Fix | Delete
}
[739] Fix | Delete
[740] Fix | Delete
// Detect if the click is inside the overlay and don't close it
[741] Fix | Delete
// unless the target was the div.back button.
[742] Fix | Delete
if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( '.close' ) || event.keyCode === 27 ) {
[743] Fix | Delete
[744] Fix | Delete
// Add a temporary closing class while overlay fades out.
[745] Fix | Delete
$( 'body' ).addClass( 'closing-overlay' );
[746] Fix | Delete
[747] Fix | Delete
// With a quick fade out animation.
[748] Fix | Delete
this.$el.fadeOut( 130, function() {
[749] Fix | Delete
// Clicking outside the modal box closes the overlay.
[750] Fix | Delete
$( 'body' ).removeClass( 'closing-overlay' );
[751] Fix | Delete
// Handle event cleanup.
[752] Fix | Delete
self.closeOverlay();
[753] Fix | Delete
[754] Fix | Delete
// Get scroll position to avoid jumping to the top.
[755] Fix | Delete
scroll = document.body.scrollTop;
[756] Fix | Delete
[757] Fix | Delete
// Clean the URL structure.
[758] Fix | Delete
themes.router.navigate( themes.router.baseUrl( '' ) );
[759] Fix | Delete
[760] Fix | Delete
// Restore scroll position.
[761] Fix | Delete
document.body.scrollTop = scroll;
[762] Fix | Delete
[763] Fix | Delete
// Return focus to the theme div.
[764] Fix | Delete
if ( themes.focusedTheme ) {
[765] Fix | Delete
themes.focusedTheme.trigger( 'focus' );
[766] Fix | Delete
}
[767] Fix | Delete
});
[768] Fix | Delete
}
[769] Fix | Delete
},
[770] Fix | Delete
[771] Fix | Delete
// Handles .disabled classes for next/previous buttons.
[772] Fix | Delete
navigation: function() {
[773] Fix | Delete
[774] Fix | Delete
// Disable Left/Right when at the start or end of the collection.
[775] Fix | Delete
if ( this.model.cid === this.model.collection.at(0).cid ) {
[776] Fix | Delete
this.$el.find( '.left' )
[777] Fix | Delete
.addClass( 'disabled' )
[778] Fix | Delete
.prop( 'disabled', true );
[779] Fix | Delete
}
[780] Fix | Delete
if ( this.model.cid === this.model.collection.at( this.model.collection.length - 1 ).cid ) {
[781] Fix | Delete
this.$el.find( '.right' )
[782] Fix | Delete
.addClass( 'disabled' )
[783] Fix | Delete
.prop( 'disabled', true );
[784] Fix | Delete
}
[785] Fix | Delete
},
[786] Fix | Delete
[787] Fix | Delete
// Performs the actions to effectively close
[788] Fix | Delete
// the theme details overlay.
[789] Fix | Delete
closeOverlay: function() {
[790] Fix | Delete
$( 'body' ).removeClass( 'modal-open' );
[791] Fix | Delete
this.remove();
[792] Fix | Delete
this.unbind();
[793] Fix | Delete
this.trigger( 'theme:collapse' );
[794] Fix | Delete
},
[795] Fix | Delete
[796] Fix | Delete
// Set state of the auto-update settings link after it has been changed and saved.
[797] Fix | Delete
autoupdateState: function() {
[798] Fix | Delete
var callback,
[799] Fix | Delete
_this = this;
[800] Fix | Delete
[801] Fix | Delete
// Support concurrent clicks in different Theme Details overlays.
[802] Fix | Delete
callback = function( event, data ) {
[803] Fix | Delete
var autoupdate;
[804] Fix | Delete
if ( _this.model.get( 'id' ) === data.asset ) {
[805] Fix | Delete
autoupdate = _this.model.get( 'autoupdate' );
[806] Fix | Delete
autoupdate.enabled = 'enable' === data.state;
[807] Fix | Delete
_this.model.set( { autoupdate: autoupdate } );
[808] Fix | Delete
$( document ).off( 'wp-auto-update-setting-changed', callback );
[809] Fix | Delete
}
[810] Fix | Delete
};
[811] Fix | Delete
[812] Fix | Delete
// Triggered in updates.js
[813] Fix | Delete
$( document ).on( 'wp-auto-update-setting-changed', callback );
[814] Fix | Delete
},
[815] Fix | Delete
[816] Fix | Delete
updateTheme: function( event ) {
[817] Fix | Delete
var _this = this;
[818] Fix | Delete
event.preventDefault();
[819] Fix | Delete
[820] Fix | Delete
wp.updates.maybeRequestFilesystemCredentials( event );
[821] Fix | Delete
[822] Fix | Delete
$( document ).on( 'wp-theme-update-success', function( event, response ) {
[823] Fix | Delete
if ( _this.model.get( 'id' ) === response.slug ) {
[824] Fix | Delete
_this.model.set( {
[825] Fix | Delete
hasUpdate: false,
[826] Fix | Delete
version: response.newVersion
[827] Fix | Delete
} );
[828] Fix | Delete
}
[829] Fix | Delete
_this.render();
[830] Fix | Delete
} );
[831] Fix | Delete
[832] Fix | Delete
wp.updates.updateTheme( {
[833] Fix | Delete
slug: $( event.target ).data( 'slug' )
[834] Fix | Delete
} );
[835] Fix | Delete
},
[836] Fix | Delete
[837] Fix | Delete
deleteTheme: function( event ) {
[838] Fix | Delete
var _this = this,
[839] Fix | Delete
_collection = _this.model.collection,
[840] Fix | Delete
_themes = themes;
[841] Fix | Delete
event.preventDefault();
[842] Fix | Delete
[843] Fix | Delete
// Confirmation dialog for deleting a theme.
[844] Fix | Delete
if ( ! window.confirm( wp.themes.data.settings.confirmDelete ) ) {
[845] Fix | Delete
return;
[846] Fix | Delete
}
[847] Fix | Delete
[848] Fix | Delete
wp.updates.maybeRequestFilesystemCredentials( event );
[849] Fix | Delete
[850] Fix | Delete
$( document ).one( 'wp-theme-delete-success', function( event, response ) {
[851] Fix | Delete
_this.$el.find( '.close' ).trigger( 'click' );
[852] Fix | Delete
$( '[data-slug="' + response.slug + '"]' ).css( { backgroundColor:'#faafaa' } ).fadeOut( 350, function() {
[853] Fix | Delete
$( this ).remove();
[854] Fix | Delete
_themes.data.themes = _.without( _themes.data.themes, _.findWhere( _themes.data.themes, { id: response.slug } ) );
[855] Fix | Delete
[856] Fix | Delete
$( '.wp-filter-search' ).val( '' );
[857] Fix | Delete
_collection.doSearch( '' );
[858] Fix | Delete
_collection.remove( _this.model );
[859] Fix | Delete
_collection.trigger( 'themes:update' );
[860] Fix | Delete
} );
[861] Fix | Delete
} );
[862] Fix | Delete
[863] Fix | Delete
wp.updates.deleteTheme( {
[864] Fix | Delete
slug: this.model.get( 'id' )
[865] Fix | Delete
} );
[866] Fix | Delete
},
[867] Fix | Delete
[868] Fix | Delete
nextTheme: function() {
[869] Fix | Delete
var self = this;
[870] Fix | Delete
self.trigger( 'theme:next', self.model.cid );
[871] Fix | Delete
return false;
[872] Fix | Delete
},
[873] Fix | Delete
[874] Fix | Delete
previousTheme: function() {
[875] Fix | Delete
var self = this;
[876] Fix | Delete
self.trigger( 'theme:previous', self.model.cid );
[877] Fix | Delete
return false;
[878] Fix | Delete
},
[879] Fix | Delete
[880] Fix | Delete
// Checks if the theme screenshot is the old 300px width version
[881] Fix | Delete
// and adds a corresponding class if it's true.
[882] Fix | Delete
screenshotCheck: function( el ) {
[883] Fix | Delete
var screenshot, image;
[884] Fix | Delete
[885] Fix | Delete
screenshot = el.find( '.screenshot img' );
[886] Fix | Delete
image = new Image();
[887] Fix | Delete
image.src = screenshot.attr( 'src' );
[888] Fix | Delete
[889] Fix | Delete
// Width check.
[890] Fix | Delete
if ( image.width && image.width <= 300 ) {
[891] Fix | Delete
el.addClass( 'small-screenshot' );
[892] Fix | Delete
}
[893] Fix | Delete
}
[894] Fix | Delete
});
[895] Fix | Delete
[896] Fix | Delete
// Theme Preview view.
[897] Fix | Delete
// Sets up a modal overlay with the expanded theme data.
[898] Fix | Delete
themes.view.Preview = themes.view.Details.extend({
[899] Fix | Delete
[900] Fix | Delete
className: 'wp-full-overlay expanded',
[901] Fix | Delete
el: '.theme-install-overlay',
[902] Fix | Delete
[903] Fix | Delete
events: {
[904] Fix | Delete
'click .close-full-overlay': 'close',
[905] Fix | Delete
'click .collapse-sidebar': 'collapse',
[906] Fix | Delete
'click .devices button': 'previewDevice',
[907] Fix | Delete
'click .previous-theme': 'previousTheme',
[908] Fix | Delete
'click .next-theme': 'nextTheme',
[909] Fix | Delete
'keyup': 'keyEvent',
[910] Fix | Delete
'click .theme-install': 'installTheme'
[911] Fix | Delete
},
[912] Fix | Delete
[913] Fix | Delete
// The HTML template for the theme preview.
[914] Fix | Delete
html: themes.template( 'theme-preview' ),
[915] Fix | Delete
[916] Fix | Delete
render: function() {
[917] Fix | Delete
var self = this,
[918] Fix | Delete
currentPreviewDevice,
[919] Fix | Delete
data = this.model.toJSON(),
[920] Fix | Delete
$body = $( document.body );
[921] Fix | Delete
[922] Fix | Delete
$body.attr( 'aria-busy', 'true' );
[923] Fix | Delete
[924] Fix | Delete
this.$el.removeClass( 'iframe-ready' ).html( this.html( data ) );
[925] Fix | Delete
[926] Fix | Delete
currentPreviewDevice = this.$el.data( 'current-preview-device' );
[927] Fix | Delete
if ( currentPreviewDevice ) {
[928] Fix | Delete
self.tooglePreviewDeviceButtons( currentPreviewDevice );
[929] Fix | Delete
}
[930] Fix | Delete
[931] Fix | Delete
themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: false } );
[932] Fix | Delete
[933] Fix | Delete
this.$el.fadeIn( 200, function() {
[934] Fix | Delete
$body.addClass( 'theme-installer-active full-overlay-active' );
[935] Fix | Delete
});
[936] Fix | Delete
[937] Fix | Delete
this.$el.find( 'iframe' ).one( 'load', function() {
[938] Fix | Delete
self.iframeLoaded();
[939] Fix | Delete
});
[940] Fix | Delete
},
[941] Fix | Delete
[942] Fix | Delete
iframeLoaded: function() {
[943] Fix | Delete
this.$el.addClass( 'iframe-ready' );
[944] Fix | Delete
$( document.body ).attr( 'aria-busy', 'false' );
[945] Fix | Delete
},
[946] Fix | Delete
[947] Fix | Delete
close: function() {
[948] Fix | Delete
this.$el.fadeOut( 200, function() {
[949] Fix | Delete
$( 'body' ).removeClass( 'theme-installer-active full-overlay-active' );
[950] Fix | Delete
[951] Fix | Delete
// Return focus to the theme div.
[952] Fix | Delete
if ( themes.focusedTheme ) {
[953] Fix | Delete
themes.focusedTheme.trigger( 'focus' );
[954] Fix | Delete
}
[955] Fix | Delete
}).removeClass( 'iframe-ready' );
[956] Fix | Delete
[957] Fix | Delete
// Restore the previous browse tab if available.
[958] Fix | Delete
if ( themes.router.selectedTab ) {
[959] Fix | Delete
themes.router.navigate( themes.router.baseUrl( '?browse=' + themes.router.selectedTab ) );
[960] Fix | Delete
themes.router.selectedTab = false;
[961] Fix | Delete
} else {
[962] Fix | Delete
themes.router.navigate( themes.router.baseUrl( '' ) );
[963] Fix | Delete
}
[964] Fix | Delete
this.trigger( 'preview:close' );
[965] Fix | Delete
this.undelegateEvents();
[966] Fix | Delete
this.unbind();
[967] Fix | Delete
return false;
[968] Fix | Delete
},
[969] Fix | Delete
[970] Fix | Delete
collapse: function( event ) {
[971] Fix | Delete
var $button = $( event.currentTarget );
[972] Fix | Delete
if ( 'true' === $button.attr( 'aria-expanded' ) ) {
[973] Fix | Delete
$button.attr({ 'aria-expanded': 'false', 'aria-label': l10n.expandSidebar });
[974] Fix | Delete
} else {
[975] Fix | Delete
$button.attr({ 'aria-expanded': 'true', 'aria-label': l10n.collapseSidebar });
[976] Fix | Delete
}
[977] Fix | Delete
[978] Fix | Delete
this.$el.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
[979] Fix | Delete
return false;
[980] Fix | Delete
},
[981] Fix | Delete
[982] Fix | Delete
previewDevice: function( event ) {
[983] Fix | Delete
var device = $( event.currentTarget ).data( 'device' );
[984] Fix | Delete
[985] Fix | Delete
this.$el
[986] Fix | Delete
.removeClass( 'preview-desktop preview-tablet preview-mobile' )
[987] Fix | Delete
.addClass( 'preview-' + device )
[988] Fix | Delete
.data( 'current-preview-device', device );
[989] Fix | Delete
[990] Fix | Delete
this.tooglePreviewDeviceButtons( device );
[991] Fix | Delete
},
[992] Fix | Delete
[993] Fix | Delete
tooglePreviewDeviceButtons: function( newDevice ) {
[994] Fix | Delete
var $devices = $( '.wp-full-overlay-footer .devices' );
[995] Fix | Delete
[996] Fix | Delete
$devices.find( 'button' )
[997] Fix | Delete
.removeClass( 'active' )
[998] Fix | Delete
.attr( 'aria-pressed', false );
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function