User:Galobtter/Shortdesc helper

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Shortdesc helper
Shortdesc helper screenshot.png
Shortdesc helper editing screenshot.png
DescriptionAllows easy changing and importing of short descriptions
AuthorGalobtter
StatusStable
Version3.4.4
UpdatedJune 13, 2019; 2 months ago
Skin support
  • Vector
  • Monobook
  • Modern
  • Timeless
  • Cologne Blue
  • MinervaNeue
Source
GitHub repositoryshortdesc-helper on GitHub

Shortdesc helper (SDH) is a gadget for editing, adding, and importing short descriptions.

Enabling

Select the gadget at the "Editing" section of Special:Preferences#mw-prefsection-gadgets (and save).

(if you already have the script installed, remove importScript('User:Galobtter/Shortdesc helper.js'); from Special:MyPage/common.js or Special:MyPage/skin.js)

Usage

When activated, the article's short description will be displayed on the page immediately under the line "From Wikipedia, the free encyclopedia", and edits may be made by clicking the buttons to the right of the short description. (see image).

The gadget is compatible with the page assessments gadget.

Options

Settings as of version 3.4.3

Shortdesc helper may be configured using the settings window that can be accessed when editing or adding a short description by clicking the gear-wheel button on the right.

Installation on another wiki

For individual use

Add

mw.loader.getScript( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-libSettings.js&action=raw&ctype=text/javascript' ).then (
function() {
	mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Shortdesc-helper.css&action=raw&ctype=text/css', 'text/css');
	mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Shortdesc-helper.js&action=raw&ctype=text/javascript' );
});

to Special:MyPage/common.js on that wiki to use the script on another wiki.

As a gadget

To install Shortdesc helper on another wiki, create a file named "MediaWiki:Gadget-Shortdesc-helper.js" with the content (comments there note how to localize):

window.sdh = {};

/* These messages can be changed to localize Shortdesc helper for your wiki. 
** If that is not necessary, then this can be removed, and English-language messages will be used. */
window.sdh.messages = {
	/* Settings messages */
	'sdh-settingsDialog-title': 'Settings for Shortdesc helper',
	'sdh-header-general': 'General',
	'sdh-header-appearance': 'Appearance',
	'sdh-AddToRedirect-label': 'Allow additions of short descriptions to redirects',
	'sdh-AddToRedirect-help': 'When checked, redirects will have an "add" button to add a short description. (default off)',
	'sdh-InputWidth-label': 'Width of editing input in em (default 35)',
	'sdh-FontSize-label': 'Font size, as a percentage (default 100%)',
	/* Initial view messages */
	'sdh-missing-description': 'Missing <a href="/wiki/Wikipedia:Short description">$1 description</a>',
	/* Initial view buttons */
	'sdh-add-label': 'Add',
	'sdh-add-title': 'Add short description',
	'sdh-edit-label': 'Edit',
	'sdh-edit-title': 'Edit short description',
	/* Editing messages */
	'sdh-save-label': 'Save',
	'sdh-save-title': 'Save description',
	'sdh-cancel-label': 'Cancel',
	'sdh-cancel-title': 'Cancel editing',
	'sdh-settings-title': 'Settings',
	/* Wikidata summary messages */
	'sdh-wd-summary': '([[w:en:User:Galobtter/Shortdesc helper|Shortdesc helper]])',
	'sdh-wd-edit-failed': 'Saving the edit to Wikidata failed.',
	'sdh-wd-edit-failed-prefix': '\n\nThe info given by Wikidata is that:\n\n'
};

mw.loader.getScript( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-libSettings.js&action=raw&ctype=text/javascript' ).then (
function() {
	mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Shortdesc-helper.css&action=raw&ctype=text/css', 'text/css');
	mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Shortdesc-helper.js&action=raw&ctype=text/javascript' );
});

and create a css file named "MediaWiki:Gadget-Shortdesc-helper-pagestyles-vector.css" with the content of MediaWiki:Gadget-Shortdesc-helper-pagestyles-vector.css.

Then, add to MediaWiki:Gadgets-definition:

* Shortdesc-helper[ResourceLoader|dependencies=mediawiki.api,mediawiki.notify,mediawiki.user,mediawiki.util|skins=vector,monobook,modern,timeless|peers=Shortdesc-helper-pagestyles-vector]|libSettings.js|Shortdesc-helper.js|Shortdesc-helper.css
* Shortdesc-helper-pagestyles-vector[hidden|skins=vector]|Shortdesc-helper-pagestyles-vector.css