jekyll-theme-ascii 0.1.4 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/mastodon_comments.html +10 -0
- data/_layouts/post.html +1 -1
- data/assets/js/mastodon_comments.js +73 -0
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7114952645fd140b27a67ac1e05c610dad802636f913fd1954579eef45f8e3
|
4
|
+
data.tar.gz: 553f5b5b1de4f36174f068c0a185498ad97f6491416b39e7e03060efd79b9fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92ed049b03c20b2458d60d6f0c415131f642d23eff41decb350e7620234a150c1562615d5c2e406cc9d1745c73e14cda279958febb61f48206c5b35bb26ace1c
|
7
|
+
data.tar.gz: 62912b16d0a01b8d11214e4c726d1666f5b7edc70543df2742c79440a32e92b2489c427116d549c85d40da94d5840a88b1e7367402bc2ab5933266df0aa91d1b
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{%- assign mastodon_host = page.mastodon_comments.host | default: site.mastodon_comments.host -%}
|
2
|
+
<div style="border-top: dashed 1px rgba(219, 219, 219, 0.9)">
|
3
|
+
<h2>Comments in Mastodon</h2>
|
4
|
+
<div id="mastodon_comments_list" style="margin-top: 22px;">
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
<script src="/assets/js/mastodon_comments.js"></script>
|
8
|
+
<script>
|
9
|
+
window.onload = mastodon_comments_load('{{ mastodon_host }}', '{{ page.mastodon_comments.toot_id }}', 'mastodon_comments_list')
|
10
|
+
</script>
|
data/_layouts/post.html
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
function mastodon_comments_load(host, toot_id, element) {
|
2
|
+
fetch(`https://${host}/api/v1/statuses/${toot_id}`)
|
3
|
+
.then(function (response) {
|
4
|
+
return response.json()
|
5
|
+
})
|
6
|
+
.then(function (data) {
|
7
|
+
mastodon_comment_render(data, element)
|
8
|
+
fetch(`https://${host}/api/v1/statuses/${toot_id}/context`)
|
9
|
+
.then(function (response) {
|
10
|
+
return response.json()
|
11
|
+
})
|
12
|
+
.then(function (data) {
|
13
|
+
if (data['descendants'] && Array.isArray(data['descendants']) && data['descendants'].length > 0) {
|
14
|
+
data['descendants'].forEach(function (reply) {
|
15
|
+
mastodon_comment_render(reply, element)
|
16
|
+
})
|
17
|
+
}
|
18
|
+
})
|
19
|
+
})
|
20
|
+
}
|
21
|
+
|
22
|
+
function mastodon_comment_render(toot, element) {
|
23
|
+
console.log('Comment:')
|
24
|
+
console.log(toot)
|
25
|
+
container = document.createElement('a')
|
26
|
+
container.href = toot.url
|
27
|
+
container.style.textDecoration = 'none'
|
28
|
+
comment = document.createElement('div')
|
29
|
+
comment.style.lineHeight = 'normal'
|
30
|
+
comment.style.background = '#111111'
|
31
|
+
comment.style.borderRadius = '10px'
|
32
|
+
comment.style.padding = '10px'
|
33
|
+
comment.style.marginBottom = '10px'
|
34
|
+
comment.style.paddingBottom = '1px'
|
35
|
+
comment.append(mastodon_comment_create_author(toot.account))
|
36
|
+
comment_content = document.createElement('div')
|
37
|
+
comment_content.innerHTML = toot.content
|
38
|
+
comment.append(comment_content)
|
39
|
+
container.append(comment)
|
40
|
+
document.getElementById(element).append(container)
|
41
|
+
}
|
42
|
+
|
43
|
+
function mastodon_comment_create_author(account) {
|
44
|
+
author = document.createElement('a')
|
45
|
+
author.style.display = 'flex'
|
46
|
+
author.style.gap = '10px'
|
47
|
+
author.href = account.url
|
48
|
+
author_avatar = document.createElement('img')
|
49
|
+
author_avatar.src = account.avatar
|
50
|
+
author_avatar.width = 46
|
51
|
+
author_avatar.height = 46
|
52
|
+
author_avatar.style.borderRadius = '5px'
|
53
|
+
author.append(author_avatar)
|
54
|
+
author_info = document.createElement('span')
|
55
|
+
author_display_name = document.createElement('strong')
|
56
|
+
author_display_name.style.display = 'block'
|
57
|
+
author_display_name.append(document.createTextNode(account.display_name))
|
58
|
+
author_info.append(author_display_name)
|
59
|
+
author_account = document.createElement('span')
|
60
|
+
author_account.append(document.createTextNode(mastodon_acct_full(account)))
|
61
|
+
author_info.append(author_account)
|
62
|
+
author.append(author_info)
|
63
|
+
return author
|
64
|
+
}
|
65
|
+
|
66
|
+
function mastodon_acct_full(account) {
|
67
|
+
acct = account.acct
|
68
|
+
if (acct.indexOf('@') == -1) {
|
69
|
+
account_url = new URL(account.url)
|
70
|
+
acct += '@' + account_url.hostname
|
71
|
+
}
|
72
|
+
return '@' + acct
|
73
|
+
}
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-ascii
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antonio Vázquez Blanco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jekyll-feed
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jekyll-seo-tag
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jemoji
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- _includes/google-analytics.html
|
97
97
|
- _includes/head.html
|
98
98
|
- _includes/header.html
|
99
|
+
- _includes/mastodon_comments.html
|
99
100
|
- _layouts/default.html
|
100
101
|
- _layouts/home.html
|
101
102
|
- _layouts/page.html
|
@@ -104,6 +105,7 @@ files:
|
|
104
105
|
- _sass/jekyll-theme-ascii/skins/classic-highlighting.scss
|
105
106
|
- _sass/jekyll-theme-ascii/skins/classic.scss
|
106
107
|
- assets/css/style.scss
|
108
|
+
- assets/js/mastodon_comments.js
|
107
109
|
homepage: https://github.com/antoniovazquezblanco/jekyll-theme-ascii
|
108
110
|
licenses:
|
109
111
|
- MIT
|