Steamgifts Hide Joined Giveaways

Automatically hides all giveaways on steamgifts.com that you've already joined

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Steamgifts Hide Joined Giveaways
// @namespace    http://your.homepage/
// @version      0.2
// @description  Automatically hides all giveaways on steamgifts.com that you've already joined
// @author       Zarnaik
// @match        http://www.steamgifts.com/
// @includes     http://www.steamgifts.com/*
// @grant        none
// ==/UserScript==

var pinned = document.querySelector('div.pinned-giveaways__inner-wrap');
var node = document.querySelector("body > div.page__outer-wrap > div > div > div:nth-child(2) > div:nth-child(3)");
//console.log(node);
if (node === undefined | node.classList[0] !== undefined){var node = document.querySelector("body > div.page__outer-wrap > div > div > div:nth-child(2) > div:nth-child(2)");}
//If using some sort of autopager, the joined giveaways on following pages will be hidden as well.

//console.log(node);
var obtest = new MutationObserver(function(mutrec){
    var added = mutrec[0].addedNodes;
    for (var i = 0; i<added.length;i++)
        if (added[i].children[0].classList.contains('is-faded'))
            added[i].style.display = 'none';
});
obtest.observe(node,{attributes: true, childList: true, characterData: true});
if (pinned !== null) initClean(pinned);
initClean(node);

function initClean(giveaways){
    var init = giveaways.children;
    for (var i = 0; i < init.length; i++)
        if (init[i].children[0].classList.contains('is-faded'))
            init[i].style.display = 'none';
}