Created
August 15, 2011 00:04
-
-
Save mahemoff/1145482 to your computer and use it in GitHub Desktop.
Simple growl-style notifier (jQuery)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include the following | |
.notifier | |
img.progressor(src='/progressor.gif') | |
span.message loading fonts and stuff ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
notify = (message, isError) -> { | |
clearTimeout(timer); | |
if (!arguments.length) $(".notifier").fadeOut() | |
$(".notifier").toggleClass("error", isError===true).show().find(".message").html(message) | |
if (isError) timer = setTimeout(-> { $(".notifier").fadeOut() }, 3000) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lightgray = #ecf1f2 | |
.notifier | |
// visibility hidden ---- I leave this commented out as I want to show "app loading" message | |
position fixed | |
top 0 | |
right 0 | |
background lightgray | |
border-color lightgray * 0.9 | |
border-width 1px | |
border-style solid | |
color black | |
padding 0.5em | |
&.error | |
color red | |
.progressor | |
display none | |
.progressor | |
width 1em | |
height 1em | |
position relative | |
top 0.2em | |
margin-right 0.3em |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a simple notifier geared around progress indication and loading stuff. I found the main libs don't seem to support this use case too well, ie this lib includes progress indicator by default and the notion of being able to close the notifier. (Most libs seem to close notifier on a timeout or by user intervention, whereas I want my app to close it when an async message comes in.) | |
Requirements: | |
jQuery + Kaffeine + Stylus + Jade |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment