您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Download mods from mods.factorio.com for free
当前为
- // ==UserScript==
- // @name Factorio mod downloader
- // @namespace nipsuontop
- // @version 1.1
- // @description Download mods from mods.factorio.com for free
- // @author Ruhto
- // @match https://mods.factorio.com/mod/*
- // @icon https://steamuserimages-a.akamaihd.net/ugc/793135197243665662/A9845DE547208C8293F60FB84B241C65A418E4B4/?imw=128&imh=128&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=true
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- const modUrlMatch = location.href.match(/^https:\/\/mods\.factorio\.com\/mod\/([^\/]+)/);
- if (!modUrlMatch) {
- return;
- }
- const modName = modUrlMatch[1];
- const loggedInButtons = document.querySelectorAll('.mod-download-section .mod-download-button a.button-green');
- for (const button of loggedInButtons) {
- if (button.innerText.trim() !== 'Download' || !button.classList.contains('disabled')) {
- continue;
- }
- button.innerText = 'Download';
- button.classList.remove('disabled');
- button.setAttribute('target', '_blank');
- button.setAttribute('title', '');
- button.setAttribute('href', `https://re146.dev/factorio/mods/en#https://mods.factorio.com/mod/${modName}`);
- }
- const buttons = document.getElementsByClassName('btn mod-download-button btn-download');
- for (const button of buttons) {
- if (button.innerText.trim() !== 'Download') {
- continue;
- }
- if (!button.getAttribute('href').startsWith('/login?next=')) {
- continue;
- }
- if (button.parentElement.tagName === 'DIV') {
- button.innerText = 'Download';
- button.setAttribute('target', '_blank');
- button.setAttribute('href', `https://re146.dev/factorio/mods/en#https://mods.factorio.com/mod/${modName}`);
- } else if (button.parentElement.tagName === 'TD') {
- const version = button.parentElement.parentElement.children[0].innerText;
- button.innerText = 'Download';
- button.setAttribute('target', '_blank');
- button.setAttribute('href', `https://re146.dev/factorio/mods/en#https://mods.factorio.com/mod/${modName}#${version}`);
- }
- }
- })();