force copy
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/534397/1580089/forcecopy.js
;PushIconAction({
name: 'force copy',
id: 'icon-copy',
image: GM_getResourceURL('icon-copy'),
trigger: (t, hideIcon) => {
const el = getSelectionElement();
const html = el.innerHTML ? el.innerHTML : t;
const item = new ClipboardItem({
'text/html': new Blob([html], {type: 'text/html'}),
'text/plain': new Blob([t], {type: 'text/plain'}),
})
navigator.clipboard.write([item]).catch((err) => {
console.log(err);
request('text=' + t, '', () => {
hideIcon();
}).catch(console.log);
});
},
});