Jump to content

User:Jeeputer/coordInserter

From Wikipedia, the free encyclopedia
Coord Inserter
DescriptionSemi-automatically insert {{Coord}} into articles listed here, with coordination data from Wikidata,
Author(s)Jeeputer
Statusbeta
UpdatedSeptember 7, 2024
    (2 months ago)
Skins
  • Vector
  • Vector 2022
SourceUser:Jeeputer/coordInserter.js

Coord Inserter is a user script for easily inserting {{Coord}} template on articles listed on Category:Articles missing coordinates with coordinates on Wikidata. This script fills the template with values fetched from Wikidata (coordinate location (P625)).

Description

[edit]

Coord Inserter, which is created based on a request, adds an "Edit" link next to each article's link on Category:Articles missing coordinates with coordinates on Wikidata. When you click on this link, Coord Inserter will open the article's edit form in a new tab and fetches coordinates (coordinate location (P625)) from the Wikidata item associated with that article. It then prepares {{Coord}} template syntax, filled with values fetched from Wikidata and inserts the template in front of the |coord= (or |coordinates=) parameter in the infobox. If no such parameter exists inside wikitext, this script shows you a notification on which you can click to copy the template syntax into your clipboard. Then you can paste it anywhere you want inside wikitext.

Whenever the template is automatically inserted, the {{Coord missing}} template will also be removed to remove the page from the category. But when the |coord= parameter is not found and you paste the coord template somewhere on the page, you also have to manually remove the Coord missing template (a notification will remind you to do so).

Note: When the template is inserted by the script itself, the code for the template will be automatically selected inside the edit form, so you can check if the template is inserted in a proper location.

Note 2: Coord Inserter does not load on categories other than the category mentioned above (even if they are related to coordinate issues) or on the edit form of every page if you don't get there directly from that category page.

Note 3: Coordinate values are always in WGS84 (d.ddddd) with 5 decimal places. You may edit those values and set the precision to conform WP:OPCOORD. As there is no way to determine the size of the object at the moment, the script itself cannot set the appropriate precision based on the article's subject.

Installation

[edit]

Copy the following to your common.js page and click Save.

mw.loader.load('//wiki.riteme.site/w/index.php?title=User:Jeeputer/coordInserter.js&action=raw&ctype=text/javascript'); // Backlink: [[User:Jeeputer/coordInserter.js]]

You may need to clear your browser's cache after saving.

Bug reports and feature requests

[edit]

You can report bugs or request for new features on the script's or my own talk page.