Skip to content

Commit ec67eab

Browse files
committed
1112
1 parent ebbf4a9 commit ec67eab

File tree

14 files changed

+717
-606
lines changed

14 files changed

+717
-606
lines changed

css/nav.css

Lines changed: 38 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

footer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
})
3636
}
3737
})
38-
$('.user-info-menu .hidden-sm').click(function(){
38+
$('.user-info-menu .hidden-xs').click(function(){
3939
if($('.sidebar-menu').hasClass('collapsed')) {
4040
$('.has-sub.expanded > ul').attr("style","")
4141
} else {

functions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@
99
//登陆界面logo的title为博客副标题
1010
add_filter('login_headertext',function() {return get_bloginfo( 'description' );});
1111

12+
//WordPress 5.0+移除 block-library CSS
13+
add_action( 'wp_enqueue_scripts', 'fanly_remove_block_library_css', 100 );
14+
function fanly_remove_block_library_css() {
15+
wp_dequeue_style( 'wp-block-library' );
16+
}

header.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
<meta property="og:site_name" content="<?php echo io_get_option('seo_home_desc') ?>">
2121
<link rel="shortcut icon" href="<?php echo io_get_option('favicon') ?>">
2222
<link rel="apple-touch-icon" href="<?php echo io_get_option('apple_icon') ?>">
23-
<link rel="stylesheet" href="//fonts.loli.net/css?family=Arimo:400,700,400italic">
2423
<?php wp_head(); ?>
2524
</head>
26-
<body class="page-body">
25+
<body class="page-body <?php echo io_get_option('theme_mode')?>">
2726
<div class="page-container">
2827

inc/fav-content.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ function fav_con($mid) { ?>
3535
<div class="xe-widget xe-conversations box2 label-info" onclick="window.open('<?php echo io_get_option('is_go')? '/go/?url='.base64_encode($link_url) : $link_url ?>', '_blank')" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="<?php echo $link_url ?>">
3636
<div class="xe-comment-entry">
3737
<a class="xe-user-img">
38-
<img src="<?php echo get_post_meta($post->ID, '_thumbnail', true)? get_post_meta($post->ID, '_thumbnail', true): ('https://f.ydr.me/'.$link_url) ?>" onerror="javascript:this.src='<?php echo $default_ico; ?>'" class="img-circle" width="40">
38+
<?php if(io_get_option('lazyload')): ?>
39+
<img class="img-circle lazy" src="images/favicon.png" data-src="<?php echo get_post_meta($post->ID, '_thumbnail', true)? get_post_meta($post->ID, '_thumbnail', true): ('https://f.ydr.me/'.$link_url) ?>" onerror="javascript:this.src='<?php echo $default_ico; ?>'" width="40">
40+
<?php else: ?>
41+
<img class="img-circle lazy" src="<?php echo get_post_meta($post->ID, '_thumbnail', true)? get_post_meta($post->ID, '_thumbnail', true): ('https://f.ydr.me/'.$link_url) ?>" onerror="javascript:this.src='<?php echo $default_ico; ?>'" width="40">
42+
<?php endif ?>
3943
</a>
4044
<div class="xe-comment">
4145
<a href="javascript:void(0)" class="xe-user-name overflowClip_1">

inc/frame/config/framework.config.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// ===============================================================================================
77
$settings = array(
88
'menu_title' => __('主题设置','io_setting'),
9-
'menu_type' => 'theme', // menu, submenu, options, theme, etc.
9+
'menu_type' => 'menu', // menu, submenu, options, theme, etc.
1010
'menu_slug' => 'io_get_option',
1111
'menu_position' => 59,
1212
'menu_icon' => CS_URI.'/assets/images/setting.png',
@@ -72,12 +72,12 @@
7272
'type' => 'radio',
7373
'title' => '网址列数',
7474
'desc' => '一行显示个数',
75-
'default' => 'col-md-4 col-lg-3',
75+
'default' => 'col-sm-4 col-md-3',
7676
'class' => 'horizontal',
7777
'options' => array(
78-
'col-md-6' => '2',
79-
'col-md-4' => '3',
80-
'col-md-4 col-lg-3' => '4',
78+
'col-sm-6' => '2',
79+
'col-sm-4' => '3',
80+
'col-sm-4 col-md-3' => '4',
8181
'col-sm-4 col-md-3 col-lg-2' => '6'
8282
),
8383
),
@@ -86,11 +86,28 @@
8686
'content' => '其他设置',
8787
'class' => 'info',
8888
),
89+
array(
90+
'id' => 'theme_mode',
91+
'type' => 'radio',
92+
'title' => '颜色主题',
93+
'default' => 'white',
94+
'class' => 'horizontal',
95+
'options' => array(
96+
'black' => '暗色',
97+
'white' => '亮色'
98+
),
99+
),
89100
array(
90101
'id' => 'icp',
91102
'type' => 'text',
92103
'title' => '备案号',
93104
),
105+
array(
106+
'id' => 'lazyload',
107+
'type' => 'switcher',
108+
'title' => '图标懒加载',
109+
'default' => false,
110+
),
94111
array(
95112
'id' => 'is_search',
96113
'type' => 'switcher',
@@ -101,7 +118,7 @@
101118
'id' => 'is_go',
102119
'type' => 'switcher',
103120
'title' => '内链跳转',
104-
'default' => true,
121+
'default' => false,
105122
),
106123
),
107124
);

inc/meta-boxes.php

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
"thumbnail" => array(
3030
"name" => "_thumbnail",
3131
"std" => "",
32-
"title" => "添加图片地址,调用指定缩略图",
33-
"type"=>"text"),
32+
"title" => "添加图标地址,调用自定义图标",
33+
"size" => "",
34+
'button_text' => '添加图标',
35+
"type"=>"upload"),
3436
);
3537

3638
// 面板内容
@@ -73,7 +75,13 @@ function new_meta_sites_boxes() {
7375
else $checked = '';
7476
echo '<br /><label><input type="checkbox" name="' . $meta_box['name'] . '" value="true" ' . $checked . ' />';
7577
echo '' . $meta_box['title'] . '</label><br />';
76-
break;
78+
break;
79+
case 'upload':
80+
$button_text = (isset($meta_box['button_text'])) ? $meta_box['button_text'] : 'Upload';
81+
echo '<h4>' . $meta_box['title'] . '</h4>';
82+
echo '<input class="damiwp_url_input" style="width: 95%;margin-bottom: 10px;" type="text" id="'.$meta_box['name'].'_input" size="'.$meta_box['size'].'" value="'.$meta_box['std'].'" name="'.$meta_box['name'].'"/><a href="#" id="'.$meta_box['name'].'" class="dami_upload_button button">'.$button_text.'</a>';
83+
add_script_and_styles();
84+
break;
7785
}
7886
}
7987
}
@@ -103,3 +111,28 @@ function save_sites_postdata($post_id) {
103111
add_action('admin_menu', 'create_meta_sites_box');
104112
add_action('save_post', 'save_sites_postdata');
105113

114+
function add_script_and_styles() {
115+
echo "<script>
116+
jQuery(document).ready(function(){
117+
var dami_upload_frame;
118+
var value_id;
119+
jQuery('.dami_upload_button').live('click',function(event){
120+
value_id =jQuery( this ).attr('id');
121+
event.preventDefault();
122+
if( dami_upload_frame ){
123+
dami_upload_frame.open();
124+
return;
125+
}
126+
dami_upload_frame = wp.media({
127+
title: '上传图片',
128+
button: {
129+
text: '确定',
130+
},
131+
multiple: false
132+
});
133+
dami_upload_frame.on('select',function(){
134+
attachment = dami_upload_frame.state().get('selection').first().toJSON();
135+
//jQuery('#'+value_id+'_input').val(attachment.url).trigger('change');
136+
jQuery('input[name='+value_id+']').val(attachment.url).trigger('change');});dami_upload_frame.open();});});
137+
</script>";
138+
}

inc/register.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ function theme_load_scripts() {
99

1010
wp_register_script( 'bootstrap', THEME_URL.'/js/bootstrap.min.js', array('jquery'), $theme_version, true );
1111
wp_register_script( 'TweenMax', THEME_URL.'/js/TweenMax.min.js', array('jquery'), $theme_version, true );
12-
wp_register_script( 'app', THEME_URL.'/js/app.js', array('jquery'), $theme_version, true );
12+
wp_register_script( 'appjs', THEME_URL.'/js/app.js', array('jquery'), $theme_version, true );
13+
wp_register_script( 'lazyload', THEME_URL.'/js/lazyload.min.js', array('jquery'), $theme_version, true );
1314

1415
if( !is_admin() )
1516
{
1617
wp_enqueue_style('font-awesome');
1718
wp_enqueue_style('bootstrap');
1819
wp_enqueue_style('nav');
19-
20+
2021
wp_deregister_script( 'jquery' );
2122
wp_register_script( 'jquery', THEME_URL.'/js/jquery-1.11.1.min.js', array(), $theme_version ,false);
2223
wp_enqueue_script('jquery');
23-
24+
2425
wp_enqueue_script('bootstrap');
2526
wp_enqueue_script('TweenMax');
26-
wp_enqueue_script('app');
27-
27+
wp_enqueue_script('appjs');
28+
29+
if(io_get_option('lazyload')) wp_enqueue_script('lazyload');
2830

2931
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
3032
wp_enqueue_script( 'comment-reply' );

0 commit comments

Comments
 (0)