liddlelab-theme 0.0.4 → 0.0.5

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: 2dbfb332c90448bd1c9241bb8427b3b329a5552ac68b7a7e89173e3062dd8cc5
4
- data.tar.gz: 2df038cfdf016b04e297c24592566fcabce23afc3535289169e472285315c77d
3
+ metadata.gz: 92e3deeb597654517ae3c7cbbf4f1d3e0939964d2556517709f3c81e8c5f9440
4
+ data.tar.gz: 6742c65bd69ba9e4d9c6237f98f3f9553f60b462698ae4ccf1f027686fc28aab
5
5
  SHA512:
6
- metadata.gz: c05544f395af55e596525981bc81d3f40ea9e39168eb406169f7090b4169e36c99ba984aa3b99f569123d0a4c6f1044663b251fdeb842d12b1cf2e6aea460b23
7
- data.tar.gz: 3bca68ed2d4c86af42026dce88ea3673250b56090116e5ea2a6d5639130648562c1bca3070c1ea1ede4d72be045fa7145a3679f98aab3f6fd08ee56468ee03f5
6
+ metadata.gz: 42d64a153d71067789e03932b7fdf8ccd3739e9c0135d424c0ec6903b851c0043aca699ba5b2125af1e14b93129c2612b9ce6af83836e24287b2a43a3aca8235
7
+ data.tar.gz: 6e07b637bcd6cd91a36a4eb702ba9495f60191115c5f5089eb4d302cc67d94d546251be4fdada485401712f00bc112747e17e73b5e11355ae181c270ec68fed6
@@ -1,8 +1,8 @@
1
1
  <script src="https://giscus.app/client.js"
2
- data-repo="[ENTER REPO HERE]"
3
- data-repo-id="[ENTER REPO ID HERE]"
4
- data-category="[ENTER CATEGORY NAME HERE]"
5
- data-category-id="[ENTER CATEGORY ID HERE]"
2
+ data-repo="{{ site.repo }}"
3
+ data-repo-id="{{ site.repo_id }}"
4
+ data-category="{{ site.category }}"
5
+ data-category-id="{{ site.category_id }}"
6
6
  data-mapping="pathname"
7
7
  data-strict="0"
8
8
  data-reactions-enabled="1"
data/_layouts/post.html CHANGED
@@ -141,15 +141,7 @@ post_class: post-template
141
141
 
142
142
  <!-- Begin Comments
143
143
  ================================================== -->
144
- {% if page.comments != false %}
145
- <div class="container">
146
- <div id="comments" class="row justify-content-center mb-5">
147
- <div class="col-md-8">
148
-
149
- </div>
150
- </div>
151
- </div>
152
- {% endif %}
144
+ {% include giscus.html %}
153
145
  <!--End Comments
154
146
  ================================================== -->
155
147
 
@@ -4,24 +4,33 @@
4
4
  let currentPage = 1;
5
5
  let loading = false;
6
6
  let hitEnd = false;
7
+ let isFirstLoad = true;
8
+ let numPostsPerPage = 0;
9
+
7
10
  const loadMorePosts = async () => {
8
11
  if (hitEnd) return; // Prevent loading more if we've hit the end
9
12
  try {
10
13
  currentPage++;
11
14
  const response = await fetch(`/blog/page${currentPage}`);
12
15
  if (!response.ok) throw new Error('Failed to load posts');
16
+
13
17
  const newPosts = await response.text();
18
+
14
19
  const parser = new DOMParser();
15
20
  const doc = parser.parseFromString(newPosts, 'text/html');
16
21
  const tempDiv = document.createElement('div');
17
22
  tempDiv.innerHTML = doc.getElementById('postlist').innerHTML;
23
+
18
24
  const postList = document.getElementById('postlist');
19
- if (tempDiv.children.length < 10) {
25
+
26
+ if (tempDiv.children.length < numPostsPerPage) {
20
27
  hitEnd = true; // No more posts to load
21
28
  }
29
+
22
30
  while (tempDiv.firstChild) {
23
31
  postList.appendChild(tempDiv.firstChild);
24
32
  }
33
+
25
34
  loading = false;
26
35
  } catch (error) {
27
36
  hitEnd = true;
@@ -31,7 +40,14 @@ const loadMorePosts = async () => {
31
40
 
32
41
  window.addEventListener('scroll', () => {
33
42
  if (loading || hitEnd) return; // Prevent multiple loads
43
+
34
44
  const postList = document.getElementById('postlist');
45
+
46
+ if (isFirstLoad) {
47
+ isFirstLoad = false;
48
+ numPostsPerPage = postList.children.length;
49
+ }
50
+
35
51
  if (window.innerHeight + window.scrollY >= postList.offsetTop + postList.offsetHeight - 100) {
36
52
  loading = true;
37
53
  loadMorePosts();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liddlelab-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Liddle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-25 00:00:00.000000000 Z
11
+ date: 2025-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll-seo-tag