jekyll-v4-theme-primer 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/default.html +8 -0
- data/assets/js/primer-clipboard-copy.js +6 -42
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8cc0534cb93f2a4d9e542faf756696d19c83ac23b69661eded6057446082179
|
4
|
+
data.tar.gz: c488f8537df36a35c5aceece516f3f7361e0ba91f8f5c6e9b1b3dc453c95a8c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75978fac31c5b31ebda67825a01450cdcf270a77797878a6d79377fbdc0c1503740a1d806572b17971d4f7efe527765c3b6b560499b342ba9f806f820e439754
|
7
|
+
data.tar.gz: befb341bfeca02021e8c63df3c35a1e2a234217d22c2cf5cbbe7f538714a92600fa3d062d27f220afee6441682723e984b0819a4827dcd6a47ddc19345cfc0a7
|
data/_layouts/default.html
CHANGED
@@ -24,6 +24,14 @@
|
|
24
24
|
</div>
|
25
25
|
{% endif %}
|
26
26
|
</div>
|
27
|
+
<template id=clipboard_template>
|
28
|
+
<div>
|
29
|
+
<clipboard-copy aria-label="Copy" class="btn btn-invisible m-2 p-0 tooltipped-no-delay d-flex flex-justify-center flex-items-center" tabindex="0" role="button">
|
30
|
+
{% octicon copy height:16 %}
|
31
|
+
{% octicon check height:16 class:"color-fg-success d-none" %}
|
32
|
+
</clipboard-copy>
|
33
|
+
</div>
|
34
|
+
</template>
|
27
35
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js" integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
|
28
36
|
<script>anchors.add();</script>
|
29
37
|
<script type="module" src="{{ "/assets/js/primer-clipboard-copy.js?v=" | append: site.github.build_revision | relative_url }}"></script>
|
@@ -1,52 +1,16 @@
|
|
1
1
|
import './github-clipboard-copy-element.js';
|
2
|
-
http://localhost:4000/assets/js/github_clipboard_copy_element
|
3
|
-
String.prototype.format = function () {
|
4
|
-
var args = arguments;
|
5
|
-
return this.replace(/{([0-9]+)}/g, function (match, index) {
|
6
|
-
return typeof args[index] == 'undefined' ? match : args[index];
|
7
|
-
});
|
8
|
-
};
|
9
|
-
|
10
|
-
function fromHTML(html, trim = true) {
|
11
|
-
// Process the HTML string.
|
12
|
-
html = trim ? html.trim() : html;
|
13
|
-
if (!html) return null;
|
14
|
-
|
15
|
-
// Then set up a new template element.
|
16
|
-
const template = document.createElement('template');
|
17
|
-
template.innerHTML = html;
|
18
|
-
const result = template.content.children;
|
19
|
-
|
20
|
-
// Then return either an HTMLElement or HTMLCollection,
|
21
|
-
// based on whether the input HTML had one or more roots.
|
22
|
-
if (result.length === 1) return result[0];
|
23
|
-
return result;
|
24
|
-
}
|
25
2
|
|
26
3
|
function makeCopyButtons() {
|
27
|
-
const
|
28
|
-
<div>
|
29
|
-
<clipboard-copy aria-label="Copy" class="btn btn-invisible m-2 p-0 tooltipped-no-delay d-flex flex-justify-center flex-items-center" value="{0}" tabindex="0" role="button">
|
30
|
-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy">
|
31
|
-
<path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path>
|
32
|
-
</svg>
|
33
|
-
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check color-fg-success d-none">
|
34
|
-
<path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path>
|
35
|
-
</svg>
|
36
|
-
</clipboard-copy>
|
37
|
-
</div>
|
38
|
-
`
|
4
|
+
const clipboardTemplate = document.getElementById("clipboard_template");
|
39
5
|
|
40
6
|
const blocks = document.querySelectorAll('div.highlighter-rouge>div.highlight');
|
41
7
|
blocks.forEach((block) => {
|
42
|
-
//
|
43
|
-
const
|
44
|
-
// Put this
|
45
|
-
|
46
|
-
// Make an html element from the block clipboard string
|
47
|
-
const block_clipboard_node = fromHTML(block_clipboard);
|
8
|
+
//Create DOM node
|
9
|
+
const clipboardNode = clipboardTemplate.content.cloneNode(true);
|
10
|
+
// Put this block's content into the clipboard-copy element's value
|
11
|
+
clipboardNode.querySelector("clipboard-copy").setAttribute("value", block.textContent);
|
48
12
|
// Add it in to the end of the html code block
|
49
|
-
block.appendChild(
|
13
|
+
block.appendChild(clipboardNode);
|
50
14
|
});
|
51
15
|
}
|
52
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-v4-theme-primer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
@@ -73,6 +73,20 @@ dependencies:
|
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.0'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: jekyll-octicons
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '19.8'
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '19.8'
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: html-proofer
|
78
92
|
requirement: !ruby/object:Gem::Requirement
|