Skip to content

Instantly share code, notes, and snippets.

@TianyiLi
Created August 30, 2025 03:50
Show Gist options
  • Save TianyiLi/e7578132ff1521d60392e3c38c4ed3d0 to your computer and use it in GitHub Desktop.
Save TianyiLi/e7578132ff1521d60392e3c38c4ed3d0 to your computer and use it in GitHub Desktop.
swingvy paste image on request payment
// ==UserScript==
// @name swingvy 報賬貼上剪貼簿
// @namespace Violentmonkey Scripts
// @match https://secure.swingvy.com/main.html*
// @grant none
// @version 1.0
// @author
// @description 2025/8/30 上午11:19:00
// ==/UserScript==
const temporallyPaste = document.createElement('div')
document.addEventListener('paste', e => {
const items = e.clipboardData && e.clipboardData.items
if (!items) return;
const dialog = document.querySelector('dialog')
dialog.appendChild(temporallyPaste)
for (const item of items) {
if (item.type.indexOf('image') !== -1) {
const reader = new FileReader();
reader.onload = e => {
const image = new Image();
image.src = e.target.result;
image.onclick = () => temporallyPaste.removeChild(image)
image.setAttribute('title', 'click to remove')
image.style = 'cursor: pointer;';
temporallyPaste.appendChild(image)
}
reader.readAsDataURL(item.getAsFile())
}
}
})
temporallyPaste.style = 'position: absolute; top: 2rem; left: 2rem;'
document.body.appendChild(temporallyPaste)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment