GeocachingPremiumOnlyLOG

Allow Basic Members to log a Premiom Member caches.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GeocachingPremiumOnlyLOG
// @version      1.1
// @namespace    https://github.com/KeyWeeUsr/Userscripts
// @description  Allow Basic Members to log a Premiom Member caches.
// @author       Peter Badida
// @copyright    2018+, Peter Badida
// @license      GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @homepage     https://github.com/KeyWeeUsr/Userscripts/tree/master/GeocachingPremiumOnlyLOG
// @supportURL   https://github.com/KeyWeeUsr/Userscripts/issues
// @icon         https://www.geocaching.com/favicon.ico
// @include      *.geocaching.com/geocache/GC*
// @grant        none
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ACVM74AYCXVWQ
// ==/UserScript==
'use strict';

var create = false;
var pmo_text = "THIS IS A GEOCACHING PREMIUM MEMBER ONLY GEOCACHE";
var banners;  // Premium Member Only banners on the website
var target;   // banner-like element with pmo_text
var link;     // replacement for the PMO banner
var li;       // single element on Difficulty/Terrain/... bar

banners = document.getElementsByClassName("premium-upgrade-widget");
if (banners.length > 0) {
    create = true;
}

// make sure the script doesn't take any additional resources
// than needed if the Cache isn't PMO i.e. execute only if found
if(create) {
    // create a LI element for the UL parent bar
    li = document.createElement("LI");

    // create a hyperlink with the URL for logging PMO Cache
    link = document.createElement("A");
    link.href = "https://www.geocaching.com/play/geocache/";
    link.href += document.getElementsByClassName("li__gccode")[0].innerText;
    link.href += "/log";

    // style the link a little
    link.innerText="LOG Premium Member Cache!";
    link.style.color = "#04c8d6";
    link.style.fontWeight="bold"

    // put the link into LI element
    li.appendChild(link);

    // append link on the Difficulty/Terrain/... bar
    target = document.getElementsByClassName("ul__hide-details")[0];
    target.appendChild(li);
}