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

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

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

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. 头像
    lezhi Lv.1
    ·Windows 10 · Google Chrome
    沙发

    纵天下几变春秋,我依旧还是我。

    回复 删除 垃圾
  2. 头像
    小东东 Lv.2
    ·MacOS · Google Chrome
    板凳

    我不会让任何人看到我软弱的一面。

    回复 删除 垃圾
  3. 头像
    knife Lv.2
    ·MacOS · Google Chrome
    地毯

    114514

    回复 删除 垃圾
  4. 头像
    孩子 Lv.1
    ·Windows 10 · Google Chrome
    第4楼

    看看~

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

    11

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

    111

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

    qs

    回复 删除 垃圾
  8. 头像
    knife Lv.2
    ·MacOS · Google Chrome
    第8楼

    1

    回复 删除 垃圾
  9. 头像
    河岸社区 Lv.1
    ·Windows 10 · Google Chrome
    第9楼

    牛逼牛逼牛逼666666

    回复 删除 垃圾
  10. 头像
    老龙王 Lv.1
    ·Windows 7 · Google Chrome
    第10楼

    学习中。。。。。

    回复 删除 垃圾
  11. 头像
    tinklh Lv.1
    ·Android · Google Chrome
    第11楼

    支持

    回复 删除 垃圾
  12. 头像
    测试 Lv.6
    ·Windows 10 · FireFox
    第12楼

    ces

    回复 删除 垃圾
  13. 头像
    joinliu Lv.3
    ·Windows 10 · Google Chrome
    第13楼

    画图

    回复 删除 垃圾
  14. 头像
    Joinliu Lv.3
    ·Windows 10 · Google Chrome
    第14楼

    画图

    回复 删除 垃圾
  15. 头像
    22 Lv.2
    ·MacOS · Google Chrome
    第15楼

    画图

    回复 删除 垃圾
  16. 头像
    冬眠 Lv.1
    ·Android · Google Chrome
    第16楼

    表情

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

    不错诶

    回复 删除 垃圾
  18. 头像
    亚麻和 Lv.6
    ·Windows 7 · Google Chrome
    第18楼

    学士

    回复 删除 垃圾
  19. 头像
    蓝天 Lv.1
    ·Linux · Safari
    第19楼

    请问,现在还可以用吗?

    回复 删除 垃圾
    1. 头像
      执念博客 Lv.6 作者
      ·Android · QQ Browser
      @ 蓝天

      那肯定是可以的

      回复 删除 垃圾
  20. 头像
    匿名 Lv.6
    ·Android · Google Chrome
    第20楼

    6

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

    那先走

    回复 删除 垃圾
  22. 头像
    shu Lv.1
    ·Android Oreo · QQ Browser
    第22楼

    66666

    回复 删除 垃圾
  23. 头像
    炫杰 Lv.2
    ·Windows 10 · Google Chrome
    第23楼

    拿走了

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

    666666666666666666666666666

    回复 删除 垃圾
  25. 头像
    75555 Lv.1
    ·Android · Google Chrome
    第25楼

    1

    回复 删除 垃圾
  26. 头像
    匿名 Lv.1
    ·iPhone · Safari
    第26楼

    111111111

    回复 删除 垃圾
  27. 头像
    很好 Lv.2
    ·Windows 10 · Google Chrome
    第27楼

    1

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

    多谢分享

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

    看看

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

    真不错!!

    回复 删除 垃圾