diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-19 11:38:25 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 12:12:42 +0100 |
commit | d70b3cdf98919c89f1ba481a700d79d84fe3c43d (patch) | |
tree | 783d76368575a15791f23b8a8f101101da5fb030 | |
parent | 2c807d4ce8a075f588b3b054b0652d42a99a096f (diff) | |
download | shores-of-tripoli-d70b3cdf98919c89f1ba481a700d79d84fe3c43d.tar.gz |
tripoli: Show disabled card popup menu items too.
Stable menu items should prevent some mis-clicks.
-rw-r--r-- | play.html | 24 | ||||
-rw-r--r-- | ui.js | 25 |
2 files changed, 26 insertions, 23 deletions
@@ -166,19 +166,23 @@ svg circle, .piece { /* CARD ACTION POPUP MENU */ #popup { - position: absolute; + position: fixed; user-select: none; - background-color: #ddd; + background-color: gainsboro; left: 10px; top: 100px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.3); z-index: 200; min-width: 20ex; white-space: nowrap; + display: none; } -#popup div { padding: 3pt 8pt; display: none; } -#popup div.enabled { padding: 3pt 8pt; display: block; } -#popup div:hover { background-color: teal; color: white; } +#popup div { padding: 3pt 8pt; color: gray; display: none; } +#popup div.enabled { color: black; display: block; } +#popup div.enabled:hover { background-color: teal; color: white; } +#popup div.always { display: block; } +.Tripolitania ~ .grid_center > #popup > .tr_always { display: block; } +.United_States ~ .grid_center > #popup > .us_always { display: block; } /* CARD IMAGES */ @@ -481,12 +485,12 @@ svg circle, .piece { </div> <div id="popup" onmouseleave="hide_popup_menu()"> -<div id="menu_card_event" onclick="on_card_event()">Play Event</div> +<div id="menu_card_event" class="always" onclick="on_card_event()">Play Event</div> +<div id="menu_card_move_frigates" class="us_always" onclick="on_card_move_frigates()">Discard to move two frigates</div> +<div id="menu_card_build_gunboat" class="us_always" onclick="on_card_build_gunboat()">Discard to build a gunboat</div> +<div id="menu_card_pirate_raid" class="tr_always" onclick="on_card_pirate_raid()">Discard to pirate raid</div> +<div id="menu_card_build_corsair" class="tr_always" onclick="on_card_build_corsair()">Discard to build a corsair</div> <div id="menu_card_take" onclick="on_card_take()">Place in hand</div> -<div id="menu_card_move_frigates" onclick="on_card_move_frigates()">Discard to move two frigates</div> -<div id="menu_card_pirate_raid" onclick="on_card_pirate_raid()">Discard to pirate raid</div> -<div id="menu_card_build_gunboat" onclick="on_card_build_gunboat()">Discard to build a gunboat</div> -<div id="menu_card_build_corsair" onclick="on_card_build_corsair()">Discard to build a corsair</div> </div> </div> @@ -212,7 +212,6 @@ function on_update() { function update_year_marker(year) { let e = document.getElementById("year"); - console.log("year", e); e.style.left = Math.round(YEAR_X[year] - 27) + "px"; e.style.top = Math.round(YEAR_Y - 27) + "px"; } @@ -388,33 +387,33 @@ function hide_popup_menu() { } function on_card_event() { - send_action('card_event', current_popup_card); - hide_popup_menu(); + if (send_action('card_event', current_popup_card)) + hide_popup_menu(); } function on_card_take() { - send_action('card_take', current_popup_card); - hide_popup_menu(); + if (send_action('card_take', current_popup_card)) + hide_popup_menu(); } function on_card_move_frigates() { - send_action('card_move_frigates', current_popup_card); - hide_popup_menu(); + if (send_action('card_move_frigates', current_popup_card)) + hide_popup_menu(); } function on_card_pirate_raid() { - send_action('card_pirate_raid', current_popup_card); - hide_popup_menu(); + if (send_action('card_pirate_raid', current_popup_card)) + hide_popup_menu(); } function on_card_build_gunboat() { - send_action('card_build_gunboat', current_popup_card); - hide_popup_menu(); + if (send_action('card_build_gunboat', current_popup_card)) + hide_popup_menu(); } function on_card_build_corsair() { - send_action('card_build_corsair', current_popup_card); - hide_popup_menu(); + if (send_action('card_build_corsair', current_popup_card)) + hide_popup_menu(); } function is_card_action(action, card) { |