stat panel, no longer locks movement, and fixed some icon issues

This commit is contained in:
QuoteFox
2021-03-02 05:44:49 +00:00
parent 0d3011e17a
commit f8b40ed8e3
3 changed files with 105 additions and 14 deletions
+96 -12
View File
@@ -4,6 +4,7 @@
<title>Stat Browser</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Cache-Control" content="max-age=15; must-revalidate" />
<link id="goonStyle" rel="stylesheet" type="text/css" href="browserOutput_white.css" media="all" />
<style>
body {
@@ -145,6 +146,12 @@ li a:hover:not(.active) {
.link:hover {
text-decoration: underline;
}
img {
-ms-interpolation-mode: nearest-neighbor;
image-rendering: pixelated;
}
</style>
</head>
<body>
@@ -170,6 +177,51 @@ if (!String.prototype.trim) {
};
}
/*\
|*|
|*| Polyfill which enables the passage of arbitrary arguments to the
|*| callback functions of JavaScript timers (HTML5 standard syntax).
|*|
|*| https://developer.mozilla.org/en-US/docs/DOM/window.setInterval
|*|
|*| Syntax:
|*| var timeoutID = window.setTimeout(func, delay[, arg1, arg2, ...]);
|*| var timeoutID = window.setTimeout(code, delay);
|*| var intervalID = window.setInterval(func, delay[, arg1, arg2, ...]);
|*| var intervalID = window.setInterval(code, delay);
|*|
\*/
(function() {
setTimeout(function(arg1) {
if (arg1 === 'test') {
// feature test is passed, no need for polyfill
return;
}
var __nativeST__ = window.setTimeout;
window.setTimeout = function(vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */ ) {
var aArgs = Array.prototype.slice.call(arguments, 2);
return __nativeST__(vCallback instanceof Function ? function() {
vCallback.apply(null, aArgs);
} : vCallback, nDelay);
};
}, 0, 'test');
var interval = setInterval(function(arg1) {
clearInterval(interval);
if (arg1 === 'test') {
// feature test is passed, no need for polyfill
return;
}
var __nativeSI__ = window.setInterval;
window.setInterval = function(vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */ ) {
var aArgs = Array.prototype.slice.call(arguments, 2);
return __nativeSI__(vCallback instanceof Function ? function() {
vCallback.apply(null, aArgs);
} : vCallback, nDelay);
};
}, 0, 'test');
}())
// Browser passthrough code ---------------------------------------------------
if (window.location) {
var anti_spam = []; // wow I wish I could use e.repeat but IE is dumb and doesn't have it.
@@ -181,10 +233,12 @@ if (window.location) {
if(e.which) {
if(!anti_spam[e.which]) {
anti_spam[e.which] = true;
var href = "?__keydown=" + e.which;
if(e.ctrlKey === false) href += "&ctrlKey=0"
else if(e.ctrlKey === true) href += "&ctrlKey=1"
window.location.href = href;
var key = String.fromCharCode(e.which);
var x = event.x || event.clientX;
var y = event.y || event.clientY;
if(x || y ) // if either of these exist this is happening after a click
return;
window.location.href = "byond://winset?command=keyDown " + e.key;
}
}
});
@@ -195,10 +249,14 @@ if (window.location) {
return;
if(e.which) {
anti_spam[e.which] = false;
var href = "?__keyup=" + e.which;
if(e.ctrlKey === false) href += "&ctrlKey=0"
else if(e.ctrlKey === true) href += "&ctrlKey=1"
window.location.href = href;
var key = String.fromCharCode(e.which);
var x = event.x || event.clientX;
var y = event.y || event.clientY;
if( x || y ) // if either of these exist this is happening after a click
return;
window.location.href = "byond://winset?command=keyUp " + e.key;
}
});
}
@@ -227,6 +285,8 @@ var sqdl2 = [];
var permanent_tabs = []; // tabs that won't be cleared by wipes
var turfcontents = [];
var turfname = "";
var imageRetryDelay = 50;
var imageRetryLimit = 50;
var menu = document.querySelector('#menu');
var under_menu = document.querySelector('#under_menu');
@@ -337,6 +397,14 @@ function verbs_cat_check(cat) {
}
}
function findVerbindex(name, verblist) {
for(var i = 0; i < verblist.length; i++) {
var part = verblist[i];
if(part[1] == name)
return i;
}
}
function wipe_verbs() {
verbs = [["", ""]];
verb_tabs = [];
@@ -348,10 +416,9 @@ function add_verb_list(v) {
to_add.sort(); // sort what we're adding
for(var i = 0; i < to_add.length; i++) {
var part = to_add[i];
if(findVerbindex(part[1], verbs))
continue;
if(verb_tabs.includes(part[0])){
if(verbs.includes(part)){
continue;
}
verbs.push(part);
if(current_tab == part[0]) {
draw_verbs(part[0]); // redraw if we added a verb to the tab we're currently in
@@ -392,7 +459,7 @@ function init_verbs(c, v) {
do_update = true;
}
if(v) {
verbs = JSON.parse(v);
add_verb_list(v);
verbs.sort(); // sort them
if(do_update) {
draw_verbs(current_tab);
@@ -674,6 +741,22 @@ function update_listedturf(TC) {
draw_listedturf();
}
function iconError(E) {
var that = this;
setTimeout(function() {
var current_attempts = that.id; // a bit of a hack, change this if we need to call on img id's later
if(!current_attempts)
that.id = 1;
if (current_attempts > imageRetryLimit)
return;
var src = that.src;
that.src = null;
that.src = src + '#' + current_attempts;
that.id++;
draw_listedturf();
}, imageRetryDelay);
}
function draw_listedturf() {
var statcontentdiv = document.getElementById("statcontent");
statcontentdiv[textContentKey] = "";
@@ -683,6 +766,7 @@ function draw_listedturf() {
if(part[2]) {
var img = document.createElement("img");
img.src = part[2];
img[addEventListenerKey]("onerror", iconError());
table.appendChild(img);
}
var b = document.createElement("div");