SwitchDD

Switch back deals with discussions

Від 21.12.2022. Дивіться остання версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         SwitchDD
// @namespace    https://greasyfork.org/en/users/2205-ryzhehvost
// @version      0.5
// @description  Switch back deals with discussions
// @author       Ryzhehvost
// @match        https://www.steamgifts.com/giveaways/*
// @match        https://www.steamgifts.com/
// @grant        none
// @license      Apache-2.0
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    let previews = document.querySelectorAll(".block_header_text");
    let deals = null;
    let discussions = null;
    for (let i = 0; i<previews.length; i++){
        if (previews[i].textContent=="Deals") {
            deals = previews[i].parentElement.parentElement.parentElement;
        }
        if (previews[i].textContent=="Discussions") {
            discussions = previews[i].parentElement.parentElement.parentElement;
        }
    }
    if (deals!=null && discussions!=null){
        let newdeals=deals.cloneNode(true);
        let newdiscussions=discussions.cloneNode(true);
        deals.parentNode.replaceChild(newdiscussions, deals);
        discussions.parentNode.replaceChild(newdeals,discussions);
    }
})();