Mattthew
commited on
Commit
·
40c75f3
1
Parent(s):
7c89569
show all 3 prompts/images in the enlarged view
Browse files- index.css +29 -3
- index.html +1 -1
- index.js +29 -14
index.css
CHANGED
@@ -86,12 +86,24 @@ h4 {
|
|
86 |
box-shadow: 0 5px 20px #0000007d;
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
#alert.show {
|
90 |
right: 12px;
|
91 |
opacity: 1;
|
92 |
transition: all 100ms ease-in;
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
footer {
|
96 |
flex-shrink: 0;
|
97 |
padding: 5px 10px;
|
@@ -569,10 +581,11 @@ footer.special #close_footer strong {
|
|
569 |
top: -256px;
|
570 |
left: 0px;
|
571 |
width: 256px;
|
572 |
-
aspect-ratio: 1 / 1;
|
573 |
overflow: hidden;
|
574 |
border-radius: 2px;
|
575 |
-
background-color: #
|
|
|
576 |
cursor: pointer;
|
577 |
animation-name: reduce;
|
578 |
animation-duration: 100ms;
|
@@ -619,14 +632,27 @@ footer.special #close_footer strong {
|
|
619 |
.image-item img {
|
620 |
display: block;
|
621 |
width: 256px;
|
|
|
|
|
622 |
}
|
623 |
|
624 |
-
.image-item img.hidden {
|
625 |
display: none;
|
626 |
}
|
627 |
|
628 |
.image-item:hover .imgBox img {
|
629 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
}
|
631 |
|
632 |
.image-item.favorite {
|
|
|
86 |
box-shadow: 0 5px 20px #0000007d;
|
87 |
}
|
88 |
|
89 |
+
#alert.left {
|
90 |
+
left: -52px;
|
91 |
+
right: initial;
|
92 |
+
}
|
93 |
+
|
94 |
#alert.show {
|
95 |
right: 12px;
|
96 |
opacity: 1;
|
97 |
transition: all 100ms ease-in;
|
98 |
}
|
99 |
|
100 |
+
#alert.left.show {
|
101 |
+
left: 12px;
|
102 |
+
right: initial;
|
103 |
+
opacity: 1;
|
104 |
+
transition: all 100ms ease-in;
|
105 |
+
}
|
106 |
+
|
107 |
footer {
|
108 |
flex-shrink: 0;
|
109 |
padding: 5px 10px;
|
|
|
581 |
top: -256px;
|
582 |
left: 0px;
|
583 |
width: 256px;
|
584 |
+
aspect-ratio: 1 / 1.33;
|
585 |
overflow: hidden;
|
586 |
border-radius: 2px;
|
587 |
+
background-color: #111;
|
588 |
+
text-align: left;
|
589 |
cursor: pointer;
|
590 |
animation-name: reduce;
|
591 |
animation-duration: 100ms;
|
|
|
632 |
.image-item img {
|
633 |
display: block;
|
634 |
width: 256px;
|
635 |
+
position: absolute;
|
636 |
+
top: 0;
|
637 |
}
|
638 |
|
639 |
+
.image-item .imgBox img.hidden {
|
640 |
display: none;
|
641 |
}
|
642 |
|
643 |
.image-item:hover .imgBox img {
|
644 |
width: 100%;
|
645 |
+
z-index: 1;
|
646 |
+
box-shadow: -10px 10px 20px rgba(0,0,0,0.6);
|
647 |
+
}
|
648 |
+
|
649 |
+
.image-item:hover .imgBox img.hidden {
|
650 |
+
display: initial;
|
651 |
+
width: 33%;
|
652 |
+
position: relative;
|
653 |
+
top: 75%;
|
654 |
+
box-shadow: initial;
|
655 |
+
z-index: 0;
|
656 |
}
|
657 |
|
658 |
.image-item.favorite {
|
index.html
CHANGED
@@ -190,7 +190,7 @@
|
|
190 |
<footer class="special">
|
191 |
<div>
|
192 |
<span><strong>Temporarily 500 artists while in Beta.</strong> To learn more click the 📓 at the top left -</span>
|
193 |
-
<span>SDXL
|
194 |
<a href="https://huggingface.co/mattthew" target="_blank">Mattthew</a>
|
195 |
<div id="close_footer"><strong> x </strong></div>
|
196 |
</div>
|
|
|
190 |
<footer class="special">
|
191 |
<div>
|
192 |
<span><strong>Temporarily 500 artists while in Beta.</strong> To learn more click the 📓 at the top left -</span>
|
193 |
+
<span>SDXL Artist Style Explorer, v0.9, by</span>
|
194 |
<a href="https://huggingface.co/mattthew" target="_blank">Mattthew</a>
|
195 |
<div id="close_footer"><strong> x </strong></div>
|
196 |
</div>
|
index.js
CHANGED
@@ -52,11 +52,14 @@ function insertArtists() {
|
|
52 |
let imagePromises = artistsData.map((artist) => {
|
53 |
var last = artist[0];
|
54 |
var first = artist[1];
|
55 |
-
var tags1 = artist[2].replaceAll('|', ' ').toLowerCase();
|
|
|
56 |
// class names can't start with a number, but some tags do
|
57 |
-
// in these cases
|
58 |
tags1 = tags1.replace(/(^|\s)(\d)/g, '$1qqqq-$2');
|
59 |
-
|
|
|
|
|
60 |
var itemDiv = document.createElement('div');
|
61 |
itemDiv.className = 'image-item ' + tags1;
|
62 |
var itemHeader = document.createElement('span');
|
@@ -307,24 +310,24 @@ function highlightSelectedOption(selected) {
|
|
307 |
});
|
308 |
if(imgTypeShown == 0) {
|
309 |
document.getElementById('promptA').classList.add('selected');
|
310 |
-
doAlert('Showing artwork');
|
311 |
} else if(imgTypeShown == 1) {
|
312 |
document.getElementById('promptP').classList.add('selected');
|
313 |
-
doAlert('Showing portraits');
|
314 |
} else if(imgTypeShown == 2) {
|
315 |
document.getElementById('promptL').classList.add('selected');
|
316 |
-
doAlert('Showing landscapes');
|
317 |
}
|
318 |
} else {
|
319 |
if(selected == 'promptA') {
|
320 |
imgTypeShown = 0;
|
321 |
-
doAlert('Showing artwork');
|
322 |
} else if(selected == 'promptP') {
|
323 |
imgTypeShown = 1;
|
324 |
-
doAlert('Showing portraits');
|
325 |
} else if(selected == 'promptL') {
|
326 |
imgTypeShown = 2;
|
327 |
-
doAlert('Showing landscapes');
|
328 |
}
|
329 |
var links = document.getElementById(selected).parentNode.querySelectorAll('.link');
|
330 |
links.forEach(function(link) {
|
@@ -664,7 +667,7 @@ function showExport() {
|
|
664 |
function copyExportToClipboard() {
|
665 |
var favorites = document.getElementById('export').getElementsByTagName('textarea')[0].value;
|
666 |
navigator.clipboard.writeText(favorites);
|
667 |
-
doAlert('Favorites copied to clipboard!');
|
668 |
}
|
669 |
|
670 |
function importFavorites() {
|
@@ -1056,18 +1059,30 @@ function updateFavoritesCount() {
|
|
1056 |
favoriteCounter.textContent = ' - ' + favoriteCount;
|
1057 |
}
|
1058 |
|
1059 |
-
function doAlert(str) {
|
1060 |
var alert = document.getElementById('alert');
|
1061 |
alert.textContent = str;
|
|
|
1062 |
alert.classList.remove('show');
|
1063 |
window.clearTimeout(timer);
|
|
|
|
|
|
|
|
|
|
|
|
|
1064 |
timer = setTimeout(showAlert, 100);
|
1065 |
}
|
1066 |
|
1067 |
function showAlert() {
|
1068 |
var alert = document.getElementById('alert');
|
1069 |
alert.classList.add('show');
|
1070 |
-
|
|
|
|
|
|
|
|
|
|
|
1071 |
}
|
1072 |
|
1073 |
function hideAlert() {
|
@@ -1079,11 +1094,11 @@ function copyStuffToClipboard(item,stuff) {
|
|
1079 |
if(stuff == 'name') {
|
1080 |
var str = item.closest('.image-item').getElementsByClassName('firstN')[0].textContent +
|
1081 |
' ' + item.closest('.image-item').getElementsByClassName('lastN')[0].textContent;
|
1082 |
-
doAlert('Copied to name clipboard!');
|
1083 |
} else if(stuff == 'tags') {
|
1084 |
console.log(item);
|
1085 |
var str = item.textContent;
|
1086 |
-
doAlert('Copied to tags clipboard!');
|
1087 |
}
|
1088 |
navigator.clipboard.writeText(str);
|
1089 |
}
|
|
|
52 |
let imagePromises = artistsData.map((artist) => {
|
53 |
var last = artist[0];
|
54 |
var first = artist[1];
|
55 |
+
var tags1 = artist[2].replaceAll('|', ' ').toLowerCase(); // for classes
|
56 |
+
var tags2 = artist[2].replaceAll('|', ', ').toLowerCase(); // for display
|
57 |
// class names can't start with a number, but some tags do
|
58 |
+
// in these cases we prepend the class with 'qqqq-'
|
59 |
tags1 = tags1.replace(/(^|\s)(\d)/g, '$1qqqq-$2');
|
60 |
+
// artists can have a tag in the format of "added-YYYY-MM"
|
61 |
+
// we want that to show up as a filter, but not on the artist card
|
62 |
+
tags2 = tags2.replace(/, added-(\d|-)*/g,'');
|
63 |
var itemDiv = document.createElement('div');
|
64 |
itemDiv.className = 'image-item ' + tags1;
|
65 |
var itemHeader = document.createElement('span');
|
|
|
310 |
});
|
311 |
if(imgTypeShown == 0) {
|
312 |
document.getElementById('promptA').classList.add('selected');
|
313 |
+
doAlert('Showing artwork',0);
|
314 |
} else if(imgTypeShown == 1) {
|
315 |
document.getElementById('promptP').classList.add('selected');
|
316 |
+
doAlert('Showing portraits',0);
|
317 |
} else if(imgTypeShown == 2) {
|
318 |
document.getElementById('promptL').classList.add('selected');
|
319 |
+
doAlert('Showing landscapes',0);
|
320 |
}
|
321 |
} else {
|
322 |
if(selected == 'promptA') {
|
323 |
imgTypeShown = 0;
|
324 |
+
doAlert('Showing artwork',0);
|
325 |
} else if(selected == 'promptP') {
|
326 |
imgTypeShown = 1;
|
327 |
+
doAlert('Showing portraits',0);
|
328 |
} else if(selected == 'promptL') {
|
329 |
imgTypeShown = 2;
|
330 |
+
doAlert('Showing landscapes',0);
|
331 |
}
|
332 |
var links = document.getElementById(selected).parentNode.querySelectorAll('.link');
|
333 |
links.forEach(function(link) {
|
|
|
667 |
function copyExportToClipboard() {
|
668 |
var favorites = document.getElementById('export').getElementsByTagName('textarea')[0].value;
|
669 |
navigator.clipboard.writeText(favorites);
|
670 |
+
doAlert('Favorites copied to clipboard!',1);
|
671 |
}
|
672 |
|
673 |
function importFavorites() {
|
|
|
1059 |
favoriteCounter.textContent = ' - ' + favoriteCount;
|
1060 |
}
|
1061 |
|
1062 |
+
function doAlert(str,location) {
|
1063 |
var alert = document.getElementById('alert');
|
1064 |
alert.textContent = str;
|
1065 |
+
// remove show and cleartimeout to redo anim if alert called multiple times
|
1066 |
alert.classList.remove('show');
|
1067 |
window.clearTimeout(timer);
|
1068 |
+
if(location == 0) {
|
1069 |
+
alert.classList.add('left');
|
1070 |
+
} else {
|
1071 |
+
alert.classList.remove('left');
|
1072 |
+
// CSS defaults to right
|
1073 |
+
}
|
1074 |
timer = setTimeout(showAlert, 100);
|
1075 |
}
|
1076 |
|
1077 |
function showAlert() {
|
1078 |
var alert = document.getElementById('alert');
|
1079 |
alert.classList.add('show');
|
1080 |
+
if(alert.classList.contains('left')) {
|
1081 |
+
// shorter display time because it covers the enlarged image
|
1082 |
+
timer = setTimeout(hideAlert, 750);
|
1083 |
+
} else {
|
1084 |
+
timer = setTimeout(hideAlert, 2000);
|
1085 |
+
}
|
1086 |
}
|
1087 |
|
1088 |
function hideAlert() {
|
|
|
1094 |
if(stuff == 'name') {
|
1095 |
var str = item.closest('.image-item').getElementsByClassName('firstN')[0].textContent +
|
1096 |
' ' + item.closest('.image-item').getElementsByClassName('lastN')[0].textContent;
|
1097 |
+
doAlert('Copied to name clipboard!',1);
|
1098 |
} else if(stuff == 'tags') {
|
1099 |
console.log(item);
|
1100 |
var str = item.textContent;
|
1101 |
+
doAlert('Copied to tags clipboard!',1);
|
1102 |
}
|
1103 |
navigator.clipboard.writeText(str);
|
1104 |
}
|