All Downloads are FREE. Search and download functionalities are using the official Maven repository.

annis.visualizers.iframe.partitur.jquery.noty.js Maven / Gradle / Ivy

There is a newer version: 4.0.0-beta.4
Show newest version
/**
 * jQuery Noty Plugin v0.1
 * Authors: Nedim Arabacı (http://ned.im), Muhittin Özer (http://muhittinozer.com)
 * 
 * http://needim.github.com/noty/
 *
 * Licensed under the MIT licenses:
 * http://www.opensource.org/licenses/mit-license.php
 *
 **/
(function($) {
	$.noty = function(options) {
		// To avoid scope issues, use 'base' instead of 'this'
		// to reference this class from internal events and functions.
		var base = this;

		base.init = function() {

			base.options = $.extend({}, $.noty.defaultOptions, options);
			
			// Push notification to queue
			if (base.options.layout != 'topLeft' && base.options.layout != 'topRight') {
				if (base.options.force) {
					$.noty.queue.unshift({options: base.options});
				} else {
					$.noty.queue.push({options: base.options});
				}
				
				base.render();
				$.noty.available = false;
				
			} else {
				$.noty.available = true;
				base.render({options: base.options});
			}
			
		};
		
		// Render the queue
		base.render = function(noty) {
		 
			if ($.noty.available) {
				
				// Get noty from queue
				var notification = (jQuery.type(noty) === 'object') ? noty : $.noty.queue.shift();
				
				if (jQuery.type(notification) === 'object') {
					
					// Layout spesific container settings
					if (notification.options.layout == "topLeft" || notification.options.layout == "topRight") {
						if ($("ul.noty_container."+notification.options.layout).length > 0) {
							base.$noty_container = $("ul.noty_container."+notification.options.layout);
						} else {
							base.$noty_container = $('
    ').addClass('noty_container').addClass(notification.options.layout); $("body").prepend(base.$noty_container); } base.$notyContainer = $('
  • '); base.$noty_container.prepend(base.$notyContainer); } else { base.$notyContainer = $("body"); } base.$bar = $('
    ').addClass('noty_bar'); base.$message = $('
    ').addClass('noty_message'); base.$text = $('
    ').addClass('noty_text'); base.$close = $('
    ').addClass('noty_close'); base.$message.append(base.$text).append(base.$close); base.$bar.append(base.$message); var $noty = base.$bar; $noty.data('noty_options', notification.options); // Basic layout settings $noty.addClass(notification.options.layout).addClass(notification.options.type).addClass(notification.options.theme); // Message and style settings $noty.find('.noty_text').html(notification.options.text).css({textAlign: notification.options.textAlign}); // Closable option (notification.options.closable) ? $noty.find('.noty_close').show() : $noty.find('.noty_close').remove(); // Bind close event to button $noty.find('.noty_close').bind('click', function() { $noty.trigger('noty.close'); }); // Close on self click if (notification.options.closeOnSelfClick) { $noty.find('.noty_message').bind('click', function() { $noty.trigger('noty.close'); }).css('cursor', 'pointer'); } // is Modal? if (notification.options.modal) { $('
    ').addClass('noty_modal').prependTo($('body')).css(notification.options.modalCss).fadeIn('fast'); } // Prepend noty to container base.$notyContainer.prepend($noty); // Bind close event $noty.one('noty.close', function(event, callback) { var options = $noty.data('noty_options'); // Modal Cleaning if (options.modal) { $('.noty_modal').fadeOut('fast', function() { $(this).remove(); }); } $noty.stop().animate( $noty.data('noty_options').animateClose, $noty.data('noty_options').speed, $noty.data('noty_options').easing, $noty.data('noty_options').onClose) .promise().done(function() { // Layout spesific cleaning if (options.layout == 'topLeft' || options.layout == 'topRight') { $noty.parent().remove(); } else { $noty.remove(); } // Are we have a callback function? if ($.isFunction(callback)) { callback.apply(); } // queue render if (options.layout != 'topLeft' && options.layout != 'topRight') { $.noty.available = true; base.render(); } }); }); // Set buttons if available if (notification.options.buttons) { $buttons = $('
    ').addClass('noty_buttons'); $noty.find('.noty_text').append($buttons); $.each(notification.options.buttons, function(i, button) { bclass = (button.type) ? button.type : 'gray'; $('




© 2015 - 2024 Weber Informatics LLC | Privacy Policy