Typecho博客Joe主题实现打赏设置

执念博客
2021-05-12 / 297 评论 / 4,193 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年05月25日,已超过1066天没有更新,若内容或图片失效,请留言反馈。
广告

点击广告查看隐藏内容....

0.成品图展示
komd3vp6.png
1.新增一个php文件,用于以后新增自定义设置,文件名:custom.php;文件路径:usr/themes/Joe-master/public


kom53g0u.png

2.修改handle.php文件,底部新增代码,放在最后一行上面,文件路径:usr/themes/Joe-master/public

<style>
    /*弹出*/
    .footer_flex { width: 42px; height: 42px; background-color: #f56c6c; border-radius: 50%; cursor: pointer; position: relative; z-index: 10; display: flex; justify-content: center; align-items: center; color:#909399; font-size:12px}
    .footer_flex:hover { background-color: #409eff; }
    /*top*/
    .footer_flex:hover .flex-footer { display: block; }
    .footer_flex .flex-footer { box-shadow: 0px 0px 5px 0px #409eff; border-radius: 8px; width: 156px; height: 166px; position: absolute; left: -52px; top: -175px; text-align: center; padding-top: 15px; background: #fff; display: none; }
    .flex-footer input{vertical-align:middle; margin-bottom:3px; *margin-bottom:3px;}
    </style>
    <script language="javascript" type="text/javascript">
    function zfb(){
     var obj=document.getElementById("ewm");
     obj.src=`<?php $this->options->ZNAlipay() ?>`;
    };
    function wx(){
     var obj=document.getElementById("ewm");
     obj.src=`<?php $this->options->ZNWeChat() ?>`;
    };
    function qq(){
     var obj=document.getElementById("ewm");
     obj.src=`<?php $this->options->ZNQqPay() ?>`;
    };
    </script> 
    <div style="text-align: center; margin-left:30px; <?php if(Helper::options()->ZNPaySet !== 'on') echo 'display:none;' ?>">
        <div class="footer_flex">
            <img src="https://cdn.jsdelivr.net/gh/aill66/cdn/shang.png" width="20px" height="20px">
            <div class="flex-footer">
            <img id="ewm" src="<?php $this->options->ZNAlipay() ?>" width="120px" height="120px">
            <div style="margin-top:5px;">
            <label><input name="pay" type="radio" value="wx" checked="checked" onclick="wx()">微信</label>
            <label style="margin-left:3px; display:block-inline"><input name="pay" type="radio" value="zfb" onclick="zfb()" checked>支付宝</label>
            <label style="margin-left:3px;"><input name="pay" type="radio" value="qq" onclick="qq()">QQ</label>
            </div>
            <div style="height:40px; background:rgba(0,0,0,0);"></div>
            </div>
        </div>
        <p style="margin-top:5px; color:#909399; font-size:12px">打赏</p>
    </div>

kom5644a.png
3.修改functions.php文件,加入打赏设置菜单和底部引入新建的php文件,文件路径:usr/themes/Joe-master

<li class="item" data-current="joe_custom">自定义设置</li>

// 收款设置
require_once("public/custom.php");

kom591ey.png
kom59iez.png

4.为打赏按钮增加跳动特效,将以下代码放在主题的全局设置-自定义CSS里面

.footer_flex {
    animation: star 0.5s ease-in-out infinite alternate;
}
@keyframes star {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.1);
    }
}

kp3vjvbo.png

本文共 251 个字数,平均阅读时长 ≈ 1分钟

点击广告查看隐藏内容....

45

打赏

海报

正在生成.....

评论 (297)

语录
取消
  1. 头像
    浩宇 Lv.2
    ·Android · Google Chrome
    沙发

    学习学习

    回复 删除 垃圾
  2. 头像
    Lv.4
    ·Windows 10 · Google Chrome
    板凳

    kan

    回复 删除 垃圾
  3. 头像
    咯NYX Lv.1
    ·Android · QQ Browser
    地毯

    5696669

    回复 删除 垃圾
  4. 头像
    透露 Lv.5
    ·Android · QQ Browser
    第4楼

    649494848

    回复 删除 垃圾
  5. 头像
    ww Lv.2
    ·Android · Google Chrome
    第5楼

    学习

    回复 删除 垃圾
  6. 头像
    川川 Lv.2
    ·Windows 7 · QQ Browser
    第6楼

    看看

    回复 删除 垃圾
  7. 头像
    Lv.1
    ·Android Pie · QQ Browser
    第7楼

    回复可见

    回复 删除 垃圾
  8. 头像
    柳卿卿 Lv.1
    ·Android Oreo · Google Chrome
    第8楼

    加油加油

    回复 删除 垃圾
  9. 头像
    123452 Lv.1
    ·Windows 10 · Google Chrome
    第9楼

    画图

    回复 删除 垃圾
  10. 头像
    米奇 Lv.2
    ·Windows 10 · Google Chrome
    第10楼

    支持支持

    回复 删除 垃圾
  11. 头像
    bgg Lv.1
    ·Windows 10 · Google Chrome
    第11楼

    ghhgghghtytyh

    回复 删除 垃圾
  12. 头像
    江屿辰. Lv.1
    ·Windows 10 · Google Chrome
    第12楼

    .

    回复 删除 垃圾
  13. 头像
    哒哒 Lv.1
    ·iPhone · Safari
    第13楼

    为啥每次看都要评论一次

    回复 删除 垃圾
    1. 头像
      执念博客 Lv.6 作者
      ·Windows 10 · Google Chrome
      @ 哒哒

      因为没有要你登录才能评论,没办法记住你的信息

      回复 删除 垃圾
  14. 头像
    江屿辰. Lv.1
    ·Android · Google Chrome
    第14楼

    换个浏览器还要我从新发一遍评论表情

    回复 删除 垃圾
  15. 头像
    边缘人oh Lv.1
    ·Windows 10 · Google Chrome
    第15楼

    学习学习

    回复 删除 垃圾
  16. 头像
    哒哒 Lv.1
    ·iPhone · Safari
    第16楼

    我来学习来了

    回复 删除 垃圾
  17. 头像
    江屿辰. Lv.1
    ·Windows 10 · Google Chrome
    第17楼

    看看

    回复 删除 垃圾
  18. 头像
    星辰 Lv.1
    ·Windows 10 · Google Chrome
    第18楼

    表情

    回复 删除 垃圾
  19. 头像
    小້໌ᮨㅤ七҉ Lv.1
    ·Android · Google Chrome
    第19楼

    果然,这个也失败了表情

    回复 删除 垃圾
    1. 头像
      执念博客 Lv.6 作者
      ·Windows 7 · Google Chrome
      @ 小້໌ᮨㅤ七҉

      为啥会失败呢,后台没有设置显示吗?

      回复 删除 垃圾
  20. 头像
    小້໌ᮨㅤ七҉ Lv.1
    ·Android · Google Chrome
    第20楼

    大佬,那个在线人数的还是无法显示咩表情

    回复 删除 垃圾
    1. 头像
      执念博客 Lv.6 作者
      ·Windows 7 · Google Chrome
      @ 小້໌ᮨㅤ七҉

      设置出来没?

      回复 删除 垃圾
  21. 头像
    球球 Lv.2
    ·Windows 10 · Google Chrome
    第21楼

    真不错

    回复 删除 垃圾
  22. 头像
    九七 Lv.1
    ·Windows 10 · Google Chrome
    第22楼

    看一下

    回复 删除 垃圾
  23. 头像
    6094121 Lv.1
    ·Windows 10 · QQ Browser
    第23楼

    看一下

    回复 删除 垃圾
  24. 头像
    米奇 Lv.2
    ·Windows 10 · Google Chrome
    第24楼

    66666666666666

    回复 删除 垃圾
  25. 头像
    cc Lv.1
    ·Android · QQ Browser
    第25楼

    666

    回复 删除 垃圾
  26. 头像
    清风 Lv.1
    ·Windows 10 · Google Chrome
    第26楼

    表情୧(๑•̀⌄•́๑)૭

    回复 删除 垃圾
  27. 头像
    Lv.3
    ·Windows 7 · Google Chrome
    第27楼

    为啥我的更新7.4 评论人的头像都没了

    回复 删除 垃圾
    1. 头像
      执念博客 Lv.6 作者
      ·Windows 10 · Google Chrome
      @

      那不清楚了,我还没更新

      回复 删除 垃圾
  28. 头像
    Lv.3
    ·iPhone · QQ Browser
    第28楼

    每次更新都要动代码不是很痛苦

    回复 删除 垃圾
    1. 头像
      执念 Lv.6
      ·Windows 7 · Google Chrome
      @

      你可以比对着更新,不要覆盖

      回复 删除 垃圾
  29. 头像
    324224 Lv.1
    ·Windows 7 · Google Chrome
    第29楼

    454454

    回复 删除 垃圾
  30. 头像
    9541 Lv.1
    ·Windows 10 · Google Chrome
    第30楼

    画图

    回复 删除 垃圾