Added 1.0 files

This commit is contained in:
webuser@infra.woelkchen.at
2024-03-19 22:33:58 +01:00
commit 6a5237bd8c
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?php
class SpoilerAlertHooks {
public static function onParserFirstCallInit( Parser $parser ) {
$parser->setHook( 'spoiler', [ self::class, 'renderSpoiler' ] );
return true;
}
public static function renderSpoiler( $input, array $args, Parser $parser, PPFrame $frame ) {
$output = $parser->recursiveTagParse( $input, $frame );
return "<span class='spoiler' onclick='this.classList.toggle(\"revealed\")'>" . htmlspecialchars( $output ) . "</span>";
}
public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
$out->addModules( ['ext.spoileralert'] );
return true;
}
}