mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
Fix stat panel turf list menu clicks only working on the text (#89456)
## About The Pull Request Only the div was setting onmousedown ## Changelog 🆑 fix: Fixed stat panel turf list menu clicks only working on the text /🆑 Co-authored-by: TiviPlus <572233640+TiviPlus@users.noreply.com>
This commit is contained in:
committed by
Roxy
co-authored by
TiviPlus
parent
eb6e277904
commit
b956f575a6
+21
-18
@@ -438,24 +438,7 @@ function draw_listedturf() {
|
||||
var table = document.createElement("table");
|
||||
for (var i = 0; i < turfcontents.length; i++) {
|
||||
var part = turfcontents[i];
|
||||
if (storedimages[part[1]] == null && part[2]) {
|
||||
var img = document.createElement("img");
|
||||
img.src = part[2];
|
||||
img.id = part[1];
|
||||
storedimages[part[1]] = part[2];
|
||||
img.onerror = iconError;
|
||||
table.appendChild(img);
|
||||
} else {
|
||||
var img = document.createElement("img");
|
||||
img.onerror = iconError;
|
||||
img.src = storedimages[part[1]];
|
||||
img.id = part[1];
|
||||
table.appendChild(img);
|
||||
}
|
||||
var b = document.createElement("div");
|
||||
var clickcatcher = "";
|
||||
b.className = "link";
|
||||
b.onmousedown = function (part) {
|
||||
var clickfunc = function (part) {
|
||||
// The outer function is used to close over a fresh "part" variable,
|
||||
// rather than every onmousedown getting the "part" of the last entry.
|
||||
return function (e) {
|
||||
@@ -483,6 +466,26 @@ function draw_listedturf() {
|
||||
window.location.href = clickcatcher;
|
||||
}
|
||||
}(part);
|
||||
if (storedimages[part[1]] == null && part[2]) {
|
||||
var img = document.createElement("img");
|
||||
img.src = part[2];
|
||||
img.id = part[1];
|
||||
storedimages[part[1]] = part[2];
|
||||
img.onerror = iconError;
|
||||
img.onmousedown = clickfunc;
|
||||
table.appendChild(img);
|
||||
} else {
|
||||
var img = document.createElement("img");
|
||||
img.onerror = iconError;
|
||||
img.onmousedown = clickfunc;
|
||||
img.src = storedimages[part[1]];
|
||||
img.id = part[1];
|
||||
table.appendChild(img);
|
||||
}
|
||||
var b = document.createElement("div");
|
||||
var clickcatcher = "";
|
||||
b.className = "link";
|
||||
b.onmousedown = clickfunc;
|
||||
b.textContent = part[0];
|
||||
table.appendChild(b);
|
||||
table.appendChild(document.createElement("br"));
|
||||
|
||||
Reference in New Issue
Block a user