Jump to content

User:Nardog/PasteToCommons

From Wikipedia, the free encyclopedia
PasteToCommons
DescriptionUpload an image to Commons from anywhere on the site by pasting it
UpdatedNovember 4, 2023
    (12 months ago)
BrowsersChrome, Firefox, etc.
SourceUser:Nardog/PasteToCommons.js

If you paste an image by Ctrl+V (or ⌘ Cmd+V or whatever depending on your OS) on any page on the site while this script is installed, a dialog will show up that allows you to upload it to Wikimedia Commons. This is to allow easier uploading and sharing of screenshots of the site.

Installation

[edit]

Add the following to your common.js:

mw.loader.load('//wiki.riteme.site/w/index.php?title=User:Nardog/PasteToCommons.js&action=raw&ctype=text/javascript');

Or you may enable the script installer in Preferences → Gadgets and click "Install" in the infobox on this page.

Usage

[edit]

The default values for the description are based on the instructions at Wikipedia:Screenshots of Wikipedia . You may override them in your common.js using the following syntax:

window.pastetocommonsDefaults = {
	filename: 'wiki.riteme.site Page Name yyyy-mm-dd',
	description: 'Screenshot of the English Wikipedia',
	source: 'Screenshot',
	author: 'Wikipedia Authors, see the history of [[w:Page Name]]',
	license: '{{Wikipedia-screenshot|1=en}}'
};

Caveats

[edit]

The names of the site and the page on which you pasted the file will be published in the upload summary (separate from the filename/description).

This script employs hacks that may cease to work upon upstream code change.