Typecho - Joe主题给网站添加复制弹窗提醒
效果截图

教程开始
1.修改config.php,文件路径:/usr/themes/Joe-master/public,添加如下代码:
{tabs}
{tabs-pane label="代码"}
var copyRightText = '<?php $this->options->CopyRightText() ?>';{/tabs-pane}
{tabs-pane label="代码安装位置"}
{/tabs-pane}
{/tabs}
2.修改custom.js,文件路径:usr/themes/Joe-master/assets/js,添加如下代码:
{tabs}
{tabs-pane label="代码"}
// 复制弹出提示document.body.oncopy = function() {
if(copyRightText) {
Qmsg.warning(copyRightText);
}
};
{/tabs-pane}
{tabs-pane label="代码安装位置"}
{/tabs-pane}
{/tabs}
3.修改include.php,文件路径:/usr/themes/Joe-master/public,添加如下代码:
{tabs}
{tabs-pane label="代码"}
<script src="<?php $this->options->themeUrl('assets/js/custom.js'); ?>"></script>{/tabs-pane}
{tabs-pane label="代码安装位置"}
{/tabs-pane}
{/tabs}
4.修改custom.php文件,文件路径:usr/themes/Joe-master/public,添加如下代码:
{tabs}
{tabs-pane label="代码"}
// 复制内容弹窗提醒
$CopyRightText = new Typecho_Widget_Helper_Form_Element_Text('CopyRightText',
NULL,
NULL,
'网站复制时提醒内容',
'介绍:填写此处,有人复制网站内容则弹出该提示 <br />'
);
$CopyRightText->setAttribute('class', 'joe_content joe_custom');
$form->addInput($CopyRightText->multiMode());
{/tabs-pane}
{tabs-pane label="代码安装位置"}
{/tabs-pane}
{/tabs}
本文系作者 @jichun29 原创发布在季春二九站点。未经许可,禁止转载。
暂无评论数据