Toggle Archived Geocaches

Adds a button to the Owned Caches page to toggle between hiding/showing archived caches

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Toggle Archived Geocaches
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a button to the Owned Caches page to toggle between hiding/showing archived caches
// @author       Michel ten Voorde
// @match        https://www.geocaching.com/my/owned.aspx*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var notArchived = 0;

	$('.MyOwnedCachesTable').before('<a id="toggleArchivedBtn" class="btn btn-primary" style="margin-top: 14px; background-color: #17a2b8" data-show="true"><span id="hideShowToggle">Hide</span> archived caches</a>');

    $('#toggleArchivedBtn').click(function() {
        if ($('#toggleArchivedBtn').data('show') === true) {
            $('#hideShowToggle').text('Show');
            $('#toggleArchivedBtn').data('show', false);
            $('a.OldWarning').parent().parent().hide(500);

            if (notArchived === 0) {
                notArchived = $('table.MyOwnedCachesTable tr.UserOwned').length - $('a.OldWarning').parent().parent().length;
                $("#ctl00_ContentBody_lbHeading").text($("#ctl00_ContentBody_lbHeading").text() + ", of which " + notArchived + " are active.");
            }
        } else {
            $('#hideShowToggle').text('Hide');
            $('#toggleArchivedBtn').data('show', true);
            $('a.OldWarning').parent().parent().show(500);
        }
    });
})();