« MediaWiki:Common.js » : différence entre les versions
Page de l’interface de MediaWiki
Autres actions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 3 : | Ligne 3 : | ||
var a = document.createElement('a'); | var a = document.createElement('a'); | ||
a.id = 'citizen-newpage-button'; | a.id = 'citizen-newpage-button'; | ||
a.href = | a.href = '#'; | ||
a.title = 'Créer une page'; | a.title = 'Créer une page'; | ||
a.className = 'citizen-header__item cdx-button cdx-button--icon-only'; | a.className = 'citizen-header__item cdx-button cdx-button--icon-only'; | ||
a.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="M17 9v2h-6v6H9v-6H3V9h6V3h2v6z"/></svg>'; | a.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="M17 9v2h-6v6H9v-6H3V9h6V3h2v6z"/></svg>'; | ||
a.addEventListener('click', function(e) { | |||
e.preventDefault(); | |||
var searchInput = document.querySelector('.citizen-search input[type="search"]'); | |||
if (searchInput) { | |||
searchInput.focus(); | |||
searchInput.click(); | |||
} | |||
}); | |||
var d = document.querySelector('.citizen-drawer'); | var d = document.querySelector('.citizen-drawer'); | ||
if (d) d.parentNode.insertBefore(a, d.nextSibling); | if (d) d.parentNode.insertBefore(a, d.nextSibling); | ||
}); | }); | ||
Version du 21 mai 2026 à 14:48
$(function() {
if (document.getElementById('citizen-newpage-button')) return;
var a = document.createElement('a');
a.id = 'citizen-newpage-button';
a.href = '#';
a.title = 'Créer une page';
a.className = 'citizen-header__item cdx-button cdx-button--icon-only';
a.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="M17 9v2h-6v6H9v-6H3V9h6V3h2v6z"/></svg>';
a.addEventListener('click', function(e) {
e.preventDefault();
var searchInput = document.querySelector('.citizen-search input[type="search"]');
if (searchInput) {
searchInput.focus();
searchInput.click();
}
});
var d = document.querySelector('.citizen-drawer');
if (d) d.parentNode.insertBefore(a, d.nextSibling);
});