Mattthew
commited on
Commit
•
d482631
1
Parent(s):
319456a
fix bugs, missing emoji, keep showing thumb if large size missing
Browse files- index.html +1 -0
- index.js +10 -4
index.html
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
<head>
|
|
|
4 |
<script type="text/javascript" src="artists_and_tags.js"></script>
|
5 |
<script type="text/javascript" src="index.js"></script>
|
6 |
<link rel="stylesheet" href="index.css">
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
<script type="text/javascript" src="artists_and_tags.js"></script>
|
6 |
<script type="text/javascript" src="index.js"></script>
|
7 |
<link rel="stylesheet" href="index.css">
|
index.js
CHANGED
@@ -1150,17 +1150,23 @@ function loadLargerImages(imageItem) {
|
|
1150 |
let images = imageItem.querySelectorAll('img');
|
1151 |
let missingFiles = '';
|
1152 |
let imagePromises = Array.from(images).map((img) => {
|
1153 |
-
if(img.src.indexOf('_thumbs') > -1) {
|
1154 |
-
|
1155 |
-
let
|
|
|
1156 |
return new Promise((resolve, reject) => {
|
1157 |
img.onload = () => {
|
1158 |
resolve();
|
1159 |
}
|
1160 |
img.onerror = () => {
|
1161 |
-
missingFiles
|
|
|
|
|
|
|
|
|
1162 |
reject();
|
1163 |
};
|
|
|
1164 |
img.src = img.src.replace('_thumbs','');
|
1165 |
});
|
1166 |
}
|
|
|
1150 |
let images = imageItem.querySelectorAll('img');
|
1151 |
let missingFiles = '';
|
1152 |
let imagePromises = Array.from(images).map((img) => {
|
1153 |
+
if(img.src.indexOf('_thumbs') > -1 && img.dataset.thumbSrc == undefined) {
|
1154 |
+
// don't try to load if we tried before
|
1155 |
+
let first = img.closest('.image-item').querySelector('.firstN').textContent;
|
1156 |
+
let last = img.closest('.image-item').querySelector('.lastN').textContent;
|
1157 |
return new Promise((resolve, reject) => {
|
1158 |
img.onload = () => {
|
1159 |
resolve();
|
1160 |
}
|
1161 |
img.onerror = () => {
|
1162 |
+
if(img.dataset.missingFiles == undefined) {
|
1163 |
+
img.dataset.missingFiles = true;
|
1164 |
+
missingFiles += '<li>' + img.src + '</li>';
|
1165 |
+
img.src = img.dataset.thumbSrc;
|
1166 |
+
}
|
1167 |
reject();
|
1168 |
};
|
1169 |
+
img.dataset.thumbSrc = img.src;
|
1170 |
img.src = img.src.replace('_thumbs','');
|
1171 |
});
|
1172 |
}
|