mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-22 06:48:12 +08:00
lazyload options
This commit is contained in:
parent
425348bb8f
commit
cd60df83ff
@ -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 文件`;请留意主题说明里的其他注意事项。
|
||||
|
||||
主题使用说明见:<https://2heng.xin/theme-sakura/>
|
||||
|
||||
|
@ -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(
|
||||
'/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i',
|
||||
"<img $1 class=\"lazyload\" data-src=\"$2\" src=\"https://cdn.jsdelivr.net/gh/moezx/cdn@3.0.2/img/svg/loader/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
|
||||
$content
|
||||
);
|
||||
if(!is_feed()) {
|
||||
if(akina_option('lazyload') && akina_option('lazyload_spinner')){
|
||||
$content=preg_replace(
|
||||
'/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i',
|
||||
"<img $1 class=\"lazyload\" data-src=\"$2\" src=\"".akina_option('lazyload_spinner')."\" onerror=\"imgError(this)\" $3 >\n<noscript>$0</noscript>",
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
||||
//Fancybox
|
||||
/* Markdown Regex Pattern for Matching URLs:
|
||||
|
14
options.php
14
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'),
|
||||
|
Loading…
Reference in New Issue
Block a user