Correct All The Coordinates

This script enables the functionality to change the coordinates of every cachetype

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name 		Correct All The Coordinates
// @namespace	http://www.dennistreysa.de
// @author 		dennistreysa
// @oujs:author	dennistreysa
// @copyright	2015-2016, dennistreysa
// @version 	1.0
// @icon		https://raw.githubusercontent.com/dennistreysa/CATC/master/res/logo.png
// @description	This script enables the functionality to change the coordinates of every cachetype
// @include		*.geocaching.com/seek/cache_details.aspx*
// @include		*.geocaching.com/geocache/GC*
// @noframes
// @grant 		none
// ==/UserScript==

var CATC = {

	onStart : function(){

		// Find coords container
		var $CacheInformationTable = $("#ctl00_ContentBody_CacheInformationTable").find(".NoBottomSpacing :first");
		var $coords = $CacheInformationTable.find("strong :first");

		if($CacheInformationTable.length && $coords.length){

			// Check if coords are original or already changed
			if(!$coords.parent().is("a")){

				// Set up userdefined coords
				var userDefinedCoords = {"status":"success","data":{"isUserDefined":false,"oldLatLngDisplay":$coords.find("#uxLatLon").text()}};

				mapLatLng.oldLatLngDisplay = userDefinedCoords.data.oldLatLngDisplay;

				// Create link
				var $a = $('<a href="#" class="edit-cache-coordinates" id="uxLatLonLink" title="Correct All The Coordinates"></a>');

				// Append original coordinates
				$a.append($coords.clone(true));

				// Replace old coordinates
				$coords.replaceWith($a);

				// Add click-event
				$a.qtip({
					suppress:false,
					content: buildCacheCoordMenu(),
					position: {
						my: 'left top',
						at: 'right top',
						adjust: {
							x: 10, y: -10
						}
					},
					show: {
						ready: false,
						event: "click",
						solo: true
					}, hide: {
						event: 'unfocus'
					},
					style: {
						tip: {
							corner: false
						},
						classes: 'ui-tooltip-widget'
					},
					events: {
						show: function () {
							if ($("#uxLatLon").data("isOverridden")) {
								$("a.ccu-restore").show();
							} else {
								$("a.ccu-restore").hide();
							}

							if (userDefinedCoords.status != "success") {
								$("div.ccu-update").hide();
							} else {
								$("div.ccu-update").show();
							}
						}
					}
				}).click(function (e) {
					e.preventDefault();
					return false;
				});
			}
		}
	}
};

$(document).ready(function(){
	CATC.onStart();
});