博客園文章版權聲明(js自動生成)

博客園文章版權聲明(js自動生成)

一.代碼

我比較直接,直接上代碼,把下面html放右側,首頁,頁腳均可以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>
相關文章
相關標籤/搜索