Thingiverse allow adding things to multiple collections

Enables the Collected button to be pressed to add an item to another collection - this additionally fixes the issue that the server does not update immediately once a thing has been removed from a collection, allowing you to immediately add to another one.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Thingiverse allow adding things to multiple collections
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Enables the Collected button to be pressed to add an item to another collection - this additionally fixes the issue that the server does not update immediately once a thing has been removed from a collection, allowing you to immediately add to another one.
// @author       H. J. Norden
// @match        https://www.thingiverse.com/thing:*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let DONE = false;

    function get_collected_btn() {
        if (DONE) return;
        for (let el of document.getElementsByTagName("a")) {
            if (el.innerHTML === "Collected") {
                return el.parentNode;
            }
        }
    }

    function show_collection_window() {
        let el = document.getElementsByClassName("SidebarMenu__collectWindowWrapper--2dRST")[0];
        el.classList.remove("CollectThingWindow__hidden--OSA7G");
    }

    function hide_collection_window() {
        let el = document.getElementsByClassName("SidebarMenu__collectWindowWrapper--2dRST")[0];
        el.classList.add("CollectThingWindow__hidden--OSA7G");
    }

    function fix_collection_window_closing() {
        let close_btn = document.getElementsByClassName("CollectThingWindow__closeImageWraper--2oYuJ")[0];
        let save_btn = document.getElementsByClassName("CollectThingWindow__buttonWrapper--1rp4p")[0];
        close_btn.addEventListener("click", hide_collection_window);
        save_btn.addEventListener("click", hide_collection_window);
    }

    function enable_collection(from_button) {
        if (DONE) return;
        if (from_button === undefined) {
            console.log("Couldn't find 'Collected' button!");
            return;
        }

        fix_collection_window_closing();

        from_button.classList.remove("SideMenuItem__itemDisabled--pGJ7S");
        from_button.addEventListener("click", show_collection_window);

        DONE = true;
    }


    // Try multiple timeouts for different network conditions...
    setTimeout(function(){enable_collection(get_collected_btn());}, 100);
    setTimeout(function(){enable_collection(get_collected_btn());}, 500);
    setTimeout(function(){enable_collection(get_collected_btn());}, 2000);
    setTimeout(function(){enable_collection(get_collected_btn());}, 5000);

})();