Jump to content

User:Dragoniez/Selective Rollback

From Meta, a Wikimedia project coordination wiki
This page is a translated version of the page User:Dragoniez/Selective Rollback and the translation is 69% complete.
Selective Rollback的对话框(英语)
Selective Rollback的对话框(日语)

Selective Rollback是一个用户脚本,为回退功能提供了多项实用的特性:

  • 非跳转回退
在点击回退链接时不跳转页面,而是直接在当前页面执行回退操作。
  • 回退摘要
允许为回退操作设置自定义的编辑摘要。
  • 选择性回退(Selective rollback)
允许选择页面内的部分回退链接,并一次性批量回退。
  • 批量回退
一次性回退页面内所有可回退的编辑。
  • 机器人回退
在用户具备相应权限的情况下(可配置),将回退操作标记为机器人编辑。
  • 管理监视列表
将被回退的页面加入监视列表(可配置),也可以指定加入监视列表的时长。
  • 回退确认
在执行回退操作前显示确认对话框(桌面版默认禁用)。
请注意,该脚本会自动禁用可在参数设置中启用的内置回退确认功能。
  • 轻松自定义
可以在Special:SelectiveRollbackConfig中设置个人配置,该特殊页面会在脚本加载时自动生成。

安装方法

如果要在全域使用,请将以下内容添加到Special:MyPage/global.js;如果只是在元维基使用,请添加到Special:MyPage/common.js;如果想在某个本地维基使用,请添加到该维基的用户common.js中。(源代码)

mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Dragoniez/Selective_Rollback.js&action=raw&ctype=text/javascript');

关于如何使用此脚本,请参见下方的#使用方法;关于如何进行配置,请参见#配置

使用方法

对话框

可以通过点击“Tools”菜单中的“Selective Rollback”工具栏链接,或者按住CTRL点击某个回退链接来打开Selective Rollback对话框。

非跳转回退

只需点击回退链接;回退操作将在不离开当前页面的情况下执行。

回退摘要

在对话框中选择“自定义”,然后输入编辑摘要(或者直接在文本框中输入摘要)。 您设置的自定义编辑摘要在关闭对话框后仍会被保留,并会在点击回退链接进行非跳转回退时使用。

Replacement expressions you can use inside summaries:

  • $0default rollback summary on the local wiki
  • $1username of the author of the edit that is being restored
  • $2 — 被回退编辑的编者用户名
  • $3 — 被回退到的修订版本的版本ID
  • $4 — 被回退到的版本的时间戳
  • $5 — 被回退的版本的版本ID
  • $6 — 被回退版本的时间戳
  • $7 — 被回退的编辑次数

示例:

假设$1Example$2Example2。 例如在元维基中,

Long-term abuse $0

会被展开为

Long-term abuse Reverted changes by Example2 (talk) to last version by Example

这是因为默认的回退摘要是:

Reverted changes by [[Special:Contributions/$2|$2]] ([[User talk:$2|talk]]) to last version by $1

当您希望在回退操作中添加自定义说明,同时保留默认回退摘要时,$0替换功能非常有用。 实质上,这个功能使回退操作可以像撤销一样指定摘要。

