PageSourceSearch

https://cruzeirodovale.com.br/adm/frontend/js/noty/jquery.noty.js

js cruzeirodovale.com.br collected 2026-10-02 13:26:29 UTC 6,937 bytes, 227 lines download raw bytes

1/**
2 * jQuery Noty Plugin v0.1
3 * Authors: Nedim Arabacı (http://ned.im), Muhittin Özer (http://muhittinozer.com)
4 * 
5 * http://needim.github.com/noty/
6 *
7 * Licensed under the MIT licenses:
8 * http://www.opensource.org/licenses/mit-license.php
9 *
10 **/
11(function($) {
12	$.noty = function(options) {
13		// To avoid scope issues, use 'base' instead of 'this'
14		// to reference this class from internal events and functions.
15		var base = this;
16
17		base.init = function() {
18
19			base.options = $.extend({}, $.noty.defaultOptions, options);
20			
21			// Push notification to queue
22			if (base.options.layout != 'topLeft' && base.options.layout != 'topRight') {
23				if (base.options.force) {
24					$.noty.queue.unshift({options: base.options});
25				} else {
26					$.noty.queue.push({options: base.options});
27				}
28				
29				base.render();
30				$.noty.available = false;
31				
32			} else {
33				$.noty.available = true;
34				base.render({options: base.options});
35			}
36			
37		};
38		
39		// Render the queue
40		base.render = function(noty) {
41		 
42			if ($.noty.available) {
43				
44				// Get noty from queue
45				var notification = (jQuery.type(noty) === 'object') ? noty : $.noty.queue.shift();
46				
47				if (jQuery.type(notification) === 'object') {
48					
49					// Layout spesific container settings
50					if (notification.options.layout == "topLeft" || notification.options.layout == "topRight") {
51						if ($("ul.noty_container."+notification.options.layout).length > 0) {
52							base.$noty_container = $("ul.noty_container."+notification.options.layout);
53						} else {
54							base.$noty_container = $('<ul/>').addClass('noty_container').addClass(notification.options.layout);
55							$("body").prepend(base.$noty_container);
56						}
57						base.$notyContainer = $('<li/>');
58						base.$noty_container.prepend(base.$notyContainer);
59						
60					} else {
61						base.$notyContainer = $("body");
62					}
63					
64					base.$bar 		= $('<div/>').addClass('noty_bar');
65					base.$message 	= $('<div/>').addClass('noty_message');
66					base.$type 		= $('<div/>').addClass('noty_type'); //-> by JC ([email protected])
67					base.$text 		= $('<div/>').addClass('noty_text');
68					base.$close 	= $('<div/>').addClass('noty_close');
69					
70					//-> by JC ([email protected])
71					if(notification.options.type == 'loading') {
72						base.$type.append('<img src="/adm/frontend/js/noty/easyadm/img/ajax-loader.gif" />');
73					}
74					//-> by JC ([email protected])
75					
76					base.$message.append(base.$text).append(base.$close)
77						.append(base.$type); //-> by JC ([email protected])
78					base.$bar.append(base.$message);
79					
80					var $noty = base.$bar;
81					$noty.data('noty_options', notification.options);
82					
83					// Basic layout settings
84					$noty.addClass(notification.options.layout).addClass(notification.options.type).addClass(notification.options.theme);
85					
86					// Message and style settings
87					$noty.find('.noty_text').html(notification.options.text).css({textAlign: notification.options.textAlign});					
88					
89					// Closable option 
90					(notification.options.closable) ? $noty.find('.noty_close').show() : $noty.find('.noty_close').remove();
91					
92					// Bind close event to button 
93					$noty.find('.noty_close').bind('click', function() { $noty.trigger('noty.close'); });
94					
95					// Close on self click
96					if (notification.options.closeOnSelfClick) {
97						$noty.find('.noty_message').bind('click', function() { $noty.trigger('noty.close'); }).css('cursor', 'pointer');
98					}
99					
100					// is Modal? 
101					if (notification.options.modal) {
102						$('<div />').addClass('noty_modal').prependTo($('body')).css(notification.options.modalCss).fadeIn('fast');
103					}
104					
105					// Prepend noty to container
106					base.$notyContainer.prepend($noty);
107					
108					// Bind close event
109					$noty.one('noty.close', function(event, callback) {
110						var options = $noty.data('noty_options');
111						
112						// Modal Cleaning
113						if (options.modal) {
114							$('.noty_modal').fadeOut('fast', function() { $(this).remove(); });
115						}
116						
117						$noty.stop().animate(
118								$noty.data('noty_options').animateClose,
119								$noty.data('noty_options').speed,
120								$noty.data('noty_options').easing,
121								$noty.data('noty_options').onClose)
122						.promise().done(function() {
123							
124							// Layout spesific cleaning
125							if (options.layout == 'topLeft' || options.layout == 'topRight') {
126								$noty.parent().remove();
127							} else {
128								$noty.remove();
129							}
130							
131							// Are we have a callback function?
132							if ($.isFunction(callback)) {
133								callback.apply();
134							}
135							
136							// queue render
137							if (options.layout != 'topLeft' && options.layout != 'topRight') {
138								$.noty.available = true;
139								base.render();
140							}
141						});
142					});
143					
144					// Set buttons if available
145					if (notification.options.buttons) {
146						$buttons = $('<div/>').addClass('noty_buttons');
147						$noty.find('.noty_text').append($buttons);
148						
149						$.each(notification.options.buttons, function(i, button) {
150							bclass = (button.type) ? button.type : 'gray';
151							$('<button/>').addClass(bclass).html(button.text).appendTo($noty.find('.noty_buttons')).one("click", function() { $noty.trigger('noty.close', button.click); });
152						});
153					}
154					
155					// Start the show
156					$noty.animate(
157							notification.options.animateOpen,
158							notification.options.speed,
159							notification.options.easing,
160							notification.options.onShow);
161					
162					// Do not hide noty
163					if(notification.options.hide) { //-> by JC ([email protected])
164						
165						// If noty is have a timeout option
166						if (notification.options.timeout) { 
167							$noty.delay(notification.options.timeout).promise().done(function() { $noty.trigger('noty.close'); });
168						}
169						
170					}
171				}
172		 
173			}
174		};
175		
176		// Run initializer
177		base.init();
178	};
179	
180	$.noty.queue = [];
181	
182	$.noty.clearQueue = function () {
183		$.noty.queue = [];
184	};
185	
186	$.noty.close = function () {
187		$('.noty_bar:first').trigger('noty.close');
188	};
189
190	$.noty.closeAll = function () {
191		$.noty.clearQueue();
192		$('.noty_bar').trigger('noty.close');
193	};
194
195	$.noty.available = true;
196	$.noty.defaultOptions = {
197		layout : "top",
198		theme : "default",
199		animateOpen : {height: 'toggle'},
200		animateClose : {height: 'toggle'},
201		easing : 'swing',
202		text : "null",
203		textAlign : "center",
204		type : "alert",
205		speed : 500,
206		timeout : 5000,
207		closable : true,
208		closeOnSelfClick : true,
209		force : false,
210		onShow : false,
211		onClose : false,
212		buttons : false,
213		modal : false,
214		modalCss : {'opacity': 0.4},
215		hide : true
216	};
217
218	$.fn.noty = function(options) {
219		return new $.noty(options);
220	};
221
222})(jQuery);
223
224// Helper
225function noty(options) {
226	jQuery.fn.noty(options);
227}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.