Shoka 主题使用教程:Step.5 自定义优化技巧

这里是 Shoka 主题的自定义优化技巧,不是官方的。

关闭复制的时候出现版权信息

文件路径:themes/shoka/source/js/_app/page.js,
注释掉以下代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var copyright = $('#copyright')
if(window.getSelection().toString().length > 30 && copyright) {
event.preventDefault();
var author = "# " + copyright.child('.author').innerText
var link = "# " + copyright.child('.link').innerText
var license = "# " + copyright.child('.license').innerText
var htmlData = author + "<br>" + link + "<br>" + license + "<br><br>" + window.getSelection().toString().replace(/\r\n/g, "<br>");;
var textData = author + "\n" + link + "\n" + license + "\n\n" + window.getSelection().toString().replace(/\r\n/g, "\n");
if (event.clipboardData) {
event.clipboardData.setData("text/html", htmlData);
event.clipboardData.setData("text/plain", textData);
} else if (window.clipboardData) {
return window.clipboardData.setData("text", textData);
}
}