feat: add lightgallery switch (#507)

pull/568/head
Seaton Jiang 2022-11-27 20:12:55 +08:00
parent 4b5f80393e
commit fdd494070e
No known key found for this signature in database
GPG Key ID: B79682F6FE8D30E3
3 changed files with 17 additions and 5 deletions

View File

@ -149,9 +149,11 @@
}
var lightGalleryConfig = function () {
lightGallery(document.getElementById('lightgallery'), {
selector: 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]'
})
if(kratos.lightgallery){
lightGallery(document.getElementById('lightgallery'), {
selector: 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]'
})
}
}
document.addEventListener('DOMContentLoaded', function () {

View File

@ -4,7 +4,7 @@
* 核心函数
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.05.27
* @version 2022.11.27
*/
// CDN 资源地址
@ -41,7 +41,9 @@ function theme_autoload()
wp_enqueue_style('bootstrap', ASSET_PATH . '/assets/css/bootstrap.min.css', array(), '4.5.0');
wp_enqueue_style('kicon', ASSET_PATH . '/assets/css/iconfont.min.css', array(), THEME_VERSION);
wp_enqueue_style('layer', ASSET_PATH . '/assets/css/layer.min.css', array(), '3.1.1');
wp_enqueue_style('lightgallery', ASSET_PATH . '/assets/css/lightgallery.min.css', array(), '1.4.0');
if (kratos_option('g_lightgallery', true)) {
wp_enqueue_style('lightgallery', ASSET_PATH . '/assets/css/lightgallery.min.css', array(), '1.4.0');
}
if (kratos_option('g_animate', false)) {
wp_enqueue_style('animate', ASSET_PATH . '/assets/css/animate.min.css', array(), '4.1.1');
}
@ -104,6 +106,7 @@ function theme_autoload()
'directory' => ASSET_PATH,
'alipay' => kratos_option('g_donate_fieldset')['g_donate_alipay'] ?? '',
'wechat' => kratos_option('g_donate_fieldset')['g_donate_wechat'] ?? '',
'lightgallery' => kratos_option('g_lightgallery',true),
'repeat' => __('您已经赞过了', 'kratos'),
'thanks' => __('感谢您的支持', 'kratos'),
'donate' => __('打赏作者', 'kratos'),

View File

@ -681,6 +681,13 @@ CSF::createSection($prefix, array(
'subtitle' => __('启用/禁用按类型筛选媒体库功能功能', 'kratos'),
'default' => true,
),
array(
'id' => 'g_lightgallery',
'type' => 'switcher',
'title' => __('文章图片灯箱', 'kratos'),
'subtitle' => __('启用/禁用文章图片灯箱功能', 'kratos'),
'default' => true,
),
array(
'id' => 'g_article_widgets',
'type' => 'image_select',