add link helper

This commit is contained in:
Jeremy Penner 2011-02-15 08:42:01 -08:00
parent c45e3cf00d
commit 200333b787

View file

@ -215,6 +215,11 @@ class Gst
@mpstId_dgOnClick.push([stId, dgOnClick])
stId
Link: (stText, dgOnClick, stExtra) ->
if not stExtra?
stExtra = ""
"<a href='javascript:void(0)' id='#{@RegOnClick(dgOnClick)}' #{stExtra}>#{stText}</a>"
RgwstRun: () ->
wst = @rgwstInit[@rgwstInit.length - 1].WstNext(@SectionCurrent().NevByName("start"))
eniWst = Nevgen.EniWst(this, wst)
@ -371,10 +376,7 @@ TemplateFromStNev = (st, wst) ->
word = wst.gst.SectionCurrent().WordByName(wst.gst, stWord)
if word? and (rgverb = word.Rgverb(wst)).length > 0
dgOnClick = (ev) -> wst.gst.ShowMenu(ev, this, rgverb)
stId = wst.gst.RegOnClick(dgOnClick)
JsStringLit("<a href='javascript:void(0)' id='#{stId}' class='iffy-word'>#{stDisplay}</a>")
JsStringLit(wst.gst.Link(stDisplay, ((ev) -> wst.gst.ShowMenu(ev, this, rgverb)), "class='iffy-word'"))
else
JsStringLit(stDisplay)
MatchInWord = MatchBracket(0, () -> PushText(true, StWord))
@ -450,8 +452,7 @@ class ActorPlayer
StHtmlUi: (wst) ->
if (wst.nev.player_nevIDRespondedTo?)
stId = wst.gst.RegOnClick(() => @RemoveResponse(wst.nev); wst.gst.Display())
"<a href='javascript:void(0)' id='#{stId}' class='iffy-undo'>Undo</a>"
wst.gst.Link("Undo", (() => @RemoveResponse(wst.nev); wst.gst.Display()), "class='iffy-undo'")
class Story
constructor: (@jStory) ->