Greasy Fork

Greasy Fork is available in English.

futbin.com - Extract players to buy for squad sbc

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         futbin.com - Extract players to buy for squad sbc
// @namespace    http://greasyfork.icu/en/users/884999-l%C3%A6ge-manden
// @version      0.5
// @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 cards = document.querySelectorAll(".card.added");
        var htmlstr = Array.prototype.reduce.call(cards, function (html, node) {
            return html + node.dataset.formpos + ' - ' + node.getElementsByClassName('pcdisplay-name')[0].innerHTML + ' - ' + node.getElementsByClassName('pcdisplay-rat')[0].innerText + ' - <img style="width: 12px;" src="/design/img/coins_bin.png"> ' + node.getElementsByClassName('pcdisplay-pc-price')[0].innerText + '<br/>';
        }, "");

        htmlstr = htmlstr + '<br /><a href="' + window.location.href +'">Link to sqaud</a>';

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