MediaWiki:Gadget-HotCat.js:修订间差异
外观
删除的内容 添加的内容
Maintenance script(留言 | 贡献) 固定上游版本并补全依赖 |
Maintenance script(留言 | 贡献) 维护 HotCat 加载范围和远程加载协议 |
||
| 第1行: | 第1行: | ||
/** |
/** |
||
* Gadget: |
* Gadget: HotCat loader |
||
* 来源:Wikimedia Commons |
|||
* 文档:https://commons.wikimedia.org/wiki/Help:Gadget-HotCat |
|||
* |
* |
||
* Loads the pinned Wikimedia Commons HotCat gadget for logged-in users on |
|||
* 功能: |
|||
* editable pages. The actual implementation stays upstream; this local page |
|||
* - 在页面底部分类栏提供快速添加 / 删除 / 修改分类的按钮。 |
|||
* keeps loading scope and dependency handling explicit. |
|||
* - 支持自动补全分类名称、快速保存、更改预览等功能。 |
|||
* - 自动根据语言加载本地化翻译。 |
|||
| ⚫ | |||
* 注意: |
|||
* - 依赖 MediaWiki API 权限(编辑页面)。 |
|||
* - 若本地无 HotCat 翻译,将自动从 Commons 读取。 |
|||
* - 若你想自定义翻译,请创建 MediaWiki:Gadget-HotCat-message-zh.json 等文件。 |
|||
*/ |
*/ |
||
( function () { |
|||
'use strict'; |
|||
| ⚫ | |||
return; |
|||
| ⚫ | |||
if ( !mw.config.get( 'wgIsProbablyEditable' ) || mw.config.get( 'wgNamespaceNumber' ) < 0 ) { |
|||
return; |
|||
| ⚫ | |||
| ⚫ | |||
// 避免重复加载 |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
// 等待 MediaWiki 核心模块加载完成后再调用 |
|||
| ⚫ | |||
| ⚫ | |||
} ); |
|||
| ⚫ | |||
}() ); |
|||
| ⚫ | |||
2026年7月16日 (四) 16:59的最新版本
/**
* Gadget: HotCat loader
*
* Loads the pinned Wikimedia Commons HotCat gadget for logged-in users on
* editable pages. The actual implementation stays upstream; this local page
* keeps loading scope and dependency handling explicit.
*/
( function () {
'use strict';
if ( window.HotCatLoader ) {
return;
}
if ( !mw.config.get( 'wgIsProbablyEditable' ) || mw.config.get( 'wgNamespaceNumber' ) < 0 ) {
return;
}
window.HotCatLoader = true;
window.hotcat_translations_from_commons = true;
mw.loader.using( [ 'mediawiki.util', 'mediawiki.api' ] ).then( function () {
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&oldid=1093305835&action=raw&ctype=text/javascript' );
} );
}() );