rawfeed 0.1.4 → 0.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.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +20 -21
  3. data/README.md +12 -130
  4. data/_data/options.yml +270 -0
  5. data/_data/resume.yml +8 -8
  6. data/_includes/alert +3 -1
  7. data/_includes/chart +13 -32
  8. data/_includes/details +1 -57
  9. data/_includes/image +12 -4
  10. data/_includes/layout/blog_search.html +6 -4
  11. data/_includes/layout/data.liquid +21 -3
  12. data/_includes/layout/disqus.html +12 -26
  13. data/_includes/layout/footer.html +33 -17
  14. data/_includes/layout/giscus.html +27 -19
  15. data/_includes/layout/head.html +41 -41
  16. data/_includes/layout/header.html +127 -101
  17. data/_includes/layout/maintenance.html +6 -10
  18. data/_includes/layout/paginator.html +6 -4
  19. data/_includes/socials +7 -5
  20. data/_includes/tabs +1 -94
  21. data/_includes/toc +11 -194
  22. data/_includes/video +4 -1
  23. data/_layouts/blog.html +8 -7
  24. data/_layouts/contact.html +90 -196
  25. data/_layouts/default.html +42 -341
  26. data/_layouts/error.html +6 -4
  27. data/_layouts/home.html +45 -36
  28. data/_layouts/licenses.html +10 -0
  29. data/_layouts/page.html +4 -4
  30. data/_layouts/pixel.html +48 -0
  31. data/_layouts/pixels.html +71 -1
  32. data/_layouts/post.html +28 -29
  33. data/_layouts/resume.html +41 -34
  34. data/_layouts/tag.html +14 -3
  35. data/_layouts/tag_posts.html +3 -3
  36. data/_sass/base/_index.scss +39 -3
  37. data/_sass/components/_badges.scss +10 -0
  38. data/_sass/components/_markdown.scss +8 -5
  39. data/_sass/includes/_footer.scss +5 -2
  40. data/_sass/includes/_header.scss +23 -19
  41. data/_sass/includes/_highlight.scss +20 -7
  42. data/_sass/includes/_maintenance.scss +2 -3
  43. data/_sass/includes/_terminal.scss +35 -12
  44. data/_sass/layouts/_blog.scss +13 -9
  45. data/_sass/layouts/_contact.scss +6 -5
  46. data/_sass/layouts/_default.scss +5 -5
  47. data/_sass/layouts/_index.scss +3 -0
  48. data/_sass/layouts/_licenses.scss +7 -0
  49. data/_sass/layouts/_page.scss +1 -0
  50. data/_sass/layouts/_pixel.scss +61 -0
  51. data/_sass/layouts/_pixels.scss +86 -0
  52. data/_sass/layouts/_post.scss +4 -11
  53. data/_sass/layouts/_resume.scss +16 -3
  54. data/_sass/layouts/_tag-posts.scss +1 -2
  55. data/_sass/layouts/_tag.scss +12 -1
  56. data/_sass/main.scss +16 -1
  57. data/_sass/theme/_dark.scss +8 -1
  58. data/_sass/theme/_light.scss +8 -1
  59. data/assets/images/blog/.keep +0 -0
  60. data/assets/images/pixels/luffy.jpg +0 -0
  61. data/assets/js/blog.coffee +102 -0
  62. data/assets/js/contact.coffee +105 -0
  63. data/assets/js/default.coffee +172 -0
  64. data/assets/js/discus.coffee +30 -0
  65. data/assets/js/fallback/README.md +3 -0
  66. data/assets/js/fallback/blog.js +113 -0
  67. data/assets/js/fallback/contact.js +116 -0
  68. data/assets/js/{default.js → fallback/default.js} +50 -0
  69. data/assets/js/fallback/discus.js +32 -0
  70. data/{_includes/layout/google_analytics.html → assets/js/fallback/google_analytics.js} +7 -3
  71. data/assets/js/fallback/home.js +275 -0
  72. data/assets/js/fallback/no_inframe.js +4 -0
  73. data/assets/js/fallback/page.js +423 -0
  74. data/assets/js/fallback/pixels.js +1 -0
  75. data/assets/js/fallback/resume.js +13 -0
  76. data/assets/js/fallback/tags.js +1 -0
  77. data/{_includes/layout/capture_scripts.liquid → assets/js/fallback/theme_load.js} +0 -2
  78. data/assets/js/google_analytics.coffee +24 -0
  79. data/assets/js/home.coffee +250 -0
  80. data/assets/js/no_inframe.coffee +9 -0
  81. data/assets/js/page.coffee +379 -0
  82. data/assets/js/pixels.coffee +2 -0
  83. data/assets/js/resume.coffee +9 -0
  84. data/assets/js/tags.coffee +2 -0
  85. data/assets/js/theme_load.coffee +6 -0
  86. data/assets/json/blog_search.json +2 -2
  87. data/lib/rawfeed/author.rb +59 -0
  88. data/lib/rawfeed/csp_filters.rb +3 -0
  89. data/lib/rawfeed/draft.rb +1 -1
  90. data/lib/rawfeed/layout.rb +7 -0
  91. data/lib/rawfeed/page.rb +2 -2
  92. data/lib/rawfeed/pixel.rb +32 -0
  93. data/lib/rawfeed/post.rb +2 -2
  94. data/lib/rawfeed/resume.rb +1 -0
  95. data/lib/rawfeed/typescript_liquid.rb +172 -0
  96. data/lib/rawfeed/utils.rb +1 -0
  97. data/lib/rawfeed/version.rb +1 -1
  98. data/lib/rawfeed/with_class.rb +20 -0
  99. data/lib/rawfeed.rb +5 -1
  100. metadata +44 -12
  101. data/assets/js/avatar.js +0 -59
  102. data/assets/js/terminal.js +0 -18
