download profile pic - vsco.co

Download profile pic from vsco.co

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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
);