I am thinking that if you did the layout with CSS instead of as a table, the problem of having an extra board or extra white space on Apple devices would go away.
I don't really understand what it means to do the layout with CSS. I was under the impression that CSS is just a method for globally assigning style attributes to HTML elements. The same style elements that can also be set on a per-element basis by a style="name:value" attribute in a HTML element, or by assigning to it in JavaScript as <element>.style.name = value.
So if the board is not a table, how would a program specify which image should be drawn where on the page, and to reserve space for that?
In the Diagram script the function Display() is quite independent from the rest of the program; its only function is to read the board[rank][file] array, and draw the image. If there exists another method for making a board diagram appear on the screen, a routine using that method could easily be used as replacement without the rest of the program knowing about it.
Another issue is how to arrange mouse-click input. This is now handled by attaching event handlers (for mouse down or up, touch, hover etc.) to the individual cells, which get the (diagram number, rank, file) as parameters to indicate what was clicked. Each table cell would have its own calls to these handlers, passing the parameters to reveal their identity. If there is no table I don't know what HTML element would accept the clicks (a canvas?), but there could be some 'master handler' that gets passed the coordinates of the click location in some way in pixels, and then calculates which board cell such a click would belong to. And then call the existing handlers for that type of event passing tose deduced (rank, file) numbers.
I don't really understand what it means to do the layout with CSS. I was under the impression that CSS is just a method for globally assigning style attributes to HTML elements. The same style elements that can also be set on a per-element basis by a style="name:value" attribute in a HTML element, or by assigning to it in JavaScript as <element>.style.name = value.
So if the board is not a table, how would a program specify which image should be drawn where on the page, and to reserve space for that?
In the Diagram script the function Display() is quite independent from the rest of the program; its only function is to read the board[rank][file] array, and draw the image. If there exists another method for making a board diagram appear on the screen, a routine using that method could easily be used as replacement without the rest of the program knowing about it.
Another issue is how to arrange mouse-click input. This is now handled by attaching event handlers (for mouse down or up, touch, hover etc.) to the individual cells, which get the (diagram number, rank, file) as parameters to indicate what was clicked. Each table cell would have its own calls to these handlers, passing the parameters to reveal their identity. If there is no table I don't know what HTML element would accept the clicks (a canvas?), but there could be some 'master handler' that gets passed the coordinates of the click location in some way in pixels, and then calculates which board cell such a click would belong to. And then call the existing handlers for that type of event passing tose deduced (rank, file) numbers.
None of this should be very difficult.