> I want to disable the browser's back and forward buttons in favor of
> controlling all navigation from within the story. Is modifying the
> Glorious Trainwrecks code ... the best way to do that in SugarCube?
No. Don't use that, you'll break everything, everywhere, forever.
Let me see what I can do.
> (I'm planning to use Transition CSS.)
No. Don't use that, you'll break everything, everywhere, forever.
In this case, nothing much should need to be done. SugarCube's
passage transition code is largely compatible with Transition CSS.
There are some differences, but I can't say if they'd affect you.
> Alternatively, is there a way to hook an event onto the back
> button/forward button? I need to be able to cancel ongoing media
> events (sounds playing) if I do allow the back button.
Using the browser's back/forward buttons, or anything which provides
the same functionality (e.g. mice with back/forward button), generates
a "popstate" event, so you can do something like this: [snip]
Note: You, generally, do not want to be calling a macro's handler
directly like that, because it won't have a proper execution context
(or a proper set of arguments for old-style macros), however, the
stopAllSounds handler doesn't use any of that anyway, so it's okay
in this case.
macros.add("redirectSoundPlay", {
handler: {
macro_string = '<<playSound ' + this.args[0] + ' >>';
Wikifier.parse(macro_string);
}
});
On Nov 28, 2013 10:58 PM, "Thomas Michael EDWARDS" <tmed...@motoslave.net> wrote:
> I'm assuming this is a follow on to the "Is there a more robust way
> to generate a macro call from javascript?" question.
Yes, and you're reading my intent correctly throughout. With that pseudocode, I was trying to give a much simplified example of how you might call a macro from the using the wikifier, without trying to come up with context for an example that showed why you might want to do that.
> > Maybe that's a weird workaround (assuming it's even viable), but it
> > might be easier for some folks than reconfiguring existing macros...
>
> OK. You lost me. Why would anyone need to reconfiguring existing
> macros?
I thought the thrust of your previous post was that it is possible to call macros with parameters from javascript, but only if their handlers have been set up to not require the execution context object. I was merely suggesting that the wikifier might be an alternate way to approach things.
Anyway, I agree that you can do most of what you'd ever need to do with widgets. As I said in my previous, this was mostly just a "what if I needed to do this" type thought experiment. Thanks for looking at it with me!