微软CRX下载器

使非Edge浏览器,也能从微软扩展商店下载CRX文件

目前為 2021-08-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name         微软CRX下载器
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  使非Edge浏览器,也能从微软扩展商店下载CRX文件
// @author       那年那tu那些事
// @match        *://microsoftedge.microsoft.com/addons/detail/*
// @icon         https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE4sQDc?ver=30c2&q=90&m=6&h=40&w=40&b=%23FFFFFFFF&l=f&o=t&aim=true
// ==/UserScript==

//获取扩展ID写入下载链接
var crxurl = window.location.pathname.replace(/^\/addons\/detail\/.+\/([a-z]{32}).*/,
	`https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&acceptformat=crx3&x=id%3D$1%26installsource%3Dondemand%26uc`
	);
//构造下载按钮
var button = document.createElement("Button");
button.innerHTML = "<a href=" + crxurl +
	" target='_blank' style='color: white'><b>下载 CRX</b><br></a>";
button.style =
	"top:25%;right:5%;position:absolute;z-index: 9999;cursor:pointer;display:inline-flex;overflow:hidden;max-width:374px;box-sizing:border-box;transition:all 0.1s ease-in-out;line-height:1;font-family:inherit;align-items:center;white-space:nowrap;justify-content:center;text-decoration:none;font-size:14px;min-width:140px;height:60px;border:2px solid transparent;border-radius:2px;background:linear-gradient(to bottom right, #6ce2d8, #468fd5);text-shadow:1px 1px #3e90ae;border-radius: 8px;"
document.body.appendChild(button);

//隐藏原本的“获取”按钮
var crxid = window.location.pathname;
crxid = crxid.slice(crxid.search("detail/") + "detail/".length);
crxid = crxid.slice(crxid.search("/") + 1);
document.getElementById("getOrRemoveButton-" + crxid).style.display="none";