Update app.js

master
Andy Smy 2025-05-13 07:59:06 +01:00 committed by GitHub
parent 5cdc232853
commit 63c05d9076
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 6 deletions

View File

@ -145,6 +145,9 @@ function countDown(dir) {
processing = false;
return;
}
// Suppress dir when play after time
if(timeCalled)
counter -= dir;
// Correction to last ball of over
if(counter<0) {
counter = BALLS_PER_OVER -1;
@ -349,7 +352,7 @@ function showMainMenu() {
if(wickets>0)
scrollMenuItems.push(/*LANG*/"Recall Batter");
scrollMenuItems.push("Call Time");
scrollMenuItems.push("2nd Innings");
scrollMenuItems.push("New Innings");
if(!HRM)
scrollMenuItems.push("Start HRM");
}
@ -381,7 +384,7 @@ function showMainMenu() {
incrementWickets(1);
if(scrollMenuItems[idx]==/*LANG*/"Recall Batter")
incrementWickets(-1);
if(scrollMenuItems[idx]=="2nd Innings")
if(scrollMenuItems[idx]=="New Innings")
newInnings();
if(scrollMenuItems[idx]=="Start HRM"
|| scrollMenuItems[idx]=="Stop HRM") {
@ -394,7 +397,7 @@ function showMainMenu() {
function newInnings() {
var timeSig = new Date();
if(over!=0) { // next innings
if(over!=0) { // new innings
E.showPrompt(/*LANG*/"Start next innings?").
then(function(confirmed) {
if (confirmed) {
@ -416,7 +419,7 @@ function newInnings() {
menu = showMainMenu();
}
});
} else { // 1st innings
} else { // resume innings or start app
addLog(timeSig, OVERS_PER_INNINGS + 1, BALLS_PER_OVER,
"New Innings", require("locale").date(new Date(), 1));
}
@ -425,7 +428,7 @@ function newInnings() {
var file = require("Storage").open("matchlog.csv","a");
// save state on exit TODO WIP
E.on("kill", function() {
console.log("Umpire app closed");
console.log("Umpire app closed at " + (over-1) + "." + counter);
});
// start app
newInnings(); // prepare 1st innings