From 6058bcd7b025b28dea159bd231218f1023e7bf5c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 31 May 2024 21:38:29 +0200 Subject: fix eslint issues --- play.js | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index e70b83e..68104e0 100644 --- a/play.js +++ b/play.js @@ -1,7 +1,7 @@ "use strict" // vim: set nowrap: -/* globals data, view, action_button, action_button_with_argument, confirm_action_button, send_action +/* globals data, view, action_button, action_button_with_argument, confirm_action_button, send_action, params, roles */ function toggle_pieces() { @@ -10,8 +10,6 @@ function toggle_pieces() { /* DATA */ -const max_power_troops = [ 32, 12, 16, 4, 30, 6, 20 ] - const P_PRUSSIA = 0 const P_HANOVER = 1 const P_RUSSIA = 2 @@ -89,7 +87,6 @@ const all_power_trains = [ /* F */ [ 33, 34 ], ] -const RESERVE = 4 let suit_class = [ "spades", "clubs", "hearts", "diamonds", "reserve" ] let suit_letter = [ "S", "C", "H", "D", "R" ] @@ -397,7 +394,6 @@ const ui = { prompt: document.getElementById("prompt"), status: document.getElementById("status"), header: document.querySelector("header"), - roads_element: document.getElementById("roads"), spaces_element: document.getElementById("spaces"), pieces_element: document.getElementById("pieces"), markers_element: document.getElementById("markers"), @@ -433,7 +429,6 @@ const ui = { document.getElementById("hand_france"), ], cities: [], - roads: [], action_register: [], } @@ -744,7 +739,7 @@ function layout_general_offset(g, s) { } } -function layout_general_count(g, s) { +function layout_general_count(s) { let n = 0 for (let i = 0; i < 24; ++i) if (view.pos[i] === s) @@ -794,7 +789,7 @@ function layout_general(id, s) { y = ELIMINATED_GENERAL_Y } else { n = layout_general_offset(id, s) - if (layout_general_count(id, s) === 3) + if (layout_general_count(s) === 3) n -= 1 x = data.cities.x[s] y = data.cities.y[s] @@ -865,10 +860,10 @@ function create_conquest(style, s) { function update_favicon() { let favicon = document.querySelector('link[rel="icon"]') switch (params.role) { - case "Frederick": favicon.href = "favicon/favicon_frederick.png"; break - case "Elisabeth": favicon.href = "favicon/favicon_elisabeth.png"; break - case "Maria Theresa": favicon.href = "favicon/favicon_maria_theresa.png"; break - case "Pompadour": favicon.href = "favicon/favicon_pompadour.png"; break + case "Frederick": favicon.href = "favicon/favicon_frederick.png"; break + case "Elisabeth": favicon.href = "favicon/favicon_elisabeth.png"; break + case "Maria Theresa": favicon.href = "favicon/favicon_maria_theresa.png"; break + case "Pompadour": favicon.href = "favicon/favicon_pompadour.png"; break } } @@ -884,14 +879,6 @@ const colorize_H = '\u2665' const colorize_D = '\u2666' const colorize_R = '$1R' -const suit_text = [ - '\u2660', - '\u2663', - '\u2665', - '\u2666', - 'R' -] - function colorize(text) { text = text.replaceAll("\u2660", colorize_S) text = text.replaceAll("\u2663", colorize_C) @@ -1131,24 +1118,19 @@ const piece_tooltip_name = [ "French supply train", ] -function sub_piece(match, p1) { +function sub_piece(_match, p1) { let x = p1 | 0 let n = piece_log_name[x] let p = power_class[piece_power[x]] return `${n}` - return n } -function sub_space(match, p1) { +function sub_space(_match, p1) { let x = p1 | 0 let n = data.cities.name[x] return `${n}` } -function sub_tc(match, p1) { - return value + suit_text[suit] -} - function on_log(text) { let p = document.createElement("div") -- cgit v1.2.3