User:Nw520/Gadgets

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

AutoReplace[edit]

Source code

Activation[edit]

This gadget can be enabled by appending the following line to either your global.js or your common.js on any Wikimedia-wiki:

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

Configuration[edit]

window.nw520_config = {
	autoReplace_replacements: [
		{
			find: / Open Street Maps?([ .,])/g,
			replace: ' OpenStreetMaps$1',
			comment: 'fixed spelling of OSM',
			trivial: false
		}
	]
};
Key Type Description
window.nw520_config.autoReplace_replacements List<{find: String|Regex, replace: String|Function, [comment]: String}, [trivial]: boolean}> List of replacements. Each replacement is defined by an object consisting of a string or regular expression to find and a string or function returning a string to replace the match with. Regex group matching is supported. Optionally, one can specify a comment to append to the edit summary and declare that a user may instantly save the automatically applied changes without checking first by declaring the replacement as trivial.


GadgetManager[edit]

Source code // de,en

Activation[edit]

This gadget can be enabled by appending the following line to either your global.js or your common.js on any Wikimedia-wiki:

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

Methods[edit]

Method Description
window.nw520.gadgetManager.addKeyboardListener()
window.nw520.gadgetManager.addLazyPortlet()
window.nw520.gadgetManager.loadLazyGadgets()
window.nw520.gadgetManager.registerGadget( displayName: String, URL: string, [lazy=false]: boolean, [method='using']: String )

Query parameters[edit]

Parameter Description
nogadget List of gadget slugs to not load. If no value is defined, no gadgets will be loaded.


HashCheck[edit]

Source code // de,en

Activation[edit]

This gadget can be enabled by appending the following line to either your global.js or your common.js on any Wikimedia-wiki:

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

Hooks[edit]

Hooks can be used to execute code once an event has occurred.

Hook Parameter Beschreibung
ext.hashCheck.loaded HashCheck-object Triggered, once HashCheck has been loaded and initialised.

Methods[edit]

Method Description
window.nw520.hashCheck.scan()


StraightToCommons[edit]

Source code

Replaces links to files on any Wikimedia-wiki to directly link to Wikimedia Commons saving you from having to wait for the on-wiki file page to load. Images and files hosted on Wikimedia Commons are highlighted with a green border to help distinguish between on-wiki files. Clicking on an image while holding down Ctrl copies the Commons file name to your clipboard.

Activation[edit]

This gadget can be enabled by appending the following line to either your global.js or your common.js on any Wikimedia-wiki:

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


SummaryFloskeln[edit]

Source code

Activation[edit]

This gadget can be enabled by appending to following line to either your global.js or your common.js on any Wikimedia-wiki:

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

Configuration[edit]

window.nw520_config = {
	summaryFloskeln_floskeln: [
		'Maintenance',
		[
			'Typo',
			[
				'OSM',
				'fixed spelling of OSM'
			]
		]
	]
};
Key Type Description
window.nw520_config.summaryFloskeln_floskeln List<[String, String|[String, String]]> List of summary strings to display. Summaries are grouped into groups which are modelled as tuples with the former component being a label to display in the interface and the latter being a list of summaries. Summaries can either be a string which is displayed and when chosen appended to the summary, or a tuple with the former component being the string that is displayed and the latter component being the string that is appended to the summary.


Wikivoyage favicon.svg VoyageData[edit]

Source code // Only for German Wikivoyage (dewikivoyage)

Durchsucht den aktuellen Artikel nach Markern und vCards ohne Wikidata-ID und listet mögliche passende Wikidata-Datenobjekte auf.

Aktivierung[edit]

Dieses Gadget kann aktiviert werden, indem Du folgende Zeile deiner common.js in der Wikivoyage hinzufügst:

mw.loader.load( '//de.wikivoyage.org/w/index.php?title=User:Nw520/VoyageData.js&action=raw&ctype=text/javascript' );

Konfiguration[edit]

mw.hook( 'voy.voyagedata.loaded' ).add( function ( VoyageData ) {
	VoyageData.COORDINATES_MAX_LENGTH = 8;
	VoyageData.INITIAL_ZOOM = 12;
	VoyageData.SEARCH_LIMIT = 15;
	VoyageData.SPARQL_LIMIT = 1500;
    VoyageData.WIKIDATA_CLASS_SUGGESTIONS = [];
} );
Key Type Description
window.VoyageData.COORDINATES_MAX_LENGTH number Maximale Anzahl an Stellen von Koordinaten bei SPARQL-Anfragen.
window.VoyageData.INITIAL_ZOOM number Zoomstufe der Karte beim Öffnen von VoyageData.
window.VoyageData.SEARCH_LIMIT number Maximale Anzahl an Ergebnissen je Suchlauf bei der Namenssuche.
window.VoyageData.SPARQL_LIMIT number Maximale Anzahl an Ergebnissen für SPARQL-Anfragen.
window.VoyageData.WIKIDATA_CLASS_SUGGESTIONS [string, string][] In Autocomplete anzuzeigende Wikidata-Klassen (z.B. für Whitelist).

CSS[edit]

CSS-Klassen haben die Präfix voy-voyagedata-.

Hooks[edit]

Hooks können genutzt werden, um Code auszuführen, sobald bestimmte Ereignisse eintreten.

Hook Parameter Beschreibung
voy.voyagedata.loaded Klasse von VoyageData Ausgelöst, sobald VoyageData geladen und initialisiert wurde.

Zeichenketten[edit]

mw.messages-Zeichenketten haben die Präfix voy-voyagedata-.

globale Variablen[edit]

Variable Beschreibung
window.VoyageData Klasse von VoyageData