Generating a NodeBB toaster from UserScript
-
Simply put, is it possible to make a toaster appear from a GreaseMonkey script? I created a little script for myself that allows me to select topics in /unread, and hit a new button next to the New Topic button to ignore the selected topics. I just thought it would be nicer to use a toaster instead of the normal JavaScript
alert()
function.
-
Use app.alert:
app.alert({ alert_id: 'some_id', title: 'your toaster title', message: 'something stupid', clickfn: () => { console.log('something'); }, type: 'warning', // I don't know the types });
You may not need all of the things.
-
@hungrier Well, that was simple enough. Thanks!
For future reference, three of the types are
"success"
,"warning"
and"danger"
(that's the red one).
-
@erufael Additionally, set the
timeout
parameter so that they can disappear on their own. :D
-
@erufael said in Generating a NodeBB toaster from UserScript:
@hungrier Well, that was simple enough. Thanks!
For future reference, three of the types are
"success"
,"warning"
and"danger"
(that's the red one).Yes, Bootstrap.
-
@tsaukpaetra said in Generating a NodeBB toaster from UserScript:
@erufael said in Generating a NodeBB toaster from UserScript:
@hungrier Well, that was simple enough. Thanks!
For future reference, three of the types are
"success"
,"warning"
and"danger"
(that's the red one).Yes, Bootstrap.
So in theory,
info
should work too for a blue toaster.
-
Hopefully
talkie
isn't an option.
-
@erufael said in Generating a NodeBB toaster from UserScript:
I created a little script for myself that allows me to select topics in /unread, and hit a new button next to the New Topic button to ignore the selected topics
What's wrong with the existing button that does exactly that?
-
@jaloopa said in Generating a NodeBB toaster from UserScript:
@erufael said in Generating a NodeBB toaster from UserScript:
I created a little script for myself that allows me to select topics in /unread, and hit a new button next to the New Topic button to ignore the selected topics
What's wrong with the existing button that does exactly that?
Reading comprehension fail. He was ignoring topics, not marking them read.
-
@tsaukpaetra d'oh!