User:Artoria2e5/Gadget-PRCoords.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/** People's Rectified Coordinates -- Gadget for Correcting Chinese Coords
 * 
 * Just install the tool by adding the following line to [[User:YourName/common.js]]:
 *    importScript('User:Artoria2e5/Gadget-PRCoords.js') // [[User:Artoria2e5/Gadget-PRCoords.js]]
 * 
 * You will see two globe-with-question-mark icons appear in your edit buttons.
 * Put the mouse pointer over them to see the mouseover text, so you know which
 * one is which.
 * 
 * This gadget does not yet support 2017 source editor. That thing is nuts.
 * 
 * To find coords to correct and actually fix them:
 * 
 * 1. Actively search for articles on Chinese locations, or just hang around
 *    in DYKC & recent changes to wait for new ones.
 * 2. Check the coordinates by clicking the coordinates, going to GeoHack and
 *    summoning the maps. Always use the satellite map as your reference.
 *    As a lazyier solution, OSM maps can be used if you can find your location
 *    on it.
 * 
 *    If you find out that a place nearly exactly matches non-OSM-based
 *    commercial maps, you can almost certainly assume the coordinate as broken.
 *    Use "BD" for Baidu, and "GCJ" for anything else.
 * 3. Go into the source editor, select the coordinates portion in {{Coord}}'s
 *    parameters. For example, for:
 *      {{coord|121.3213|31.9320}}
 *      {{coord|121|19|17|N|31|55|55|E}}
 *    You select:
 *      121.3213|31.9320
 *      121|19|17|N|31|55|55|E
 * 4. Click a globe button to convert your selection.
 * 5. Preview and double-check in GeoHack's satellite imagery before you save.
 *    You can always go back with your browser and try the other button.
 * 6. Change your edit summary to indicate your source of verification
 *    (OSM/satellite), and whether you have done any verification. Sometimes
 *    people want to have it done fast....
 * 
 * <pre>
 * To teach people about fixing coordinates:
 * 1. Use WikiBlame (wikipedia.ramselehof.de/wikiblame.php?lang=en) to search
 *    for addition of "{{Coord" in the last 4096 edits on the page you just
 *    fixed.
 * 2. Click into the addition, write down the revision number.
 * 3. Go into the editor's talk page.
 * 4. Now template the regular:
      {{subst:User:Artoria2e5/coord-notice
      |diff=11223344 <!-- change me -->
      |type=GCJ-02   <!-- and me -->
  	  |add= (from Google Maps?)}} <!-- optional -->
 * 5. Save.
 * </pre>
 * @license CC0
 */
 
 // soft redirect to [[:zh:User:Artoria2e5/Gadget-PRCoords.js]]. No worries,
 // I got the translations done well.
 mw.loader.load('https://zh.wikipedia.org/w/index.php?title=User:Artoria2e5/Gadget-PRCoords.js&action=raw&ctype=text/javascript');

// web: https://artoria2e5.github.io/PRCoords/demo
// pdf: https://commons.wikimedia.org/wiki/File:PRcoords_Cheatsheet.pdf