MediaWiki:Welcome-modal-dialog.js
Note : après avoir enregistré vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
/* This modal dialog displays a welcome message along with a warning for first time visitors. */
if(document.cookie.search("wikimedica-skip-welcome-message=1") == -1)
{
// When: The 'mediawiki.api' module is loaded, and, the page is ready.
$.when( mw.loader.using( [ 'mediawiki.api', 'oojs-ui-core', 'oojs-ui-windows' ] ), $.ready ).then(function() {
return new mw.Api().loadMessagesIfMissing( [ 'welcome-modal-dialog-title', 'welcome-modal-dialog-message' ] );
}).then( function() {
if( !mw.user.isAnon() ) { return; } // Do not show if user is logged in.
switch(mw.config.get("wgPageName").replace("_", " "))
{
case "Gestion:Politiques/Conditions d'utilisation":
case "Gestion:Politiques/Conflits d'intérêts":
case "Gestion:Licence":
case "Gestion:Politiques/Droit d'auteur":
// Let these pages through, they are needed for the user to make an inform decision wether they want to agree with the terms of use.
return;
}
var dialog = new OO.ui.MessageDialog();
// Create and append a window manager.
var windowManager = new OO.ui.WindowManager();
$( 'body' ).append( windowManager.$element );
// Add the dialog to the window manager.
windowManager.addWindows( [ dialog ] );
dialog.getActionProcess = function(action) // Set the cookie and close the dialog when the user clicks the button.
{
document.cookie = "wikimedica-skip-welcome-message=1; expires=Thu, 18 Dec 2030 12:00:00 UTC; path=/";
this.close();
return OO.ui.MessageDialog.super.prototype.getActionProcess.call( this, action );
}
// Configure the message dialog when it is opened with the window manager's openWindow() method.
windowManager.openWindow( dialog, {
title: new OO.ui.HtmlSnippet(mw.message('welcome-modal-dialog-title').parse()),
message: new OO.ui.HtmlSnippet(mw.message('welcome-modal-dialog-message').parse()),
verbose: true,
size: 'medium',
actions: [
{
action: 'accept',
label: "J'accepte les conditions",
flags: 'primary'
}
]
});
});
}