This was previously reported on T331679. There have been some changes to how user and site scripts load for Vector 2022 on certain wikis. Gadgets are not impacted. If you think you have been impacted or want to minimize impact to your project please see this ticket.
Wikis impacted:
* All projects where Vector legacy is the default skin
* Wikivoyage
* Wikibooks
All projects will be impacted over the next 3 months. It is strongly advised that you coordinate and take action proactively rather than retroactively :)
# Proactive actions required to avoid disruption
## For admins
* Copy essential code in [[MediaWiki:Vector.js]] to [[MediaWiki:Vector-2022.js]]. Note temporarily this will load both sets of code so make sure that your code is setup defensively e.g. for example to avoid two identical buttons being added to a page.
* Copy essential code in [[MediaWiki:Vector.css]] to [[MediaWiki:Vector-2022.css]]
* Request to be fast tracked by commenting on this ticket by telling me your project e.g. en.wikipedia.org
* Consider notifying your community in some way to mitigate the number of technical village pump / help requests you get relating to user scripts not working.
Considering installing a gadget for all logged in users to migrate their user JS.
```
function doMigrate() {
if ( mw.storage.get( 'vector-migration' ) ) {
return;
}
const api = new mw.Api();
const username = mw.user.getName();
const VECTOR_JS = `User:${username}/vector.js`;
const VECTOR_22_JS = `User:${username}/vector-2022.js`;
const VECTOR_CSS = `User:${username}/vector.css`;
const VECTOR_22_CSS = `User:${username}/vector-2022.css`;
api.get( {
action: 'query',
format: 'json',
titles: [
VECTOR_JS,
VECTOR_22_JS,
VECTOR_CSS,
VECTOR_22_CSS
],
prop: [ 'revisions', 'content' ],
rvprop: 'content',
formatversion: 2
} ).then( ( r ) => {
const content = {};
const rpages = r.query.pages
rpages.forEach( ( page ) => {
if ( page.revisions ) {
content[ page.title ] = page.revisions[0].content;
}
} );
const pages = rpages.filter( ( page ) => !page.missing ).map( ( page ) => page.title );
let migrateVJS = false;
let migrateVCSS = false;
if ( pages.indexOf( VECTOR_CSS ) > -1 && pages.indexOf( VECTOR_22_CSS ) === -1 && content[ VECTOR_CSS ] ) {
migrateVCSS = true;
}
if ( pages.indexOf( VECTOR_JS ) > -1 && pages.indexOf( VECTOR_22_JS ) === -1 && content[ VECTOR_JS ] ) {
migrateVJS = true;
}
if ( !migrateVCSS && !migrateVJS ) {
return;
}
const ok = window.confirm( 'Do you want your user scripts for Vector to apply to Vector 2022?' );
if ( ok ) {
const promises = [];
if ( migrateVCSS ) {
promises.push(
api.postWithEditToken( {
action: 'edit',
title: VECTOR_22_CSS,
text: content[ VECTOR_CSS ]
} )
)
}
if ( migrateVJS ) {
promises.push(
api.postWithEditToken( {
action: 'edit',
title: VECTOR_22_JS,
text: content[ VECTOR_JS ]
} )
)
}
return Promise.all( promises ).then( () => {
location.reload();
} );
}
mw.storage.set( 'vector-migration', 1 );
} )
}
if ( mw.config.get( 'skin' ) === 'vector-2022' ) {
doMigrate();
}
```
## For users
* Copy essential code in [[Special:MyPage/vector.js]] to [[Special:MyPage/vector-2022.js]]
* Copy essential code in [[Special:MyPage/vector.css]] to [[Special:MyPage/vector-2022.css]]
# Retroactive actions required to restore old behaviour.
## For admins
* Copy essential code in [[MediaWiki:Vector.js]] to [[MediaWiki:Vector-2022.js]]
* Copy essential code in [[MediaWiki:Vector.css]] to [[MediaWiki:Vector-2022.css]]
## For users
* Copy essential code in [[Special:MyPage/vector.js]] to [[Special:MyPage/vector-2022.js]]
* Copy essential code in [[Special:MyPage/vector.css]] to [[Special:MyPage/vector-2022.css]]