User:PerfektesChaos/js/remindErrorMessages
JavaScript gadget – remind and augment error messages in page:
- Show a summary of all error messages in page close to the heading area, on top of content, with link to every message.
- Make all messages flamboyant and visible even if hidden by default.
- On preview of source text editing a button ! is present next to preview button if any warning detected.
Error messages are created by templates or sometimes by MediaWiki components and contain a class="error"
assignment.
Additionally, hidden categories may be shown in page head since many but not all of them indicate maintenance needs.
Usage
[edit]- If your project has registered this as a gadget, just activate on your Preferences page.
- Otherwise include the following lines into your common.js, global.js etc.:
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/remindErrorMessages/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
"text/javascript" );
User options
[edit]The appearance might be changed via CSS on two ways.
CSS
[edit]The following lines may be inserted into your common.css, global.css or skin dependant CSS. Any attribute value may be applied.
/* every single message */
.remindErrorMessages_msg {
background: #FF4040 ! important;
}
/* box on top of content */
#remindErrorMessages_box {
background: #FFFF80 ! important;
}
/* button on source text editing */
#remindErrorMessages_attention {
border: #FFFF00 2px solid ! important;
}
JavaScript
[edit]Another approach is to influence code generation directly as follows:
- The
{ ...: ... }
may be an object equipped with assignments of CSS properties and values.
if ( typeof mw.libs.remindErrorMessages !== "object" ) {
mw.libs.remindErrorMessages = { };
}
// button on source text editing
mw.libs.remindErrorMessages.barCSS = { ...: ... };
// every single element
mw.libs.remindErrorMessages.barkCSS = { ...: ... };
// box on top of content
mw.libs.remindErrorMessages.boxCSS = { ...: ... };
It should appear on your common.js, global.js or skin dependant JS best before an mw.loader.load()
call as described in “Usage” section.
Hidden categories
[edit]Hidden categories may be shown in page head since many but not all of them indicate maintenance needs.
The following lines could be included into your common.js, global.js etc., best before loading the gadget:
if ( typeof mw.libs.remindErrorMessages !== "object" ) {
mw.libs.remindErrorMessages = { };
}
mw.libs.remindErrorMessages.hiddencats = true;
Other languages
[edit]This gadget is prepared for bidirectional support.
Text to be translated is not used.
Codes
[edit]Source code |
|
ResourceLoader |
|
Namespaces |
|
mw.libs
|
remindErrorMessages
|