A substitute for the javascript Confirm and Alert boxes?

69 views
Skip to first unread message

Stephen Kimmel

unread,
Apr 26, 2016, 9:02:11 AM4/26/16
to TiddlyWiki
Has someone come up a substitute for the javascript confirm and alert boxes that can be styled? My understanding is that the functions built into the browser's javascript can not be styled at all and I find them too bright for the color palettes I'm using. What I like is something where I could edit navigator.js, change the references from confirm(whatever) to something like tbconfirm(whatever). Then I could add some css to a stylesheet and change the colors or fonts of the confirm dialog boxes.

Has someone done something like that with TW5?

Devin Weaver

unread,
Apr 26, 2016, 5:54:13 PM4/26/16
to TiddlyWiki
I have looked into this. The problem is that any type of user themed confirmation prompt is asynchronous. But the browser built in version actually blocks code execution. In the places that TiddlyWiki needs a confirmation it depends on that code blocking. In other words the need to use the browsers built in confirm dialog is deeply embedded in the TW code and would require significant work to change the core design and support asynchronous user input.

Sadly, I don't think Jeremey nor any of the contributors are up to the task with everything else going on.

But one could dream because I would love this feature.

Jeremy Ruston

unread,
Apr 27, 2016, 9:21:41 AM4/27/16
to tiddl...@googlegroups.com
Thanks Devin, I was going to reply to make the same point.

In practice, I think all of the alert()'s in the core could actually be replaced; I don't think any of them rely on the synchronous behaviour.

It's the confirm()s and prompt()s that are the difficulty; they are used freely in navigator.js in a manner which requires them to be synchronous. But I've always considered that to be a bit of a hack, and I'd be delighted to wake up and find that they had been refactored away. But I think it would be quite tricky: we'd have to completely change how we handle the associated messages in navigator.js.

Best wishes

Jeremy

--
Jeremy Ruston
jer...@jermolene.com
http://jermolene.com
> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
> To post to this group, send email to tiddl...@googlegroups.com.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/35c016d2-c29d-4559-b30b-7432833eacdb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages