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

This is bad to have spaces in file names

2024/08/21のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

作者のサイトでサポートを受ける。または、このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        moneymuseum.by: PDP: add button to copy a title without spaces
// @namespace   Violentmonkey Scripts
// @match       https://moneymuseum.by/*
// @version     1.1
// @author      Vitaly Zdanevich
// @description This is bad to have spaces in file names
// @supportURL  https://gitlab.com/vitaly-zdanevich-userscripts/copy-title-without-spaces
// @license     MIT 
// ==/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(/%/g, 'percent')
			.replace(/\s/g, '_')
			.replaceAll(',', '')
		navigator.clipboard.writeText(text)
	}
	span.innerText = 'copy'

	h1.append(span)
})()