@@ -82,7 +82,7 @@ $font-size: 18px;
82
82
  overflow-y: auto;
83
83
  font-weight: bold;
84
84
  padding: 10px 4px;
85
- letter-spacing: 2px;
85
+ letter-spacing: 1px;
86
86
  text-transform: var(--terminal-screen-text-transform);
87
87
  text-shadow: var(--terminal-screen-text-shadow);
88
88
 
@@ -100,22 +100,23 @@ $font-size: 18px;
100
100
  opacity: 0.7;
101
101
  }
102
102
 
103
+ .socials-command {
104
+ &__desc {
105
+ margin-top: 15px !important;
106
+ white-space: pre;
107
+ display: flex;
108
+ align-items: center;
109
+ font-size: $font-size;
110
+ line-height: 1.4;
111
+ color: var(--text-color);
112
+ }
113
+ }
114
+
103
115
  .line-wrapper {
104
116
  font-size: $font-size;
105
117
  margin: 10px 0px;
106
118
  color: var(--text-color);
107
119
 
108
- #mcmd,
109
- #mdesc {
110
- font-weight: bold;
111
- // border-bottom: 1px solid #fff;
112
- margin-bottom: 10px;
113
- }
114
-
115
- #mcmd {
116
- margin-right: 130px;
117
- }
118
-
119
120
  a {
120
121
  color: var(--terminal-screen-link-color) !important;
121
122
 
@@ -123,6 +124,28 @@ $font-size: 18px;
123
124
  color: var(--text-color) !important;
124
125
  }
125
126
  }
127
+
128
+ .help-description {
129
+ p {
130
+ margin-top: 15px !important;
131
+ margin-bottom: 30px !important;
132
+ }
133
+ }
134
+
135
+ .help-commands {
136
+
137
+ &__title,
138
+ &__desc {
139
+ font-weight: bold;
140
+ text-decoration: underline;
141
+ display: inline-block;
142
+ margin-bottom: 10px !important;
143
+ }
144
+
145
+ &__desc {
146
+ margin-left: 120px !important;
147
+ }
148
+ }
126
149
  }
127
150
 
