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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>Cards</title>
|
| 7 |
+
<style>
|
| 8 |
+
html{
|
| 9 |
+
font-family: system-ui, sans-serif;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
#cards{
|
| 13 |
+
display: flex;
|
| 14 |
+
flex-wrap: wrap;
|
| 15 |
+
gap: 0.5em;
|
| 16 |
+
}
|
| 17 |
+
.card{
|
| 18 |
+
width: 256px;
|
| 19 |
+
height: 384px;
|
| 20 |
+
background-size: cover;
|
| 21 |
+
background-position: center;
|
| 22 |
+
position: relative;
|
| 23 |
+
overflow: hidden;
|
| 24 |
+
box-shadow: 2px 2px 3px rgba(0,0,0,0.5);
|
| 25 |
+
cursor: pointer;
|
| 26 |
+
background-color: #575757;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.card .cardname{
|
| 30 |
+
padding: 0.5em;
|
| 31 |
+
background-color: rgba(0,0,0,0.65);
|
| 32 |
+
box-shadow: 0px 0px 10px 10px rgba(0,0,0,0.65);
|
| 33 |
+
color: white;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
.card .cardbottom{
|
| 37 |
+
padding: 0.5em;
|
| 38 |
+
position: absolute;
|
| 39 |
+
bottom: 0;
|
| 40 |
+
left: 0;
|
| 41 |
+
right: 0;
|
| 42 |
+
background-color: rgba(0,0,0,0.65);
|
| 43 |
+
box-shadow: 0px 0px 10px 10px rgba(0,0,0,0.65);
|
| 44 |
+
color: white;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.card .carddesc{
|
| 48 |
+
overflow: hidden;
|
| 49 |
+
display: -webkit-box;
|
| 50 |
+
-webkit-line-clamp: 2;
|
| 51 |
+
line-clamp: 2;
|
| 52 |
+
-webkit-box-orient: vertical;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.topctl{
|
| 56 |
+
display: inline-block;
|
| 57 |
+
margin: 0 3em 0 0;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
#tags{
|
| 61 |
+
display: flex;
|
| 62 |
+
flex-wrap: wrap;
|
| 63 |
+
gap: 0.5em;
|
| 64 |
+
margin: 0.5em 0;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
#tags .tag{
|
| 68 |
+
border: 1px solid #ccc;
|
| 69 |
+
padding: 0.25em 0.5em;
|
| 70 |
+
cursor: pointer;
|
| 71 |
+
user-select: none;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
#tags .tag.enable{
|
| 75 |
+
color: white;
|
| 76 |
+
background: green;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
#tags .tag.disable{
|
| 80 |
+
color: white;
|
| 81 |
+
background: red;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
.order-options{
|
| 85 |
+
display: inline-block;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.pagination {
|
| 89 |
+
margin: 0.5em 0;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.pagination span{
|
| 93 |
+
padding: 0.25em 0.5em;
|
| 94 |
+
user-select: none;
|
| 95 |
+
margin: 0.15em 0;
|
| 96 |
+
display: inline-block;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.pagination span.active{
|
| 100 |
+
border: 1px solid #ccc;
|
| 101 |
+
cursor: pointer;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
#cardview{
|
| 105 |
+
position: fixed;
|
| 106 |
+
margin: 2em;
|
| 107 |
+
padding: 0 2em;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
#cardview .cardview{
|
| 111 |
+
margin: 4em 0em 2em 0;
|
| 112 |
+
height: 100%;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
::backdrop {
|
| 116 |
+
background-image: linear-gradient( 65deg, black, #3e3e3e, #133e40, black );
|
| 117 |
+
opacity: 0.90;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
#cardviewDownload{
|
| 121 |
+
display: flex;
|
| 122 |
+
align-items: center;
|
| 123 |
+
justify-content: center;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.dlhere{
|
| 127 |
+
font-size: 64pt;
|
| 128 |
+
font-weight: bold;
|
| 129 |
+
color: #b5b5b5;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.dlmsg{
|
| 133 |
+
text-align: center;
|
| 134 |
+
font-size: 85%;
|
| 135 |
+
color: #555;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
.closebutton{
|
| 139 |
+
position: fixed;
|
| 140 |
+
right: 4.5em;
|
| 141 |
+
top: 3.5em;
|
| 142 |
+
display: block;
|
| 143 |
+
color: white;
|
| 144 |
+
background: #b76666;
|
| 145 |
+
border: none;
|
| 146 |
+
padding: 0.5em 0.6em;
|
| 147 |
+
cursor: pointer;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.closebutton:hover{
|
| 151 |
+
background: #c77676;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.cardinfo .header{
|
| 155 |
+
font-size: 120%;
|
| 156 |
+
text-decoration: underline;
|
| 157 |
+
margin: 1.75em 0 0.5em 0;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.cardinfo .notes{
|
| 161 |
+
padding: 1em;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
.cardinfo .aitext{
|
| 165 |
+
font-family: monospace, monospace;
|
| 166 |
+
padding: 1em;
|
| 167 |
+
border: 2px solid #ccc;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.modal-open {
|
| 171 |
+
overflow: initial;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
.load-all-loading{
|
| 175 |
+
font-style: italic;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
</style>
|
| 180 |
+
<script src="html/cards.js"></script>
|
| 181 |
+
<script src="html/cardsmeta.js"></script>
|
| 182 |
+
<script>
|
| 183 |
+
cardsPerPage = 60
|
| 184 |
+
currentPage = 0
|
| 185 |
+
|
| 186 |
+
function setup(){
|
| 187 |
+
document.getElementById('loadedCardsCount').textContent = cards.length
|
| 188 |
+
|
| 189 |
+
var tagsDiv = document.getElementById('tags')
|
| 190 |
+
|
| 191 |
+
for(var tag of tags){
|
| 192 |
+
let tagDiv = document.createElement('DIV')
|
| 193 |
+
tagDiv.innerText = tag[0]
|
| 194 |
+
tagDiv.classList.add('tag')
|
| 195 |
+
tagsDiv.appendChild(tagDiv)
|
| 196 |
+
|
| 197 |
+
tagDiv.addEventListener('click', function(){
|
| 198 |
+
if(tagDiv.classList.contains('enable')){
|
| 199 |
+
tagDiv.classList.remove('enable');
|
| 200 |
+
tagDiv.classList.add('disable');
|
| 201 |
+
} else if(tagDiv.classList.contains('disable')){
|
| 202 |
+
tagDiv.classList.remove('disable');
|
| 203 |
+
} else{
|
| 204 |
+
tagDiv.classList.add('enable');
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
update()
|
| 208 |
+
});
|
| 209 |
+
}
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
var currentSort = "";
|
| 213 |
+
var currentFilter = "";
|
| 214 |
+
var filteredCards = null;
|
| 215 |
+
|
| 216 |
+
function createPages(pagesDiv){
|
| 217 |
+
pagesDiv.innerHTML=''
|
| 218 |
+
|
| 219 |
+
var totalPages = Math.floor(filteredCards.length / cardsPerPage)
|
| 220 |
+
if(currentPage >= totalPages) currentPage = totalPages - 1
|
| 221 |
+
if(currentPage < 0) currentPage = 0
|
| 222 |
+
|
| 223 |
+
var addedEllipsisBefore = false;
|
| 224 |
+
var addedEllipsisAfter = false;
|
| 225 |
+
|
| 226 |
+
var add = function(text, className){
|
| 227 |
+
var elem = document.createElement('SPAN')
|
| 228 |
+
elem.classList.add(className)
|
| 229 |
+
elem.innerText = text
|
| 230 |
+
pagesDiv.appendChild(elem)
|
| 231 |
+
pagesDiv.appendChild(document.createTextNode(' '))
|
| 232 |
+
|
| 233 |
+
return elem;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
for(let i=0; i<totalPages; i++){
|
| 237 |
+
var skip = true;
|
| 238 |
+
|
| 239 |
+
if(i<3) skip = false;
|
| 240 |
+
if(i+3>=totalPages) skip = false;
|
| 241 |
+
if(i>=currentPage-8 && i<currentPage+8+1) skip = false;
|
| 242 |
+
|
| 243 |
+
if(skip){
|
| 244 |
+
if (i < currentPage && !addedEllipsisBefore){
|
| 245 |
+
add('...', 'inactive')
|
| 246 |
+
addedEllipsisBefore = true
|
| 247 |
+
}
|
| 248 |
+
if (i > currentPage && !addedEllipsisAfter){
|
| 249 |
+
add('...', 'inactive')
|
| 250 |
+
addedEllipsisAfter = true
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
continue;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
button = add(i+1, i==currentPage ? 'inactive' : 'active')
|
| 257 |
+
button.addEventListener('click', function(){
|
| 258 |
+
currentPage = i
|
| 259 |
+
update()
|
| 260 |
+
window.scrollTo(0,0)
|
| 261 |
+
});
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
function createCard(card){
|
| 267 |
+
var cardDiv = document.createElement('DIV')
|
| 268 |
+
cardDiv.style.backgroundImage = "url('cards/" + card.id[0] + "/" + card.id + ".png')"
|
| 269 |
+
cardDiv.classList.add('card')
|
| 270 |
+
|
| 271 |
+
var cardTitle = document.createElement('DIV')
|
| 272 |
+
cardTitle.innerText = card.name
|
| 273 |
+
cardTitle.classList.add('cardname')
|
| 274 |
+
cardDiv.appendChild(cardTitle)
|
| 275 |
+
|
| 276 |
+
var cardBottom = document.createElement('DIV')
|
| 277 |
+
cardBottom.classList.add('cardbottom')
|
| 278 |
+
cardDiv.appendChild(cardBottom)
|
| 279 |
+
|
| 280 |
+
var cardDesc = document.createElement('DIV')
|
| 281 |
+
cardDesc.innerText = card.creator_notes
|
| 282 |
+
cardDesc.classList.add('carddesc')
|
| 283 |
+
cardBottom.appendChild(cardDesc)
|
| 284 |
+
|
| 285 |
+
return cardDiv
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
function update(){
|
| 289 |
+
var sortBy = document.querySelector('input[name="sortby"]:checked').value;
|
| 290 |
+
var sortAsc = (document.querySelector('input[name="sortorder"]:checked').value == "ascending");
|
| 291 |
+
var sortKey = sortBy + "-" + sortAsc;
|
| 292 |
+
|
| 293 |
+
if(sortKey != currentSort){
|
| 294 |
+
currentSort = sortKey;
|
| 295 |
+
|
| 296 |
+
var compare = function(a, b){
|
| 297 |
+
var aa = a[sortBy];
|
| 298 |
+
var bb = b[sortBy];
|
| 299 |
+
if (aa < bb) {
|
| 300 |
+
return sortAsc ? -1 : 1;
|
| 301 |
+
} if (aa > bb) {
|
| 302 |
+
return sortAsc ? 1 : -1;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
return 0;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
cards.sort(compare)
|
| 309 |
+
filteredCards = null;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
var enabledTags = {}
|
| 313 |
+
var disabledTags = {}
|
| 314 |
+
var searchTags = 0
|
| 315 |
+
for(var elem of document.querySelectorAll('#tags .tag')){
|
| 316 |
+
if(elem.classList.contains('enable')){
|
| 317 |
+
enabledTags[elem.textContent] = 1
|
| 318 |
+
searchTags += 1
|
| 319 |
+
} else if(elem.classList.contains('disable')){
|
| 320 |
+
disabledTags[elem.textContent] = 1
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
var searchText = document.getElementById('searchEdit').value.toLowerCase()
|
| 325 |
+
var searchContent = document.getElementById('searchContent').checked
|
| 326 |
+
var searchAuthor = document.getElementById('searchAuthor').checked
|
| 327 |
+
|
| 328 |
+
var newFilter = searchText + "|" + searchContent + "|" + searchAuthor + "|" + JSON.stringify(enabledTags) + "|" + JSON.stringify(disabledTags);
|
| 329 |
+
|
| 330 |
+
if (filteredCards == null || currentFilter != newFilter){
|
| 331 |
+
currentFilter = newFilter
|
| 332 |
+
|
| 333 |
+
filteredCards = cards.filter(function(card){
|
| 334 |
+
if(searchText != ""){
|
| 335 |
+
if(searchAuthor){
|
| 336 |
+
if(card.creator.toLowerCase().indexOf(searchText) == -1) return false;
|
| 337 |
+
} else if (searchContent){
|
| 338 |
+
var found = false;
|
| 339 |
+
for(var field of ["creator_notes", "description", "first_mes", "mes_example", "scenario", "name"]){
|
| 340 |
+
if(card[field].toLowerCase().indexOf(searchText) != -1){
|
| 341 |
+
found = true;
|
| 342 |
+
break;
|
| 343 |
+
}
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
if(! found) return false;
|
| 347 |
+
} else{
|
| 348 |
+
if(card.name.toLowerCase().indexOf(searchText) == -1) return false;
|
| 349 |
+
}
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
var matches = 0;
|
| 353 |
+
|
| 354 |
+
for(var tag of card.tags){
|
| 355 |
+
if(disabledTags[tag]) return false;
|
| 356 |
+
if(searchTags && enabledTags[tag]) matches += 1;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
if(searchTags == matches) return true;
|
| 360 |
+
|
| 361 |
+
return false;
|
| 362 |
+
});
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
createPages(document.getElementById('pages'))
|
| 366 |
+
createPages(document.getElementById('pagesAfter'))
|
| 367 |
+
|
| 368 |
+
var cardsDiv = document.getElementById('cards')
|
| 369 |
+
cardsDiv.innerHTML=''
|
| 370 |
+
|
| 371 |
+
for(var index=0; index<cardsPerPage;index++){
|
| 372 |
+
let cardIndex = currentPage * cardsPerPage + index
|
| 373 |
+
let card = filteredCards[cardIndex]
|
| 374 |
+
if(! card) return
|
| 375 |
+
|
| 376 |
+
var cardDiv = createCard(card)
|
| 377 |
+
cardsDiv.appendChild(cardDiv)
|
| 378 |
+
|
| 379 |
+
cardDiv.addEventListener('click', function(){
|
| 380 |
+
var cardview = document.getElementById('cardview')
|
| 381 |
+
|
| 382 |
+
var cardPlaceholder = document.getElementById('cardviewCard');
|
| 383 |
+
cardPlaceholder.innerHTML = ''
|
| 384 |
+
cardPlaceholder.appendChild(createCard(card))
|
| 385 |
+
cardPlaceholder.href = "cards/" + card.id[0] + "/" + card.id + ".png"
|
| 386 |
+
|
| 387 |
+
var content = document.getElementById('cardviewContent');
|
| 388 |
+
content.innerHTML = ''
|
| 389 |
+
|
| 390 |
+
var addSection = function(style, title, text){
|
| 391 |
+
var sectionHeader = document.createElement('DIV')
|
| 392 |
+
sectionHeader.innerText = title
|
| 393 |
+
sectionHeader.classList.add('header')
|
| 394 |
+
content.appendChild(sectionHeader)
|
| 395 |
+
|
| 396 |
+
var sectionContent = document.createElement('DIV')
|
| 397 |
+
sectionContent.innerText = text
|
| 398 |
+
sectionContent.classList.add(style)
|
| 399 |
+
content.appendChild(sectionContent)
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
addSection('notes', card.name, card.tags.join(", "))
|
| 403 |
+
addSection('notes', "Creator's notes - by" + card.creator, card.creator_notes)
|
| 404 |
+
addSection('notes', "Metadata",
|
| 405 |
+
"Created: " + card.created_at + "\n" +
|
| 406 |
+
"Updated: " + card.updated_at + "\n" +
|
| 407 |
+
"Messages: " + card.messages + "\n" +
|
| 408 |
+
"Chats: " + card.chats + "\n"
|
| 409 |
+
)
|
| 410 |
+
|
| 411 |
+
addSection('aitext', "Description", card.description)
|
| 412 |
+
addSection('aitext', "First message", card.first_mes)
|
| 413 |
+
addSection('aitext', "Scenario", card.scenario)
|
| 414 |
+
addSection('aitext', "Message examples", card.mes_example)
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
cardview.showModal()
|
| 418 |
+
cardview.scrollTo(0, 0)
|
| 419 |
+
})
|
| 420 |
+
}
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
var updateGeneration = 0;
|
| 424 |
+
function delayedUpdate(){
|
| 425 |
+
var targetGeneration = ++updateGeneration;
|
| 426 |
+
window.setTimeout(function(){
|
| 427 |
+
if(targetGeneration != updateGeneration) return;
|
| 428 |
+
|
| 429 |
+
update()
|
| 430 |
+
}, 500)
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
function loadAll(){
|
| 434 |
+
var script = document.createElement('script');
|
| 435 |
+
script.onload = function () {
|
| 436 |
+
document.querySelector('.load-options').style.display='none';
|
| 437 |
+
currentSort = "";
|
| 438 |
+
update();
|
| 439 |
+
};
|
| 440 |
+
|
| 441 |
+
document.querySelector('.load-all-button').style.display='none';
|
| 442 |
+
document.querySelector('.load-all-loading').textContent="Loading...";
|
| 443 |
+
|
| 444 |
+
document.head.appendChild(script);
|
| 445 |
+
script.src = 'html/allcards.js';
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
document.addEventListener("DOMContentLoaded", function(){
|
| 449 |
+
setup();
|
| 450 |
+
update();
|
| 451 |
+
});
|
| 452 |
+
|
| 453 |
+
</script>
|
| 454 |
+
</head>
|
| 455 |
+
<body>
|
| 456 |
+
|
| 457 |
+
<meta charset="utf8">
|
| 458 |
+
|
| 459 |
+
<div id="filter">
|
| 460 |
+
<div id="topcontrols">
|
| 461 |
+
<div class="topctl search-options">
|
| 462 |
+
<input id="searchEdit" type="text" placeholder="Search..." onkeyup="delayedUpdate()" />
|
| 463 |
+
|
| 464 |
+
<input type="radio" id="searchTitle" checked="checked" name="searchType" value="Title" onchange="delayedUpdate()">
|
| 465 |
+
<label for="searchTitle">Title</label>
|
| 466 |
+
<input type="radio" id="searchContent" name="searchType" value="Content" onchange="delayedUpdate()">
|
| 467 |
+
<label for="searchContent">Content</label>
|
| 468 |
+
<input type="radio" id="searchAuthor" name="searchType" value="Author" onchange="delayedUpdate()">
|
| 469 |
+
<label for="searchAuthor">Author</label>
|
| 470 |
+
</div>
|
| 471 |
+
|
| 472 |
+
<div class="topctl sortby-options">
|
| 473 |
+
Sort by:
|
| 474 |
+
|
| 475 |
+
<input type="radio" checked="checked" id="orderPopularity" name="sortby" value="messages" onchange="delayedUpdate()">
|
| 476 |
+
<label for="orderPopularity">Popularity</label>
|
| 477 |
+
|
| 478 |
+
<input type="radio" id="orderName" name="sortby" value="name" onchange="delayedUpdate()">
|
| 479 |
+
<label for="orderName">Name</label>
|
| 480 |
+
|
| 481 |
+
<input type="radio" id="orderCreated" name="sortby" value="created_at" onchange="delayedUpdate()">
|
| 482 |
+
<label for="orderCreated">Date</label>
|
| 483 |
+
</div>
|
| 484 |
+
|
| 485 |
+
<div class="topctl order-options">
|
| 486 |
+
Order:
|
| 487 |
+
<input type="radio" id="sortAscending" name="sortorder" value="ascending" onchange="delayedUpdate()">
|
| 488 |
+
<label for="sortAscending">Ascending</label>
|
| 489 |
+
|
| 490 |
+
<input type="radio" checked="checked" id="sortDescending" name="sortorder" value="descending" onchange="delayedUpdate()">
|
| 491 |
+
<label for="sortDescending">Descending</label>
|
| 492 |
+
</div>
|
| 493 |
+
|
| 494 |
+
<div class="topctl load-options">
|
| 495 |
+
Loaded: <span id="loadedCardsCount">0</span>
|
| 496 |
+
<button class="load-all-button" onclick="loadAll()">Load all</button>
|
| 497 |
+
<span class="load-all-loading"></span>
|
| 498 |
+
</div>
|
| 499 |
+
</div>
|
| 500 |
+
|
| 501 |
+
<div id="tags"></div>
|
| 502 |
+
|
| 503 |
+
<div id="pages" class="pagination"></div>
|
| 504 |
+
</div>
|
| 505 |
+
|
| 506 |
+
<div id="cards">
|
| 507 |
+
|
| 508 |
+
</div>
|
| 509 |
+
|
| 510 |
+
<div id="pagesAfter" class="pagination"></div>
|
| 511 |
+
|
| 512 |
+
<dialog id="cardview">
|
| 513 |
+
<button class="closebutton" onclick="document.getElementById('cardview').close()">🞪</button>
|
| 514 |
+
|
| 515 |
+
<div class="cardview">
|
| 516 |
+
|
| 517 |
+
<div id="cardviewDownload">
|
| 518 |
+
<div class="dlhere">⋙</div>
|
| 519 |
+
|
| 520 |
+
<div>
|
| 521 |
+
<a id="cardviewCard" target="_blank" download></a>
|
| 522 |
+
<div class="dlmsg">click image to download</div>
|
| 523 |
+
</div>
|
| 524 |
+
<div class="dlhere">⋘</div>
|
| 525 |
+
</div>
|
| 526 |
+
|
| 527 |
+
<div class="cardinfo" id="cardviewContent">
|
| 528 |
+
</div>
|
| 529 |
+
</div>
|
| 530 |
+
</dialog>
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
</body>
|
| 534 |
+
</html>
|