Geocaching.com + GeoCoord

Add link to www.geocoord.nl on geocache pages

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

/* global $: true */
/* global unsafeWindow: true */


// ==UserScript==
// @name        Geocaching.com + GeoCoord
// @require     https://greasyfork.org/scripts/38445-monkeyconfig/code/MonkeyConfig.js?version=251319
// @namespace   geocoord
// @version     1.1
// @description Add link to www.geocoord.nl on geocache pages
// @include     http://www.geocaching.com/*
// @include     https://www.geocaching.com/*
// @exclude     https://www.geocaching.com/profile/profilecontent.html
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       GM_registerMenuCommand
// @grant       GM_addStyle
// ==/UserScript==


(function() {

   'use strict';

    var cfg = new MonkeyConfig({
        title: 'Configuratie Link naar GeoCoord',
        menuCommand: true,
        params: {
            open_in_new_tab: {
                type: 'checkbox',
                default: false
            }
        }
    });

    var open_in_new_tab = cfg.get('open_in_new_tab');

   var geocoordURL = 'https://www.geocoord.nl/forum/index.php?action=search2&search=';
   var path = window.location.pathname;
   var gccode = $('#ctl00_ContentBody_CoordInfoLinkControl1_uxCoordInfoCode').html();

   if (window.top == window.self &&
        ( (path.match(/^\/geocache\/.*/) !== null) ||
        (path.match(/^\/seek\/cache_details\.aspx.*/) !== null))) {

      if (open_in_new_tab) {
            $('#ctl00_ContentBody_GeoNav_logButton').after('<a target="_blank" id="linkToGeoCoord" class="btn btn-primary" style="margin-top: 14px; background-color: #17a2b8" href="' + geocoordURL + gccode + '">GeoCoord</a>');
        } else {
            $('#ctl00_ContentBody_GeoNav_logButton').after('<a id="linkToGeoCoord" class="btn btn-primary" style="margin-top: 14px; background-color: #17a2b8" href="' + geocoordURL + gccode + '">GeoCoord</a>');
        }
   }

}());