JS实现复制内容自动添加版权信息

把下面的代码放到主题后台设置中的开发者设置-自定义JavaScript中,然后在PJAX回调函数设置中输入上述函数名 addLink();,最后保存设置即可

function addLink() {
    var body_element = document.body;
    var selection;
    var blogName = '你的网站名称';
    selection = window.getSelection() ? window.getSelection() : document.selection.createRange().text;
    if (window.clipboardData) {
        var pagelink ="<br/>---------------------<br/>本文来源:"+blogName+"<br/>原文链接:"+document.location.href+"";
        var copyText = selection + pagelink;
        window.clipboardData.setData ("Text", copyText);
        return false;
    } else {
        var pagelink = "<br/>---------------------<br/>本文来源:"+blogName+"<br/>原文链接:"+document.location.href+"";
        var copyText = selection + pagelink;
        var newDiv = document.createElement('div');
        newDiv.style.position ='absolute';
        newDiv.style.left ='-99999px';
        body_element.appendChild(newDiv);
        newDiv.innerHTML = copyText;
        selection.selectAllChildren(newDiv);
        window.setTimeout(function() {
            body_element.removeChild(newDiv);
        },0);
    }
}
document.oncopy = addLink;

效果图

网站背景动画

下载相关JS文件放入网站目录里

在handsome主题中,进入后台设置-开发者设置-自定义输出body 尾部的HTML代码放入下面的代码:

<script type="text/javascript" color="128,128,128" src="此处填你的canvas-nest.js的地址"></script>

非handsome主题的情况下,将代码添加至底部自定义内容即可

顶部导航栏添加天气

在后台主题的目录下找到component下的headnav.php文件

!-- / search form -->的下一行加入以下代码:

 <!-- 知心天气-->
<ul class="nav navbar-nav" style="height:50px;">
<div id="tp-weather-widget" style="line-height: 50px;"></div>
<script>
  (function(a,h,g,f,e,d,c,b){b=function(){d=h.createElement(g);c=h.getElementsByTagName(g)[0];d.src=e;d.charset="utf-8";d.async=1;c.parentNode.insertBefore(d,c)};a["SeniverseWeatherWidgetObject"]=f;a[f]||(a[f]=function(){(a[f].q=a[f].q||[]).push(arguments)});a[f].l=+new Date();if(a.attachEvent){a.attachEvent("onload",b)}else{a.addEventListener("load",b,false)}}(window,document,"script","SeniverseWeatherWidget","//cdn.sencdn.com/widget2/static/js/bundle.js?t="+parseInt((new Date().getTime() / 100000000).toString(),10)));
  window.SeniverseWeatherWidget('show', {
    flavor: "slim",
    location: "WS0E9D8WN298",
    geolocation: true,
    language: "zh-Hans",
    unit: "c",
    theme: "white",
    token: "20f97289-5d56-4879-805d-c4df5408b7d9",
    hover: "enabled",
    container: "tp-weather-widget"
  })
</script>
</ul>

<!-- 知心结束-->

效果图

头像鼠标悬停旋转放大

主题设置 - 开发者设置 - 自定义CSS添加以下代码

.img-full {
    width: 100px;
    border-radius: 50%;
    animation: light 4s ease-in-out infinite;
    transition: 0.5s;
}

.img-full:hover {
transform: scale(1.15) rotate(720deg);
}

文章内打赏图标跳动

主题设置 - 开发者设置 - 自定义CSS添加以下代码

.btn-pay {
    animation: star 0.5s ease-in-out infinite alternate;
}

@keyframes star {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

首页文章列表悬停上浮

主题设置 - 开发者设置 - 自定义CSS添加以下代码

.blog-post .panel:not(article) {
transition: all 0.3s;
}

.blog-post .panel:not(article):hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 10px rgba(73, 90, 47, 0.47);
}

文章内头图和图片悬停放大并超出范围

.entry-thumbnail {
    overflow: hidden;
}

#post-content img {
    border-radius: 10px;
    transition: 0.5s;
}

#post-content img:hover {
    transform: scale(1.05);
}

添加IP地址

https://doge.uk/coding/useragent-modify.html

修改Handsome主题,component目录下的comments.php代码文件,大概第60~80行左右

<span class="comment-author vcard">
    <b class="fn"><?php echo $author; ?></b><?php echo $Identity; ?>
</span>

修改后

<span class="comment-author vcard">
    <b class="fn"><?php echo $author; ?></b><?php echo $Identity; ?><?php UserAgent_Plugin::get_useragent($comments->agent,$comments->ip); ?>
</span>

后续待更新...

最后修改:2023 年 12 月 23 日
点个赞或者请作者喝杯咖啡