-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (47 loc) · 1.89 KB
/
Copy pathscript.js
File metadata and controls
57 lines (47 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Download buttons
document.querySelectorAll('.dl-btn').forEach(button => {
button.addEventListener('click', function() {
const url = this.getAttribute('data-file');
const name = this.getAttribute('data-name');
const original = this.innerHTML;
document.getElementById('rename-notice').style.display = 'block';
this.innerHTML = 'Starting download…';
this.disabled = true;
setTimeout(() => {
const a = document.createElement('a');
a.href = url;
a.download = name;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
this.innerHTML = original;
this.disabled = false;
}, 800);
});
});
// Live public feedback
const feedbackList = document.getElementById('feedback-list');
const feedbackBox = document.getElementById('feedback-box');
const thanks = document.getElementById('feedback-thanks');
function loadFeedback() {
const items = JSON.parse(localStorage.getItem('fc26feedback') || '[]');
feedbackList.innerHTML = '';
items.reverse().forEach(item => {
const div = document.createElement('div');
div.className = 'feedback-item';
div.innerHTML = `<strong>Anonymous</strong><br>${item.text.replace(/\n/g, '<br>')}<br><small>${item.date}</small>`;
feedbackList.appendChild(div);
});
}
document.getElementById('submit-feedback').addEventListener('click', () => {
const text = feedbackBox.value.trim();
if (!text) return;
const items = JSON.parse(localStorage.getItem('fc26feedback') || '[]');
items.push({ date: new Date().toLocaleString(), text });
localStorage.setItem('fc26feedback', JSON.stringify(items));
feedbackBox.value = '';
thanks.style.display = 'block';
setTimeout(() => thanks.style.display = 'none', 3000);
loadFeedback();
});
loadFeedback();