Zum Inhalt springen

MediaWiki:Common.js: Unterschied zwischen den Versionen

Lektoratsangabe erscheint automatisch auf allen Seiten der Kategorie Medikamente
Lektoratsangabe: Kategorie auch in der mobilen Ansicht erkennen
 
Zeile 133: Zeile 133:
var haltbar = 60 * 60 * 1000;
var haltbar = 60 * 60 * 1000;


if ( conf.wgNamespaceNumber !== 0 || conf.wgAction !== 'view' || !conf.wgIsArticle || conf.wgDiffNewId ||
if ( conf.wgNamespaceNumber !== 0 || conf.wgAction !== 'view' || !conf.wgIsArticle || conf.wgDiffNewId ) {
( conf.wgCategories || [] ).indexOf( 'Medikamente' ) === -1 ) {
return;
return;
}
/* Die mobile Ansicht liefert wgCategories nicht mit. Dort zählt die Kategorienzeile am Seitenende. */
function istMedikament() {
if ( conf.wgCategories ) {
return conf.wgCategories.indexOf( 'Medikamente' ) !== -1;
}
return $( '#catlinks a[title="Kategorie:Medikamente"]' ).length > 0;
}
}


Zeile 147: Zeile 154:
}
}


mw.hook( 'wikipage.content' ).add( function ( $content ) {
mw.hook( 'wikipage.content' ).add( function () {
var $ausgabe = $content.find( '.mw-parser-output' ).addBack( '.mw-parser-output' ).first();
var $ausgabe = $( '#mw-content-text' ).find( '.mw-parser-output' ).first();
var gemerkt = null;
var gemerkt = null;
if ( !$ausgabe.length || $ausgabe.find( '.lektorat, .kein-lektorat' ).length ) {
if ( !$ausgabe.length || !istMedikament() || $ausgabe.find( '.lektorat, .kein-lektorat' ).length ) {
return;
return;
}
}