Toggle menu (三つだけ) - ボタンで ", ', ` をコピー
// ==UserScript==
// @name Toggle Menu for JS
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Toggle menu (三つだけ) - ボタンで ", ', ` をコピー
// @author umaimann
// @match *://*/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
// 既存のGUIがあれば削除
const existing = document.getElementById('copy-quote-gui');
if (existing) existing.remove();
// GUI作成
const gui = document.createElement('div');
gui.id = 'copy-quote-gui';
Object.assign(gui.style, {
position: 'fixed',
top: '20px',
right: '20px',
padding: '10px',
background: '#f0f0f0',
border: '1px solid #ccc',
borderRadius: '8px',
boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
zIndex: 9999,
fontFamily: 'sans-serif',
display: 'flex',
flexDirection: 'column',
gap: '8px',
alignItems: 'center'
});
// コピー用文字
const chars = ['"', "'", '`'];
const charContainer = document.createElement('div');
charContainer.style.display = 'flex';
charContainer.style.gap = '5px';
chars.forEach(c => {
const btn = document.createElement('button');
btn.textContent = c;
Object.assign(btn.style, {
padding: '5px 10px',
cursor: 'pointer'
});
btn.onclick = () => {
navigator.clipboard.writeText(c).then(() => {
const original = btn.textContent;
btn.textContent = 'コピー完了 ✔';
setTimeout(() => btn.textContent = original, 1000);
});
};
charContainer.appendChild(btn);
});
gui.appendChild(charContainer);
document.body.appendChild(gui);
})();