Alertify.js
github.com
github.com
EDIT: Care to explain why I'm getting downvoted? Said nothing offensive, and I'm clearly on-topic.
When they execute, they run a callback with the input provided. Inside that callback, do whatever you need to do that requires some input.
All I'm trying to say is that allowing custom defined objects to have the ability to block execution can be very handy in certain instances. I by no means was criticizing the alertify.js library
async.waterfall([ function getInput(){...}, function checkInput(){...}, function submitInput(){...}, ], function finally(){})
Each of the functions takes a callback, and returns err (if any) and output. If a callback returns err, it jumps to finally where you say what failed.
This is odd when you first get started with async, but it's really easy to visualize.
Think of a production line, with a number of different workers doing different stuff. If one of them gets a dud part, it throws it away.
confirm("Are you sure you want to leave?");I like the localStorage solution for drafts much better.
In fact, the HTML5 spec permits browsers to disregard the normal blocking behavior of alert()/confirm()/prompt() (making them no-ops) while this event is being handled: https://developer.mozilla.org/en-US/docs/DOM/window.onbefore... the dialog box is open
But I guess in some circumstances having a UI-updating callback called when a modal dialog is up might be a little confusing for the user. And setting (and checking!) a global everywhere is rather messy. So I see your pain.
Ha, one way I just thought of to get frozen behavior is to take a snapshot of the screen, then overlay a canvas element with that image. As an added bonus you can do some transform on the image to make the effect look more native. When the dialog box goes away, the canvas goes away, and your updated state is presented as if it just executed.
I used to work in applications that require you to do -as much as possible- to keep the window open. This isn't for spam reasons, it is because we did assessment and you really, really didn't want someone closing half-way through an assessment, especially one that is timed. You also don't want to freeze the timer because you might leave the user an opportunity to cheat (close window, research, relaunch assessment, repeat).
So this was real example of something that really should be single-execution. However, even with all the popups, checks, refresh-push-forward, launch-window-on-exit hacks we tried we STILL got users lost out of the system. Not only that but we wound up annoying/angering/confusing 1000 users for every 1 user it helped.
shrug
YMMV, but I believe 99.999% of all issues can be solved with user/session caches and clear wording over blocking the execution thread.
The last thing you want is a UI blocking popup like alert() that, at least in browsers like Firefox and IE, effectively lock the entire browser from doing anything, which is a terrible anti-pattern in multi-tabbed browsers. Chrome did it right, at least with the HTTP authentication prompt, to make the UI block on a per-tab basis and have the prompt window not be a top-level-window-manager-managed-block-the-entire-app modal dialog.
I think a case can be made to have functionality that shows a dialog that is modal within the context of the page it is on, not modal for the entire browser. The former would be useful for the cases you outline, the latter is the bane of users everywhere.
(forgive me if I'm misrepresenting the current state of browsers other than Chrome when it comes to modal dialogs like alert(), I don't use them much; I think everyone can get what I'm saying despite that)
https://developer.mozilla.org/en-US/docs/DOM/window.showModa...
you should be able to override any of these to your liking
Remove the border{...} values and change box shadow to:
box-shadow {box-shadow: 0 0px 60px 30px #666;}
I love that someone already made a pull request to update the readme with it.
It would be nice if the alerts appeared in the centre of the screen though... I find that jerking my eyes up to the top of the screen and then back down to what I was looking at quite intrusive.
.alertify-logs {
position: fixed;
z-index: 5000;
bottom: 10px;
right: 10px;
width: 300px;
}I think that if you'd split this two things into two different libraries it would be better (e.g.: if i want only dialogs i'd prefer to include just them)
I've been using apprise (http://thrivingkings.com/read/Apprise-The-attractive-alert-a...), which is pretty good, but going to switch to this. I really like how Alertify has the growl-like log alerts along with it.
Make the alert notification go away when ESC is pressed, like the Confirmation and Prompt notifications.
See "Customizable Log Messages".
jGrowl is a jQuery plugin that raises unobtrusive messages
within the browser, similar to the way that OS X's Growl
Framework works.
It is pretty old by now (4 years), but a benefit of that is that it supports older browsers too.And this plug-in is also close. Build on top of jQuery UI, so small footprint, but you'd need that library.
http://www.erichynds.com/examples/jquery-notify/
This is a growl/ubuntu-like notification system built on
top of jQuery UI.Edit: I had a good time click on the buttons and filling the page with notifications. The animation is solid, and it's super clean.