ugsChordBuilder.ChordDefinition Class
entity for storing raw chord info; attached to the LI via id
Item Index
Methods
definitionAdd
-
name -
definition
Adds new chord definition to our Dictionary array. Returns the new item's Id (int).
Parameters:
-
nameString -
definitionString
Returns:
dictionaryFind
-
id
Returns the entry for Id from Chord Dictionary
Parameters:
-
idInt
Returns:
dictionaryFindDupes
-
id -
name
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:
-
idInt -
nameString
Returns:
dictionaryGetIndex
-
id
Returns Index of Id within the chord Dictionary or -1 if not found.
Parameters:
-
idInt
Returns:
doDelete description]
-
chord
Handles confirming & removing a chord from the list and the song.
Parameters:
-
chordChordDefinition
Returns:
hasMutedStrings
-
chord
Checks whether any of the Chord's strings have been muted.
Parameters:
-
chordugs.chord
Returns:
init
-
setChordFunction
Parameters:
-
setChordFunctionFunction
listAddDiagram
()
Adds mini-chord diagram to the list item found by Id.
listAddItem
-
id -
name
Appends a new HTML ListItem to our UL.
Parameters:
-
idInt -
nameString
listGetItem
-
id
finds the HTML ListItem corresponding to Id
Parameters:
-
idInt
Returns:
listHtmlString
-
id -
name -
isInner
Returns HTML snippet for an LI
Parameters:
-
idInt -
nameString -
isInnerBool(optional) if TRUE only reutrns the inner HTML part, otherwise returns complete LI tag
Returns:
listLoad
-
ul -
chordDefs
Clears and loads the HTML UL using currently values in Chord Dictionary
Parameters:
-
ulDOM_UL -
chordDefsArray
listUpdate
-
id
updates an exiting HTML ListItem (LI) using the info stored for Id in the chord dictionary (array). Appends new ListItem if not found.
Parameters:
-
idInt
Returns:
onClick
-
evt
ListItem click event handler
Parameters:
-
evtEvent
replaceAll
-
text -
searchValue -
newValue
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:
-
textString -
searchValueString -
newValueString
Returns:
save
-
data
Returns TRUE if Save completed OK, false otherwise (duplicate name or unable to update)
Parameters:
-
dataJSON
Returns:
show
-
isChooserPanel
Shows either the "Chooser" or "Chord Builder/Editor" panel.
Parameters:
-
isChooserPanelBool
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:
-
definitionString
songGetDefinitions
()
Loops over all lines in "text" and extracts any {define:...} statements, adding them to the ChordDictionary.
songReplace
-
oldDefinition -
newDefinition
Updates Source and Runs Scriptasaurus after updaint the definition
Parameters:
-
oldDefinitionString -
newDefinitionString
