moneymuseum.by: PDP: add button to copy a title without spaces

This is bad to have spaces in file names

目前為 2024-06-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name        moneymuseum.by: PDP: add button to copy a title without spaces
// @namespace   Violentmonkey Scripts
// @match       https://moneymuseum.by/*
// @version     1.0
// @author      Vitaly Zdanevich
// @description This is bad to have spaces in file names
// ==/UserScript==


(function() {
	if (document.querySelector('.product-item-detail-slider-image').length === 0) {
		return // This is not a PDP
	}

	const h1 = document.querySelector('h1')

	const span = document.createElement('span')
	span.style='margin:10px; font-style:italic; color:green; cursor:pointer'
	span.onclick=function() {
		this.remove()
		const text = h1.innerText
			.replace(/\s/g, '_')
			.replaceAll(',', '')
		navigator.clipboard.writeText(text)
	}
	span.innerText = 'copy'

	h1.append(span)
})()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址