I'm trying to adapt the pop-up menu from the "One with Everything" demo in such a way that a given command will appear in the menu only once, until it's used. I can't see how to do this. Here's what I tried:
Code:
+ vorple.html.p(
vorple.html.link([
{
content: 'Look at her',
url: './lookatjulia',
classes: 'once'
},
{
content: 'Talk to her',
url: './talktojulia'
}
],
'Julia' ,
{ classes: 'transient' }
)
+ " kneels at the prow, leaning forward over the onrushing sea."
)
However, setting the upper item to classes: 'once' has no effect. The command is still in the menu after being used, and can be used again. Obviously, I don't want the make the whole link 'once', because it will ultimately contain four or five commands. I just want 'once' to apply to individual commands within it.
This code is declarative rather than procedural, so there's no obvious way to insert an if-test. I could possibly insert an if-test at the very start of the enter function, but that would mean duplicating the entire system.write block 2-to-the-(n-minus-1) times, where n is the number of menu items that may need to be shut off. That type of thing would be hideous to maintain, so there just has to be an easier solution. But I'm nowhere near familiar enough with Javascript, CSS, or the Vorple library to see how to do it.
Suggestions would be much appreciated!