diff --git a/html/changelogs/geeves-alt_fix.yml b/html/changelogs/geeves-alt_fix.yml
new file mode 100644
index 00000000000..3ccdb7f2c19
--- /dev/null
+++ b/html/changelogs/geeves-alt_fix.yml
@@ -0,0 +1,6 @@
+author: Geeves
+
+delete-after: True
+
+changes:
+ - bugfix: "Ported an alt-click statpanel fix."
diff --git a/html/statbrowser.js b/html/statbrowser.js
index 362bbb0ba46..c3c167ad4dc 100644
--- a/html/statbrowser.js
+++ b/html/statbrowser.js
@@ -440,38 +440,21 @@ 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) {
e.preventDefault();
- clickcatcher = "?src=" + part[1];
+ clickcatcher = "byond://?src=" + part[1];
switch (e.button) {
case 1:
- clickcatcher += ";statpanel_item_click=middle"
+ clickcatcher += ";statpanel_item_click=middle";
break;
case 2:
- clickcatcher += ";statpanel_item_click=right"
+ clickcatcher += ";statpanel_item_click=right";
break;
default:
- clickcatcher += ";statpanel_item_click=left"
+ clickcatcher += ";statpanel_item_click=left";
}
if (e.shiftKey) {
clickcatcher += ";statpanel_item_shiftclick=1";
@@ -483,8 +466,28 @@ function draw_listedturf() {
clickcatcher += ";statpanel_item_altclick=1";
}
window.location.href = clickcatcher;
- }
- }(part);
+ };
+ })(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"));