MediaWiki:Gadget-HotCat.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
K (https) |
||
(7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
window.hotcat_translations_from_commons = true; | |||
/* | /* | ||
HotCat | This imports the latest version of HotCat from Commons. | ||
HotCat is a gadget to make changes to categories much easier. | |||
Full documentation can be found at [[commons:Help:Gadget-HotCat]] | |||
can be | |||
*/ | */ | ||
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' ); | |||
// Präfix „Datei:“ für Dateibeschreibungsseiten und Spezial:Hochladen als Vorgabe | |||
$(function () { | |||
var namespaceNumber = mw.config.get('wgNamespaceNumber'); | |||
if (namespaceNumber === -1 && mw.config.get('wgCanonicalSpecialPageName') == 'Upload') { | |||
// We're on Special:Upload: pretend we were in the file namespace. | |||
namespaceNumber = 6; | |||
} | } | ||
// Exclude all other namespaces including talk pages and special pages | |||
if (namespaceNumber !== 6) return; | |||
$('body').delegate('.hotcatinput input:text', 'focus', function () { | |||
var wasSet = $(this).data('hotcatprefixset'); | |||
if (wasSet) return; // Already done, don't re-do it (user might have deleted pre-filled text) | |||
if (!this.value) { | |||
// If input field is empty, then pre-fill it | |||
var namespaceNames = mw.config.get('wgFormattedNamespaces'); | |||
if (namespaceNames && typeof (namespaceNames[namespaceNumber]) == 'string') { | |||
var suffix = ':'; | |||
this.value = namespaceNames[namespaceNumber] + suffix; | |||
} | |||
} | |||
$(this).data('hotcatprefixset', true); | |||
}); | |||
}); | |||
} | |||
Aktuelle Version vom 3. Januar 2017, 10:49 Uhr
window.hotcat_translations_from_commons = true; /* This imports the latest version of HotCat from Commons. HotCat is a gadget to make changes to categories much easier. Full documentation can be found at [[commons:Help:Gadget-HotCat]] */ mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' ); // Präfix „Datei:“ für Dateibeschreibungsseiten und Spezial:Hochladen als Vorgabe $(function () { var namespaceNumber = mw.config.get('wgNamespaceNumber'); if (namespaceNumber === -1 && mw.config.get('wgCanonicalSpecialPageName') == 'Upload') { // We're on Special:Upload: pretend we were in the file namespace. namespaceNumber = 6; } // Exclude all other namespaces including talk pages and special pages if (namespaceNumber !== 6) return; $('body').delegate('.hotcatinput input:text', 'focus', function () { var wasSet = $(this).data('hotcatprefixset'); if (wasSet) return; // Already done, don't re-do it (user might have deleted pre-filled text) if (!this.value) { // If input field is empty, then pre-fill it var namespaceNames = mw.config.get('wgFormattedNamespaces'); if (namespaceNames && typeof (namespaceNames[namespaceNumber]) == 'string') { var suffix = ':'; this.value = namespaceNames[namespaceNumber] + suffix; } } $(this).data('hotcatprefixset', true); }); });