Greasy Fork

Greasy Fork is available in English.

Extract players to buy for squad sbc

Makes it easy to get the players you need, to finish a SBC

目前为 2022-10-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         Extract players to buy for squad sbc
// @namespace    http://greasyfork.icu/en/users/884999-l%C3%A6ge-manden
// @version      0.3
// @description  Makes it easy to get the players you need, to finish a SBC
// @author       VeryDoc
// @match        https://www.futbin.com/23/squad/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=futbin.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    addButton('Export list', OpenSquadList);

    function addButton(text, onclick, cssObj) {
        cssObj = cssObj || { 'z-index': 3 }
        let button = document.createElement('button'), btnStyle = button.style;
        let body = document.getElementsByClassName('squad-options-block')[0];
        body.appendChild(button);
        button.innerHTML = text;
        button.onclick = onclick;
        button.classList.add('builder-ui-control-pill');
        button.classList.add('active');
        // btnStyle.position = 'absolute';
        Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key]);
        return button;
    }

    function OpenSquadList() {
        let mainlist = document.getElementById('prices-list-content');
        let missingcards = mainlist.querySelectorAll(".player_price_name");

        var htmlstr = Array.prototype.reduce.call(missingcards, function (html, node) {
            return html + node.innerText + '<br/>';
        }, "");

        var newWin = open('', 'Export list', 'height=300,width=300');
        newWin.document.write(htmlstr);
    }
})();