From 55be526441c737142db1f2c6b31b40a0e5ca6580 Mon Sep 17 00:00:00 2001 From: Mhykol Date: Thu, 6 Feb 2025 04:30:17 -0500 Subject: Added buttons in blog posts --- assets/js/blogitem.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'assets') diff --git a/assets/js/blogitem.js b/assets/js/blogitem.js index 9ed188d..3155ef9 100644 --- a/assets/js/blogitem.js +++ b/assets/js/blogitem.js @@ -65,6 +65,13 @@ class BlogItem { ` + this.buttons = document.querySelectorAll('button[value]') + this.buttons.forEach(button => { + button.addEventListener('click', () => { + window.location.href = window.location.origin + button.value + }) + }) + this.object.content.style.opacity = 0 this.object.images.forEach((img, index) => { img.addEventListener('click', () => { @@ -91,7 +98,7 @@ class BlogItem { } #RemoveTag() { this.object['images'] = document.querySelectorAll('img:not([class])') - this.object.images.forEach((img, index) => { + this.object.images.forEach(img => { const p = img.parentElement if (p.tagName === 'P') p.replaceWith(img) }) -- cgit v1.2.3-70-g09d2