mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 04:46:46 -05:00
Auto update
This commit is contained in:
parent
c02d0806d4
commit
7bfcdd98fb
2 changed files with 28 additions and 16 deletions
|
|
@ -11,7 +11,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
// Create H2 Link
|
// Create H2 Link
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = '#' + h2.id;
|
a.setAttribute('href', '#' + h2.id);
|
||||||
a.textContent = h2.textContent;
|
a.textContent = h2.textContent;
|
||||||
li.appendChild(a);
|
li.appendChild(a);
|
||||||
faqTocList.appendChild(li);
|
faqTocList.appendChild(li);
|
||||||
|
|
@ -23,7 +23,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
questions.forEach(q => {
|
questions.forEach(q => {
|
||||||
const subLi = document.createElement('li');
|
const subLi = document.createElement('li');
|
||||||
const subA = document.createElement('a');
|
const subA = document.createElement('a');
|
||||||
subA.href = '#' + q.id;
|
subA.setAttribute('href', '#' + q.id);
|
||||||
subA.textContent = q.textContent;
|
subA.textContent = q.textContent;
|
||||||
subLi.appendChild(subA);
|
subLi.appendChild(subA);
|
||||||
subUl.appendChild(subLi);
|
subUl.appendChild(subLi);
|
||||||
|
|
@ -54,7 +54,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (level === 1) {
|
if (level === 1) {
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = '#' + header.id;
|
a.setAttribute('href', '#' + header.id);
|
||||||
a.textContent = header.textContent;
|
a.textContent = header.textContent;
|
||||||
li.appendChild(a);
|
li.appendChild(a);
|
||||||
manualTocList.appendChild(li);
|
manualTocList.appendChild(li);
|
||||||
|
|
@ -69,7 +69,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = '#' + header.id;
|
a.setAttribute('href', '#' + header.id);
|
||||||
a.textContent = header.textContent;
|
a.textContent = header.textContent;
|
||||||
li.appendChild(a);
|
li.appendChild(a);
|
||||||
currentLevel2Ul.appendChild(li);
|
currentLevel2Ul.appendChild(li);
|
||||||
|
|
@ -91,12 +91,21 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
// Simple smooth scroll for anchor links
|
// Simple smooth scroll for anchor links
|
||||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||||
anchor.addEventListener('click', function (e) {
|
anchor.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
const href = this.getAttribute('href');
|
||||||
const target = document.querySelector(this.getAttribute('href'));
|
// Only handle valid hash links
|
||||||
if (target) {
|
if (href && href.startsWith('#') && href.length > 1) {
|
||||||
target.scrollIntoView({
|
const id = href.substring(1);
|
||||||
behavior: 'smooth'
|
// Use getElementById which is more robust than querySelector for IDs with special chars
|
||||||
});
|
const target = document.getElementById(id);
|
||||||
|
|
||||||
|
if (target) {
|
||||||
|
e.preventDefault();
|
||||||
|
target.scrollIntoView({
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
// Update URL hash without jumping
|
||||||
|
history.pushState(null, null, href);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -175,24 +184,25 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI Gallery Preview on Hover
|
// UI Gallery Preview on Click
|
||||||
const shots = document.querySelectorAll('.ui-shot');
|
const shots = document.querySelectorAll('.ui-shot');
|
||||||
const overlay = document.getElementById('ui-preview-overlay');
|
const overlay = document.getElementById('ui-preview-overlay');
|
||||||
const previewImg = document.getElementById('ui-preview-img');
|
const previewImg = document.getElementById('ui-preview-img');
|
||||||
|
|
||||||
if (overlay && previewImg) {
|
if (overlay && previewImg) {
|
||||||
shots.forEach(shot => {
|
shots.forEach(shot => {
|
||||||
shot.addEventListener('mouseenter', () => {
|
shot.addEventListener('click', () => {
|
||||||
const largeSrc = shot.getAttribute('data-large');
|
const largeSrc = shot.getAttribute('data-large');
|
||||||
if (largeSrc) {
|
if (largeSrc) {
|
||||||
previewImg.src = largeSrc;
|
previewImg.src = largeSrc;
|
||||||
overlay.classList.add('active');
|
overlay.classList.add('active');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
shot.addEventListener('mouseleave', () => {
|
|
||||||
overlay.classList.remove('active');
|
// Close when clicking on the overlay
|
||||||
});
|
overlay.addEventListener('click', () => {
|
||||||
|
overlay.classList.remove('active');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -814,6 +814,8 @@ footer {
|
||||||
|
|
||||||
#ui-preview-overlay.active {
|
#ui-preview-overlay.active {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
pointer-events: auto; /* Enable clicks when active */
|
||||||
|
cursor: zoom-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ui-preview-img {
|
#ui-preview-img {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue