-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader.php
219 lines (203 loc) · 9.51 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
/**
* 努力努力再努力!!!!!
* Author:smalls
* Github:https://github.com/smalls0098
* Email:[email protected]
* Date:2020/7/18 - 11:50
**/
//dev是开发模式,prod是正常模式
$GLOBALS['smallsMode'] = 'prod';
$seoDescription = get_seo_description();
$barHeaderIcon = get_option('smalls_setting_toolbar_icon');
$barHeaderTitle = get_option('smalls_setting_toolbar_title');
$barHeaderMotto = get_option('smalls_setting_toolbar_motto');
?>
<!DOCTYPE HTML>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="x-ua-compatible" content="ie=edge"/>
<meta charset="utf-8"/>
<meta http-equiv="x-dns-prefetch-control" content="on"/>
<title><?php site_page_title(); ?></title>
<meta name="keywords" content="<?php echo get_seo_keywords(); ?>"/>
<meta name="description" content="<?php echo $seoDescription ?>">
<meta property="og:title" content="<?php echo wp_get_document_title(); ?>">
<meta property="og:type" content="article">
<meta property="og:url" content="<?php echo get_url(); ?>">
<meta property="og:description" content="<?php echo $seoDescription ?>">
<meta name="theme-version" content="<?php echo $GLOBALS['themeVersion']; ?>">
<meta name="theme-name" content="<?php echo $GLOBALS['themeName']; ?>">
<meta name="theme-desc" content="<?php echo $GLOBALS['themeDesc']; ?>">
<link rel="shortcut icon" href="<?php echo get_home_url(); ?>/favicon.ico">
<?php
if (get_option('smalls_setting_assets_cdn') == 'bootcdn') {
?>
<script src="//cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.min.js" charset="UTF-8"></script>
<script src="//cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js" charset="UTF-8"></script>
<script src="//cdn.bootcdn.net/ajax/libs/highlight.js/10.1.2/highlight.min.js" charset="UTF-8"></script>
<script src="//cdn.bootcdn.net/ajax/libs/view-design/4.3.2/iview.min.js" charset="UTF-8"></script>
<link href="//cdn.bootcdn.net/ajax/libs/view-design/4.3.2/styles/iview.css" rel="stylesheet">
<?php
} elseif (get_option('smalls_setting_assets_cdn') == 'unpkg') { ?>
<script src="//unpkg.com/[email protected]/dist/vue.min.js" charset="UTF-8"></script>
<script src="//unpkg.com/[email protected]/dist/jquery.min.js" charset="UTF-8"></script>
<script src="//unpkg.com/[email protected]/highlight.pack.js" charset="UTF-8"></script>
<script src="//unpkg.com/[email protected]/dist/iview.min.js" charset="UTF-8"></script>
<link href="//unpkg.com/[email protected]/dist/styles/iview.css" rel="stylesheet">
<?php
} elseif (get_option('smalls_setting_assets_cdn') == 'unpkg.zhimg.com') { ?>
<script src="//unpkg.zhimg.com/[email protected]/dist/vue.min.js" charset="UTF-8"></script>
<script src="//unpkg.zhimg.com/[email protected]/dist/jquery.min.js" charset="UTF-8"></script>
<script src="//unpkg.zhimg.com/[email protected]/highlight.pack.js" charset="UTF-8"></script>
<script src="//unpkg.zhimg.com/[email protected]/dist/iview.min.js" charset="UTF-8"></script>
<link href="//unpkg.zhimg.com/[email protected]/dist/styles/iview.css" rel="stylesheet">
<?php
} elseif (get_option('smalls_setting_assets_cdn') == 'jsDelivr') { ?>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js" charset="UTF-8"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js" charset="UTF-8"></script>
<script src="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"
charset="UTF-8"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/iview.min.js" charset="UTF-8"></script>
<link href="//cdn.jsdelivr.net/npm/[email protected]/dist/styles/iview.css" rel="stylesheet">
<?php }else{ ?>
<script src="<?php echo esc_url(get_template_directory_uri()); ?>/js/vue.min.js" charset="UTF-8"></script>
<script src="<?php echo esc_url(get_template_directory_uri()); ?>/js/jquery.min.js" charset="UTF-8"></script>
<script src="<?php echo esc_url(get_template_directory_uri()); ?>/js/highlight.min.js" charset="UTF-8"></script>
<script src="<?php echo esc_url(get_template_directory_uri()); ?>/js/iview.min.js" charset="UTF-8"></script>
<link href="<?php echo esc_url(get_template_directory_uri()); ?>/css/iview/iview.css" rel="stylesheet">
<?php } ?>
<style>
.loading {
background: #fff;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
text-align: center
}
.loading div {
width: 150px;
height: 15px;
margin: 100px auto 0;
text-align: center
}
.loading div span {
display: inline-block;
width: 15px;
height: 100%;
margin-right: 5px;
background: #57a3f3;
-webkit-transform-origin: right bottom;
-webkit-animation: load 1s ease infinite
}
.loading div span:last-child {
margin-right: 0
}
@-webkit-keyframes load {
0% {
opacity: 1;
-webkit-transform: scale(1)
}
to {
opacity: 0;
-webkit-transform: rotate(90deg) scale(.3)
}
}
.loading div span:first-child {
-webkit-animation-delay: .13s
}
.loading div span:nth-child(2) {
-webkit-animation-delay: .26s
}
.loading div span:nth-child(3) {
-webkit-animation-delay: .39s
}
.loading div span:nth-child(4) {
-webkit-animation-delay: .52s
}
.loading div span:nth-child(5) {
-webkit-animation-delay: .65s
}
</style>
<script>
window.DATA = {
admin_ajax: "<?php echo admin_url('admin-ajax.php'); ?>",
}
</script>
<?php echo get_header_custom_html(); ?>
</head>
<body>
<div class="loading">
<div>
<span></span><span></span><span></span><span></span>
</div>
</div>
<div id="bar-header" class="bar-header">
<div class="header-container">
<button class="nav-bar-drop-down" id="menu-sm">
<i class="ivu-icon ivu-icon-ios-menu icon"></i>
</button>
<a class="logo" href="<?php bloginfo('url'); ?>">
<img src="<?php echo $barHeaderIcon; ?>" alt="首页">
<span class="title"><?php echo $barHeaderTitle; ?></span>
<span class="motto ml10"><?php echo $barHeaderMotto; ?></span>
</a>
<div class="menu-modal">
<div class="modal-header hidden" id="menu-modal-close">
<i class="ivu-icon ivu-icon-md-close"></i>
</div>
<ul class="header-nav">
<li>
<form id="search-form" method="get" actions="<?php bloginfo('url'); ?>">
<iv-input name="s" search placeholder="请输入你要搜索的内容,按Enter搜索" type="text" maxlength="40"
class="nav-link search"></iv-input>
</form>
</li>
<?php
/*顶栏菜单*/
class toolbarMenuWalker extends Walker_Nav_Menu
{
public function start_lvl(&$output, $depth = 0, $args = array())
{
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<div class=\"dropdown-menu\">\n";
}
public function end_lvl(&$output, $depth = 0, $args = array())
{
$indent = str_repeat("\t", $depth);
$output .= "\n$indent</div>\n";
}
public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
if ($depth == 0) {
$output .= "<li><a href='" . $object->url . "' target='" . $object->target . "' title='" . $object->description . "'>" . $object->title . "</a>";
} else if ($depth == 1) {
$output .= "<a href=" . $object->url . " target='" . $object->target . "' title='" . $object->description . "'>" . $object->title . "</a>";
}
}
public function end_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
if ($depth == 0) {
$output .= "\n</li>";
}
}
}
wp_nav_menu(array(
'container' => '',
'theme_location' => 'toolbar_menu',
'items_wrap' => '%3$s',
'depth' => 0,
'walker' => new toolbarMenuWalker()
));
?>
</ul>
</div>
</div>
</div>