Baseball scorekeeping with a DIY Baseball Scorecard in html. See 'Create a Baseball Scorecard in Blogger' to set up your own scorecard blog. Scoring games with an on-line scoring form as part of the process of baseball writing (http://baseball---blog.blogspot.ca/).

Friday, June 17, 2011

JavaScript functions enable push-button
colour notation Baseball Scorekeeping


- indicate base-runners' progress with colour via buttons in pop-up menu


This is the "Minima III Scorecard" at-bat (AB) box - two, side by side in a table row. In a full scorecard this would be the first batter of the games' 1st and 2nd Inning at-bats. I'm showing two together like this in order to demonstrate all the properties of these new, JavaScript enabled AB boxes.




To indicate where it is, I've enabled the border property of the menu buttons on the First Base side of the of the infield icon (the little box on the south-east side of the diamond). If you click on it, a menu will appear just to the right of the first AB box - over top of the left side of the second AB box. It's the button that a scorer clicks to make a colour scoring notation on the First Base side of the infield icon. There are four invisible buttons, one on each side of the diamond - they open separate menus in the same place as the first - one on top of the other. If you've read any of the previous scorecards I've published at the Blogger Baseball Scorecard, you know I've developed a scoring system that uses text and colour notations.
(I've posted the "Colour Legend" and "The Scoring Notations" legends to the right.)

The menus, titled "First Base", "Second Base", "Third Base" and "Home" have a list of nine options for colouring each side of the diamond - or in other words, marking colour notations that indicate, at a glance, what happened on a play there. The different coloured words in the "Fist Base" menu list explain themselves. "Out", the word coloured red, is a colour notation that you click if the batter is put-out on the play in this at-bat. Clicking on the word "Out" creates a red triangle on the south-east, or First Base side of the diamond shaped infield icon.

Click down the list to see how it works - each colour indicated appears on the diamond as you click. If you make a mistake, the "White" and "00c900" return the particular triangle to it's original default colour. This works for each quadrant of each AB box, and each AB box has these menus. The other sides of the diamond have buttons too, just click on the side of the diamond you want to make a notation on, and a new menu will pop up. After you've made your colour choice, close the menu with the 'X' at the bottom-right.

The four menus in each AB box are have 'priority orders' assigned to them; the First Base Menu gets covered by the Second Base Menu, the Third Base Menu lays over top of the Second Base one, and finally - the Home menu lays over top of all of them. All menus remain open until you close them

There are 36 possible colour actions for each AB box. Each AB box also has 5 text areas, to write scoring notations in. The tall thin box on the left is for noting pitches thrown. Each side of the diamond in the AB box also have a text area. You can write as much as you wish in them - they have room for 5 lines, 12 characters wide before a scroll-bar opens (in Firefox 3 and 4 --- Microsoft IE 7 shows the scroll bar on default, and the buttons don't work and the text areas are dead - in other words, back to the drawing board [will this war never end?] - I will be fix these things soon).

Update - June 18, 2011: Microsoft IE no longer shows scrollbars on default, and the text areas get a blinking cursor with a click (click just above north boxes - yeh, I'm still working on it). Scroll-bars now open after 5 lines are filled.


Coding the Scorecard

I'm in the process of building the scorecard that these AB boxes are at the heart of. It's a bit of a time consuming process. In order that the four menus which accompany each AB box open in the correct relative position, and change the style property of the appropriate border element - each one of the 198 AB boxes that make up an 11 Inning scorecard has to have a unique address, or "id". Not only that, but each of the four menus in each AB box has a unique address too --- and, the nine colour choice buttons all have unique addresses! Is there a better way?

I thought JavaScript would be machines running various operations, like processors; but from what I've learned so far it seems like one function machine has to be 'hard wired' to preform only one event! That's a lot of code!

The beauty of the scorecard to this point, has been that all the 198 AB boxes were identical - this made it easy to build a scorecard - and with almost all of the style info in CSS - easy to change it. For example, I can 'inflate' the size of the entire scorecard with just a few changes to CSS, in about 5 minutes!

Not good - too much code with this JavaScript. Each AB box has 11 unique 'id' that need to be input at 39 spots in the code!! I think I'm going to have to use 'a machine' (like the 'Find and Replace' widget in NotePad++) to write each box, and then perhaps, each row.



mh
Colour Legend
(as of this date)
Neon Green is a Base Hit
Forest Green is a runner advanced by a Base Hit or a Sacrifice
Yellow is Intentional Base on Balls, Defensive Indifference, a Sacrafice or Fielder's Choice
Red is an out
Pink are un-earned bases - Wild Pitch, Passed Ball or an Error
Neon Blue is a Stolen Base
Navy Blue is a base earned via a Hit or a Sacrifice, that results in a Run Scored
The Scoring Notations
BB
Base on Balls - Batter to first base because the umpire ruled that pitched ball was the forth pitch of the at-bat out of the strike zone
HBP
Hit By Pitch - Batter is ruled by the umpire to have been hit by pitch - awarded one base
BH
Base Hit - Batter-runner safe at first base via a hit ball
2BH
Two Base Hit - Batter-runner safe at second base via a hit ball
3BH
Three Base Hit - Batter-runner safe at third base via a hit ball
HR
Home Run - Batter-runner safe at home plate via a hit ball
RBI
Run Batted In - via a SAC, a BH or a BB - a run scores
RS
Run Scored.
SAC
Sacrifice - With less than two outs the batter causes a base runner to advance but in the process, is put out
FC
Ball hit on the ground, fielded and a put out made anywhere but at 1B
DI
Defensive Indifference - A baserunner advances because the defence, for strategic reasons, does nothing
IBB
Intentional Base on Balls - The defences decides to walk a batter for strategic reasons






SB
Stolen Base - Base runner advances on a pitched ball despite the defence's best efforts
CS
Caught Stealing - A baserunner is put out while tring to advance on a pitch
K
Called third strike - Batter out because the umpire ruled that with two strikes in an at-bat, a pitched ball was in the strike zone
Ks
Batter out, swinging third strike
IFR
Infield Fly Rule - A ball popped up on the infield that an umpire rules is easily catch-able - batter-runner is out, the ball is dead
LO
Ball caught that was hit so hard it appears like the vector was a straight line
GO
Ball hit on the ground, fielded and the batter-runner is put out at 1B
FO
A high arching hit ball caught on the fly by a fielder
E
The defence allows runners to advance because of less than stallar play
Eth
The defence allows runners to advance because of less than stallar throw
WP
Wild Pitch - a pitched ball that bounces in and is not caught by the catcher and that results in a runner advancing
PB
Passed Ball - a pitched ball that doesn't bounce and is not caught by the catcher and that results in a runner advancing






pop
A ball hit in a high arch such that the distance travelled up is greater than the distance travelled from the plate
GR
To prevent injury, "Ground Rules" define what hit or thrown balls are in, and out of play - announced before each game by the home team manager
f
Hit ball caught in foul territory - for example "FO3f" - Fly Ball caught by First Base, foul
op
Out of Play - for example "FO5op", Fly ball caught by Third Base across the railing in the stands, or in the camera bay...
BRIF
Base runner is out for interfering with the defence while they're making a play on a batted ball
Kf2
Foul tip with 2 strikes, caught by catcher - strike three
-
-
-
-
-
-
-
-
-
-
-
-






No comments:

Post a Comment

StatCounter


View My Stats

Calling for a Public Inquiry into Policing at the G20 Summit.

Creative Commons License Blogger Baseball Scorecard Blog by Michael Holloway
is licensed under a Creative Commons Attribution 2.5 Canada License.
Permissions beyond the scope of this license may be available at michaelholloway111(at)gmail(dot)com