From cd60df83fffb03a1afac097f5f979224138810d7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Oct 2019 13:00:27 +0000 Subject: [PATCH] lazyload options --- README.md | 2 +- functions.php | 14 ++++++++------ options.php | 14 ++++++++++++++ style.css | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1e1ebfb..bf75a3e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ 两位前辈做得已经很棒了,或许我所做的只是把他们的代码弄得凌乱不堪吧 :) -注意:建议 `git clone` 下载([简易 Git 使用指南](https://github.com/mashirozx/Sakura/wiki/Git-%E4%B8%8B%E8%BD%BD%E3%80%81%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97));如果选择下载压缩包,解压后记得把文件夹名改回 `Sakura`,也即保证主题路径为 `/wp-content/themes/Sakura/`;请留意主题说明里的其他注意事项。 +注意:建议 `git clone` 下载([简易 Git 使用指南](https://github.com/mashirozx/Sakura/wiki/Git-%E4%B8%8B%E8%BD%BD%E3%80%81%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97));如果选择下载压缩包,**解压后记得把文件夹名改回 `Sakura`,也即保证主题路径为 `/wp-content/themes/Sakura/`**;主题设置在 `菜单-外观-Sakura设置` 中;DIY 的时候建议采用[子主题](https://github.com/mashirozx/Sakura/tree/child) 并勾选 `主题设置-CDN-本地调用主题 js、css 文件`;请留意主题说明里的其他注意事项。 主题使用说明见: diff --git a/functions.php b/functions.php index 6837f01..afa99cf 100644 --- a/functions.php +++ b/functions.php @@ -1513,12 +1513,14 @@ function codecheese_register_post( $sanitized_user_login, $user_email, $errors ) // html 标签处理器 function html_tag_parser($content) { - if(!is_feed()) { - $content=preg_replace( - '//i', - "\n", - $content - ); + if(!is_feed()) { + if(akina_option('lazyload') && akina_option('lazyload_spinner')){ + $content=preg_replace( + '//i', + "\n", + $content + ); + } //Fancybox /* Markdown Regex Pattern for Matching URLs: diff --git a/options.php b/options.php index 75f6d28..c6c9e33 100644 --- a/options.php +++ b/options.php @@ -1027,6 +1027,20 @@ function optionsframework_options() { 'std' => '0', 'type' => 'checkbox'); + $options[] = array( + 'name' => __('文章内图片启用 lazyload', 'options_framework_theme'), + 'desc' => __('默认启用', 'options_framework_theme'), + 'id' => 'lazyload', + 'std' => '1', + 'type' => 'checkbox'); + + $options[] = array( + 'name' => __('lazyload spinner', 'options_framework_theme'), + 'desc' => __('图片加载时要显示的占位图,填写图片 url', 'options_framework_theme'), + 'id' => 'lazyload_spinner', + 'std' => 'https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg', + 'type' => 'text'); + $options[] = array( 'name' => __('是否开启剪贴板版权标识', 'options_framework_theme'), 'desc' => __('复制超过30个字节时自动向剪贴板添加版权标识,默认开启', 'options_framework_theme'), diff --git a/style.css b/style.css index 4510fe5..22019c8 100644 --- a/style.css +++ b/style.css @@ -8,7 +8,7 @@ Description: Akina主题分支(原版地址 http://www.akina.pw/themeakina) Version: 3.2.7 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html -Text Domain: akina +Text Domain: Sakura Tags: 樱花庄的白猫 */