From 55c5ac3d0a9274f44ff9b178197f30e4ca78d8fc Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 22 Oct 2023 08:47:02 -0300 Subject: [PATCH] fully eliminate scripts.js --- static/scripts.js | 37 ------------------------------------- templates/archive.html | 2 -- templates/head_common.html | 4 +++- templates/note.html | 2 -- templates/other.html | 2 -- templates/profile.html | 11 ++++------- 6 files changed, 7 insertions(+), 51 deletions(-) delete mode 100644 static/scripts.js diff --git a/static/scripts.js b/static/scripts.js deleted file mode 100644 index 219eca4..0000000 --- a/static/scripts.js +++ /dev/null @@ -1,37 +0,0 @@ -function isElementInViewport(element) { - // Get the position and dimensions of the element - const rect = element.getBoundingClientRect() - - // Check if the element is within the viewport's boundaries - return ( - rect.top >= 0 && - rect.left >= 0 && - rect.bottom <= - (window.innerHeight || document.documentElement.clientHeight) && - rect.right <= (window.innerWidth || document.documentElement.clientWidth) - ) -} - -const desktop_name = document.querySelector('.column_content .name') -if (desktop_name) { - window.addEventListener('scroll', function () { - desktop_profile = document.querySelector('.column_content .info-wrapper') - if (window.getComputedStyle(desktop_profile).display === 'none') { - return - } - columnA = document.querySelector('.columnA') - if (columnA != null && isElementInViewport(desktop_name)) { - columnA.querySelector('.info-wrapper').style.display = 'none' - } else { - document.querySelector('.info-wrapper').style.display = 'block' - } - }) -} - -// Needed to apply proper print styles -if ( - navigator.userAgent.indexOf('Safari') != -1 && - navigator.userAgent.indexOf('Chrome') == -1 -) { - document.body.classList.add('safari') -} diff --git a/templates/archive.html b/templates/archive.html index 67ec682..19861d6 100644 --- a/templates/archive.html +++ b/templates/archive.html @@ -50,7 +50,5 @@ {{template "footer" .}} - - diff --git a/templates/head_common.html b/templates/head_common.html index d033367..2bcedfa 100644 --- a/templates/head_common.html +++ b/templates/head_common.html @@ -42,5 +42,7 @@ diff --git a/templates/note.html b/templates/note.html index e96c793..837c99d 100644 --- a/templates/note.html +++ b/templates/note.html @@ -123,7 +123,5 @@ {{template "footer" .}} - - diff --git a/templates/other.html b/templates/other.html index c5fd8db..1f249ba 100644 --- a/templates/other.html +++ b/templates/other.html @@ -39,7 +39,5 @@ {{template "footer" .}} - - diff --git a/templates/profile.html b/templates/profile.html index 0d8cffa..cea44c2 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -34,7 +34,10 @@
-
+
{{.Metadata.Name}} {{if not (eq .Metadata.Name .Metadata.DisplayName)}} @@ -45,10 +48,6 @@
-
- Last update:
- {{.CreatedAt}} -
@@ -123,7 +122,5 @@
{{template "footer" .}} - -