Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/onweru/compose.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Gearin <blakegearin@pm.me>2022-04-04 04:22:10 +0300
committerweru <16350351+onweru@users.noreply.github.com>2022-04-04 15:14:51 +0300
commit13b85c7c54e5659caf359ec536708bb80e032e86 (patch)
tree07f1a8ab4066ff72a2eef70baacf1bfe003314f9
parentc4ce90ce987a0f93fd2a4c70f1d42886cdb34534 (diff)
Fix forEach error on empty variable
-rw-r--r--assets/js/index.js20
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 @@ function loadActions() {
tocItems.forEach(function(item){
pushClass(item, 'toc_item');
pushClass(item.firstElementChild, 'toc_link');
- })
+ });
}
});
@@ -143,12 +143,14 @@ function loadActions() {
}
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 @@ function loadActions() {
copyText.innerText = 'Link Copied';
if(!elem(`.${yanked}`, parent)) {
parent.appendChild(copyText);
- setTimeout(function() {
+ setTimeout(function() {
parent.removeChild(copyText)
}, 2250);
}
@@ -378,7 +380,7 @@ function loadActions() {
} else {
deleteClass(toTop, active);
}
- })
+ });
})();
}