128
151
  .line {
@@ -1,18 +1,23 @@
1
1
  @use "../components/index";
2
2
 
3
3
  .blog {
4
- // TODO: version: 0.2.0 - Create background light
5
- // box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
6
- // border: 1px solid #ddd;
7
- // background-color: white;
8
- // padding: 20px 10px;
9
-
10
4
  &-subtitle {
11
5
  font-size: 1.05rem;
12
6
  font-weight: bold;
13
7
  margin: 0px 0px 10px 0px;
14
8
  }
15
9
 
10
+ &-description {
11
+ line-height: 1.6 !important;
12
+ display: flex;
13
+ align-items: center;
14
+ margin-bottom: 40px;
15
+
16
+ p {
17
+ margin: 0;
18
+ }
19
+ }
20
+
16
21
  &-list {
17
22
  list-style: none;
18
23
  padding: 0;
@@ -34,8 +39,8 @@
34
39
 
35
40
  &__meta {
36
41
  display: inline-block;
37
- min-width: 115px !important;
38
- font-family: "SUSE Mono", sans-serif;
42
+ // min-width: 115px !important;
43
+ // font-family: "SUSE Mono", sans-serif;
39
44
  font-optical-sizing: auto;
40
45
  font-style: normal;
41
46
  line-height: 1rem;
@@ -48,7 +53,6 @@
48
53
 
49
54
  &__link {
50
55
  text-transform: none !important;
51
- font-weight: bold;
52
56
  text-decoration: underline;
53
57
  }
54
58
  }
@@ -18,14 +18,15 @@
18
18
  }
19
19
  }
20
20
 
21
- .contact {
22
- // box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
23
- // border: 1px solid #ddd;
24
- // background-color: white;
25
- // padding: 20px 40px;
21
+ // -disabled
26
22
 
23
+ .contact,
24
+ .contact-disabled {
27
25
  @extend %markdown;
26
+ margin-bottom: 35px !important;
27
+ }
28
28
 
29
+ .contact {
29
30
  &-message-error .modal-header {
30
31
  background-color: #f8d7da;
31
32
  color: #842029;
@@ -1,10 +1,10 @@
1
1
  .default {
2
- margin: 0 auto;
3
- transition: transform 0.3s ease;
2
+ margin: 0 auto !important;
3
+ // transition: transform 0.3s ease;
4
4
 
5
- .content {
6
- margin-bottom: 30px !important;
7
- }
5
+ // .content {
6
+ // margin-bottom: 30px !important;
7
+ // }
8
8
 
9
9
  .content code,
10
10
  .content pre {
@@ -8,3 +8,6 @@
8
8
  @use "contact";
9
9
  @use "error";
10
10
  @use "resume";
11
+ @use "licenses";
12
+ @use "pixels";
13
+ @use "pixel";
@@ -0,0 +1,7 @@
1
+ @use "../components/index";
2
+
3
+ .licenses {
4
+ @extend %markdown;
5
+ padding: 15px;
6
+ // box-shadow: 0 10px 30px rgba(0, 0, 0, .7);
7
+ }
@@ -2,6 +2,7 @@
2
2
 
3
3
  .page {
4
4
  @extend %markdown;
5
+ margin-bottom: 35px !important;
5
6
 
6
7
  .dt-published,
7
8
  .dt-modified {
@@ -0,0 +1,61 @@
1
+ @use "../components/index";
2
+
3
+ .pixel {
4
+ @extend %markdown;
5
+ margin-bottom: 35px !important;
6
+
7
+ li {
8
+ list-style: disc;
9
+ }
10
+
11
+ &-title {
12
+ margin-top: 0px !important;
13
+ font-size: 1.3rem !important;
14
+ font-weight: bold !important;
15
+ margin-bottom: 40px !important;
16
+ }
17
+
18
+ &-image {
19
+ text-align: center;
20
+ margin: 50px 0px;
21
+
22
+ figure {
23
+ display: block;
24
+ max-width: 100%;
25
+ line-height: 1;
26
+ margin-left: auto;
27
+ margin-right: auto;
28
+
29
+ img {
30
+ display: block;
31
+ width: 100%;
32
+ height: auto;
33
+ object-fit: cover;
34
+ border-radius: 12px !important;
35
+ border-top: 4px solid var(--text-color);
36
+ border-bottom: 4px solid var(--text-color);
37
+ }
38
+
39
+ figcaption {
40
+ display: block;
41
+ margin-top: 6px;
42
+ font-size: 0.85rem;
43
+ color: #777;
44
+ }
45
+ }
46
+ }
47
+
48
+ .comments {
49
+ &-title {
50
+ font-size: 1rem !important;
51
+ }
52
+ }
53
+
54
+ &-content {
55
+ margin-bottom: 100px;
56
+
57
+ p::first-letter {
58
+ text-transform: uppercase;
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,86 @@
1
+ .pixels {
2
+ margin: 0 auto;
3
+ margin-bottom: 35px !important;
4
+
5
+ &-title {
6
+ font-size: 1.05rem;
7
+ font-weight: 700;
8
+ }
9
+
10
+ &-description {
11
+ line-height: 1.6 !important;
12
+ margin-bottom: 40px;
13
+ display: flex;
14
+ align-items: center;
15
+
16
+ p {
17
+ margin: 0;
18
+ }
19
+ }
20
+
21
+ &-grid {
22
+ display: grid;
23
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
24
+ gap: 1rem;
25
+ }
26
+
27
+ &-item {
28
+ position: relative;
29
+ overflow: hidden;
30
+ border: 2px dotted var(--primary-color);
31
+
32
+ &:hover {
33
+ .overlay {
34
+ opacity: 0;
35
+ }
36
+
37
+ img {
38
+ // transform: scale(1.03);
39
+ filter: brightness(1.1);
40
+ }
41
+ }
42
+
43
+ img {
44
+ width: 100%;
45
+ height: 100%;
46
+ object-fit: cover;
47
+ // faz o recorte automático
48
+ aspect-ratio: 1 / 1;
49
+ // mantém todas as imagens quadradas (como Instagram)
50
+ // transition: transform 0.4s ease, filter 0.4s ease;
51
+ }
52
+ }
53
+
54
+ &-overlay-card {
55
+ position: relative;
56
+
57
+ .overlay {
58
+ position: absolute;
59
+ inset: 0;
60
+ background: var(--pixels-overlay-bg); // rgba(0, 0, 0, 0.55);
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ text-align: center;
65
+ // transition: opacity 0.4s ease;
66
+
67
+ &-content {
68
+ padding: 0.5rem;
69
+
70
+ .date {
71
+ background: rgba(0, 0, 0, 0.8);
72
+ padding: 0.25rem 0.5rem;
73
+ border-radius: 0.25rem;
74
+ display: inline-block;
75
+ font-weight: bold;
76
+ color: white;
77
+ margin-bottom: 20px;
78
+ }
79
+
80
+ .desc {
81
+ color: var(--pixels-overlay-color);
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
@@ -1,14 +1,8 @@
1
1
  @use "../components/index";
2
2
 
3
3
  .post {
4
- // TODO: version: 0.2.0 - Create background light
5
- // box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
6
- // border: 1px solid #ddd;
7
- // background-color: white;
8
- // padding: 10px 30px;
9
-
10
4
  @extend %markdown;
11
- margin-bottom: 50px;
5
+ margin-bottom: 35px;
12
6
 
13
7
  li {
14
8
  list-style: disc;
@@ -45,7 +39,7 @@
45
39
  .dt-published,
46
40
  .dt-modified {
47
41
  font-weight: normal !important;
48
- font-family: "SUSE Mono", sans-serif;
42
+ // font-family: "SUSE Mono", sans-serif;
49
43
  color: var(--text-muted-color);
50
44
  }
51
45
 
@@ -81,8 +75,8 @@
81
75
 
82
76
  &__meta {
83
77
  display: inline-block;
84
- min-width: 115px !important;
85
- font-family: "SUSE Mono", sans-serif;
78
+ // min-width: 115px !important;
79
+ // font-family: "SUSE Mono", sans-serif;
86
80
  font-optical-sizing: auto;
87
81
  font-style: normal;
88
82
  line-height: 1rem;
@@ -90,7 +84,6 @@
90
84
  }
91
85
 
92
86
  &__link {
93
- font-weight: bold;
94
87
  text-decoration: underline;
95
88
  }
96
89
  }
@@ -4,7 +4,10 @@
4
4
  @media print {
5
5
  @page {
6
6
  size: A4 portrait;
7
- margin: 1.5cm;
7
+ }
8
+
9
+ a[target="_blank"]::after {
10
+ all: unset !important;
8
11
  }
9
12
 
10
13
  #btn-print,
@@ -49,6 +52,12 @@
49
52
  }
50
53
  }
51
54
 
55
+ &-content__sidebar {
56
+ .section-item {
57
+ break-inside: avoid; // avoid breaking the content
58
+ }
59
+ }
60
+
52
61
  .section {
53
62
  &-title {
54
63
  font-size: 12pt;
@@ -58,12 +67,16 @@
58
67
  &-item {
59
68
  font-size: 10.5pt;
60
69
  margin-bottom: 0.4em;
61
-
70
+ break-inside: avoid; // avoid breaking the content
62
71
  a {
63
72
  color: black;
64
73
  text-decoration: none;
65
74
  font-weight: normal;
66
75
  }
76
+
77
+ .details {
78
+ break-inside: avoid; // avoid breaking the content
79
+ }
67
80
  }
68
81
  }
69
82
 
@@ -113,9 +126,9 @@
113
126
  margin: 0 auto;
114
127
  line-height: 1.5;
115
128
  font-size: 11pt;
116
- box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
117
129
  border: 1px solid var(--resume-border-color);
118
130
  margin-bottom: 50px;
131
+ // box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
119
132
 
120
133
  .role-company {
121
134
 
@@ -32,7 +32,7 @@
32
32
  &__meta {
33
33
  display: inline-block;
34
34
  min-width: 100px;
35
- font-family: "SUSE Mono", sans-serif;
35
+ // font-family: "SUSE Mono", sans-serif;
36
36
  font-optical-sizing: auto;
37
37
  font-style: normal;
38
38
  line-height: 1rem;
@@ -41,7 +41,6 @@
41
41
 
42
42
  &__link {
43
43
  text-transform: none !important;
44
- font-weight: bold;
45
44
  text-decoration: underline;
46
45
  }
47
46
  }
@@ -10,13 +10,24 @@
10
10
  &-title {
11
11
  font-size: 1.05rem !important;
12
12
  font-weight: bold;
13
- margin: 0px 0px 10px 0px !important;
13
+ margin: 0px 0px 30px 0px !important;
14
+ }
15
+
16
+ &-description {
17
+ margin-bottom: 40px;
18
+ display: flex;
19
+ align-items: center;
20
+
21
+ p {
22
+ margin: 0;
23
+ }
14
24
  }
15
25
 
16
26
  &-list {
17
27
  &__item {
18
28
  display: inline-block;
19
29
  margin-bottom: 12px;
30
+ @extend %tags-badge;
20
31
  }
21
32
  }
22
33
  }
data/_sass/main.scss CHANGED
@@ -6,7 +6,7 @@
6
6
  @use "layouts";
7
7
  @use "includes";
8
8
 
9
- /* TODO: version 0.2.0:
9
+ /* TODO: version 0.3.0:
10
10
  1 - create other dark and light themes for compilation, and have the option in
11
11
  "_config.yml" for example:
12
12
  layout:
@@ -70,6 +70,14 @@ layout:
70
70
  --resume-content-text-color: #{theme.theme-color(resume-content-text-color, light)};
71
71
  --resume-text-muted-color: #{theme.theme-color(resume-text-muted-color, light)};
72
72
  --resume-border-color: #{theme.theme-color(resume-border-color, light)};
73
+ --background-focus-color: #{theme.theme-color(background-focus-color, light)};
74
+ --background-focus-border-color: #{theme.theme-color(background-focus-border-color, light)};
75
+ --background-focus-box-shadow: #{theme.theme-color(background-focus-box-shadow, light)};
76
+ --tags-bg-color: #{theme.theme-color(tags-bg-color, light)};
77
+ --tags-border-color: #{theme.theme-color(tags-border-color, light)};
78
+ --pixels-overlay-bg: #{theme.theme-color(pixels-overlay-bg, light)};
79
+ --pixels-overlay-color: #{theme.theme-color(pixels-overlay-color, light)};
80
+
73
81
  }
74
82
 
75
83
  :root[data-theme="dark"] {
@@ -125,4 +133,11 @@ layout:
125
133
  --resume-content-text-color: #{theme.theme-color(resume-content-text-color, dark)};
126
134
  --resume-text-muted-color: #{theme.theme-color(resume-text-muted-color, dark)};
127
135
  --resume-border-color: #{theme.theme-color(resume-border-color, dark)};
136
+ --background-focus-color: #{theme.theme-color(background-focus-color, dark)};
137
+ --background-focus-border-color: #{theme.theme-color(background-focus-border-color, dark)};
138
+ --background-focus-box-shadow: #{theme.theme-color(background-focus-box-shadow, dark)};
139
+ --tags-bg-color: #{theme.theme-color(tags-bg-color, dark)};
140
+ --tags-border-color: #{theme.theme-color(tags-border-color, dark)};
141
+ --pixels-overlay-bg: #{theme.theme-color(pixels-overlay-bg, dark)};
142
+ --pixels-overlay-color: #{theme.theme-color(pixels-overlay-color, dark)};
128
143
  }
@@ -46,7 +46,7 @@ $theme-colors: (
46
46
  terminal-cursor-color: #7cff6b,
47
47
  terminal-screen-link-color: aqua,
48
48
  details-bg-color: #383838,
49
- video-border-color: #333333,
49
+ video-border-color: #e9e9e9,
50
50
  chart-bg-color: #fff,
51
51
  chart-box-shadow-color: rgba(0, 0, 0, 0.9),
52
52
  tabs-bg-color: #303030,
@@ -61,6 +61,13 @@ $theme-colors: (
61
61
  resume-title-text-color: white,
62
62
  resume-content-text-color: #d3d3d3,
63
63
  resume-text-muted-color: #9d9d9d,
64
+ background-focus-color: #222222,
65
+ background-focus-border-color: #727272,
66
+ background-focus-box-shadow: "0px 1px 0px 0px #6363634d inset, 0px 2px 4px 0px #00000044",
67
+ tags-bg-color: #1e1e1e,
68
+ tags-border-color: #8f8f8f,
69
+ pixels-overlay-bg: rgba(0, 0, 0, 0.70),
70
+ pixels-overlay-color: var(--text-color),
64
71
  );
65
72
 
66
73
  /* matrix */
@@ -38,7 +38,7 @@ $theme-colors: (
38
38
  terminal-cursor-color: #020202,
39
39
  terminal-screen-link-color: var(--primary-color),
40
40
  details-bg-color: #fbfbfb,
41
- video-border-color: #c9c9c9,
41
+ video-border-color: #000000,
42
42
  chart-bg-color: #fff,
43
43
  chart-box-shadow-color: rgba(0, 0, 0, 0.7),
44
44
  tabs-bg-color: #fdfdfd,
@@ -53,4 +53,11 @@ $theme-colors: (
53
53
  resume-title-text-color: black,
54
54
  resume-content-text-color: #222,
55
55
  resume-text-muted-color: #555,
56
+ background-focus-color: #f9f9f9,
57
+ background-focus-border-color: #353535,
58
+ background-focus-box-shadow: "0px 1px 0px 0px #6363634d inset, 0px 2px 4px 0px #00000044",
59
+ tags-bg-color: #e8e8e8,
60
+ tags-border-color: #1f1f1f,
61
+ pixels-overlay-bg: rgba(255, 255, 255, 0.63),
62
+ pixels-overlay-color: var(--text-color),
56
63
  );
File without changes
Binary file
@@ -0,0 +1,102 @@
1
+ ---
2
+ ---
3
+
4
+ {%- include layout/data.liquid -%}
5
+
6
+ document.addEventListener "DOMContentLoaded", ->
7
+
8
+ blog = document.getElementById "blog"
9
+
10
+ if blog
11
+ btn = document.getElementById 'blog-search__btn'
12
+ box = document.querySelector '.blog-search'
13
+ searchInput = document.getElementById 'blog-search__input'
14
+ blogPosts = document.getElementById 'posts'
15
+ searchResults = document.getElementById 'blog-search__results'
16
+ searchResultsWrapper = document.getElementById 'blog-search__results-wrapper'
17
+ btnSearchClean = document.getElementById 'blog-search__btn-clean'
18
+ blogSeachInput = document.getElementById 'blog-search__input'
19
+
20
+ openSearch = ->
21
+ box.classList.add 'is-open'
22
+ box.removeAttribute 'inert'
23
+ box.style.maxHeight = "#{box.scrollHeight}px"
24
+ box.style.opacity = '1'
25
+ box.addEventListener 'transitionend', onOpened = (e) ->
26
+ if e.propertyName is 'max-height'
27
+ box.style.maxHeight = 'none'
28
+ box.removeEventListener 'transitionend', onOpened
29
+ blogSeachInput.focus()
30
+
31
+ closeSearch = ->
32
+ box.style.maxHeight = "#{box.scrollHeight}px"
33
+ _ = box.offsetHeight # reflow force
34
+ requestAnimationFrame ->
35
+ box.style.maxHeight = '0'
36
+ box.style.opacity = '0'
37
+ box.setAttribute 'inert', ''
38
+ box.classList.remove 'is-open'
39
+
40
+ btn.addEventListener 'click', (e) ->
41
+ e.preventDefault()
42
+
43
+ # if are already in /blog/, toggle
44
+ pathname = location.pathname.replace /\/$/, ''
45
+ isBlog = pathname is '/blog' or pathname is '/blog/index.html'
46
+
47
+ unless isBlog
48
+ # if are on another page, go to /blog/ and open it
49
+ window.location.href = "{{ search_url }}"
50
+ return
51
+
52
+ # toggle
53
+ if box.classList.contains 'is-open'
54
+ closeSearch()
55
+ searchInput.value = ''
56
+ blogPosts.classList.remove 'disabled'
57
+ searchResultsWrapper.classList.add 'disabled'
58
+ else
59
+ openSearch()
60
+
61
+ # opens automatically if arrived from another link with ?search=open
62
+ params = new URLSearchParams location.search
63
+ if params.get('search') is 'open'
64
+ setTimeout openSearch, 30
65
+
66
+ # clean button input blog search
67
+ # ----------------------------------------------------------------------------------------------
68
+
69
+ clearSearch = ->
70
+ blogSeachInput.value = ''
71
+ blogPosts.classList.remove 'disabled'
72
+ searchResults.classList.add 'disabled'
73
+ searchResultsWrapper.classList.add 'disabled'
74
+ blogSeachInput.focus()
75
+
76
+ btnSearchClean.addEventListener 'click', clearSearch
77
+
78
+ document.addEventListener 'keydown', (e) ->
79
+ if e.key is 'Escape'
80
+ clearSearch()
81
+ closeSearch()
82
+
83
+ # open results and close posts in search (toggle)
84
+ # ----------------------------------------------------------------------------------------------
85
+
86
+ searchInput.addEventListener 'input', ->
87
+ if searchInput.value.trim().length > 0
88
+ blogPosts.classList.add 'disabled'
89
+ searchResults.classList.remove 'disabled'
90
+ searchResultsWrapper.classList.remove 'disabled'
91
+ else
92
+ blogPosts.classList.remove 'disabled'
93
+ searchResults.classList.add 'disabled'
94
+ searchResultsWrapper.classList.add 'disabled'
95
+
96
+ sjs = SimpleJekyllSearch
97
+ searchInput: document.getElementById 'blog-search__input'
98
+ resultsContainer: document.getElementById 'blog-search__results'
99
+ searchResultTemplate: '<li><span class="blog-list__meta"><time datetime="{date}">{date}</time></span>&nbsp;»&nbsp; <a class="blog-list__link" href="{{ site.url }}{url}">{title}</a></li>'
100
+ noResultsText: '<p>{{ blog_.no_results | default: "No results found" }}</p>'
101
+ json: "{{ '/assets/json/blog_search.json' | relative_url }}"
102
+