您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Edit of re146 userscript that also applies the changes to the search page. Only works on tampermonkey to my knowledge as it uses window.onurlchange.
// ==UserScript== // @name Factorio Free Mods Downloader for the search page // @namespace https://re146.dev/ // @version 1.0 // @description Edit of re146 userscript that also applies the changes to the search page. Only works on tampermonkey to my knowledge as it uses window.onurlchange. // @author You // @match https://mods.factorio.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=re146.dev/factorio/mods // @license MIT // @run-at document-end // @grant window.onurlchange // ==/UserScript== const loadit = function() { 'use strict'; const myUrlMatch = location.href.match(/^https:\/\/mods\.factorio\.com\/([^\/]+)/); if (myUrlMatch) { const buttons = document.getElementsByClassName('button-green'); for (const button of buttons) { if (button.innerText.trim() !== 'Download') { continue; } if (!button.getAttribute('href').startsWith('/login?next=')) { continue; } const refArr = button.getAttribute('href').split('/'); const modName = refArr[refArr.length-1]; if (button.parentElement.tagName === 'DIV') { button.innerText = 'Download from re146.dev'; button.setAttribute('target', '_blank'); button.setAttribute('href', `https://re146.dev/factorio/mods/en#https://mods.factorio.com/mod/${modName}`); } } return; } }; loadit(); window.addEventListener("urlchange", loadit);