Jump to content

User:Ahecht/Scripts/potd-helper

From Wikipedia, the free encyclopedia
Ahecht/Scripts/potd-helper
Author(s)
UpdatedJuly 25, 2023
    (16 months ago)
Source
Beta
User:Ahecht/Scripts/potd-helper.js
User:Ahecht/sandbox/Scripts/potd-helper.js

User:Ahecht/Scripts/potd-helper.js is a script for submitting Pictures of the Day. It will create Template:POTD, update the local image description, and post notifications on the talk pages of the linked article, uploader, and nominator. It can auto-fill the image caption (based on the first paragraph of the linked article, which may require editing) and the names of the uploader and nominator.

Add the following line to Special:MyPage/common.js or meta:Special:MyPage/global.js to install:

if ([-1, 0, 6].includes(mw.config.get('wgNamespaceNumber'))) {mw.loader.load( '//wiki.riteme.site/w/index.php?title=User:Ahecht/Scripts/potd-helper.js&action=raw&ctype=text/javascript' );} //[[User:Ahecht/Scripts/potd-helper.js]]

Click on "POTDHelper" on the top toolbar (it may be hidden under the "More" tab or in the "Tools" menu) when you're on an article or a featured picture page, or go to Special:POTDHelper, to use the script. When run from an article it will suggest all images in that article in a drop-down menu (defaulting to the pageimage), when run from an image page it will suggest all articles that use that image, and when run from Special:POTDHelper you can use either of the "Autofill" buttons to generate the list of suggestions.

The script does extensive logging to the browser's developer console. If you encounter problems with the script, please open the console (see Help:CONSOLE) and copy and paste any messages from there when creating a bug report.

Version history

[edit]
  • 31 May 2022 – Initial release.
  • 4 June 2022 – Suggest images on articles and vice versa.
  • 14 June 2022 – Auto detect wide and tall images, improve autofill, and add pre-ES6 compatibility.
  • 16 February 2023 – Vector 2022 compatibility, warn before using tall and wide parameters.
  • 14 March 2023 – Better linking of the article title within the extract text, strip references from extract, increase allowable image height.
  • 1 April 2023 – Fix bugs with generating extracts introduced in the 14 March revision.
  • 24 July 2023 – Suggest image width based on the guidelines and the image aspect ratio. Sanity check on |tall=yes and |wide=yes so they're only applied to portrait and landscape images, respectively.

See also

[edit]