mirror of
https://github.com/aljazceru/njump.git
synced 2026-02-22 22:44:29 +01:00
fully eliminate scripts.js
This commit is contained in:
@@ -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')
|
||||
}
|
||||
@@ -50,7 +50,5 @@
|
||||
</div>
|
||||
|
||||
{{template "footer" .}}
|
||||
|
||||
<script src="/njump/static/scripts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -42,5 +42,7 @@
|
||||
<meta name="theme-color" content="#e42a6d" />
|
||||
<script src="https://unpkg.com/hyperscript.org@0.9.12"></script>
|
||||
<script type="text/hyperscript">
|
||||
on load repeat for div in .content if div's offsetHeight == 160 add .gradient to it
|
||||
on load get [navigator.userAgent.includes('Safari'), navigator.userAgent.includes('Chrome')] then if it[0] is true and it[1] is false add .safari to <body /> end
|
||||
|
||||
on load repeat for div in .content if div's offsetHeight == 160 add .gradient to it end end
|
||||
</script>
|
||||
|
||||
@@ -123,7 +123,5 @@
|
||||
</div>
|
||||
|
||||
{{template "footer" .}}
|
||||
|
||||
<script src="/njump/static/scripts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -39,7 +39,5 @@
|
||||
</div>
|
||||
|
||||
{{template "footer" .}}
|
||||
|
||||
<script src="/njump/static/scripts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
<div class="container_wrapper">
|
||||
<div class="container">
|
||||
<header class="column columnA">
|
||||
<div class="info-wrapper">
|
||||
<div
|
||||
class="info-wrapper"
|
||||
_="on scroll from window get #profile_name then call it.getBoundingClientRect() then if result.top is less than result.height / -2 set me.style.display to 'block' otherwise set me.style.display to 'none' end"
|
||||
>
|
||||
<div class="name">
|
||||
{{.Metadata.Name}} {{if not (eq .Metadata.Name
|
||||
.Metadata.DisplayName)}}
|
||||
@@ -45,10 +48,6 @@
|
||||
<div class="pic-wrapper">
|
||||
<img class="pic" src="{{.Metadata.Picture}}" />
|
||||
</div>
|
||||
<div class="last_update">
|
||||
Last update:<br />
|
||||
{{.CreatedAt}}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="column column_content">
|
||||
@@ -123,7 +122,5 @@
|
||||
</div>
|
||||
|
||||
{{template "footer" .}}
|
||||
|
||||
<script src="/njump/static/scripts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user