From 13b85c7c54e5659caf359ec536708bb80e032e86 Mon Sep 17 00:00:00 2001
From: Blake Gearin <blakegearin@pm.me>
Date: Mon, 04 Apr 2022 12:14:51 +0000
Subject: [PATCH] Fix forEach error on empty variable

---
 assets/js/index.js |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/assets/js/index.js b/assets/js/index.js
index 67496d4..28411e4 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -109,7 +109,7 @@
           tocItems.forEach(function(item){
             pushClass(item, 'toc_item');
             pushClass(item.firstElementChild, 'toc_link');
-          })
+          });
         }
       });
 
@@ -143,12 +143,14 @@
     }
 
     const paragraphs = elems('p');
-    paragraphs.forEach(function(p){
-      const buttons = elems('.button', p);
-      if(buttons.length > 1) {
-        pushClass(p, 'button_grid');
-      }
-    });
+    if (paragraphs) {
+      paragraphs.forEach(function(p){
+        const buttons = elems('.button', p);
+        if(buttons.length > 1) {
+          pushClass(p, 'button_grid');
+        }
+      });
+    }
   })();
 
   (function markExternalLinks(){
@@ -216,7 +218,7 @@
     copyText.innerText = 'Link Copied';
     if(!elem(`.${yanked}`, parent)) {
       parent.appendChild(copyText);
-      setTimeout(function() { 
+      setTimeout(function() {
         parent.removeChild(copyText)
       }, 2250);
     }
@@ -378,7 +380,7 @@
       } else {
         deleteClass(toTop, active);
       }
-    })
+    });
   })();
 
 }

--
Gitblit v1.10.0