扩展:WikiLove
发行状态: 稳定版 |
|
|---|---|
| 实现 | 用户界面 |
| 描述 | 使在用户讨论页添加积极反馈变得更容易 |
| 作者 | Ryan Kaldari, Jan Paul Posma, Brandon Harris (设计) |
| 最新版本 | 1.3.1 |
| 兼容性政策 | 快照跟随MediaWiki发布。 master分支不向后兼容。 |
| MediaWiki | 1.27+ |
| 数据库更改 | 是 |
| 表 | wikilove_log |
| 许可协议 | MIT授權條款 |
| 下載 | |
|
|
|
| 前往translatewiki.net翻譯WikiLove扩展 | |
| 問題 | 开启的任务 · 报告错误 |
WikiLove 是一个扩展,旨在促进 WikiLove 在维基百科和可能的其他维基中的传播。 具体来讲,它使向用户讨论页添加奖励、礼物和邀请变得像单击几个按钮一样简单。
安装
- 下载文件,并解压
WikiLove文件夹到extensions/目录中。
开发者和代码贡献人员应改从Git安装此扩展,输入:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiLove
- 請新增下列代码到您的LocalSettings.php文件的底部:
wfLoadExtension( 'WikiLove' );
- 請运行更新脚本,它将自动创建此扩展所必须的数据库表。
完成 – 請导航至您的wiki上的Special:Version,以验证此扩展已成功安装。
如果你想使用内置奖励,你必须启用 InstantCommons。要啟用此功能,請將以下內容添加到 LocalSettings.php:
$wgUseInstantCommons = true;
扩展应该是活跃的。转到首选项中的编辑标签,打开界面。
你也可以在你的LocalSettings.php中使用這些組態選項。
$wgWikiLoveGlobal- 为所有的用户开启,用户可以在用户设置中关闭(默认值:false)。- 注意:你也可以默认启用该设置,但仍通过以下方式为用户提供关闭选项(“退出”):
$wgDefaultUserOptions['wikilove-enabled'] = 1;
$wgWikiLoveTabIcon- 为支持它们的皮肤使用图标(即 Vector)(默认值:true)$wgWikiLoveLogging- 启用 WikiLove 捐赠的日志记录(默认值:false); 这会自动创建一个数据库表wikilove_log,您可以将其用于统计查询
用法
要使您的帐户能够使用 WikiLove,请转到您首选项中的编辑选项卡,然后在“测试功能”(或者,在某些版本中,在 “常规选项” 下)打开 WikiLove。 2022年9月,这显示为“启用通过WikiLove标签向其他用户表达感谢的功能”。
要使用 WikiLove,请转到用户的讨论页(除您自己外)并单击心形图标。按照指示进行操作。
习惯配置
“要了解如何为单个编辑器(而不是整个 wiki)自定义 WikiLove,请参阅 user documentation。”
您可以通过编辑页面 MediaWiki:WikiLove.js 来自定义您自己的维基的选项。 在这里,您可以像使用内置选项一样更改配置:defaultOptions.js。 以下是一些自定义WikiLove配置的示例:
- Wikipedia
- Wikimedia Commons
defaultOptions.js顶部的选项是一些默认设置,为您提供便利。
如果您从类型或子类型中省略某些属性,将使用这些默认值(defaultText, defaultBackgroundColor, defaultBorderColor, defaultImageSize, defaultImage)。
然后是类型列表。
每种类型都可以具有属性name(必需)和icon(可选)。
此外,一个类型可以有子类型列表,也可以没有;如果没有子类型列表,那么附加属性将被分配给该类型本身。
如果该类型有子类型,它们会列在对象列表 subtypes 中。
可选地,该类型也可以具有select属性,该属性用于指定下拉菜单上方的标签。
每个子类型可以具有以下属性:
option– 下拉菜单中的名字descr– 子类型描述header– 正在添加的消息的标题,即位于== ... ==之间的部分title– 消息框的标题text– 消息框的文字(详见下方)image– 消息框的图片gallery– 用于选择图片的图库(详情见下文)fields– 用户可编辑的字段数组;可包含以下值:header, title, image, messageimageSize– 图片大小(例如100px)backgroundColor– 背景颜色(任何CSS有效颜色,例如#fdffe7或yellow)borderColor– 边框颜色(相同)
不使用子类型时,这些选项(前两项除外)应添加到类型本身中。
在text和email字段中(以及在前面提到的defaultText中),你可以使用一些会被自动替换的代码:
- $1 – 用户消息
- $2 – 标题
- $3 – 图像名称
- $4 – 圖像的尺寸
- $5 – 背景颜色
- $6 – 边框颜色
- $7 – 接收方的用户名
为了方便用户选择图片,你可以创建一个包含预定义图片的图库。为此,需要创建一个 gallery 属性,该属性具有以下特性:
imageList– 一个图像名称的数组width– 图库中图片的最大宽度(以像素为单位);对于3张图片,建议使用145height– 图库中图像的最大高度(以像素为单位)number– 要显示的随机图像数量(可选);如果省略,则显示所有图像
你可以使用维基共享资源中的图片,就像默认的奖励所做的那样。如前所述,为此你必须启用InstantCommons 。
//<nowiki>开头,以//</nowiki>结尾,这样任何wikitext代码(如签名或{{subst:foo}})都不会在JavaScript中被展开。
移除WikiLove类型
如果你只想移除一些默认的WikiLove类型,可以从$.wikiLoveOptions对象中删除它们。以下是一些你可以在你的维基的MediaWiki:WikiLove.js页面中使用的示例:
// Delete the Random Acts of Kindness Barnstar from the barnstars list
delete $.wikiLoveOptions.types.barnstar.subtypes.kindness;
// Delete the cheeseburger from the food and drink list
delete $.wikiLoveOptions.types.food.subtypes.cheeseburger;
// Delete the kittens interface entirely
delete $.wikiLoveOptions.types.kitten;
Adding new WikiLove types
Here's an example of adding a new puppy type:
$.wikiLoveOptions.types.puppy = {
name: 'Puppy', // name of the type (appears in the types menu)
fields: [ 'header', 'message' ], // fields to ask for in form
header: 'You get a puppy!', // header that appears at the top of the talk page post (optional)
text: '[[File:2009-08-16 Puppy at Duke East 1.jpg|left|150px]]\n$1\n\n~~'+'~~<br style="clear: both;"/>', // $1 is the custom message
icon: 'http://www.mysite.com/images/wikilove-icon-puppy.png' // appears in the types menu
};
Here's an example of adding a new hedgehog type with a gallery of images to choose from:
$.wikiLoveOptions.types.hedgehog = {
name: 'Hedgehogs', // name of the type (appears in the types menu)
fields: [ 'header', 'message' ], // fields to ask for in form
header: 'A hedgehog for you!', // header that appears at the top of the talk page post (optional)
text: '[[$3|left|150px]]\n$1\n\n~~'+'~~\n<br style="clear: both"/>', // $3 is the image filename, $1 is the message
gallery: {
imageList: [ 'Hedgehog1.jpg', 'Orizo5.jpg', 'Erinaceus europaeus LC0119.jpg' ],
width: 145, // maximum width of the images in the gallery
height: 150, // maximum height of the images in the gallery
number: 3 // number of random images to show (optional)
},
icon: 'http://www.mysite.com/images/wikilove-icon-hedgehog.png' // appears in the types menu
Here's an example of adding a new falafel subtype under the existing food type:
$.wikiLoveOptions.types.food.subtypes.falafel = {
fields: [ 'header', 'message' ], // fields to ask for in form
option: 'Falafel', // option listed in the select list
descr: 'Falafel is a popular Middle Eastern street food made from ground chickpeas or fava beans and topped with salads, vegetables, and sauces. It is typically served in a pocket of pita bread.',
header: 'Some falafel for you!', // header that appears at the top of the talk page post (optional)
image: 'Falafel award.png', // image for the item
imageSize: '120px' // size to display image (optional)
};
故障和问题
如果您尝试编辑的讨论页包含一个后来被添加到Special:SpamRegex中的词,那么试图通过界面添加“barnstar”或其他奖励的操作将会失败。这是因为该页面包含禁用词,所以无法编辑。从页面中移除该词或从过滤器中移除该词将解决此问题。
API帮助文档
WikiLove使用一个特殊的wikilove API向用户的讨论页发布消息。 这个API本质上只是一些现有API的简单封装。 如果用户的讨论页是一个wikitext页面,它会使用edit API。 如果是Flow页面,它会使用flow API。 如果这是一个LiquidThreads页面,它会使用threadaction API。
为了调用该API,请使用参数action=wikilove。
参数:
title- 要向其发送WikiLove的用户或用户讨论页的标题(必填)
text- 要添加到新部分的原始wikitext(必填)
message- 用户输入的实际消息,用于日志记录 (不包括图片和HTML格式)
token- 编辑令牌。您可以通过prop=info获取其中一个(必填)
subject- 新页面部分的主题标题(必填)
type- WikiLove类型(用于统计);这与左侧菜单中选择的类型相对应,之后还可以选择一个子类型(例如“barnstar-normal”或“kitten”)(可选)
email- 要发送给用户的可选电子邮件消息的内容
例如:
api.php?action=wikilove&title=User:Dummy&text=Love&subject=Hi&token=%2B\
1.0版设计





本文档介绍了维基百科"维基友爱"积极反馈系统的设计和功能。该工具旨在促进“维基友爱”在维基百科内部的传播。具体而言,它让在用户讨论页添加奖励和礼物变得如同点击几个按钮般简单。
原理
作为一个社区,维基百科有多种机制来表达不满或向用户提供“负面”反馈。某些工具,如Twinkle,在设计上着重于警告、封禁和撤销操作。
由于维基百科需要积极强化,特别是针对新用户,因此需要一个专门且仅用于积极反馈的系统。
异样的设计
该系统的设计风格极具“奇思妙想”。这是有意为之,旨在更贴合现代网站用户的期望。此外,“奖励”这一整体原则本身就充满奇趣(例如,小饼干和小猫)。
根据用户反馈,这种风格可能会被摒弃。
命名法注释
有些模板类型,例如欢迎模板,严格来说并不是“奖励”。
This document uses the term award interchangeably with template. Since the system is user-focused, and not intended directly for power-users, user-facing nomenclature has been used.
过程
对话行为
The WikiLove dialog is modal. Initiating it (from anywhere) will cause it to appear over the text of the page. It can be dismissed with a simple click.
维基友爱系统需要JavaScript。
The user will initially be presented with a short set of easy-to-understand instructions and a list of available award categories.
Upon selecting an award type, the user is presented with a section in which they can add details to the award (such as a short message).
Note that some award categories (e.g., "cookie") will not have a secondary award creation step and will go directly to "Preview".
The user then clicks the "preview" button, which will load a preview of the award so that they may see how it will look on the user's talk page.
Once the user is satisfied, they may click the "Send WikiLove" button. At this time, AJAX calls to the server API will be fired, adding the template to the user's talk page.
电子邮件通知
Since most new users are unlikely to be aware that they even have talk pages, they may not be aware that they have received the WikiLove in question.
Accordingly, the server will email the recipient (if they have provided an email address) informing them of the WikiLove as well as short instructions on how to access their talk page.
站点配置
Initially, the awards that can be given are to be defined in the gadget itself. If this system is elevated to an extension, then the names of the awards and the templates should be defined in the site's LocalSettings.php.
Alternatively, such information can be stored in the database. An administration console would be required to add or subtract available awards and award categories.
数据存储
为了收集统计数据,每次颁发奖励时,相关数据都会被跟踪并存储在数据库中。只需要一个可通过API写入的简单表格即可满足需求:
- 赠奖用户 - 授予奖励之人的用户名
- 获奖用户 - 接收奖励之人的用户名
- 模板 - 所授予奖励的模板名称
- 时间戳 - 奖励被授予的时间
- 奖励文本 - 可选;这会是奖励的具体文本内容
Special:WikiLoveStatistics
未来,应该可以创建一个名为“Special:WikiLoveStatistics”的页面,该页面可用于查看系统的使用频率,并深入了解谁送出的关爱最多、哪些奖励最受欢迎以及谁获得的奖励最多。
这将有助于提供社区健康的全局概况。授予的奖项越多,社区就越健康。
未来思考
该项目的第二阶段可能会使“发送维基友爱”链接动态添加到讨论页的签名中。这将让维基友爱的发送变得更加简便,可直接从其他讨论页进行操作。
参阅
- 维基友爱 - Original design document
- Extension:Thanks(感谢) - lighter-weight thanking for edits using Echo
- GiveCredit - MeatBall Wiki
| 此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
| 此扩展在以下wiki农场/托管网站和/或软件包中提供: 這不是一份權威名單。 即使某些wiki农场/托管网站和/或软件包未在这里列出,它们也可能提供此扩展。 请检查你的wiki农场/托管网站或软件包以确认提供情况。 |
- Stable extensions/zh
- User interface extensions/zh
- MIT licensed extensions/zh
- Extensions in Wikimedia version control/zh
- BeforePageDisplay extensions/zh
- ChangeTagsListActive extensions/zh
- GetPreferences extensions/zh
- ListDefinedTags extensions/zh
- LoadExtensionSchemaUpdates extensions/zh
- SkinTemplateNavigation::Universal extensions/zh
- UserMergeAccountFields extensions/zh
- All extensions/zh
- Extensions used on Wikimedia/zh
- Extensions included in Miraheze/zh
- Extensions included in WikiForge/zh
- API extensions/zh
