Copy Text and HTML to Clipboard

library to copy the string and html parameters to the clipboard

目前為 2024-04-07 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/491896/1355860/Copy%20Text%20and%20HTML%20to%20Clipboard.js

作者
escctrl
版本
1.0
建立日期
2024-04-07
更新日期
2024-04-07
尺寸
1.5 KB
授權條款
MIT

Call with copy2Clipboard(event, string[, html]) where

  • event is the triggering user event (for example, a button click); this is required in case the user doesn't have the Clipbord API enabled and the event.clipBoardData method is used as a fallback
  • string is the plaintext that shall be copied to clipboard
  • html (optional) is the HTML equivalent that shall be copied to clipboard; if html is not specified, string is set as html content

For example:

$(button).on('click', (ev) => {
    copy2Clipboard(ev, "hello world", "<strong>hello world</strong>");
});

QingJ © 2025

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