Skip to content

Commit 0191140

Browse files
committed
Combine local JS.
’yui-compressor’ is no longer used.
1 parent 09d109f commit 0191140

44 files changed

Lines changed: 213 additions & 195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

_config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@ defaults:
158158
-
159159
label: Home
160160
url: /
161-
-
162-
scope:
163-
path: assets/data
164-
values:
165-
layout: compress
166161

167162

168163
sass:

_includes/disqus.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<p class="font-italic text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
1212
</div>
1313

14-
<script src="{{ site.baseurl }}/assets/lib/jquery.disqusloader.min.js"></script>
14+
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script>
1515
<script>
1616
var options = {
1717
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js',

_includes/head.html

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,21 @@
1111
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
1212

1313
<title>
14-
{%- if page.layout == "home" -%}
15-
{{- site.title -}}
16-
{%- else -%}
17-
{{ page.title }} | {{ site.title }}
18-
{%- endif -%}
14+
{%- unless page.layout == "home" -%}
15+
{{ page.title | append: " | "}}
16+
{%- endunless -%}
17+
{{ site.title }}
1918
</title>
2019

2120
{% seo title=false %}
2221

2322
{% include favicons.html %}
2423

25-
<!-- google fonts -->
24+
<!-- Google Fonts -->
2625
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
2726
<link rel="dns-prefetch" href="https://fonts.gstatic.com">
2827

29-
<!-- ga -->
28+
<!-- GA -->
3029
{% if jekyll.environment == 'production' %}
3130
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
3231
<link rel="dns-prefetch" href="https://www.google-analytics.com">
@@ -40,10 +39,12 @@
4039
{% endif %}
4140
{% endif %}
4241

43-
<!-- jsdelivr CDN -->
42+
<!-- jsDelivr CDN -->
4443
<link rel="preconnect" href="cdn.jsdelivr.net">
4544
<link rel="dns-prefetch" href="cdn.jsdelivr.net">
4645

46+
<!-- Bootstrap -->
47+
4748
<link rel="preload" as="style"
4849
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
4950
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin>
@@ -52,6 +53,8 @@
5253
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
5354
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
5455

56+
<!-- Font Awesome -->
57+
5558
<link rel="preload" as="style"
5659
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"
5760
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
@@ -100,41 +103,18 @@
100103
<link rel="stylesheet" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css" />
101104
{% endif %}
102105

103-
{% if page.math %}
104-
<!-- MathJax -->
105-
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
106-
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
107-
{% endif %}
108-
109106
{% endif %}
110107

111-
<link rel="preload" as="script"
112-
href="https://cdn.jsdelivr.net/combine/npm/jquery@3.4.1,npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" crossorigin>
108+
<!-- JavaScripts -->
113109

114-
<script src="https://cdn.jsdelivr.net/combine/npm/jquery@3.4.1,npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js"></script>
110+
<link rel="preload" as="script" href="https://cdn.jsdelivr.net/npm/jquery@3.4.1"
111+
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
115112

116-
<script src="{{ site.baseurl }}/assets/js/dist/commons.js" async></script>
113+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1"
114+
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
117115

118-
{% if page.layout == 'home' or page.layout == 'post' %}
119-
<script src="{{ site.baseurl }}/assets/js/dist/timeago.min.js" async></script>
120-
{% if site.google_analytics.pv.enabled %}
121-
<script src="{{ site.baseurl }}/assets/data/pv-data.json"></script>
122-
<script src="{{ site.baseurl }}/assets/lib/countUp.min.js" async></script>
123-
<script src="{{ site.baseurl }}/assets/js/dist/pageviews.min.js" async></script>
124-
{% endif %}
125-
{% endif %}
116+
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.15.0,npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" async></script>
126117

127-
{% if site.toc and page.toc and page.layout == 'post' %}
128-
<link rel="preload" as="script" href="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js">
129-
<script src="{{ site.baseurl }}/assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js" async></script>
130-
<script src="{{ site.baseurl }}/assets/js/dist/toc.min.js" async></script>
131-
{% endif %}
132-
133-
<script src="{{ site.baseurl }}/assets/js/dist/tooltip-loader.min.js" async></script>
134-
135-
<!-- PWA -->
136-
{% if jekyll.environment == 'production' %}
137-
<script src="{{ '/app.js' | relative_url }}" defer></script>
138-
{% endif %}
118+
{% include js-selector.html %}
139119

140120
</head>

_includes/js-selector.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--
2+
JS selector for site.
3+
Chirpy v2.3
4+
https://github.com/cotes2020/jekyll-theme-chirpy
5+
© 2020 Cotes Chung
6+
MIT Licensed
7+
-->
8+
9+
{% if page.layout == 'home' %}
10+
11+
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
12+
13+
{% elsif page.layout == 'post' %}
14+
15+
{% if site.toc and page.toc %}
16+
<script src="{{ '/assets/js/post-toc.min.js' | relative_url }}" async></script>
17+
{% else %}
18+
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script>
19+
{% endif %}
20+
21+
{% if page.math %}
22+
<!-- MathJax -->
23+
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
24+
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" async></script>
25+
{% endif %}
26+
27+
{% elsif page.layout == 'page' %}
28+
29+
{% if page.title == 'Categories' %}
30+
<script src="{{ '/assets/js/categories.min.js' | relative_url }}" async></script>
31+
{% else %}
32+
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
33+
{% endif %}
34+
35+
{% else %}
36+
37+
<script src="{{ '/assets/js/page.min.js' | relative_url }}" async></script>
38+
39+
{% endif %}
40+
41+
42+
<!-- PWA -->
43+
{% if jekyll.environment == 'production' %}
44+
<script src="{{ '/app.js' | relative_url }}" defer></script>
45+
{% endif %}

_includes/search-loader.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
© 2017-2019 Cotes Chung
66
MIT License
77
-->
8-
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js" integrity="sha256-qcLR00zq6pJk4je3MLgAri8Nn+ZumUlXgTKR2H/xCY0=" crossorigin="anonymous"></script>
98

109
{% capture result_elem %}
1110
<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
@@ -20,11 +19,13 @@
2019

2120
{% capture not_found %}<p class="mt-5">Oops! No result founds.</p>{% endcapture %}
2221

22+
<script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.7.3/dest/simple-jekyll-search.min.js"></script>
23+
2324
<script>
2425
SimpleJekyllSearch({
2526
searchInput: document.getElementById('search-input'),
2627
resultsContainer: document.getElementById('search-results'),
27-
json: '{{ site.baseurl }}/assets/data/search.json',
28+
json: '{{ site.baseurl }}/assets/js/data/search.json',
2829
searchResultTemplate: '{{ result_elem | strip_newlines }}',
2930
noResultsText: '{{ not_found }}'
3031
});

assets/js/_commons.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*!
2+
Aggregation of common JS.
3+
Chirpy@2.3
4+
https://github.com/cotes2020/jekyll-theme-chirpy
5+
© 2020 Cotes Chung
6+
MIT License
7+
*/
8+
9+
{% include_relative _commons/back-to-top.js %}
10+
11+
{% include_relative _commons/search-display.js %}
12+
13+
{% include_relative _commons/sidebar.js %}
14+
15+
{% include_relative _commons/topbar-switch.js %}
16+
17+
{% include_relative _commons/topbar-title.js %}
18+
19+
{% include_relative _commons/copy-link.js %}
20+
21+
{% include_relative _utils/tooltip-loader.js %}

0 commit comments

Comments
 (0)