GC - Giveaways Helper

Add visual indicators to giveaways to make it easier to distinguish between special, normal, and entered giveaways. Sorts entered giveaways to the bottom of the page.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GC - Giveaways Helper
// @namespace    https://greasyfork.org/en/users/1175371/
// @version      0.3
// @description  Add visual indicators to giveaways to make it easier to distinguish between special, normal, and entered giveaways. Sorts entered giveaways to the bottom of the page.
// @author       sanjix
// @match        https://www.grundos.cafe/giveaways*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
// @grant        none
// ==/UserScript==

var entered = document.evaluate(
        '//div[contains(@class,"giveaway-item")][p[contains(.,"Entered")]]',
        document,
        null,
        XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
        null
    );

var special = document.evaluate(
        '//div[contains(@class,"giveaway-item")][p[contains(.,"Special")]]',
        document,
        null,
        XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
        null
    );
for (let i = 0; i < special.snapshotLength; i++) {
    special.snapshotItem(i).style.backgroundImage = "linear-gradient(to bottom left, #b827fc 0%, #2c90fc 25%, #b8fd33 50%, #fec837 75%, #fd1892 100%)";
    special.snapshotItem(i).classList.add('special');
}
for (let i = 0; i < entered.snapshotLength; i++) {
    let cur = entered.snapshotItem(i);
    cur.style.backgroundColor = "rgba(128,128,128,.1)";
    cur.style.order = 99999;
    if (cur.classList.contains('special')) {
        cur.style.backgroundImage = "linear-gradient(to left bottom, rgba(199, 0, 255, 0.2), rgba(0,0,255,.2), rgba(0,255,0,.2), rgba(247, 255, 0, 0.2), rgba(255, 131, 0, 0.2), rgba(255,0,0,.2))"
    }
}