Minecraft Gift Code Hider

Automatically hides gift codes and adds button to toggle visibility.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Minecraft Gift Code Hider
// @namespace   https://greasyfork.org/users/5927-encarton
// @description Automatically hides gift codes and adds button to toggle visibility.
// @include     http://minecraft.net/profile
// @include     https://minecraft.net/profile
// @include     http://account.mojang.com/me
// @include     https://account.mojang.com/me
// @icon        http://www.minecraft.net/favicon.png
// @version     2.2
// ==/UserScript==

//This time with jQuery!
//Since they have it and it makes things easier.

//Check for Location, if it isn't Minecraft.net assume Mojang
if ( document.location.href.search('profile') > 0){
    //Hide Gift Code List on Minecraft.net
    $('ul:eq(2)').wrap('<div id="giftCodes"></div>');
    $('#giftCodes').hide();
    //Create Button on Minecraft.net
    $('<button id="toggle" onclick="toggleVisibility()">Show Gift Codes</button>').insertBefore("#giftCodes");
} else {
    //Hide Gift Code List on Mojang.com
    $('#giftCodes').hide();
    //Create Button on Mojang.com
    $('<button id="toggle" onclick="toggleVisibility()" style="margin:20px;">Show Gift Codes</button>').insertBefore("#giftCodes");
}

//Add Function to Web Page so the Button Works
$('<script type="text/javascript">function toggleVisibility(){'
+'var container = $("#giftCodes");'
+'if (container.is(":visible")){'
+'$("#toggle").html("Show Gift Codes");'
+'container.slideToggle("slow");'
+'} else {'
+'$("#toggle").html("Hide Gift Codes");'
+'container.slideToggle("slow");'
+'}}</script>').appendTo('body');