jekyll-theme-centos 0.5.3 → 0.5.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae119c8f39b6aa8baec3821c6406c37f7ff3c7db0f8f87951ce13aff0054fc1d
4
- data.tar.gz: c3520e53ade572d47f7da165aceb3e0a74a321bdc1d7306e51852ac86ebef84f
3
+ metadata.gz: daceb5812e455c146d36dc268efeb1d088faad2e1942b78b16d3772446725691
4
+ data.tar.gz: f623690b8fdb873dda2447df495c6c8da099a9c41acaef300667dc44c5f6c64b
5
5
  SHA512:
6
- metadata.gz: 43b4c009adb1db0e55387f2e71847abaabd872782dd9d0d849e01777d1ae0da05e43918d71d4e6c2cfd0000c2de0809a1188b7faa83f80c247ef7959adb33ca0
7
- data.tar.gz: 1a90c361bfeff9e7ef867fe1e8295977ea089a7d5fb71b783e8498e6a54d4690d68b9488aef2cd8805371151175e46110ad8e4a02b3e7a1fab8abaac03e6badb
6
+ metadata.gz: 80f3567f9d5e3da5b22dc7918239179c2ed0a72f0f90112d83ac2e305623810da30b8789c69f2a429824badb568b7c9e78795083efe602db7bd99bd91a9b8398
7
+ data.tar.gz: 41cc1a3a9885f3dada9fda45ef17e99755a91fd7b044adfd92d3474f3583ca8043c5a9b5a7e43df39b61e9cdd927f9bd8a349bab1adddb95e8401a94ab26d025
@@ -0,0 +1,4 @@
1
+ <div class="code-header">
2
+ <button class="copy-code-button" aria-label="Copy code to clipboard"></button>
3
+ </div>
4
+
@@ -14,6 +14,7 @@
14
14
 
15
15
  <script src="/assets/js/jquery.min.js"></script>
16
16
  <script src="/assets/js/bootstrap.min.js"></script>
17
+ <script src="/assets/js/copycode.js"></script>
17
18
  </body>
18
19
 
19
20
  </html>
@@ -116,32 +116,34 @@
116
116
  }
117
117
 
118
118
  .search {
119
- @include content;
119
+ &__content {
120
+ @extend .col-sm-12;
121
+ @include content;
120
122
 
121
- .ais-search-box {
122
- max-width: 100%;
123
- margin-bottom: 15px;
124
- }
125
- .ais-hits {
126
- @include link-list;
127
- }
128
- .ais-pagination {
129
- li {
130
- text-decoration: none;
123
+ .ais-search-box {
124
+ max-width: 100%;
125
+ margin-bottom: 15px;
126
+ }
127
+ .ais-hits {
128
+ @include link-list;
129
+ }
130
+ .ais-pagination {
131
+ li {
132
+ text-decoration: none;
133
+ }
134
+ }
135
+ .ais-Highlight {
136
+ font-weight: bold;
137
+ font-style: normal;
138
+ }
139
+ .post-breadcrumbs {
140
+ display: block;
141
+ font-size: small;
142
+ }
143
+ .post-snippet img {
144
+ display: none;
131
145
  }
132
146
  }
133
- .ais-Highlight {
134
- font-weight: bold;
135
- font-style: normal;
136
- }
137
- .post-breadcrumbs {
138
- display: block;
139
- font-size: small;
140
- }
141
- .post-snippet img {
142
- display: none;
143
- }
144
-
145
147
  }
146
148
 
147
149
  .download {
@@ -2,5 +2,6 @@
2
2
  @import "mixins/_content-nav";
3
3
  @import "mixins/_aside-nav";
4
4
  @import "mixins/_link-list";
5
+ @import "mixins/_code-header";
5
6
 
6
7
  @import "mixins/_post-nav-explorer"
@@ -0,0 +1,41 @@
1
+ @mixin code-header {
2
+
3
+ .code-header {
4
+ display: flex;
5
+ justify-content: flex-end;
6
+ background: $black;
7
+ }
8
+
9
+ .copy-code-button {
10
+ @extend .btn, .btn-dark, .shadow-none;
11
+ border-radius: 0px;
12
+ display: grid;
13
+ grid-auto-flow: column;
14
+ align-items: center;
15
+ grid-column-gap: 4px;
16
+ border: none;
17
+ cursor: pointer;
18
+ background-color: $black;
19
+ font-size: small;
20
+
21
+ &:before {
22
+ @extend .fas;
23
+ content: fa-content($fa-var-clipboard);
24
+ }
25
+ &:after {
26
+ content: "Copy";
27
+ display: block;
28
+ }
29
+
30
+ // This class will be toggled via JavaScript
31
+ &.copied {
32
+ &:before {
33
+ @extend .fas;
34
+ content: fa-content($fa-var-clipboard-check);
35
+ }
36
+ &:after {
37
+ content: "Copied!";
38
+ }
39
+ }
40
+ }
41
+ }
@@ -70,4 +70,5 @@
70
70
  margin-bottom: $line-height-base * 1em;
71
71
  }
72
72
 
73
+ @include code-header;
73
74
  }
@@ -0,0 +1,18 @@
1
+ // Thanks Aleksandr
2
+ // https://www.aleksandrhovhannisyan.com/blog/how-to-add-a-copy-to-clipboard-button-to-your-jekyll-blog/
3
+ const codeBlocks = document.querySelectorAll(".code-header + .highlighter-rouge");
4
+ const copyCodeButtons = document.querySelectorAll(".copy-code-button");
5
+
6
+ copyCodeButtons.forEach((copyCodeButton, index) => {
7
+ const code = codeBlocks[index].innerText;
8
+
9
+ copyCodeButton.addEventListener("click", () => {
10
+ window.navigator.clipboard.writeText(code);
11
+ copyCodeButton.classList.add("copied");
12
+
13
+ setTimeout(() => {
14
+ copyCodeButton.classList.remove("copied");
15
+ copyCodeButton.blur();
16
+ }, 2000);
17
+ });
18
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-centos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alain Reguera Delgado
@@ -97,6 +97,7 @@ files:
97
97
  - _includes/page/alert-info.html
98
98
  - _includes/page/alert-success.html
99
99
  - _includes/page/alert-warning.html
100
+ - _includes/page/code-header.html
100
101
  - _includes/page/figure.html
101
102
  - _includes/page/video.html
102
103
  - _includes/post-nav-explorer.html
@@ -217,6 +218,7 @@ files:
217
218
  - _sass/centos/centos.scss
218
219
  - _sass/centos/fonts/_montserrat.scss
219
220
  - _sass/centos/mixins/_aside-nav.scss
221
+ - _sass/centos/mixins/_code-header.scss
220
222
  - _sass/centos/mixins/_content-nav.scss
221
223
  - _sass/centos/mixins/_content.scss
222
224
  - _sass/centos/mixins/_link-list.scss
@@ -335,6 +337,7 @@ files:
335
337
  - assets/img/post.png
336
338
  - assets/js/bootstrap.min.js
337
339
  - assets/js/bootstrap.min.js.map
340
+ - assets/js/copycode.js
338
341
  - assets/js/dataTables.bootstrap4.min.js
339
342
  - assets/js/instantsearch.min.js
340
343
  - assets/js/jquery.dataTables.min.js