This commit is contained in:
parent
cfb21e7dcb
commit
40f038bfb9
1 changed files with 36 additions and 30 deletions
|
@ -1,4 +1,7 @@
|
||||||
for (const item of document.getElementsByTagName("img")) {
|
window.addEventListener("load", () => main());
|
||||||
|
|
||||||
|
const main = () => {
|
||||||
|
for (const item of document.getElementsByTagName("img")) {
|
||||||
// Check if we may need to resize the image
|
// Check if we may need to resize the image
|
||||||
const possible_piece = item.alt.split(/\s?\|\s?/);
|
const possible_piece = item.alt.split(/\s?\|\s?/);
|
||||||
if (possible_piece.length > 1) {
|
if (possible_piece.length > 1) {
|
||||||
|
@ -19,7 +22,9 @@ for (const item of document.getElementsByTagName("img")) {
|
||||||
verif[1] == "x" &&
|
verif[1] == "x" &&
|
||||||
verif[2] == ""
|
verif[2] == ""
|
||||||
) {
|
) {
|
||||||
[item.width, item.height] = last_possible_piece.split("x");
|
[w, h] = last_possible_piece.split("x");
|
||||||
|
item.width = w;
|
||||||
|
item.height = h;
|
||||||
item.alt = possible_piece.join("");
|
item.alt = possible_piece.join("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,4 +35,5 @@ for (const item of document.getElementsByTagName("img")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue