Updated notifications

This commit is contained in:
Brinken
2012-08-30 18:24:34 +02:00
parent 062a9301cf
commit bbf09f00e7
32 changed files with 2804 additions and 550 deletions
@@ -0,0 +1,471 @@
/**
* noty - jQuery Notification Plugin v2.0.3
* Contributors: https://github.com/needim/noty/graphs/contributors
*
* Examples and Documentation - http://needim.github.com/noty/
*
* Licensed under the MIT licenses:
* http://www.opensource.org/licenses/mit-license.php
*
**/
if (typeof Object.create !== 'function') {
Object.create = function (o) {
function F() {};
F.prototype = o;
return new F();
};
};
;(function($) {
var NotyObject = {
init: function(options) {
// Mix in the passed in options with the default options
this.options = $.extend({}, $.noty.defaults, options);
this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout];
this.options.theme = $.noty.themes[this.options.theme];
delete options.layout, delete options.theme;
this.options = $.extend({}, this.options, this.options.layout.options);
this.options.id = 'noty_' + (new Date().getTime() * Math.floor(Math.random()* 1000000));
this.options = $.extend({}, this.options, options);
// Build the noty dom initial structure
this._build();
// return this so we can chain/use the bridge with less code.
return this;
}, // end init
_build: function() {
// Generating noty bar
var $bar = $('<div class="noty_bar"/>').attr('id', this.options.id);
$bar.append(this.options.template).find('.noty_text').html(this.options.text);
this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar;
// Set buttons if available
if (this.options.buttons) {
// If we have button disable closeWith & timeout options
this.options.closeWith = [], this.options.timeout = false;
var $buttons = $('<div/>').addClass('noty_buttons');
(this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($buttons) : this.$bar.append($buttons);
var self = this;
$.each(this.options.buttons, function(i, button) {
var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text)
.appendTo(self.$bar.find('.noty_buttons'))
.bind('click', function(e) { if ($.isFunction(button.onClick)) { button.onClick.call($button, self); } });
});
}
// For easy access
this.$message = this.$bar.find('.noty_message');
this.$closeButton = this.$bar.find('.noty_close');
this.$buttons = this.$bar.find('.noty_buttons');
$.noty.store[this.options.id] = this; // store noty for api
}, // end _build
show: function() {
var self = this;
$(self.options.layout.container.selector).append(self.$bar);
self.options.theme.style.apply(self);
($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {});
self.$bar.addClass(self.options.layout.addClass);
self.options.layout.container.style.apply($(self.options.layout.container.selector));
self.options.theme.callback.onShow.apply(this);
if ($.inArray('click', self.options.closeWith) > -1)
self.$bar.css('cursor', 'pointer').one('click', function() { self.close(); });
if ($.inArray('hover', self.options.closeWith) > -1)
self.$bar.one('mouseenter', function() { self.close(); });
if ($.inArray('button', self.options.closeWith) > -1)
self.$closeButton.one('click', function() { self.close(); });
if ($.inArray('button', self.options.closeWith) == -1)
self.$closeButton.remove();
if (self.options.callback.onShow)
self.options.callback.onShow.apply(self);
self.$bar.animate(
self.options.animation.open,
self.options.animation.speed,
self.options.animation.easing,
function() {
if (self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
self.shown = true;
});
// If noty is have a timeout option
if (self.options.timeout)
self.$bar.delay(self.options.timeout).promise().done(function() { self.close(); });
return this;
}, // end show
close: function() {
if (this.closed) return;
var self = this;
if (!this.shown) { // If we are still waiting in the queue just delete from queue
$.each($.noty.queue, function(i, n) {
if (n.options.id == self.options.id) {
$.noty.queue.splice(i, 1);
}
});
return;
}
self.$bar.addClass('i-am-closing-now');
if (self.options.callback.onClose) { self.options.callback.onClose.apply(self); }
self.$bar.clearQueue().stop().animate(
self.options.animation.close,
self.options.animation.speed,
self.options.animation.easing,
function() { if (self.options.callback.afterClose) self.options.callback.afterClose.apply(self); })
.promise().done(function() {
// Modal Cleaning
if (self.options.modal) {
$.notyRenderer.setModalCount(-1);
if ($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function() { $(this).remove(); });
}
// Layout Cleaning
$.notyRenderer.setLayoutCountFor(self, -1);
if ($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();
self.$bar.remove();
self.$bar = null;
self.closed = true;
delete $.noty.store[self.options.id]; // deleting noty from store
if (!self.options.dismissQueue) {
// Queue render
$.noty.ontap = true;
$.notyRenderer.render();
}
});
}, // end close
setText: function(text) {
if (!this.closed) {
this.options.text = text;
this.$bar.find('.noty_text').html(text);
}
return this;
},
setType: function(type) {
if (!this.closed) {
this.options.type = type;
this.options.theme.style.apply(this);
this.options.theme.callback.onShow.apply(this);
}
return this;
},
closed: false,
shown: false
}; // end NotyObject
$.notyRenderer = {};
$.notyRenderer.init = function(options) {
// Renderer creates a new noty
var notification = Object.create(NotyObject).init(options);
(notification.options.force) ? $.noty.queue.unshift(notification) : $.noty.queue.push(notification);
$.notyRenderer.render();
return ($.noty.returns == 'object') ? notification : notification.options.id;
};
$.notyRenderer.render = function() {
var instance = $.noty.queue[0];
if ($.type(instance) === 'object') {
if (instance.options.dismissQueue) {
$.notyRenderer.show($.noty.queue.shift());
} else {
if ($.noty.ontap) {
$.notyRenderer.show($.noty.queue.shift());
$.noty.ontap = false;
}
}
} else {
$.noty.ontap = true; // Queue is over
}
};
$.notyRenderer.show = function(notification) {
if (notification.options.modal) {
$.notyRenderer.createModalFor(notification);
$.notyRenderer.setModalCount(+1);
}
// Where is the container?
if ($(notification.options.layout.container.selector).length == 0) {
if (notification.options.custom) {
notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
} else {
$('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
}
} else {
$(notification.options.layout.container.selector).removeClass('i-am-new');
}
$.notyRenderer.setLayoutCountFor(notification, +1);
notification.show();
};
$.notyRenderer.createModalFor = function(notification) {
if ($('.noty_modal').length == 0)
$('<div/>').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
};
$.notyRenderer.getLayoutCountFor = function(notification) {
return $(notification.options.layout.container.selector).data('noty_layout_count') || 0;
};
$.notyRenderer.setLayoutCountFor = function(notification, arg) {
return $(notification.options.layout.container.selector).data('noty_layout_count', $.notyRenderer.getLayoutCountFor(notification) + arg);
};
$.notyRenderer.getModalCount = function() {
return $('.noty_modal').data('noty_modal_count') || 0;
};
$.notyRenderer.setModalCount = function(arg) {
return $('.noty_modal').data('noty_modal_count', $.notyRenderer.getModalCount() + arg);
};
// This is for custom container
$.fn.noty = function(options) {
options.custom = $(this);
return $.notyRenderer.init(options);
};
$.noty = {};
$.noty.queue = [];
$.noty.ontap = true;
$.noty.layouts = {};
$.noty.themes = {};
$.noty.returns = 'object';
$.noty.store = {};
$.noty.get = function(id) {
return $.noty.store.hasOwnProperty(id) ? $.noty.store[id] : false;
};
$.noty.close = function(id) {
return $.noty.get(id) ? $.noty.get(id).close() : false;
};
$.noty.setText = function(id, text) {
return $.noty.get(id) ? $.noty.get(id).setText(text) : false;
};
$.noty.setType = function(id, type) {
return $.noty.get(id) ? $.noty.get(id).setType(type) : false;
};
$.noty.clearQueue = function() {
$.noty.queue = [];
};
$.noty.closeAll = function() {
$.noty.clearQueue();
$.each($.noty.store, function(id, noty) {
noty.close();
});
};
var windowAlert = window.alert;
$.noty.consumeAlert = function(options) {
window.alert = function(text) {
if (options)
options.text = text;
else
options = {text:text};
$.notyRenderer.init(options);
};
};
$.noty.stopConsumeAlert = function(){
window.alert = windowAlert;
};
$.noty.defaults = {
layout: 'top',
theme: 'default',
type: 'alert',
text: '',
dismissQueue: true,
template: '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>',
animation: {
open: {height: 'toggle'},
close: {height: 'toggle'},
easing: 'swing',
speed: 500
},
timeout: false,
force: false,
modal: false,
closeWith: ['click'],
callback: {
onShow: function() {},
afterShow: function() {},
onClose: function() {},
afterClose: function() {}
},
buttons: false
};
$(window).resize(function() {
$.each($.noty.layouts, function(index, layout) {
layout.container.style.apply($(layout.container.selector));
});
});
})(jQuery);
// Helpers
function noty(options) {
// This is for BC - Will be deleted on v2.2.0
var using_old = 0
, old_to_new = {
'animateOpen': 'animation.open',
'animateClose': 'animation.close',
'easing': 'animation.easing',
'speed': 'animation.speed',
'onShow': 'callback.onShow',
'onShown': 'callback.afterShow',
'onClose': 'callback.onClose',
'onClosed': 'callback.afterClose'
}
jQuery.each(options, function(key, value) {
if (old_to_new[key]) {
using_old++;
var _new = old_to_new[key].split('.');
if (!options[_new[0]]) options[_new[0]] = {};
options[_new[0]][_new[1]] = (value) ? value : function() {};
delete options[key];
}
});
if (!options.closeWith) {
options.closeWith = jQuery.noty.defaults.closeWith;
}
if (options.hasOwnProperty('closeButton')) {
using_old++;
if (options.closeButton) options.closeWith.push('button');
delete options.closeButton;
}
if (options.hasOwnProperty('closeOnSelfClick')) {
using_old++;
if (options.closeOnSelfClick) options.closeWith.push('click');
delete options.closeOnSelfClick;
}
if (options.hasOwnProperty('closeOnSelfOver')) {
using_old++;
if (options.closeOnSelfOver) options.closeWith.push('hover');
delete options.closeOnSelfOver;
}
if (options.hasOwnProperty('custom')) {
using_old++;
if (options.custom.container != 'null') options.custom = options.custom.container;
}
if (options.hasOwnProperty('cssPrefix')) {
using_old++;
delete options.cssPrefix;
}
if (options.theme == 'noty_theme_default') {
using_old++;
options.theme = 'default';
}
if (!options.hasOwnProperty('dismissQueue')) {
if (options.layout == 'topLeft'
|| options.layout == 'topRight'
|| options.layout == 'bottomLeft'
|| options.layout == 'bottomRight') {
options.dismissQueue = true;
} else {
options.dismissQueue = false;
}
}
if (options.buttons) {
jQuery.each(options.buttons, function(i, button) {
if (button.click) {
using_old++;
button.onClick = button.click;
delete button.click;
}
if (button.type) {
using_old++;
button.addClass = button.type;
delete button.type;
}
});
}
if (using_old) console.warn('You are using noty v2 with v1.x.x options. @deprecated until v2.2.0 - Please update your options.');
// console.log(options);
// End of the BC
return jQuery.notyRenderer.init(options);
}
@@ -0,0 +1,34 @@
;(function($) {
$.noty.layouts.bottom = {
name: 'bottom',
options: {},
container: {
object: '<ul id="noty_bottom_layout_container" />',
selector: 'ul#noty_bottom_layout_container',
style: function() {
$(this).css({
bottom: 0,
left: '5%',
position: 'fixed',
width: '90%',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 9999999
});
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,41 @@
;(function($) {
$.noty.layouts.bottomCenter = {
name: 'bottomCenter',
options: { // overrides options
},
container: {
object: '<ul id="noty_bottomCenter_layout_container" />',
selector: 'ul#noty_bottomCenter_layout_container',
style: function() {
$(this).css({
bottom: 20,
left: 0,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
$(this).css({
left: ($(window).width() - $(this).outerWidth()) / 2 + 'px',
});
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,43 @@
;(function($) {
$.noty.layouts.bottomLeft = {
name: 'bottomLeft',
options: { // overrides options
},
container: {
object: '<ul id="noty_bottomLeft_layout_container" />',
selector: 'ul#noty_bottomLeft_layout_container',
style: function() {
$(this).css({
bottom: 20,
left: 20,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
if (window.innerWidth < 600) {
$(this).css({
left: 5
});
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,43 @@
;(function($) {
$.noty.layouts.bottomRight = {
name: 'bottomRight',
options: { // overrides options
},
container: {
object: '<ul id="noty_bottomRight_layout_container" />',
selector: 'ul#noty_bottomRight_layout_container',
style: function() {
$(this).css({
bottom: 50,
right: 20,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
if (window.innerWidth < 600) {
$(this).css({
right: 5
});
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,56 @@
;(function($) {
$.noty.layouts.center = {
name: 'center',
options: { // overrides options
},
container: {
object: '<ul id="noty_center_layout_container" />',
selector: 'ul#noty_center_layout_container',
style: function() {
$(this).css({
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
// getting hidden height
var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
$("body").append(dupe);
dupe.find('.i-am-closing-now').remove();
dupe.find('li').css('display', 'block');
var actual_height = dupe.height();
dupe.remove();
if ($(this).hasClass('i-am-new')) {
$(this).css({
left: ($(window).width() - $(this).outerWidth()) / 2 + 'px',
top: ($(window).height() - actual_height) / 2 + 'px'
});
} else {
$(this).animate({
left: ($(window).width() - $(this).outerWidth()) / 2 + 'px',
top: ($(window).height() - actual_height) / 2 + 'px'
}, 500);
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,61 @@
;(function($) {
$.noty.layouts.centerLeft = {
name: 'centerLeft',
options: { // overrides options
},
container: {
object: '<ul id="noty_centerLeft_layout_container" />',
selector: 'ul#noty_centerLeft_layout_container',
style: function() {
$(this).css({
left: 20,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
// getting hidden height
var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
$("body").append(dupe);
dupe.find('.i-am-closing-now').remove();
dupe.find('li').css('display', 'block');
var actual_height = dupe.height();
dupe.remove();
if ($(this).hasClass('i-am-new')) {
$(this).css({
top: ($(window).height() - actual_height) / 2 + 'px',
});
} else {
$(this).animate({
top: ($(window).height() - actual_height) / 2 + 'px'
}, 500);
}
if (window.innerWidth < 600) {
$(this).css({
left: 5
});
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,61 @@
;(function($) {
$.noty.layouts.centerRight = {
name: 'centerRight',
options: { // overrides options
},
container: {
object: '<ul id="noty_centerRight_layout_container" />',
selector: 'ul#noty_centerRight_layout_container',
style: function() {
$(this).css({
right: 20,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
// getting hidden height
var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
$("body").append(dupe);
dupe.find('.i-am-closing-now').remove();
dupe.find('li').css('display', 'block');
var actual_height = dupe.height();
dupe.remove();
if ($(this).hasClass('i-am-new')) {
$(this).css({
top: ($(window).height() - actual_height) / 2 + 'px',
});
} else {
$(this).animate({
top: ($(window).height() - actual_height) / 2 + 'px'
}, 500);
}
if (window.innerWidth < 600) {
$(this).css({
right: 5
});
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,31 @@
;(function($) {
$.noty.layouts.inline = {
name: 'inline',
options: {},
container: {
object: '<ul id="noty_inline_layout_container" />',
selector: 'ul#noty_inline_layout_container',
style: function() {
$(this).css({
width: '100%',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 9999999
});
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,34 @@
;(function($) {
$.noty.layouts.top = {
name: 'top',
options: {},
container: {
object: '<ul id="noty_top_layout_container" />',
selector: 'ul#noty_top_layout_container',
style: function() {
$(this).css({
top: 0,
left: '5%',
position: 'fixed',
width: '90%',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 9999999
});
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,41 @@
;(function($) {
$.noty.layouts.topCenter = {
name: 'topCenter',
options: { // overrides options
},
container: {
object: '<ul id="noty_topCenter_layout_container" />',
selector: 'ul#noty_topCenter_layout_container',
style: function() {
$(this).css({
top: 20,
left: 0,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
$(this).css({
left: ($(window).width() - $(this).outerWidth()) / 2 + 'px',
});
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,43 @@
;(function($) {
$.noty.layouts.topLeft = {
name: 'topLeft',
options: { // overrides options
},
container: {
object: '<ul id="noty_topLeft_layout_container" />',
selector: 'ul#noty_topLeft_layout_container',
style: function() {
$(this).css({
top: 20,
left: 20,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
if (window.innerWidth < 600) {
$(this).css({
left: 5
});
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
@@ -0,0 +1,43 @@
;(function($) {
$.noty.layouts.topRight = {
name: 'topRight',
options: { // overrides options
},
container: {
object: '<ul id="noty_topRight_layout_container" />',
selector: 'ul#noty_topRight_layout_container',
style: function() {
$(this).css({
top: 20,
right: 20,
position: 'fixed',
width: '310px',
height: 'auto',
margin: 0,
padding: 0,
listStyleType: 'none',
zIndex: 10000000
});
if (window.innerWidth < 600) {
$(this).css({
right: 5
});
}
}
},
parent: {
object: '<li />',
selector: 'li',
css: {}
},
css: {
display: 'none',
width: '310px'
},
addClass: ''
};
})(jQuery);
+432
View File
@@ -0,0 +1,432 @@
/*!
* Noty Helpers Javascript From JQuery Javascript Library
*
* Ported by Maksim Pecherskiy. Original Licensing:
*
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Mon Nov 21 21:11:03 2011 -0500
*/
(function(){
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = (type || "fx") + "mark";
jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
if ( count ) {
jQuery.data( elem, key, count, true );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
if ( elem ) {
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type, undefined, true );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
defer;
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift("inprogress");
}
fn.call(elem, function() {
jQuery.dequeue(elem, type);
});
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue( type, function() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
count++;
tmp.done( resolve );
}
}
resolve();
return defer.promise();
}
});
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.Callbacks = function( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( /*flagsCache[ flags ] || */createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory || memory === true ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!memory;
}
};
return self;
};
jQuery.fn.extend({
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise();
}
});
})();
@@ -0,0 +1,155 @@
;(function($) {
$.noty.themes.default = {
name: 'brink',
helpers: {
borderFix: function() {
if (this.options.dismissQueue) {
var selector = this.options.layout.container.selector + ' ' + this.options.layout.parent.selector;
switch (this.options.layout.name) {
case 'top':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).last().css({borderRadius: '0px 0px 0px 0px'}); break;
case 'topCenter': case 'topLeft': case 'topRight':
case 'bottomCenter': case 'bottomLeft': case 'bottomRight':
case 'center': case 'centerLeft': case 'centerRight': case 'inline':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).first().css({'border-top-left-radius': '0px', 'border-top-right-radius': '0px'});
$(selector).last().css({'border-bottom-left-radius': '0px', 'border-bottom-right-radius': '0px'}); break;
case 'bottom':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).first().css({borderRadius: '0px 0px 0px 0px'}); break;
default: break;
}
}
}
},
modal: {
css: {
position: 'fixed',
width: '100%',
height: '100%',
backgroundColor: '#000',
zIndex: 10000,
opacity: 0.6,
display: 'none',
left: 0,
top: 0,
}
},
style: function() {
this.$bar.css({
overflow: 'hidden',
background: "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAYAAAAPOoFWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPZJREFUeNq81tsOgjAMANB2ov7/7ypaN7IlIwi9rGuT8QSc9EIDAsAznxvY4pXPKr05RUE5MEVB+TyWfCEl9LZApYopCmo9C4FKSMtYoI8Bwv79aQJU4l6hXXCZrQbokJEksxHo9KMOgc6w1atHXM8K9DVC7FQnJ0i8iK3QooGgbnyKgMDygBWyYFZoqx4qS27KqLZJjA1D0jK6QJcYEQEiWv9PGkTsbqxQ8oT+ZtZB6AkdsJnQDnMoHXHLGKOgDYuCWmYhEERCI5gaamW0bnHdA3k2ltlIN+2qKRyCND0bhqSYCyTB3CAOc4WusBEIpkeBuPgJMAAX8Hs1NfqHRgAAAABJRU5ErkJggg==') repeat-x scroll left top #fff"
});
this.$message.css({
fontSize: '.8em',
lineHeight: '1em',
textAlign: 'left',
padding: '8px 10px 9px',
width: 'auto',
position: 'relative'
});
this.$closeButton.css({
position: 'absolute',
top: 4, right: 4,
width: 10, height: 10,
background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c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X3L13X9fcDAKJct1sx3OiuAAAAAElFTkSuQmCC)",
display: 'none',
cursor: 'pointer',
});
this.$buttons.css({
padding: 5,
textAlign: 'right',
borderTop: '1px solid #ccc',
backgroundColor: '#fff',
});
this.$buttons.find('button').css({
marginLeft: 5
});
this.$buttons.find('button:first').css({
marginLeft: 0
});
this.$bar.bind({
mouseenter: function() { $(this).find('.noty_close').fadeIn(); },
mouseleave: function() { $(this).find('.noty_close').fadeOut(); }
});
switch (this.options.layout.name) {
case 'top':
this.$bar.css({
borderRadius: '0px 0px 0px 0px',
borderBottom: '1px solid #eee',
borderLeft: '1px solid #eee',
borderRight: '1px solid #eee',
boxShadow: "0 5px 4px rgba(0, 0, 0, 0.1)"
});
break;
case 'topCenter': case 'center': case 'bottomCenter': case 'inline':
this.$bar.css({
borderRadius: '0px',
border: '1px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
this.$message.css({fontSize: '13px', textAlign: 'center'});
break;
case 'topLeft': case 'topRight':
case 'bottomLeft': case 'bottomRight':
case 'centerLeft': case 'centerRight':
this.$bar.css({
borderRadius: '0px',
border: '1px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
this.$message.css({fontSize: '13px', textAlign: 'left'});
break;
case 'bottom':
this.$bar.css({
borderRadius: '0x 0px 0px 0px',
borderTop: '1px solid #eee',
borderLeft: '1px solid #eee',
borderRight: '1px solid #eee',
boxShadow: "0 -2px 4px rgba(0, 0, 0, 0.1)"
});
break;
default:
this.$bar.css({
border: '2px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
break;
}
switch (this.options.type) {
case 'alert': case 'notification':
this.$bar.css({backgroundColor: '#FFF', borderColor: '#353535', color: '#444'}); break;
case 'warning':
this.$bar.css({backgroundColor: '#FFEAA8', borderColor: '#353535', color: '#826200'});
this.$buttons.css({borderTop: '1px solid #FFC237'}); break;
case 'error':
this.$bar.css({backgroundColor: 'red', borderColor: '#353535', color: '#FFF'});
this.$buttons.css({borderTop: '1px solid darkred'}); break;
case 'information':
this.$bar.css({backgroundColor: '#57B7E2', borderColor: '#353535', color: '#FFF'});
this.$buttons.css({borderTop: '1px solid #0B90C4'}); break;
case 'success':
this.$bar.css({backgroundColor: 'lightgreen', borderColor: '#353535', color: '#000'});
this.$buttons.css({borderTop: '1px solid #50C24E'});break;
default:
this.$bar.css({backgroundColor: '#FFF', borderColor: '#353535', color: '#444'}); break;
}
},
callback: {
onShow: function() { $.noty.themes.default.helpers.borderFix.apply(this); },
onClose: function() { $.noty.themes.default.helpers.borderFix.apply(this); }
}
};
})(jQuery);
@@ -0,0 +1,156 @@
;(function($) {
$.noty.themes.default = {
name: 'default',
helpers: {
borderFix: function() {
if (this.options.dismissQueue) {
var selector = this.options.layout.container.selector + ' ' + this.options.layout.parent.selector;
switch (this.options.layout.name) {
case 'top':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).last().css({borderRadius: '0px 0px 5px 5px'}); break;
case 'topCenter': case 'topLeft': case 'topRight':
case 'bottomCenter': case 'bottomLeft': case 'bottomRight':
case 'center': case 'centerLeft': case 'centerRight': case 'inline':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).first().css({'border-top-left-radius': '5px', 'border-top-right-radius': '5px'});
$(selector).last().css({'border-bottom-left-radius': '5px', 'border-bottom-right-radius': '5px'}); break;
case 'bottom':
$(selector).css({borderRadius: '0px 0px 0px 0px'});
$(selector).first().css({borderRadius: '5px 5px 0px 0px'}); break;
default: break;
}
}
}
},
modal: {
css: {
position: 'fixed',
width: '100%',
height: '100%',
backgroundColor: '#000',
zIndex: 10000,
opacity: 0.6,
display: 'none',
left: 0,
top: 0,
}
},
style: function() {
this.$bar.css({
overflow: 'hidden',
background: "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAYAAAAPOoFWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPZJREFUeNq81tsOgjAMANB2ov7/7ypaN7IlIwi9rGuT8QSc9EIDAsAznxvY4pXPKr05RUE5MEVB+TyWfCEl9LZApYopCmo9C4FKSMtYoI8Bwv79aQJU4l6hXXCZrQbokJEksxHo9KMOgc6w1atHXM8K9DVC7FQnJ0i8iK3QooGgbnyKgMDygBWyYFZoqx4qS27KqLZJjA1D0jK6QJcYEQEiWv9PGkTsbqxQ8oT+ZtZB6AkdsJnQDnMoHXHLGKOgDYuCWmYhEERCI5gaamW0bnHdA3k2ltlIN+2qKRyCND0bhqSYCyTB3CAOc4WusBEIpkeBuPgJMAAX8Hs1NfqHRgAAAABJRU5ErkJggg==') repeat-x scroll left top #fff"
});
this.$message.css({
fontSize: '13px',
lineHeight: '16px',
textAlign: 'center',
padding: '8px 10px 9px',
width: 'auto',
position: 'relative'
});
this.$closeButton.css({
position: 'absolute',
top: 4, right: 4,
width: 10, height: 10,
background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4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DGBH0nuSzwHsRcRVRNRSysuU0i6AOwA/02w2+9Fae00SEbEh6SGAR5K+k3zWWptKepCm0+kpyRoRGyRBcpPkDsn1iEBr7drdP2VJZyQXERGSPpiZAViTBACXKaV9kqd5uVzCzO5KKb/d/UZSDwD/eyxqree1VqSu6zKAF2Z2RPJJaw0rAkjOJT0m+SuT/AbgDcmnkmBmfwAsJL1dXQ8lWY6IGwB1ZbrOOb8zs8thGP4COFwx/mE8Ho9Go9ErMzvJOW/1fY/JZIJSypqZfXX3L13X9fcDAKJct1sx3OiuAAAAAElFTkSuQmCC)",
display: 'none',
cursor: 'pointer',
});
this.$buttons.css({
padding: 5,
textAlign: 'right',
borderTop: '1px solid #ccc',
backgroundColor: '#fff',
});
this.$buttons.find('button').css({
marginLeft: 5
});
this.$buttons.find('button:first').css({
marginLeft: 0
});
this.$bar.bind({
mouseenter: function() { $(this).find('.noty_close').fadeIn(); },
mouseleave: function() { $(this).find('.noty_close').fadeOut(); }
});
switch (this.options.layout.name) {
case 'top':
this.$bar.css({
borderRadius: '0px 0px 5px 5px',
borderBottom: '2px solid #eee',
borderLeft: '2px solid #eee',
borderRight: '2px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
break;
case 'topCenter': case 'center': case 'bottomCenter': case 'inline':
this.$bar.css({
borderRadius: '5px',
border: '1px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
this.$message.css({fontSize: '13px', textAlign: 'center'});
break;
case 'topLeft': case 'topRight':
case 'bottomLeft': case 'bottomRight':
case 'centerLeft': case 'centerRight':
this.$bar.css({
borderRadius: '5px',
border: '1px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
this.$message.css({fontSize: '13px', textAlign: 'left'});
break;
case 'bottom':
this.$bar.css({
borderRadius: '5px 5px 0px 0px',
borderTop: '2px solid #eee',
borderLeft: '2px solid #eee',
borderRight: '2px solid #eee',
boxShadow: "0 -2px 4px rgba(0, 0, 0, 0.1)"
});
break;
default:
this.$bar.css({
border: '2px solid #eee',
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
});
break;
}
switch (this.options.type) {
case 'alert': case 'notification':
this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'}); break;
case 'warning':
this.$bar.css({backgroundColor: '#FFEAA8', borderColor: '#FFC237', color: '#826200'});
this.$buttons.css({borderTop: '1px solid #FFC237'}); break;
case 'error':
this.$bar.css({backgroundColor: 'red', borderColor: 'darkred', color: '#FFF'});
this.$message.css({fontWeight: 'bold'});
this.$buttons.css({borderTop: '1px solid darkred'}); break;
case 'information':
this.$bar.css({backgroundColor: '#57B7E2', borderColor: '#0B90C4', color: '#FFF'});
this.$buttons.css({borderTop: '1px solid #0B90C4'}); break;
case 'success':
this.$bar.css({backgroundColor: 'lightgreen', borderColor: '#50C24E', color: 'darkgreen'});
this.$buttons.css({borderTop: '1px solid #50C24E'});break;
default:
this.$bar.css({backgroundColor: '#FFF', borderColor: '#CCC', color: '#444'}); break;
}
},
callback: {
onShow: function() { $.noty.themes.default.helpers.borderFix.apply(this); },
onClose: function() { $.noty.themes.default.helpers.borderFix.apply(this); }
}
};
})(jQuery);