download profile pic - vsco.co

Download profile pic from vsco.co

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        download profile pic - vsco.co
// @namespace   Violentmonkey Scripts
// @match       *://vsco.co/*
// @grant       none
// @version     1.3.1
// @author      Edgeburn Media
// @description Download profile pic from vsco.co
// @license     MIT
// ==/UserScript==

function setUpDownloadButton(img) {
	let src = img.src;
	// create a button that will download the image
	let button = document.createElement("button");
	// set the text of the button
	button.innerHTML = "\u2193 Download Profile Pic";
	button.classList.add("nav__logo-items");
	// set the onclick attribute of the button to a function
	button.onclick = function () {
		// store the src in a variable
		let u = src;
		// replace the size=120 in the url with size=960
		u = u.replace("size=120", "size=960");
		// open u in a new tab
		window.open(u);
	};
	img.parentElement.addEventListener("click", function () {
		let u = src;
		u = u.replace("size=120", "size=960");
		window.open(u);
	});
	// append the button to the div
	if (!document.querySelector(".touch")) {
		document.querySelector(".nav__logo-items").appendChild(button);
	}
	button.style.cssText = "width:200px;height:50px;background-color:green;";
}

window.addEventListener(
	"load",
	function () {
		let img = document.querySelector(".css-x3m333");
		setUpDownloadButton(img);
	},
	false
);