relist all

relist all :)

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey 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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         relist all
// @namespace    https://nookazon.com/profile/*
// @version      0.1
// @description  relist all :)
// @author       You
// @match        https://nookazon.com/profile/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nookazon.com
// @grant        none
// ==/UserScript==

window.onload = function(){
    setTimeout(function() {
        //grab  menu bar
        const topBar = document.querySelector('div.profile-tabs');
        const menu = topBar.nextElementSibling.firstChild.firstChild;
        menu.id = 'menu';

        //create button el
        const btn = document.createElement('a');
        btn.innerHTML = 'Relist All';
        btn.classList.add('kBQGpb');
        btn.style.marginLeft = '10px';
        btn.id = 'relistAll';
        menu.appendChild(btn);
        btn.addEventListener('click', relistAll);

        //label relist btns
        let listingActionBar = document.querySelectorAll('.listing-action-bar');
        listingActionBar.forEach((element) => {
        let greenBtnContainer = element.children[3];
        let greenBtn = greenBtnContainer.childNodes[0];
        greenBtn.className += (' relist-btn');
        });
    },1000);
};

function relistAll() {
    let btn = document.querySelectorAll('.relist-btn');
    let eligible;
    btn.forEach((btn) => {
        btn.click();
        let btnColor = window.getComputedStyle(btn).color;
        console.log(btnColor);
        if (btnColor == 'rgb(234, 104, 94)') {
            eligible = false;
        } else {
            eligible = true;
        }
    });

    eligible ? alert('Relisted!') : alert("Can't relist yet!");
}