Skip to content

Commit e436049

Browse files
authored
Use pure JavaScript instead of jQuery [8] (#1135)
1 parent eb01dc5 commit e436049

File tree

22 files changed

+193
-143
lines changed

22 files changed

+193
-143
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ source/lib/font-awesome/less/
1414
source/lib/font-awesome/scss/
1515
!source/lib/font-awesome/
1616

17-
!source/lib/jquery/
17+
!source/lib/anime.min.js
1818

1919
!source/lib/velocity/

_config.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -970,11 +970,10 @@ vendors:
970970
# Internal path prefix. Please do not edit it.
971971
_internal: lib
972972

973-
# Internal version: 3.4.1
973+
# Internal version: 3.1.0
974974
# Example:
975-
# jquery: //cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
976-
# jquery: //cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js
977-
jquery:
975+
# anime: //cdn.jsdelivr.net/npm/[email protected]/lib/anime.min.js
976+
anime:
978977

979978
# Internal version: 4.7.0
980979
# Example:
@@ -1008,10 +1007,10 @@ vendors:
10081007

10091008
# FancyBox
10101009
# Example:
1010+
# jquery: //cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
10111011
# fancybox: //cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js
1012-
# fancybox: //cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js
10131012
# fancybox_css: //cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css
1014-
# fancybox_css: //cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css
1013+
jquery:
10151014
fancybox:
10161015
fancybox_css:
10171016

layout/_macro/sidebar.swig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
{%- endif %}
2020

2121
<ul class="sidebar-nav motion-element">
22-
<li class="sidebar-nav-toc" data-target="post-toc-wrap">
22+
<li class="sidebar-nav-toc">
2323
{{ __('sidebar.toc') }}
2424
</li>
25-
<li class="sidebar-nav-overview" data-target="site-overview-wrap">
25+
<li class="sidebar-nav-overview">
2626
{{ __('sidebar.overview') }}
2727
</li>
2828
</ul>

layout/_partials/head/head.swig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
copy_button: '{{ __("post.copy_button") }}',
9494
copy_success: '{{ __("post.copy_success") }}',
9595
copy_failure: '{{ __("post.copy_failure") }}'
96-
}
96+
},
97+
sidebarPadding: 40
9798
};
9899
</script>

layout/_scripts/vendors.swig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
{%- set js_vendors = {} %}
22
{%- set js_defer_vendors = {} %}
3-
{%- set js_vendors.jquery = 'jquery/index.js?v=3.4.1' %}
3+
{%- set js_vendors.anime = 'anime.min.js?v=3.1.0' %}
4+
5+
{# Velocity must be loaded before jQuery #}
6+
{%- if theme.motion.enable %}
7+
{%- set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %}
8+
{%- set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %}
9+
{%- endif %}
410

511
{%- if theme.pjax %}
612
{%- set js_vendors.pjax = 'pjax/pjax.min.js?v=0.2.8' %}
713
{%- endif %}
814

915
{%- if theme.fancybox %}
16+
{%- set js_vendors.jquery = '//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js' %}
1017
{%- set js_vendors.fancybox = '//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js' %}
1118
{%- endif %}
1219

@@ -22,11 +29,6 @@
2229
{%- set js_vendors.pangu = '//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js' %}
2330
{%- endif %}
2431

25-
{%- if theme.motion.enable %}
26-
{%- set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %}
27-
{%- set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %}
28-
{%- endif %}
29-
3032
{%- if theme.three.enable and not theme.three.delay %}
3133
{%- if theme.three.three_waves %}
3234
{%- set js_defer_vendors.three = 'three/three.min.js' %}

scripts/filters/minify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ hexo.extend.filter.register('after_generate', () => {
3333
});
3434
}
3535

36-
if (theme.vendors.jquery) {
37-
hexo.route.remove('lib/jquery/index.js');
36+
if (theme.vendors.anime) {
37+
hexo.route.remove('lib/anime.min.js');
3838
}
3939

4040
if (!theme.algolia_search.enable) {

source/css/_common/components/footer/footer.styl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
color: $grey-dark;
33
font-size: $font-size-small;
44

5+
&.footer-fixed {
6+
bottom: 0;
7+
left: 0;
8+
position: fixed;
9+
right: 0;
10+
}
11+
512
img {
613
border: 0;
714
}

source/css/_common/components/header/site-nav.styl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
margin: 0 -10px;
2626
padding: 0 10px;
2727
}
28+
29+
&.site-nav-on {
30+
display: block;
31+
}
2832
}

source/css/_common/components/post/post-eof.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
width: 8%;
77
}
88

9-
.post:last-child {
9+
article:last-child {
1010
.post-eof {
1111
display: none;
1212
}

source/css/_common/components/third-party/search.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ if (hexo-config('algolia_search.enable')) {
154154
}
155155

156156
if (hexo-config('local_search.enable')) {
157+
.search-loading-icon {
158+
margin: 20% auto 0 auto;
159+
text-align: center;
160+
}
161+
157162
.search-popup {
158163
ul.search-result-list {
159164
margin: 0 5px;

0 commit comments

Comments
 (0)