The DRAFT1846Com File

From BOARD18 Project WIKI
Jump to navigation Jump to search
DRAFT1846 Design edit

This file contains scripts that are common to many draft1846 web pages.

All draft1846 global variables are contained in one 'master variable' called D1846.
This isolates them from global variables in other packages.
D1846 is initialized here too.

Page Resizing Functions

These 2 functions control the sizing of all DRAFT1846 pages.

function setPage()

Function setPage() adjusts the height and width of rightofpage and the height of lefttofpage.
It is triggered by the resize() function.

function resize()

Function resize() is triggered whenever a window resize event occurs.
Function resize() waits for 200 ms (2 seconds) before executing setPage().
Multiple window resize events that occur within this time peroid will only trigger the setPage function once.

Utility Functions

As it turns out, these functions are actually only used by draft1846Next. But I haven't bothered to move them

function fillHand()

Function fillHand() deals the top cards from DD1846.deck to DD1846.hand. It deals 2 more cards than the number of players.
Function fillHand() returns FALSE if D1846.deck is empty or contains only blank cards when the function is called.

function emptyHand()

Function emptyHand() coppies all cards from DD1846.hand to the bottom of DD1846.deck. It then empties DD1846.hand.

Functions only used by draft1846Next and by draft1846Last

function draftDone()

The draftDone function deletes any previously displayed player status table. It then appends the final player status table to the draftrpt div.
The final player status table shows all status for all players. Finally, The draftDone function appends a draft completed message to the 'did' paragraph.

function playerDisplay()

The playerDisplay function deletes any previously displayed player status table. It then appends a current player status table to the draftrpt div.