Added 1.0 files
This commit is contained in:
		
							
								
								
									
										35
									
								
								extension.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								extension.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "name": "Spoiler▓Alert",
 | 
				
			||||||
 | 
					    "author": "Samuel Maenle",
 | 
				
			||||||
 | 
					    "url": "https://git.maenle.net/diocloid/SpoilerAlert",
 | 
				
			||||||
 | 
					    "description": "This MediaWiki extension allows users to create spoiler tags that reveal content on click. <code><spoiler> I am a spoiler </spoiler></code>",
 | 
				
			||||||
 | 
					    "type": "parserhook",
 | 
				
			||||||
 | 
					    "version": "1.0",
 | 
				
			||||||
 | 
					    "license-name": "AGPL-3.0-only",
 | 
				
			||||||
 | 
					    "manifest_version": 2,
 | 
				
			||||||
 | 
					    "AutoloadClasses": {
 | 
				
			||||||
 | 
					        "SpoilerAlertHooks": "includes/SpoilerAlertHooks.php"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "Hooks": {
 | 
				
			||||||
 | 
					        "BeforePageDisplay": [
 | 
				
			||||||
 | 
					            "SpoilerAlertHooks::onBeforePageDisplay"
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        "ParserFirstCallInit": [
 | 
				
			||||||
 | 
					            "SpoilerAlertHooks::onParserFirstCallInit"
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "ResourceModules": {
 | 
				
			||||||
 | 
					        "ext.spoileralert": {
 | 
				
			||||||
 | 
					            "scripts": [
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "styles": [
 | 
				
			||||||
 | 
					                "/modules/ext.spoileralert.css"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "position": "top"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "ResourceFileModulePaths": {
 | 
				
			||||||
 | 
						"localBasePath": "",
 | 
				
			||||||
 | 
						"remoteExtPath": "SpoilerAlert"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										17
									
								
								includes/SpoilerAlertHooks.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								includes/SpoilerAlertHooks.php
									
									
									
									
									
										Normal 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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								modules/ext.spoileralert.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								modules/ext.spoileralert.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					.spoiler {
 | 
				
			||||||
 | 
					    background-color: black;
 | 
				
			||||||
 | 
					    color: black;
 | 
				
			||||||
 | 
					    transition: color 0.5s ease;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.spoiler.revealed {
 | 
				
			||||||
 | 
					    color: white;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user