forked from dknight/jQuery-Notify-bar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
65 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,80 @@ | ||
/* | ||
* Notify Bar - jQuery plugin | ||
* Notify Bar - jQuery plugin | ||
* | ||
* Copyright (c) 2009-2010 Dmitri Smirnov | ||
* Copyright (c) 2009-2010 Dmitri Smirnov | ||
* | ||
* Licensed under the MIT license: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* | ||
* Version: 1.2 | ||
* Licensed under the MIT license: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* | ||
* Project home: | ||
* http://www.dmitri.me/blog/notify-bar | ||
* Version: 1.2.1 | ||
* | ||
* Project home: | ||
* http://www.dmitri.me/blog/notify-bar | ||
*/ | ||
|
||
/** | ||
* param Object | ||
*/ | ||
$.notifyBar = function(settings) | ||
{ | ||
var bar = notifyBarNS = {}; | ||
notifyBarNS.shown = false; | ||
|
||
if( !settings) { | ||
* param Object | ||
*/ | ||
jQuery.notifyBar = function(settings) { | ||
|
||
(function($) { | ||
|
||
var bar = notifyBarNS = {}; | ||
notifyBarNS.shown = false; | ||
|
||
if( !settings) { | ||
settings = {}; | ||
} | ||
// HTML inside bar | ||
notifyBarNS.html = settings.html || "Your message here"; | ||
|
||
//How long bar will be delayed, doesn't count animation time. | ||
notifyBarNS.delay = settings.delay || 2000; | ||
|
||
//How long notifyBarNS bar will be slided up and down | ||
notifyBarNS.animationSpeed = settings.animationSpeed || 200; | ||
|
||
//Use own jquery object usually DIV, or use default | ||
notifyBarNS.jqObject = settings.jqObject; | ||
|
||
//Set up own class | ||
notifyBarNS.cls = settings.cls || ""; | ||
|
||
if( notifyBarNS.jqObject) { | ||
bar = notifyBarNS.jqObject; | ||
notifyBarNS.html = bar.html(); | ||
} else { | ||
bar = $("<div></div>") | ||
.addClass("jquery-notify-bar") | ||
.addClass(notifyBarNS.cls) | ||
.attr("id", "__notifyBar"); | ||
|
||
} | ||
|
||
bar.html(notifyBarNS.html).hide(); | ||
var id = bar.attr("id"); | ||
switch (notifyBarNS.animationSpeed) { | ||
case "slow": | ||
} | ||
// HTML inside bar | ||
notifyBarNS.html = settings.html || "Your message here"; | ||
|
||
//How long bar will be delayed, doesn't count animation time. | ||
notifyBarNS.delay = settings.delay || 2000; | ||
|
||
//How long notifyBarNS bar will be slided up and down | ||
notifyBarNS.animationSpeed = settings.animationSpeed || 200; | ||
|
||
//Use own jquery object usually DIV, or use default | ||
notifyBarNS.jqObject = settings.jqObject; | ||
|
||
//Set up own class | ||
notifyBarNS.cls = settings.cls || ""; | ||
|
||
if( notifyBarNS.jqObject) { | ||
bar = notifyBarNS.jqObject; | ||
notifyBarNS.html = bar.html(); | ||
} else { | ||
bar = $("<div></div>") | ||
.addClass("jquery-notify-bar") | ||
.addClass(notifyBarNS.cls) | ||
.attr("id", "__notifyBar"); | ||
} | ||
|
||
bar.html(notifyBarNS.html).hide(); | ||
var id = bar.attr("id"); | ||
switch (notifyBarNS.animationSpeed) { | ||
case "slow": | ||
asTime = 600; | ||
break; | ||
case "normal": | ||
case "normal": | ||
asTime = 400; | ||
break; | ||
case "fast": | ||
case "fast": | ||
asTime = 200; | ||
break; | ||
default: | ||
default: | ||
asTime = notifyBarNS.animationSpeed; | ||
} | ||
if( bar != 'object'); { | ||
$("body").prepend(bar); | ||
} | ||
bar.slideDown(asTime); | ||
|
||
// If taken from DOM dot not remove just hide | ||
if( bar.attr("id") == "__notifyBar") { | ||
setTimeout("$('#" + id + "').slideUp(" + asTime +", function() {$('#" + id + "').remove()});", notifyBarNS.delay + asTime); | ||
} else { | ||
setTimeout("$('#" + id + "').slideUp(" + asTime +", function() {$('#" + id + "')});", notifyBarNS.delay + asTime); | ||
} | ||
}; | ||
} | ||
if( bar != 'object'); { | ||
$("body").prepend(bar); | ||
} | ||
bar.slideDown(asTime); | ||
// If taken from DOM dot not remove just hide | ||
if( bar.attr("id") == "__notifyBar") { | ||
setTimeout("$('#" + id + "').slideUp(" + asTime +", function() {$('#" + id + "').remove()});", notifyBarNS.delay + asTime); | ||
} else { | ||
setTimeout("$('#" + id + "').slideUp(" + asTime +", function() {$('#" + id + "')});", notifyBarNS.delay + asTime); | ||
} | ||
})(jQuery) }; |