visualstudio marketplace toolkit by Theo·Chan
// ==UserScript==
// @name visualstudio marketplace toolkit
// @namespace http://tampermonkey.net/
// @version 0.01
// @description visualstudio marketplace toolkit by Theo·Chan
// @author Theo·Chan
// @match *://marketplace.visualstudio.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license AGPL-3.0-or-later
// ==/UserScript==
(function () {
'use strict';
//--------------------------marketplace.visualstudio.com----download-------------------------------//
let vsMarketDownloader = (function () {
return {
addDownloadBtn: function () {
if (window.location.host.toUpperCase() !== 'MARKETPLACE.VISUALSTUDIO.COM') return false;
let arr = window.location.href.split('?')[1].split('=')[1].split('.');
let author = arr[0];
let id = arr[1];
var histories = document.querySelectorAll('tr.version-history-container-row');
for (var i = 1; i < histories.length; i++) {
let version = histories[i].firstChild.textContent;
let a = document.createElement('a');
a.className = 'bowtie-icon bowtie-install';
a.style = 'margin-left: 1rem;'
a.href = `https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${author}/vsextensions/${id}/${version}/vspackage`;
histories[i].firstChild.appendChild(a);
}
return true;
}
}
})();
setTimeout(() => {
vsMarketDownloader.addDownloadBtn();
}, 1200);
}) ();