User:Suyash.dwivedi/userscripts/LocationInserter

Wikidata Location Button
LocationInserter is a utility script that adds a link to your sidebar (toolbox) to quickly generate and copy the
| Camera location | | View all coordinates using: OpenStreetMap |
|---|
template for any file. It streamlines the manual addition of coordinates by handling the formatting and opening the edit window automatically.
Installation
To install this script, add the following line to your common.js page:
// Location Inserter Sidebar Link mw.loader.load('https://commons.wikimedia.org/wiki/User:Suyash.dwivedi/userscripts/LocationInserter.js?action=raw&ctype=text/javascript');
How to use
- Locate the 🌍 Add Location link in the sidebar menu (Tools/Toolbox section).
- Click the link to trigger the process.
- A prompt will appear asking for coordinates. Enter them in
lat, longformat (e.g.,23.2599, 77.4126).
- A second prompt will ask for the filename (e.g.,
File:Example.jpg).
The script will:
- Convert your input into a properly formatted
template.Camera location 
View all coordinates using: OpenStreetMap 
- Copy this template to your clipboard automatically.
- Open the edit page for that specific file in a new browser tab.
- Paste the copied template into the appropriate section (usually the Summary or Information template) and save.
Features
- Sidebar Integration: Accessible from any page on Commons via the toolbox.
- Automatic Clipboard Copy: Saves time by copying the wikitext code for you immediately.
- Smart Navigation: Opens the target file directly in edit mode for section 1.
- Input Validation: Ensures the coordinates are numeric and properly separated before proceeding.