MediaWiki:Gadget-watchlistMessage.js
Erscheinungsbild
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
/// <nowiki> Gadget-watchlistMessage.js
/// PerfektesChaos@de.wikipedia 2025
/* global window: false */
/* jshint forin: false,
bitwise:true, curly:true, eqeqeq:true, latedef:true,
laxbreak:true,
nocomma:true, strict:true, undef:true, unused:true */
( function ( mw, $ ) {
"use strict";
var Self = "gadget-watchlist-message",
Summary = ".mw-specialpage-summary",
Support = "dauerhaft ausblenden",
ButtCSS = { "background-color": "#FF0000",
"color": "#FFFFFF",
"float": "right",
"font-family": "sans-serif",
"font-size": "0.6rem",
"font-style": "normal",
"font-weight": "bolder",
"margin": "0.3em",
"padding-left": "0.1em",
"padding-right": "0.1em",
"text-align": "center",
"vertical-align": "middle" },
Regex, $Boxes, $Button;
function fade( arglist ) {
// Dismiss request, set cookie
var data, sign, $box;
if ( typeof arglist === "object"
&& arglist &&
typeof arglist.data === "object"
&& arglist.data
&& arglist.data.length ) {
data = arglist.data;
if ( typeof data[ 0 ] === "string" &&
typeof data[ 1 ] === "object" ) {
sign = data[ 0 ];
$box = data[ 1 ];
$box.hide();
mw.cookie.set( sign,
"hide",
{ "expires": 3 * 7 * 86400 } );
}
}
} // fade()
function fill( aCode, $aBox ) {
// Equip and show $aBox
var $butt;
if ( ! $Button ) {
$Button = $( "<button>" );
$Button.attr( "title", Support )
.css( ButtCSS )
.text( "X" );
}
$butt = $Button.clone();
$butt.on( "click", null, [ aCode, $aBox ], fade );
$aBox.append( $butt )
.show();
} // fill()
function find( $aBox ) {
// $aBox found
var s = " " + $aBox.attr( "class" ) + " ",
g = Regex.exec( s );
if ( g ) {
s = g[ 1 ];
if ( mw.cookie.get( s ) ) {
$aBox.hide();
} else {
fill( s, $aBox );
}
}
} // find()
function finder() {
// $Boxes found
var i;
Regex = " (" + Self + "-20[^ ;\n]+) ";
Regex = new RegExp( Regex );
for ( i = 0; i < $Boxes.length; i++ ) {
find( $Boxes.eq( i ) );
} // for i
} // finder()
function first() {
// Autorun on loading; DOM ready
var $summary = $( Summary );
if ( $summary.length ) {
$Boxes = $summary.find( "div." + Self );
if ( $Boxes.length ) {
mw.loader.using( "mediawiki.cookie", finder );
}
}
} // first()
$( first );
}( window.mediaWiki, window.jQuery ) );
/// EOF </nowiki> Gadget-watchlistMessage.js