hexo-theme-yelee
hexo-theme-yelee copied to clipboard
能都增加类似于知乎的复制文本自动添加版权保护?
在知乎复制文本时,会自动加上作者和链接,能否添加呢?
var lz = function (a, b, c) {
function d(a, b) {
return ["著作权归作者所有。", "商业转载请联系作者获得授权,非商业转载请注明出处。", "作者:" + b, "链接:" + a, "来源:知乎", "", ""]
}
function f(a, b, c) {
return "\x3cdiv\x3e" + d(b, c).join("\x3cbr /\x3e") + a + "\x3c/div\x3e"
}
function g(a) {
var g = z.Wq(), m = g && (0, z.ib)(g.Ed());
if (m && !(42 > m.length)) {
if ("object" === typeof a.originalEvent.clipboardData && (a.originalEvent.clipboardData.setData("text/html", f(g.Of(), b, c)), a.originalEvent.clipboardData.setData("text/plain", d(b, c).join("\n") + m), 0 < a.originalEvent.clipboardData.getData("text/plain").length)) {
a.preventDefault();
return
}
if (window.getSelection) {
a = g.Of();
var n = (0, window.$)(f(a, b, c)).css({position: "fixed", left: "-9999px"}).appendTo("body");
window.getSelection().selectAllChildren(n.get(0));
(0, window.setTimeout)(function () {
g.select();
n.remove()
}, 200)
}
}
}
a && b && c && (z.Fa(b, "http") || (b = window.location.protocol + "//" + window.location.host + b), a.on("copy", g))