2023-07-16 23:53:46
This commit is contained in:
parent
60099452c9
commit
1bb037429e
|
@ -0,0 +1 @@
|
||||||
|
.idea/
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
- Feedback, wishes and suggestions can be sent by email.
|
||||||
|
- Constructive criticism, bug descriptions and other reports are welcome.
|
||||||
|
- Email: mail@ihub.to
|
||||||
|
|
||||||
|
## Sources
|
||||||
|
|
||||||
|
- [**GitHub**](https://github.com/pkgstore)
|
||||||
|
- [GitLab](https://gitlab.com/pkgstore) (MIRROR)
|
||||||
|
- [Codeberg](https://codeberg.org/pkgstore) (MIRROR)
|
||||||
|
- [MosHub](https://hub.mos.ru/pkgstore) (MIRROR)
|
||||||
|
- [Git.Org.Ru](https://git.org.ru/pkgstore) (MIRROR)
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Package Store
|
Copyright (c) 2023 iHub TO <https://ihub.to>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MediaWiki\Extension\PkgStore;
|
||||||
|
|
||||||
|
use MWException;
|
||||||
|
use OutputPage, Parser, Skin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MW_EXT_Tooltip
|
||||||
|
*/
|
||||||
|
class MW_EXT_Tooltip
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register tag function.
|
||||||
|
*
|
||||||
|
* @param Parser $parser
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws MWException
|
||||||
|
*/
|
||||||
|
public static function onParserFirstCallInit(Parser $parser): void
|
||||||
|
{
|
||||||
|
$parser->setFunctionHook('tooltip', [__CLASS__, 'onRenderTag']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render tag function.
|
||||||
|
*
|
||||||
|
* @param Parser $parser
|
||||||
|
* @param string $word
|
||||||
|
* @param string $tooltip
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function onRenderTag(Parser $parser, string $word = '', string $tooltip = ''): string
|
||||||
|
{
|
||||||
|
// Argument: id.
|
||||||
|
$getWord = MW_EXT_Kernel::outClear($word ?? '' ?: '');
|
||||||
|
$outWord = $getWord;
|
||||||
|
|
||||||
|
// Argument: tooltip.
|
||||||
|
$getTooltip = MW_EXT_Kernel::outClear($tooltip ?? '' ?: '');
|
||||||
|
$outTooltip = $getTooltip;
|
||||||
|
|
||||||
|
// Out parser.
|
||||||
|
return '<span class="mw-tooltip" title="' . $outTooltip . '">' . $outWord . '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load resource function.
|
||||||
|
*
|
||||||
|
* @param OutputPage $out
|
||||||
|
* @param Skin $skin
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function onBeforePageDisplay(OutputPage $out, Skin $skin): void
|
||||||
|
{
|
||||||
|
$out->addModuleStyles(['ext.mw.tooltip.styles']);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internationalization file for extension MW_EXT_Tooltip (magic words).
|
||||||
|
*
|
||||||
|
* @file
|
||||||
|
* @ingroup Extensions
|
||||||
|
* @license MIT
|
||||||
|
* @author iHub TO <https://ihub.to>
|
||||||
|
*/
|
||||||
|
$magicWords = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* English.
|
||||||
|
*
|
||||||
|
* @author iHub TO <https://ihub.to>
|
||||||
|
*/
|
||||||
|
$magicWords['en'] = [
|
||||||
|
'tooltip' => [0, 'tooltip'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Russian.
|
||||||
|
*
|
||||||
|
* @author iHub TO <https://ihub.to>
|
||||||
|
*/
|
||||||
|
$magicWords['ru'] = [
|
||||||
|
'tooltip' => [0, 'tooltip'],
|
||||||
|
];
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Confirm MediaWiki environment.
|
||||||
|
if (!defined('MEDIAWIKI')) {
|
||||||
|
die('This file is a MediaWiki extension and thus not a valid entry point.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('wfLoadExtension')) {
|
||||||
|
wfLoadExtension('MW_EXT_Tooltip');
|
||||||
|
// Keep i18n globals so mergeMessageFileList.php doesn't break.
|
||||||
|
$wgExtensionMessagesFiles['MW_EXT_Tooltip'] = __DIR__ . '/i18n';
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
die('This version of the MW_EXT_Tooltip extension requires MediaWiki 1.31+');
|
||||||
|
}
|
19
README.md
19
README.md
|
@ -1 +1,18 @@
|
||||||
# mediawiki-ext-tooltip
|
# Information
|
||||||
|
|
||||||
|
Всплывающее информационное сообщение напротив определённого слова. Расшифровка аббревиатур.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
1. Загрузите папки и файлы в директорию `extensions/MW_EXT_Tooltip`.
|
||||||
|
2. В самый низ файла `LocalSettings.php` добавьте строку:
|
||||||
|
|
||||||
|
```php
|
||||||
|
wfLoadExtension( 'MW_EXT_Tooltip' );
|
||||||
|
```
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
|
```html
|
||||||
|
{{#tooltip: [WORD]|[TOOLTIP]}}
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"name": "pkgstore/mediawiki-ext-tooltip",
|
||||||
|
"type": "mediawiki-extension",
|
||||||
|
"description": "MediaWiki tooltip extension.",
|
||||||
|
"license": "MIT",
|
||||||
|
"homepage": "https://ihub.to/",
|
||||||
|
"keywords": [
|
||||||
|
"mediawiki",
|
||||||
|
"tooltip"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "iHub TO",
|
||||||
|
"email": "mail@ihub.to",
|
||||||
|
"homepage": "https://ihub.to/",
|
||||||
|
"role": "Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kitsune Solar",
|
||||||
|
"email": "mail@kitsune.solar",
|
||||||
|
"homepage": "https://kitsune.solar/",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/pkgstore/mediawiki-ext-tooltip/issues",
|
||||||
|
"source": "https://github.com/pkgstore/mediawiki-ext-tooltip"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer/installers": "^1.0.1",
|
||||||
|
"php": ">=8.2",
|
||||||
|
"pkgstore/mediawiki-ext-kernel": "*"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"MW_EXT_Tooltip.class.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"prepend-autoloader": false
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "MW_EXT_Tooltip"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"name": "MW_EXT_Tooltip",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": [
|
||||||
|
"[https://ihub.to/ iHub TO]",
|
||||||
|
"[https://kitsune.solar/ Kitsune Solar]",
|
||||||
|
"..."
|
||||||
|
],
|
||||||
|
"url": "https://ihub.to/",
|
||||||
|
"descriptionmsg": "mw-tooltip-desc",
|
||||||
|
"license-name": "[https://choosealicense.com/licenses/mit/ MIT]",
|
||||||
|
"type": "parserhook",
|
||||||
|
"require": {
|
||||||
|
"MediaWiki": ">= 1.31.0",
|
||||||
|
"extensions": {
|
||||||
|
"MW_EXT_Kernel": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AutoloadClasses": {
|
||||||
|
"MediaWiki\\Extension\\PkgStore\\MW_EXT_Tooltip": "MW_EXT_Tooltip.class.php"
|
||||||
|
},
|
||||||
|
"Hooks": {
|
||||||
|
"ParserFirstCallInit": [
|
||||||
|
"MediaWiki\\Extension\\PkgStore\\MW_EXT_Tooltip::onParserFirstCallInit"
|
||||||
|
],
|
||||||
|
"BeforePageDisplay": [
|
||||||
|
"MediaWiki\\Extension\\PkgStore\\MW_EXT_Tooltip::onBeforePageDisplay"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ExtensionMessagesFiles": {
|
||||||
|
"MW_EXT_TooltipMagic": "MW_EXT_Tooltip.i18n.magic.php"
|
||||||
|
},
|
||||||
|
"MessagesDirs": {
|
||||||
|
"MW_EXT_Tooltip": [
|
||||||
|
"i18n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ResourceModules": {
|
||||||
|
"ext.mw.tooltip.styles": {
|
||||||
|
"styles": [
|
||||||
|
"styles/theme.css"
|
||||||
|
],
|
||||||
|
"position": "top",
|
||||||
|
"targets": [
|
||||||
|
"desktop",
|
||||||
|
"mobile"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ResourceFileModulePaths": {
|
||||||
|
"localBasePath": "modules",
|
||||||
|
"remoteExtPath": "MW_EXT_Tooltip/modules"
|
||||||
|
},
|
||||||
|
"manifest_version": 2
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"@metadata": {
|
||||||
|
"authors": [
|
||||||
|
"iHub TO"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mw-tooltip-desc": "Всплывающее информационное сообщение напротив определённого слова. Расшифровка аббревиатур."
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
.mw-tooltip {
|
||||||
|
border-bottom: 1px dotted;
|
||||||
|
cursor: help;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
.mw-tooltip{border-bottom:1px dotted;cursor:help}
|
|
@ -0,0 +1 @@
|
||||||
|
@import 'main.scss';
|
Loading…
Reference in New Issue