styless 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/nav.html +2 -2
- data/_includes/search/algolia.html +95 -0
- data/_layouts/default.html +3 -1
- data/_layouts/home.html +1 -0
- data/_sass/styless.scss +585 -604
- data/assets/js/jit.js +9 -90
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15c65c37aa3993c0bf1a83da99802855e746abc1025e337369134b4e5eb1f05b
|
4
|
+
data.tar.gz: 380813725685823d9c3ffd641c10d0f76ec0a6dfddda7cb5a3798716b6a32d22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf3e1cbd36ab0bc124f41fadb472f34a07c6401eda9383c610cba2b949b9c37062fa1400d3fefcf084754b86a112014120e164bd0aea6f54ba859d7c79ae036
|
7
|
+
data.tar.gz: f251a7ee9e996a4c0ddb1065121b37ca17d921d76357676069846bb66ab08ced7f63bfe17b0008236cc045edcbb131eef25f7cd5571845d333ba66cfe2f0f10a
|
data/_includes/nav.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<
|
1
|
+
<div class="height-[100%] width-[160px] position-[fixed] z-index-[1] top-[0] left-[0] background-color-[#111] overflow-x-hidden padding-top-[20px]">
|
2
2
|
{%- assign titled_pages = include.pages
|
3
3
|
| where_exp:"item", "item.title != nil" -%}
|
4
4
|
|
@@ -96,4 +96,4 @@
|
|
96
96
|
{%- endunless -%}
|
97
97
|
{%- endif -%}
|
98
98
|
{%- endfor -%}
|
99
|
-
</
|
99
|
+
</div>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.6.0/dist/instantsearch.min.js"></script>
|
2
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
|
3
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.6.0/dist/instantsearch.min.css">
|
4
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.6.0/dist/instantsearch-theme-algolia.min.css">
|
5
|
+
<base href="{{ site.baseurl }}">
|
6
|
+
|
7
|
+
<script>
|
8
|
+
const search = instantsearch({
|
9
|
+
appId: '{{ site.algolia.application_id }}',
|
10
|
+
apiKey: '{{ site.algolia.search_only_api_key }}',
|
11
|
+
indexName: '{{ site.algolia.index_name }}'
|
12
|
+
});
|
13
|
+
|
14
|
+
const hitTemplate = function(hit) {
|
15
|
+
let date = '';
|
16
|
+
if (hit.date) {
|
17
|
+
date = moment.unix(hit.date).format('MMM D, YYYY');
|
18
|
+
}
|
19
|
+
let url = `{{ site.baseurl }}${hit.url}#${hit.anchor}`;
|
20
|
+
|
21
|
+
const title = hit._highlightResult.title.value;
|
22
|
+
|
23
|
+
let breadcrumbs = '';
|
24
|
+
if (hit._highlightResult.headings) {
|
25
|
+
breadcrumbs = hit._highlightResult.headings.map(match => {
|
26
|
+
return `<span class="search-breadcrumb">${match.value}</span>`
|
27
|
+
}).join(' > ')
|
28
|
+
}
|
29
|
+
const content = hit._highlightResult.html.value;
|
30
|
+
|
31
|
+
return `
|
32
|
+
<div class="search-item">
|
33
|
+
<span class="search-meta">${date}</span>
|
34
|
+
<h2><a class="search-link" href="${url}">${title}</a></h2>
|
35
|
+
{{#breadcrumbs}}<a href="${url}" class="post-breadcrumbs">${breadcrumbs}</a>{{/breadcrumbs}}
|
36
|
+
<div class="post-snippet">${content}</div>
|
37
|
+
</div>
|
38
|
+
`;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
search.addWidget(
|
43
|
+
instantsearch.widgets.searchBox({
|
44
|
+
container: '#search-searchbar',
|
45
|
+
placeholder: 'Search into posts...',
|
46
|
+
poweredBy: true
|
47
|
+
})
|
48
|
+
);
|
49
|
+
|
50
|
+
search.addWidget(
|
51
|
+
instantsearch.widgets.hits({
|
52
|
+
container: '#search-hits',
|
53
|
+
templates: {
|
54
|
+
item: hitTemplate
|
55
|
+
}
|
56
|
+
})
|
57
|
+
);
|
58
|
+
|
59
|
+
search.start();
|
60
|
+
</script>
|
61
|
+
|
62
|
+
<style>
|
63
|
+
.ais-search-box {
|
64
|
+
max-width: 100%;
|
65
|
+
margin-bottom: 15px;
|
66
|
+
}
|
67
|
+
.post-item {
|
68
|
+
margin-bottom: 30px;
|
69
|
+
}
|
70
|
+
.post-link .ais-Highlight {
|
71
|
+
color: #111;
|
72
|
+
font-style: normal;
|
73
|
+
text-decoration: underline;
|
74
|
+
}
|
75
|
+
.post-breadcrumbs {
|
76
|
+
color: #424242;
|
77
|
+
display: block;
|
78
|
+
}
|
79
|
+
.post-breadcrumb {
|
80
|
+
font-size: 18px;
|
81
|
+
color: #424242;
|
82
|
+
}
|
83
|
+
.post-breadcrumb .ais-Highlight {
|
84
|
+
font-weight: bold;
|
85
|
+
font-style: normal;
|
86
|
+
}
|
87
|
+
.post-snippet .ais-Highlight {
|
88
|
+
color: #2a7ae2;
|
89
|
+
font-style: normal;
|
90
|
+
font-weight: bold;
|
91
|
+
}
|
92
|
+
.post-snippet img {
|
93
|
+
display: none;
|
94
|
+
}
|
95
|
+
</style>
|
data/_layouts/default.html
CHANGED
@@ -12,7 +12,9 @@
|
|
12
12
|
<![endif]-->
|
13
13
|
</head>
|
14
14
|
<body>
|
15
|
-
|
15
|
+
<div style="max-width:1012px;margin-right:auto;margin-left:auto;margin-top:32px;margin-bottom:32px;padding-left:16px;padding-right:16px;">
|
16
|
+
{{ content }}
|
17
|
+
</div>
|
16
18
|
{% if site.google_analytics %}
|
17
19
|
<script>
|
18
20
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
data/_layouts/home.html
CHANGED
@@ -4,6 +4,7 @@ layout: default
|
|
4
4
|
<div class="padding:1rem max-width:1012px margin:auto">
|
5
5
|
{{ content }}
|
6
6
|
{% if site.github.private != true and site.github.license %}
|
7
|
+
<hr>
|
7
8
|
<div class="padding:1rem color:gray margin-top:1rem border-top-width:1px border-style:solid">
|
8
9
|
<center>This site is open source. {% github_edit_link "Improve this page" %}.</center>
|
9
10
|
</div>
|