博客园文章版权声明(js自动生成)

博客园文章版权声明(js自动生成)

一.代码

我比较直接,直接上代码,把下面html放右侧,首页,页脚都可以

<style>
    #MySignature {
        display: block;
    	background-color: #c6ced4;
    	border-radius: 7px;
    	box-shadow: 1px 1px 1px #6B6B6B;
    	padding: 10px;
    	line-height: 1.5;
    	text-shadow: 1px 1px 1px #FFF;
    	font-size: 16px;
    }
    #MySignature a {
        margin: 0;
        padding: 0;
        display: contents;
    }
</style>
<script>
    var MySignature = document.querySelector('#MySignature')
    //会自动找你的url,如果你自己自定义了自定义匹配他的位置
    var postTitleUrl = document.querySelector('.postTitle a').getAttribute('href').replace(/\s*/g, "")
    //自动找你的名字,如果你自定义也是自己找
    var authorNanme = document.querySelector('#profile_block a').textContent.replace(/\s*/g, "")
    //你的介绍
    var info = '你的介绍'
    MySignature.innerHTML = '<div><p>作者:<a href=' + postTitleUrl + '>' + authorNanme + '</a></p><p>出处:<a href=' + postTitleUrl + '>' + postTitleUrl + '</a></p><p>关于作者:' + info + '</p><p>本作品采用<a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh">署名-非商业性使用-禁止演绎 4.0 国际 </a>进行许可,转载请标明作者与出处</p></div>'
</script>
posted @ 2020-01-20 18:50  小小咸鱼YwY  阅读(774)  评论(4编辑  收藏  举报