Changeset View
Standalone View
binaries/data/mods/mod/gui/common/guitags.js
/* | |||||
* Set GUI tags on text string. | |||||
* @param {string} string - String to set tags around. | |||||
bb: The description should tell how the tags object looks like and what it exactly does
(maybe just… | |||||
* @param {object} tags - Object with tags like { "color": "white" } or { "font": "sans-13" }. | |||||
* @returns {string} string - String surrounded by tags. | |||||
Not Done Inline Actionss/text/string ?? bb: s/text/string ?? | |||||
Not Done Inline ActionsMaybe setStringTags bb: Maybe setStringTags | |||||
Not Done Inline Actionsperiod bb: period | |||||
Not Done Inline ActionsMaybe mention what the tags do explicitly, but not entirely convinced that is required/useful myself. bb: Maybe mention what the tags do explicitly, but not entirely convinced that is required/useful… | |||||
bbUnsubmitted Done Inline Actionsno s, no string: bb: no s, no string:
` * @return {string} - String surrounded by tags.` | |||||
ffffffffAuthorUnsubmitted Not Done Inline ActionsFound both @return and @returns in the project code. @return seem php: http://www.phpdoc.de/kongress/return.html ffffffff: Found both @return and @returns in the project code.
@return seem php: http://www.phpdoc. | |||||
elexisUnsubmitted Not Done Inline Actionssee that synonyms part elexis: see that synonyms part
see also my comments about the naming of functions | |||||
*/ | |||||
Done Inline Actions@return? bb: @return? | |||||
Not Done Inline ActionsThe @return part is redundant with the function description. elexis: The @return part is redundant with the function description.
Surrounding (umzingeln) and around… | |||||
function setStringTags(string, tags) | |||||
Not Done Inline Actionss/i/tag bb: s/i/tag | |||||
Not Done Inline ActionssetGUITags? guiTags? elexis: setGUITags? guiTags? | |||||
Not Done Inline ActionssetStringTags ok too. I'll move this below the color setter because functions should be sorted from less complex to more complex. elexis: setStringTags ok too.
I'll move this below the color setter because functions should be sorted… | |||||
{ | |||||
for (let tag in tags) | |||||
text = '[' + tag + '="' + tags[tag] + '"]' + string + '[/' + tags[tag] + ']'; | |||||
bbUnsubmitted Done Inline Actionssecond tags[tag] => tag (or am I stupid?) bb: second `tags[tag]` => `tag` (or am I stupid?) | |||||
elexisUnsubmitted Not Done Inline ActionsSeems correct to not escape anything, because we do want to be able to use that function recursively and gui tags never contain quotes. So did anyone notice that this fixes all the inconsistencies of quoted quotes? (Sometimes ' being used, othertimes quotes being escaped)? elexis: Seems correct to not escape anything, because we do want to be able to use that function… | |||||
ffffffffAuthorUnsubmitted Not Done Inline ActionsI ffffffff: I | |||||
return string; | |||||
} | |||||
/** | /** | ||||
* Add color to text string. | * Add color to text string. | ||||
*/ | */ | ||||
function coloredText(text, color) | function coloredText(text, color) | ||||
{ | { | ||||
return '[color="' + color + '"]' + text + '[/color]'; | return '[color="' + color + '"]' + text + '[/color]'; | ||||
Not Done Inline Actionscan use it here too elexis: can use it here too | |||||
Not Done Inline Actionssorry noise, constructing and deconstructing object seems slightly pointless and we want to nuke the function anyhow elexis: sorry noise, constructing and deconstructing object seems slightly pointless and we want to… | |||||
} | } | ||||
Done Inline Actionsthose can be removed though bb: those can be removed though
(my considerations were saying, do this patch, but do not make… | |||||
Not Done Inline ActionsOne function is functionally complete, drop the rest. elexis: One function is functionally complete, drop the rest.
Not having the other functions means it's… | |||||
//TODO: font setter |
The description should tell how the tags object looks like and what it exactly does
(maybe just make the @param thingies)