-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfooter.php
More file actions
95 lines (80 loc) · 2.96 KB
/
Copy pathfooter.php
File metadata and controls
95 lines (80 loc) · 2.96 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<script>
let isDragging = false;
let currentDraggingTitleBar = null;
let offsetX, offsetY;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.window').forEach((windowElement) => {
const p = JSON.parse(localStorage.getItem(windowElement.id + '_p'));
if (p) {
windowElement.style.left = p.x + 'px';
windowElement.style.top = p.y + 'px';
}
});
});
document.addEventListener('mousedown', (e) => {
const titleBar = e.target.closest('.title-bar');
const clickedWindow = e.target.closest('.window');
if (titleBar) {
isDragging = true;
currentDraggingTitleBar = titleBar;
const windowElement = titleBar.closest('.window');
if (windowElement) {
offsetX = e.clientX - windowElement.offsetLeft;
offsetY = e.clientY - windowElement.offsetTop;
}
}
if (clickedWindow) {
toggleActive(clickedWindow);
}
});
document.addEventListener('mousemove', (e) => {
if (!isDragging || !currentDraggingTitleBar) return;
const windowElement = currentDraggingTitleBar.closest('.window');
if (windowElement) {
windowElement.style.left = e.clientX - offsetX + 'px';
windowElement.style.top = e.clientY - offsetY + 'px';
const p = {
x: e.clientX - offsetX,
y: e.clientY - offsetY
};
localStorage.setItem(windowElement.id + '_p', JSON.stringify(p));
}
});
document.addEventListener('mouseup', () => {
isDragging = false;
currentDraggingTitleBar = null;
});
document.querySelectorAll('a').forEach((a) => {
a.addEventListener('click', (e) => {
const audio = new Audio('<?php $this->options->themeUrl('audio/START.wav'); ?>');
audio.play();
});
});
function closeWindow(closeButton) {
const windowElement = closeButton.closest('.window');
if (windowElement) {
windowElement.style.display = 'none';
}
}
function toggleActive(currentWindow) {
document.querySelectorAll('.window').forEach((windowElement) => {
windowElement.classList.remove('active');
});
currentWindow.classList.add('active');
}
function toggleCommentWindow() {
if(document.getElementById("commentsWindow").style.display === 'none') {
document.getElementById("commentsWindow").style.display = 'block';
toggleActive(document.getElementById("commentsWindow"));
} else {
document.getElementById("commentsWindow").style.display = 'none';
}
}
if (window.location.hash === '#comments') {
toggleCommentWindow();
}
</script>
<?php $this->footer(); ?>
</body>
</html>