kloeckner.com.ar

a backup of my entire webpage
Index Commits Files Refs README LICENSE
commit c06d83496825b6390e8a128730f0b6a56f8bbd80
parent ad3026c5ac797a4832ccc37e5561dea79dc21f03
Author: mjkloeckner <martinjkloeckner@gmail.com>
Date:   Fri, 23 Feb 2024 23:45:02 -0300

Extract inline JavaScript to a separate file

Diffstat:
Mindex.html | 12+-----------
Ajs/count-blog-posts.js | 9+++++++++
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/index.html b/index.html
@@ -38,17 +38,7 @@
 
             <p id=blog-entries>See all <a href="/blog">blog entries</a></p>
 
-            <script>
-                var file;
-                fetch('/common/blog_index.shtml')
-                    .then(response => response.text())
-                    .then((data) => {
-                        var match = data.match(/\r?\n/g);
-                        // alert(match.length);
-                        var content = document.getElementById('blog-entries');
-                        content.innerHTML += " (" + match.length + ")";
-                    })
-            </script>
+            <script src="/js/count-blog-posts.js" defer> </script>
             <hr class="article_bottom_bar">
         </article>
 
diff --git a/js/count-blog-posts.js b/js/count-blog-posts.js
@@ -0,0 +1,9 @@
+var file;
+fetch('/common/blog_index.shtml')
+    .then(response => response.text())
+    .then((data) => {
+        var match = data.match(/\r?\n/g);
+        // alert(match.length);
+        var content = document.getElementById('blog-entries');
+        content.innerHTML += " (" + match.length + ")";
+    })