您也可以预先设置自定义摘要和替换内容(详情请参见#配置)。

选择性回退

If the current page contains rollback links, "SR" checkboxes will appear next to them. Select the edits you want to rollback, open the dialog, and click "Rollback".

Note: This feature is disabled on Special:RecentChanges and Special:Watchlist.

批量回退

Open the dialog, hit "Select all", and then hit "Rollback".

Note: This feature is disabled on Special:RecentChanges and Special:Watchlist.

机器人回退

Check "Mark rollbacks as bot edits" before performing rollback.

管理监视列表

Check "Add rollback targets to watchlist" before performing rollback.

配置

Selective Rollback can be configured via Special:SelectiveRollbackConfig (or Special:SRC), which provides an intuitive and self-explanatory interface.

A few notes:

  • The configuration consists of global and local settings. When local settings exist, they (partially) override global settings.
  • Existing configurations can be deleted via the "Miscellaneous" tab on the config page.
  • On initialization, the script fetches the default rollback summary and the user's rights, then caches them to reduce API calls. However, this also means that the corresponding internal data are not immediately updated even when affecting changes occur on the wiki. If this ever causes an issue, try clearing the cache via the "Miscellaneous" tab on the config page.

翻译

Selective Rollbck支持多种语言。 If you would like to add support for another language, please translate the following texts and submit your translations on the talk page.

翻译用文本

{
	'scriptname': 'Selective Rollback', // Added in v5.0.1
	'portlet-tooltip-dialog': 'Open the Selective Rollback dialog',
	'portlet-label-uncacher': 'Purge cache for Selective Rollback', // v4.4.3
	'dialog-label-summary': 'Edit summary',
	'dialog-label-summary-default': 'Default edit summary',
	'dialog-label-summary-custom': 'Custom',
	'dialog-label-summaryinput': 'Custom edit summary',
	'dialog-help-summaryinput-$0': '<code>$0</code> will be replaced with the default rollback summary.',
	'dialog-help-summaryinput-$0-error': '<code>$0</code> will be replaced with the default rollback summary <b>in English</b>.',
	'dialog-label-summarypreview': 'Summary preview', // v4.0.0
	'dialog-help-summarypreview': '<code>{{PLURAL:$7}}</code> will be replaced.', // Updated in v5.0.0
	'dialog-label-markbot': 'Mark rollbacks as bot edits',
	'dialog-label-watchlist': 'Add rollback targets to watchlist',
	'dialog-label-watchlistexpiry': 'Expiry', // Deprecated since v5.0.0
	'dialog-label-watchlistexpiry-indefinite': 'Indefinite',
	'dialog-label-watchlistexpiry-1week': '1 week',
	'dialog-label-watchlistexpiry-1month': '1 month',
	'dialog-label-watchlistexpiry-3months': '3 months',
	'dialog-label-watchlistexpiry-6months': '6 months',
	'dialog-label-watchlistexpiry-1year': '1 year',
	'dialog-button-rollback': 'Rollback', // Updated in v5.0.0
	'dialog-button-documentation': 'Docs', // Added in v5.0.0
	'dialog-button-config': 'Config', // v5.1.0
	'dialog-button-selectall': 'Select all', // Updated in v5.0.0
	'dialog-label-selectcount': 'Selected:', // Added in v5.0.7
	'dialog-button-close': 'Close', // Deprecated since v5.0.0
	'rollback-notify-noneselected': 'No checkbox is checked.',
	'rollback-notify-linksresolved': 'Rollback links on this page have all been resolved.',
	'rollback-confirm': 'Are you sure you want to rollback this edit?',
	'rollback-label-success': 'reverted',
	'rollback-label-failure': 'rollback failed',
	'rollback-notify-success': 'Success', // v4.0.0
	'rollback-notify-failure': 'Failure', // v4.0.0
	// v5.1.0
	'config-title': 'Configure Selective Rollback',
	'config-tab-local': 'Local',
	'config-tab-global': 'Global',
	'config-notice-local': 'Local config applies only to this project and may (partially) override the global config if present.',
	'config-notice-global': 'Global config applies to all projects and may be (partially) overridden by the local config if present.',
	'config-default': 'Default',
	'config-default-disabled': 'Disabled',
	'config-default-enabled': 'Enabled',
	'config-label-lang': 'Language',
	'config-help-lang': 'The user\'s interface language as set in preferences, or English if translations are unavailable.',
	'config-label-summary': 'Preset summaries',
	'config-label-propertyinput-key': 'Key',
	'config-label-propertyinput-value': 'Value',
	'config-error-propertyinput-key-empty': 'The key must not be empty.',
	'config-error-propertyinput-value-empty': 'The value must not be empty.',
	'config-error-propertyinput-key-reserved': 'The key "$1" is reserved by the system and hence disallowed.',
	'config-error-propertyinput-key-duplicate': 'The key must be unique.',
	'config-button-add': 'Add',
	'config-button-remove': 'Remove',
	'config-button-deselectall': 'Deselect all',
	'config-help-summary-$0': '<code>$0</code> — default rollback summary on the local wiki',
	'config-help-summary-$1': '<code>$1</code> — username of the author of the edit that is being restored',
	'config-help-summary-$2': '<code>$2</code> — username of the author of the edits that are being reverted',
	'config-help-summary-$3': '<code>$3</code> — revision ID of the revision reverted to',
	'config-help-summary-$4': '<code>$4</code> — timestamp of the revision reverted to',
	'config-help-summary-$5': '<code>$5</code> — revision ID of the revision reverted from',
	'config-help-summary-$6': '<code>$6</code> — timestamp of the revision reverted from',
	'config-help-summary-$7': '<code>$7</code> — the number of edits that have been reverted',
	'config-label-showkeys': 'Use keys instead of values as dropdown options',
	'config-label-mergesummaries': 'Merge summaries from the global config instead of overriding them',
	'config-label-replacer': 'Replacement expressions',
	'config-help-replacer': 'Replacement expressions are keywords that will be replaced with certain texts in a rollback summary. It is recommended to <b>always prefix your expressions</b> with <code>$</code> or a similar symbol to avoid unintentional text replacements.',
	'config-label-mergereplacers': 'Merge replacement expressions from the global config instead of overriding them',
	'config-label-watchlist': 'Watchlist',
	'config-label-watchlistexpiry': 'Watchlist expiry',
	'config-label-confirmation': 'Rollback confirmation',
	'config-label-confirmation-desktop': 'Desktop',
	'config-label-confirmation-mobile': 'Mobile',
	'config-label-confirmation-always': 'Always',
	'config-label-confirmation-never': 'Never',
	'config-label-confirmation-RCW': 'If on Recentchanges or Watchlist',
	'config-label-confirmation-nonRCW': 'If not on Recentchanges or Watchlist',
	'config-label-checkboxlabelcolor': 'Checkbox label color',
	'config-help-checkboxlabelcolor': 'Preview:',
	'config-label-miscellaneous': 'Miscellaneous',
	'config-help-markbot': 'This option applies only when you have the required rights on the wiki.',
	'config-label-configlink': 'Generate a portlet link to the config page',
	'config-label-purger': 'Generate a portlet link to purge the cache',
	'config-button-save': 'Save',
	'config-notify-save-success': 'Saved the configurations.',
	'config-notify-save-failure': 'Failed to save the configurations: $1',
	'config-button-reset': 'Reset',
	'config-confirm-reset': 'Do you want to reset the configurations to their default values? Changes will need to be saved manually.',
	'config-notify-reset': 'Field values have been reset to their default values.',
	'config-label-deleteglobal': 'Delete global config',
	'config-help-deleteglobal-absent': 'You do not have any global settings configured.',
	'config-label-deletelocal': 'Delete local config',
	'config-help-deletelocal-absent': 'You do not have any local settings configured.',
	'config-label-deletelocalall': 'Delete local config on all other projects',
	'config-help-deletelocalall-present': 'To perform this action, you need to be logged in on $1.',
	'config-help-deletelocalall-absent': 'You do not have any local settings configured on other projects.',
	'config-label-deletedata': 'Delete data',
	'config-button-deletedata': 'Delete',
	'config-confirm-deletedata': 'Are you sure you want to delete configuration data? This cannot be undone.',
	'config-notify-deletedata-success': 'Deleted the specified configuration data.',
	'config-notify-deletedata-failure': 'Failed to delete some of the specified configuration data.',
}