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:
-
name
String -
definition
String
Returns:
dictionaryFind
-
id
Returns the entry for Id from Chord Dictionary
Parameters:
-
id
Int
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:
-
id
Int -
name
String
Returns:
dictionaryGetIndex
-
id
Returns Index of Id within the chord Dictionary or -1 if not found.
Parameters:
-
id
Int
Returns:
doDelete description]
-
chord
Handles confirming & removing a chord from the list and the song.
Parameters:
-
chord
ChordDefinition
Returns:
hasMutedStrings
-
chord
Checks whether any of the Chord's strings have been muted.
Parameters:
-
chord
ugs.chord
Returns:
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
finds the HTML ListItem corresponding to Id
Parameters:
-
id
Int
Returns:
listHtmlString
-
id
-
name
-
isInner
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:
listLoad
-
ul
-
chordDefs
Clears and loads the HTML UL using currently values in Chord Dictionary
Parameters:
-
ul
DOM_UL -
chordDefs
Array
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:
-
id
Int
Returns:
onClick
-
evt
ListItem click event handler
Parameters:
-
evt
Event
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:
-
text
String -
searchValue
String -
newValue
String
Returns:
save
-
data
Returns TRUE if Save completed OK, false otherwise (duplicate name or unable to update)
Parameters:
-
data
JSON
Returns:
show
-
isChooserPanel
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
Updates Source and Runs Scriptasaurus after updaint the definition
Parameters:
-
oldDefinition
String -
newDefinition
String