Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CrosswordGame

Crossword game

Hierarchy

  • CrosswordGame

Index

Properties

Protected acrossCluesContainer

acrossCluesContainer: JQuery

Container element of the across clues list

Protected acrossCluesList

acrossCluesList: JQuery

Across list element

Protected board

board: JQuery

Board

Protected cluesRegistry

cluesRegistry: object

Registry of the clues. The key is the number of the clue

Type declaration

Protected definition

definition: CrosswordDefinition

Definition to use. Passed as CrosswordOptions.definition

Protected disabled

disabled: boolean

Disabled state

Protected downCluesContainer

downCluesContainer: JQuery

Container element of the down clues list

Protected downCluesList

downCluesList: JQuery

Down list element

Protected element

element: JQuery

Root element of the plugin

Protected interaction

interaction: boolean

Used to prevent duplicated events when interacting with the list or the cells

Protected options

Current options

Protected registryActive

registryActive: CrosswordClueRegistry

Clue registry active

Protected registryCellActive

registryCellActive: CrosswordCellRegistry

Cell registry active

Protected rowsRegistry

rowsRegistry: CrosswordRowRegistry[]

Rows registry

Methods

Private _activateClue

  • _activateClue(clue: CrosswordClueDefinition): void
  • Activate a clue. Store the activated clue in registryActive

    Parameters

    • clue: CrosswordClueDefinition

      Registry of the clue to activate

    Returns void

Private _addEvents

  • _addEvents(): void

Private _addInfoToCellElement

  • _addInfoToCellElement(cell: JQuery, cellDefinition: CrosswordCell): void
  • Add info to the cell element like classes and attributes

    Parameters

    • cell: JQuery
    • cellDefinition: CrosswordCell

    Returns void

Private _addInfoToListElement

  • _addInfoToListElement(listItem: JQuery, clueDefinition: CrosswordClueDefinition): void
  • Add info to the list element like classes and attributes

    Parameters

    • listItem: JQuery
    • clueDefinition: CrosswordClueDefinition

    Returns void

Private _checkCellAnswer

Private _construct

  • _construct(): void

Private _create

  • _create(): void

Private _createAcrossCluesList

  • _createAcrossCluesList(): void

Private _createBoard

  • _createBoard(): JQuery
  • Create the main element for the board By default is a table If the option "createBoard" is provided, will be used instead

    Returns JQuery

Private _createCell

  • _createCell(definition: CrosswordCell): JQuery
  • Create a cell for the board By default is a td If the option "createCell" is provided, will be used instead

    Parameters

    • definition: CrosswordCell

      The definition object for the cell

    Returns JQuery

Private _createCellField

  • _createCellField(definition: CrosswordCell): JQuery
  • Create a cell field for the board By default is a input If the option "createCellField" is provided, will be used instead

    Parameters

    • definition: CrosswordCell

      The definition object for the cell

    Returns JQuery

Private _createClueRegistry

  • _createClueRegistry(): object

Private _createCluesList

  • _createCluesList(across: boolean): JQuery
  • Create a list of clues If the option "createCluesList" is provided, will be used instead

    Parameters

    • across: boolean

    Returns JQuery

Private _createCluesListContainer

  • _createCluesListContainer(across: boolean): JQuery
  • Create the container of a list of clues. If the option "createCluesListContainer" is provided, will be used instead

    Parameters

    • across: boolean

    Returns JQuery

Private _createCluesListItem

  • _createCluesListItem(definition: CrosswordClueDefinition): JQuery
  • Create a clue list item. If the option "createCluesListContainer" is provided, will be used instead

    Parameters

    • definition: CrosswordClueDefinition

      Definition

    Returns JQuery

Private _createCluesLists

  • _createCluesLists(): void

Private _createDefinition

  • _createDefinition(): void

Private _createDownCluesList

  • _createDownCluesList(): void

Private _createRow

  • _createRow(rowIndex: number): JQuery
  • Create a row of the board. By default is a tr If the option "createRow" is provided, will be used instead. The row is optional, if the function returns a null the cells will be attached to the board directly. Useful for use css grid

    Parameters

    • rowIndex: number

      The index of the row

    Returns JQuery

Private _getCellFor

  • Get the cell registry related to an other registry

    example

    _getCellFor(someCell,true,false);//will look in vertical by decrease, the result is the cell above the registry passed to the function

    Parameters

    • cell: CrosswordCellRegistry

      Registry related

    • vertical: boolean

      If true, will search in vertical. Otherwise in horizontal

    • increase: boolean

      If true, will search by increment. Otherwise by decrease

    Returns CrosswordCellRegistry

Private _getCreateOptions

Private _getDefinitionForClosestToFirstLetter

  • _getDefinitionForClosestToFirstLetter(cell: CrosswordCell): any
  • Get the definition for a clue based on the position of the letter. If the cell has across and down definitions, returns the definition for which the cell is closest to the first letter If the cell has only one definition, returns that definition

    Parameters

    • cell: CrosswordCell

    Returns any

Private _getNextOrPrevClueFrom

  • Get the next or prev clue related to a registry

    Parameters

    • cellRegistry: CrosswordCellRegistry
    • next: boolean

      If true, will look for the next clue, otherwise will look for the prev clue

    Returns any

Private _onFieldBlur

  • _onFieldBlur(e: any): void
  • Invoked when a field lose focus. Clear the active clue and cell

    Parameters

    • e: any

    Returns void

Private _onFieldChange

  • _onFieldChange(e: any): void
  • Invoked when the field changes. Moves the focus to the next cell

    Parameters

    • e: any

    Returns void

Private _onFieldFocus

  • _onFieldFocus(e: any): void
  • Invoked when a field receives focus. Goes to the cell

    Parameters

    • e: any

    Returns void

Private _onFieldKey

  • _onFieldKey(e: any): void

Private _onListItemClick

  • _onListItemClick(e: any): void
  • Invoked when a item of the clues list is clicked. Enables the clue and navigates to the first cell

    Parameters

    • e: any

    Returns void

Private _storeAndCheckAnswer

Protected _updateClueStateClass

check

  • check(): void

checkClue

clearActive

  • clearActive(): void

destroy

  • destroy(): void

disable

  • disable(): void

enable

  • enable(): void

goToCell

  • Move the cursor to a cell. Also activates the related clue. If the cell has one clue, the focus will be to the active clue or to the clue related to the cell If the cell has two clues, the focus will be to the clue for which the cell is the first letter. If none of the cells are the first letter, the focus will go to the current clue, or, if there isn't a current clue, the focus will go to the clue for which the cell is closest to the first letter

    Parameters

    • yOrCell: number | CrosswordCellRegistry

      Could be a number or a CrosswordCellRegistry.

    • Optional x: number

    Returns CrosswordCellRegistry

    The activated cell regitry

Private goToCellAbove

  • goToCellAbove(): void

goToCellBelow

  • goToCellBelow(): void

goToCellLeft

  • goToCellLeft(): void
  • Moves the focus to the cell at the left side of the current one

    Returns void

goToCellRight

  • goToCellRight(): void
  • Moves the focus to the cell at the right side of the current one

    Returns void

goToNextWord

  • goToNextWord(): void

goToPrevWord

  • goToPrevWord(): void

solve

  • solve(): void

Generated using TypeDoc