Repository navigation
Expand file tree
/
Copy pathtemplates.js
More file actions
198 lines (185 loc) · 12.9 KB
/
Copy pathtemplates.js
File metadata and controls
198 lines (185 loc) · 12.9 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
window.ApacheVisualizer = window.ApacheVisualizer || {};
(function(AV) {
AV.templates = {
header: function(title) {
var displayTitle = title || 'Apache Visualizer';
return '<header class="visualizer-header">' +
' <div class="header-title-container">' +
' <h1 id="visualizerHeaderTitle">' + displayTitle + '</h1>' +
' </div>' +
'</header>';
},
foldersSection: function() {
return '<div class="folders-section">' +
' <button class="folders-accordion-header" id="foldersAccordionHeader">' +
' <span class="accordion-title-group">' +
' <svg class="accordion-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>' +
' <span class="accordion-title">Folders</span>' +
' <span class="folders-badge" id="foldersBadge">0</span>' +
' </span>' +
' <svg class="chevron-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>' +
' </button>' +
' <div class="folders-accordion-content" id="foldersAccordionContent">' +
' <div class="folders-container" id="pastas"></div>' +
' </div>' +
'</div>';
},
controlsGroup: function() {
var currentLayout = localStorage.getItem('av-layout') || 'vertical';
var layoutLabel = 'Layout: ' + (currentLayout.charAt(0).toUpperCase() + currentLayout.slice(1));
var filterButton = '';
if (AV.is4chan) {
var showTexts = localStorage.getItem('av-show-texts') !== 'false';
var filterLabel = showTexts ? 'View: Texts & Files' : 'View: Files Only';
filterButton = ' <button class="btn-custom" id="toggleFilterBtn" style="margin-left: 12px; color: #800000; font-weight: bold;">' + filterLabel + '</button>';
}
return '<div class="controls-group">' +
' <span>Sort by:</span>' +
' <a href="?C=M;O=D" class="btn-custom">Last Modified</a>' +
' <a href="?C=S;O=D" class="btn-custom">Size</a>' +
' <a href="?C=N;O=A" class="btn-custom">Name</a>' +
' <button class="btn-custom" id="toggleLayoutBtn" style="margin-left: 12px; color: #800000; font-weight: bold;">' + layoutLabel + '</button>' +
filterButton +
' <button class="btn-custom" id="toggleScrollKeysBtn" style="margin-left: auto; color: #800000; font-weight: bold;">Scroll Keys: ON</button>' +
'</div>';
},
galleryGrid: function() {
return '<div class="gallery-grid" id="list"></div>';
},
threadSection: function(sectionId, titleHTML, badgeText, threadUrl) {
var buttonHTML = '';
if (threadUrl) {
buttonHTML = '<a href="' + threadUrl + '" target="_blank" class="thread-action-btn">' +
' View Thread' +
' <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>' +
'</a>';
}
return '<div class="thread-section" id="' + sectionId + '">' +
' <div class="thread-header">' +
' <h2 class="thread-title">' + titleHTML + '</h2>' +
' <div class="thread-header-actions">' +
' <span class="thread-meta-badge">' + badgeText + '</span>' +
buttonHTML +
' </div>' +
' </div>' +
' <div class="gallery-grid thread-grid"></div>' +
'</div>';
},
imageCard: function(pair, title, itemIndex, postText) {
var iconHTML = '<div class="card-type-icon image-icon" title="Image">' +
' <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>' +
'</div>';
var messageHTML = '';
if (postText) {
messageHTML = '<blockquote class="postMessage card-post-text">' + postText + '</blockquote>';
}
return '<div class="gallery-card">' +
' <div class="media-wrapper">' +
iconHTML +
' <img class="gallery-img lightbox-trigger" data-index="' + itemIndex + '" src="' + pair.thumb + '" alt="' + title + '" loading="lazy">' +
' </div>' +
' <div class="card-info">' +
' <p class="card-title" title="' + pair.big + '">' + title + '</p>' +
messageHTML +
' <div class="card-footer-row" style="margin-top: auto !important;">' +
' <span class="card-meta">Image</span>' +
' <a href="' + pair.big + '" target="_blank" class="open-tab-btn" title="Open in new tab">' +
' <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>' +
' </a>' +
' </div>' +
' </div>' +
'</div>';
},
videoCard: function(link, title, itemIndex, videoThumb, postText) {
var iconHTML = '<div class="card-type-icon video-icon" title="Video">' +
' <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg>' +
'</div>';
var mediaHTML = '';
if (videoThumb) {
mediaHTML = '<img class="gallery-img lightbox-trigger" data-index="' + itemIndex + '" src="' + videoThumb + '" alt="' + title + '" loading="lazy">';
} else {
mediaHTML = '<video class="gallery-video" style="pointer-events: none;" preload="none"><source src="' + link + '" type="video/mp4"></video>';
}
var messageHTML = '';
if (postText) {
messageHTML = '<blockquote class="postMessage card-post-text">' + postText + '</blockquote>';
}
return '<div class="gallery-card">' +
' <div class="media-wrapper lightbox-trigger" data-index="' + itemIndex + '">' +
iconHTML +
mediaHTML +
' </div>' +
' <div class="card-info">' +
' <p class="card-title" title="' + link + '">' + title + '</p>' +
messageHTML +
' <div class="card-footer-row" style="margin-top: auto !important;">' +
' <span class="card-meta">Video</span>' +
' <a href="' + link + '" target="_blank" class="open-tab-btn" title="Open in new tab">' +
' <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>' +
' </a>' +
' </div>' +
' </div>' +
'</div>';
},
textCard: function(postId, textHTML) {
return '<div class="gallery-card text-card" id="' + postId + '">' +
' <div class="card-info">' +
' <blockquote class="postMessage">' +
textHTML +
' </blockquote>' +
' <div class="card-footer-row">' +
' <span class="card-meta">Comment</span>' +
' <span class="card-text-badge">Text</span>' +
' </div>' +
' </div>' +
'</div>';
},
audioCard: function(link, title) {
return '<div class="gallery-card">' +
' <div class="media-wrapper">' +
' <audio class="gallery-audio" controls><source src="' + link + '" type="audio/mp3"></audio>' +
' </div>' +
' <div class="card-info">' +
' <p class="card-title" title="' + link + '">' + title + '</p>' +
' <div class="card-footer-row">' +
' <span class="card-meta">Audio</span>' +
' <a href="' + link + '" target="_blank" class="open-tab-btn" title="Open in new tab">' +
' <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>' +
' </a>' +
' </div>' +
' </div>' +
'</div>';
},
documentCard: function(link, title) {
return '<div class="gallery-card">' +
' <div class="media-wrapper">' +
' <iframe class="gallery-iframe" src="' + link + '"></iframe>' +
' </div>' +
' <div class="card-info">' +
' <p class="card-title" title="' + link + '">' + title + '</p>' +
' <div class="card-footer-row">' +
' <span class="card-meta">Document</span>' +
' <a href="' + link + '" target="_blank" class="open-tab-btn" title="Open in new tab">' +
' <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>' +
' </a>' +
' </div>' +
' </div>' +
'</div>';
},
lightbox: function() {
return '<div class="custom-lightbox" id="galleryLightbox">' +
' <button class="lightbox-btn lightbox-close" id="lightboxClose">×</button>' +
' <div class="lightbox-content-wrapper">' +
' <button class="lightbox-btn lightbox-prev" id="lightboxPrev">❮</button>' +
' <img class="lightbox-img" id="lightboxImg" src="" alt="">' +
' <video class="lightbox-video" id="lightboxVideo" controls style="display: none;"></video>' +
' <button class="lightbox-btn lightbox-next" id="lightboxNext">❯</button>' +
' </div>' +
' <div class="lightbox-info">' +
' <p class="lightbox-filename" id="lightboxFilename"></p>' +
' <p class="lightbox-counter" id="lightboxCounter"></p>' +
' </div>' +
'</div>';
}
};
})(window.ApacheVisualizer);