mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Change document title on surface setup/teardown
Now reads "Creating/Editing Title - Sitename". Bug: 48272 Change-Id: I9dcc8ec2c37a7ff9cff6cedb7bdb1fed1bdc4deb
This commit is contained in:
parent
0a8e596ffc
commit
706b64e82c
|
@ -147,6 +147,8 @@ $wgResourceModules += array(
|
|||
'copyrightpage',
|
||||
'accesskey-ca-editsource',
|
||||
'accesskey-ca-ve-edit',
|
||||
'creating',
|
||||
'editing',
|
||||
'tooltip-ca-createsource',
|
||||
'tooltip-ca-editsource',
|
||||
'tooltip-ca-ve-edit',
|
||||
|
|
|
@ -64,6 +64,7 @@ ve.init.mw.ViewPageTarget = function VeInitMwViewPageTarget() {
|
|||
$.client.test( ve.init.mw.ViewPageTarget.compatibility ) ||
|
||||
'vewhitelist' in currentUri.query
|
||||
);
|
||||
this.originalDocumentTitle = document.title;
|
||||
this.editSummaryByteLimit = 255;
|
||||
// Tab layout.
|
||||
// * add: Adds #ca-ve-edit.
|
||||
|
@ -740,6 +741,7 @@ ve.init.mw.ViewPageTarget.prototype.setUpSurface = function ( doc ) {
|
|||
this.surface.initialize();
|
||||
this.setUpToolbar();
|
||||
this.transformPageTitle();
|
||||
this.changeDocumentTitle();
|
||||
// Update UI
|
||||
this.hidePageContent();
|
||||
this.hideSpinner();
|
||||
|
@ -767,6 +769,7 @@ ve.init.mw.ViewPageTarget.prototype.tearDownSurface = function () {
|
|||
this.hideSpinner();
|
||||
this.showPageContent();
|
||||
this.restorePageTitle();
|
||||
this.restoreDocumentTitle();
|
||||
this.showTableOfContents();
|
||||
// Destroy editor
|
||||
if ( this.surface ) {
|
||||
|
@ -1539,6 +1542,27 @@ ve.init.mw.ViewPageTarget.prototype.restorePageTitle = function () {
|
|||
}, 1000 );
|
||||
};
|
||||
|
||||
/**
|
||||
* Change the document title to state that we are now editing.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.changeDocumentTitle = function () {
|
||||
document.title = ve.msg(
|
||||
this.pageExists ? 'editing' : 'creating',
|
||||
mw.config.get( 'wgTitle' )
|
||||
) + ' - ' + mw.config.get( 'wgSiteName' );
|
||||
};
|
||||
|
||||
/**
|
||||
* Restore the original document title.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.init.mw.ViewPageTarget.prototype.restoreDocumentTitle = function () {
|
||||
document.title = this.originalDocumentTitle;
|
||||
};
|
||||
|
||||
/**
|
||||
* Modify page tabs to show that editing is taking place.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue