Steam badge craft button

Will transform the useless blue button "Ready" to an actual working carft button.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Steam badge craft button
// @version      0.1111
// @description  Will transform the useless blue button "Ready" to an actual working carft button.
// @author       Zeper
// @match        https://steamcommunity.com/id/*/badges*
// @grant        none
// @namespace https://greasyfork.org/users/191481
// ==/UserScript==

var craftbtn = document.getElementsByClassName("badge_craft_button");
var craft = [];
for(var i=0; i<craftbtn.length; i++){craft[i]=craftbtn[i].href.split( 'gamecards/' )[1].split( '/' );}
if (craft.length <= 0) {console.log("No craft button to do !");}
else {
    var profileUrl = window.location.href.split( 'badges/' )[0];
    var series = 1;
    var border_color = 0;
    var jshref;
    var hidebtn;
    ShowDialog = function(){};
    for( i=0; i<craft.length; i++){
        if (craft[i]["1"].length <= 0) {border_color = 0;} else {border_color = craft[i]["1"].replace(/[^0-9]+/, '');}
        jshref = "Profile_CraftGameBadge( "+"'"+profileUrl+"'"+", "+craft[i]["0"]+", "+series+", "+border_color+" );";
        hidebtn = "document.getElementsByClassName('badge_craft_button')["+i+"].hide();"
        craftbtn[i].href = "javascript:"+jshref;
        craftbtn[i].innerText = "CRAFT";
        craftbtn[i].setAttribute("Onclick", hidebtn);
        console.log("javascript:"+jshref);
    }
}