Unpublished-Geocaches

Fetch unpublished geocaches

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name            Unpublished-Geocaches
// @namespace       https://www.geocaching.com
// @author          Surfoo
// @description     Fetch unpublished geocaches
// @include         https://www.geocaching.com/geocache/*
// @include         https://www.geocaching.com/seek/cache_details.aspx*
// @version         1.1.4
// @grant           GM.xmlHttpRequest
// ==/UserScript==


var d = document.getElementById('Download');
var m = d.children;
var last = m.item(m.length - 1);

var html = '<br /><input type="button" name="SendToUnpublishedGeocaches" style="margin-top: 10px;" value="Send to unpublished geocaches" id="SendToUnpublishedGeocaches" />';
last.innerHTML = last.innerHTML + html;

var button = document.getElementById("SendToUnpublishedGeocaches");

button.addEventListener('click', function() {
    GM.xmlHttpRequest({
        method: "POST",
        url: "https://unpublished.vaguelibre.net/gm.php",
        data: "content=" + encodeURIComponent(document.documentElement.innerHTML),
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        onload: function(response) {
            var data = JSON.parse(response.responseText);
            if (!data.success) {
                alert(data.message);
                return false;
            }
            alert('Geocache added to your list!');
            return true;
        }
    });
}, true);