From f23e6fad659d6d73f6635570c4854891c0e0a422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=AA=E5=AD=90?= Date: Sat, 18 May 2024 19:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E8=B5=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/css/donate.css | 66 +++++++++++++++++++++++++++++++++++++++++++++ dist/js/donate.js | 30 +++++++++++++++++++++ functions.php | 6 ++++- post.php | 20 ++++++++++---- 4 files changed, 116 insertions(+), 6 deletions(-) create mode 100644 dist/css/donate.css create mode 100644 dist/js/donate.js diff --git a/dist/css/donate.css b/dist/css/donate.css new file mode 100644 index 0000000..08dec03 --- /dev/null +++ b/dist/css/donate.css @@ -0,0 +1,66 @@ +.donate-panel{ + text-align: center; + position: relative; +} +#donate-btn{ + width: 50px; + height: 50px; + /* #background: #e26d6d;*/ + color: #fff; + font-size: 20px; + font-weight: 600; + border-radius: 50%; + text-align: center; + line-height: 50px; + cursor: pointer; + display: inline-block; + position: relative; + /* box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)*/ +} +#donate-btn:hover{ + /* #background: #bd4b4b;*/ +} +#qrcode-panel{ + position: absolute; + width: 300px; + height: 320px; + background:#fff; + top: 0; + left: 0; + border-radius: 5px; + /* padding: 5px; */ + box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); +} +.qrcode-body{ + width: 100%; + height: 100%; + background:#fff; + position: relative; + border-radius: 5px; + +} +.donate-memo{ + padding: 10px; + font-size: 14px; + color: #999; + text-align: center; +} +#donate-close{ + float: right; + padding: 0 5px; + font-size: 12px; + cursor: pointer; +} +#donate-close:hover{ + color: #bd4b4b; +} +.donate-qrpay{ + +} +.donate-qrpay img{ + width: 280px; + height: 280px; +} +input[name='pay']{ + cursor: pointer; +} \ No newline at end of file diff --git a/dist/js/donate.js b/dist/js/donate.js new file mode 100644 index 0000000..de9c0ce --- /dev/null +++ b/dist/js/donate.js @@ -0,0 +1,30 @@ +setTimeout(function(){ + initDonate() +}, 1000); +function initDonate(){ + var donateBtn = document.getElementById('donate-btn'); + var donatePopup = document.getElementById('qrcode-panel'); + if(!donateBtn && !donatePopup){ + return + } + var l = donateBtn.offsetLeft-125; + var t = donateBtn.offsetTop-330; + donatePopup.style.left=l+'px' + donatePopup.style.top=t+'px' + + donateBtn.addEventListener('click',function(){ + donatePopup.style.display=''; + event.stopPropagation() + }) + document.getElementById('donate-close').addEventListener('click',function(){ + donatePopup.style.display='none'; + event.stopPropagation() + }) + document.querySelector('body').addEventListener('click',function() { + donatePopup.style.display='none'; + event.stopPropagation() + }); + donatePopup.addEventListener('click',function() { + event.stopPropagation() + }); +} \ No newline at end of file diff --git a/functions.php b/functions.php index 3542d1b..02928f6 100644 --- a/functions.php +++ b/functions.php @@ -5,7 +5,7 @@ function themeConfig($form) { $form->addInput($logoUrl); $icoUrl = new Typecho_Widget_Helper_Form_Element_Text('icoUrl', NULL, NULL, _t('站点 Favicon 地址')); $form->addInput($icoUrl); - $jzyear = new Typecho_Widget_Helper_Form_Element_Text('jzyear', NULL, NULL, _t('建站年份')); + $jzyear = new Typecho_Widget_Helper_Form_Element_Text('jzyear', NULL, NULL, _t('建站年份 eg. 2006')); $form->addInput($jzyear); $instagramurl = new Typecho_Widget_Helper_Form_Element_Text('instagramurl', NULL, NULL, _t('ins')); $form->addInput($instagramurl); @@ -21,6 +21,10 @@ function themeConfig($form) { $form->addInput($sitemapurl); $cnavatar = new Typecho_Widget_Helper_Form_Element_Text('cnavatar', NULL, 'https://cravatar.cn/avatar/', _t('自定义Gravatar镜像服务器,默认https://cravatar.cn/avatar/')); $form->addInput($cnavatar); + $donate = new Typecho_Widget_Helper_Form_Element_Text('donate', NULL, 'https://blogcdn.loliko.cn/donate/wx.png', _t('赞赏二维码')); + $form->addInput($donate); + + $twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('引用第三方评论')); $form->addInput($twikoo); diff --git a/post.php b/post.php index 2db247a..8d5bbc3 100644 --- a/post.php +++ b/post.php @@ -31,23 +31,33 @@

title() ?>

content(); ?>
-
+
+ options->donate): ?> - - + + +