API Docs for: 1.4.4
Show:

ugsChordBuilder.ChordDefinition Class

entity for storing raw chord info; attached to the LI via id

Methods

definitionAdd

(
  • name
  • definition
)
Int

Adds new chord definition to our Dictionary array. Returns the new item's Id (int).

Parameters:

  • name String
  • definition String

Returns:

Int:

dictionaryFind

(
  • id
)
ChordDefinition

Returns the entry for Id from Chord Dictionary

Parameters:

  • id Int

Returns:

ChordDefinition:

dictionaryFindDupes

(
  • id
  • name
)
Int

Returns index of the duplicate chord name. Pass in Id of the chord to be ignored, (i.e. the one currently being edited). Comparison ignores case. Returns -1 if no dupe is found.

Parameters:

  • id Int
  • name String

Returns:

Int:

dictionaryGetIndex

(
  • id
)
Int

Returns Index of Id within the chord Dictionary or -1 if not found.

Parameters:

  • id Int

Returns:

Int:

doDelete description]

(
  • chord
)
Void

Handles confirming & removing a chord from the list and the song.

Parameters:

  • chord ChordDefinition

Returns:

Void:

hasMutedStrings

(
  • chord
)
Boolean

Checks whether any of the Chord's strings have been muted.

Parameters:

  • chord ugs.chord

Returns:

Boolean:

init

(
  • setChordFunction
)

Parameters:

  • setChordFunction Function

listAddDiagram

()

Adds mini-chord diagram to the list item found by Id.

listAddItem

(
  • id
  • name
)

Appends a new HTML ListItem to our UL.

Parameters:

  • id Int
  • name String

listGetItem

(
  • id
)
DOM_LI

finds the HTML ListItem corresponding to Id

Parameters:

  • id Int

Returns:

DOM_LI:

listHtmlString

(
  • id
  • name
  • isInner
)
String

Returns HTML snippet for an LI

Parameters:

  • id Int
  • name String
  • isInner Bool

    (optional) if TRUE only reutrns the inner HTML part, otherwise returns complete LI tag

Returns:

String:

listLoad

(
  • ul
  • chordDefs
)

Clears and loads the HTML UL using currently values in Chord Dictionary

Parameters:

  • ul DOM_UL
  • chordDefs Array

listUpdate

(
  • id
)
DOM_LI

updates an exiting HTML ListItem (LI) using the info stored for Id in the chord dictionary (array). Appends new ListItem if not found.

Parameters:

  • id Int

Returns:

DOM_LI:

onClick

(
  • evt
)

ListItem click event handler

Parameters:

  • evt Event

replaceAll

(
  • text
  • searchValue
  • newValue
)
String

Using just a bit of recursion performs as advertised: replaces all occurences of searchValue with newValue within text (haystack). DANGER: it is, of course, for this to get hung in an infinite loop if new value inclues complete search value. :D

Parameters:

  • text String
  • searchValue String
  • newValue String

Returns:

String:

save

(
  • data
)
Bool

Returns TRUE if Save completed OK, false otherwise (duplicate name or unable to update)

Parameters:

  • data JSON

Returns:

Bool:

show

(
  • isChooserPanel
)
public

Shows either the "Chooser" or "Chord Builder/Editor" panel.

Parameters:

  • isChooserPanel Bool

songAddDefinition

(
  • definition
)

Inserts the passed chord definition into the song (and reruns Sscriptasaurus). The chord insertion point is at the end of either the song meta tags or the existing chord defintion block. Determined by the last "header" tag line.

Parameters:

  • definition String

songGetDefinitions

()

Loops over all lines in "text" and extracts any {define:...} statements, adding them to the ChordDictionary.

songReplace

(
  • oldDefinition
  • newDefinition
)
Void

Updates Source and Runs Scriptasaurus after updaint the definition

Parameters:

  • oldDefinition String
  • newDefinition String

Returns:

Void: