return format_distance(speed, suffix);
}
-/* Find the joker checkbox. */
-function get_joker() {
- var inputs = document.getElementsByName('endorsement_j');
+/* Find an endorsement checkbox. */
+function get_endorsement(e) {
+ var inputs = document.getElementsByName('endorsement_' + e);
if (! inputs.length) return null;
return inputs[0];
}
+/* Find the joker checkbox. */
+function get_joker() {
+ return get_endorsement('j');
+}
+
+/* Find the shields checkbox. */
+function get_shields() {
+ return get_endorsement('s');
+}
+
/* Is joker in effect? */
function joker() {
+ var shields = get_shields();
+ if (shields && shields.checked) return false;
var joker = get_joker();
- if (joker) return (get_joker().checked);
+ if (joker) return (joker.checked);
else return false;
}
echo "<td style=\"vertical-align: top\">\n";
echo "<table>\n";
foreach ($endorsements as $e) {
+ if (Entry::EndorsementHidden($e)) continue;
$description = Entry::EndorsementDescription($e);
echo "<tr><td>$e</td><td>$description</td></tr>\n";
}
echo "[td]\n";
echo "[table]\n";
foreach ($endorsements as $e) {
+ if (Entry::EndorsementHidden($e)) continue;
$description = Entry::EndorsementDescription($e);
echo "[tr]";
echo "[td]";
class Entry extends BaseEntry
{
private static $ENDORSEMENTS = array(
- 'c' => array('entry cut short', 1 << 0),
- 'd' => array('docking computer', 1 << 1),
- 'f' => array('FSD injection', 1 << 2),
- 'j' => array('joker card', 1 << 3),
- 'x' => array('excluded from ranking', 1 << 4),
- 'm' => array('missing evidence', 1 << 5)
+ 'c' => array('entry cut short', false, 1 << 0),
+ 'd' => array('docking computer', false, 1 << 1),
+ 'f' => array('FSD injection', false, 1 << 2),
+ 'j' => array('joker card', false, 1 << 3),
+ 'x' => array('excluded from ranking', false, 1 << 4),
+ 'm' => array('missing evidence', false, 1 << 5),
+ 's' => array('shields', true, 1 << 6)
);
function Endorsements() {
return self::Endorsement($e)[0];
}
- function EndorsementValue($e) {
+ function EndorsementHidden($e) {
return self::Endorsement($e)[1];
}
+ function EndorsementValue($e) {
+ return self::Endorsement($e)[2];
+ }
+
function Sort($a, $b, $method, $reverse = false) {
$A = $a->$method(); $B = $b->$method();
if ($A == $B) return 0;
return $this->hasEndorsement('m');
}
+ function shields() {
+ return $this->hasEndorsement('s');
+ }
+
function getEndorsementString($delimiter = '') {
$ret = array();
foreach ($this->EndorsementKeys() as $e) {
+ if ($this->EndorsementHidden($e)) continue;
if ($this->hasEndorsement($e)) $ret[] = $e;
}
return implode($delimiter, $ret);