PageSourceSearch

https://www.silven.com.br/js/frontend/message.js

js silven.com.br collected 2026-09-30 17:20:01 UTC 7,835 bytes, 253 lines download raw bytes

1$(function(){
2	$.message = (function(){
3		
4	var conf = {
5			'vars' : {},
6			'classes': new Array(),
7			'showTime': 1000,
8			'hideTime': 1000,
9			'hideOnClick': true,
10			'showAnimation': 'bounceInDown',
11			'hideAnimation': 'bounceOutUp',
12			'idleTime': false,
13			'parent': $('body'),
14			'hideTriggers': '.close-msg,.msg-link-close'
15		},
16		syncConf = {
17			'showTime': 1000,
18			'hideTime': 1000,
19			'idleTime': false,
20			'showAnimation': 'bounceInDown',
21			'hideAnimation': 'bounceOutUp',
22			'hideTriggers': '.close-msg,.msg-link-close',
23			'parent': $('body'),
24			'hideOnClick': true
25		},
26		layoutLookup = {
27			'product-add':{
28							html:'<div class="{{klass}}">'+
29								 '<p class="msg-text-top">Produto adicionado com sucesso!</p>'+ 
30 							     '<p class="msg-text-bottom">Você deseja <a class="msg-link-cart" href="'+base_url+'carrinho">finalizar o pedido</a> ou <a class="msg-link-close" href="javascript:;">continuar comprando</a>?</p>'+
31	 					   		     '<a href="javascript:;" class="close-msg">&times;</a>'+
32	 					   		  '</div>'
33   	 		},
34   	 		'product-add-home':{
35							html:'<div class="{{klass}} msg-success">'+
36								 '<p class="msg-text-top">Produto adicionado com sucesso!</p>'+ 
37 							     '<p class="msg-text-bottom">Você deseja <a class="msg-link-cart" href="'+base_url+'carrinho">finalizar o pedido</a> ou <a class="msg-link-close" href="'+base_url+'">continuar comprando</a>?</p>'+
38	 					   		     '<a href="javascript:;" class="close-msg">&times;</a>'+
39	 					   		  '</div>'
40   	 		},
41   	 		'price-not-fit':{
42							html:'<div class="{{klass}} msg-error">'+
43								 '<p class="msg-text-top">O valor mínimo do pedido é de: {{value}}</p>'+ 
44 							     '<p class="msg-text-bottom">'+
45 							     	  '<a class="msg-link-close" href="'+base_url+'">continue comprando</a>'+		
46 							    '</p>'+ 
47	 					   		 '<a href="javascript:;" class="close-msg">&times;</a>'+
48	 					   		  '</div>'
49   	 		},
50   	 		'success': {
51   	 				html: '<div class="{{klass}}">'+
52   	 					'<p class="msg-text-top">{{title}}</p>'+ 
53	 					 '<p class="msg-text-bottom">{{content}}</p>'+ 
54	 					  '<a href="javascript:;" class="close-msg">&times;</a>'+
55   	 					 '</div>'
56   	 		},
57   	 		'error':{
58   	 				html: '<div class="{{klass}}">'+ 
59   	 					  '<p class="msg-text-top">{{title}}</p>'+
60   	 					  '<p class="msg-text-bottom">{{content}}</p>'+
61   	 					   '<a href="javascript:;" class="close-msg">&times;</a>'+
62   	 					  '</div>'
63   	 		},
64   	 		'info':{
65   	 				html: '<div class="{{klass}}">'+ 
66   	 					  '<p class="msg-text-top">{{title}}</p>'+
67   	 					  '<p class="msg-text-bottom">{{content}}</p>'+
68   	 					   '<a href="javascript:;" class="close-msg">&times;</a>'+
69   	 					  '</div>'
70   	 		},
71   	 		'warning':{
72   	 				html: '<div class="{{klass}}">'+ 
73   	 					  '<p class="msg-text-top">{{title}}</p>'+
74   	 					  '<p class="msg-text-bottom">{{content}}</p>'+
75   	 					   '<a href="javascript:;" class="close-msg">&times;</a>'+
76   	 					  '</div>'
77   	 		},
78   	 		'masked-success':{
79   	 				html: '<div class="mask-msg"></div>'+
80		   	 			  '<div class="{{klass}}">'+
81		   	 				'<p class="msg-text-top">{{title}}</p>'+ 
82			 				'<p class="msg-text-bottom">{{content}}</p>'+ 
83		   	 			   '</div>'
84   	 		},
85   	 		'masked-warning':{
86   	 				html: '<div class="mask-msg"></div>'+
87		   	 			  '<div class="{{klass}}">'+
88		   	 				'<p class="msg-text-top">{{title}}</p>'+ 
89			 				'<p class="msg-text-bottom">{{content}}</p>'+ 
90		   	 			   '</div>'
91   	 		},
92 		   'masked':{
93 				html: '<div class="mask-msg"></div>'+
94   	 			  '<div class="{{klass}}">'+
95   	 				'<p class="msg-text-top">{{title}}</p>'+ 
96	 				'<p class="msg-text-bottom">{{content}}</p>'+ 
97   	 			   '</div>'
98 			},
99 			'product-list-add':{
100				html:'<div class="{{klass}} msg-success">'+
101						 '<p class="msg-text-top">Produto Adicionado à Lista com sucesso!</p>'+ 
102 					     '<p class="msg-text-bottom">Você deseja <a class="msg-link-cart" href="'+base_url+'clientes/listaPresentes">Ver Lista</a> ou <a class="msg-link-close" href="javascript:;">Continuar</a></p>'+ 
103	 				     '<a href="javascript:;" class="close-msg">&times;</a>'+
104	 				  '</div>'
105   	 		},
106   	 		'product-list-error':{
107				html:'<div class="{{klass}} msg-error">'+
108						 '<p class="msg-text-top">Falha ao Adicionar Produto na Lista.</p>'+ 
109 					     '<p class="msg-text-bottom">Acesse seu Cadastro e Gerencie sua Lista <a class="msg-link-cart" href="'+base_url+'clientes/login/lista">Aqui</a></p>'+ 
110	 				     '<a href="javascript:;" class="close-msg">&times;</a>'+
111	 				  '</div>'
112   	 		}
113 	  	};
114
115		var setConf = function(msgConf){
116				if(typeof msgConf !=  'undefined'){
117					$.each(msgConf, function(index, value){
118						conf[index] = value; 
119					});
120				}
121			},
122			hide = function(div, callback){
123				var div = $(div),
124					mask = div.prev(),
125					msg_conf = (div.hasClass('sync-msg')) ? syncConf : conf;
126
127				if(mask.hasClass('mask-msg')){
128					mask.fadeOut('slow', function(){ div.remove(); });
129				}
130
131				div.removeClass(msg_conf.showAnimation).addClass(msg_conf.hideAnimation);
132				setTimeout(function(){ 
133					div.remove(); 
134					
135					if(typeof callback !== 'undefined'){
136						callback.call(div);
137					}
138
139				}, msg_conf.hideTime);
140			},
141			setClasses = function(div){
142				$(conf.classes).each(function(index, klass){ div.addClass(klass); });
143			},
144			interpolate = function(html){
145				if(typeof conf.vars !== 'undefined'){
146					var vars = conf.vars,
147						regex = /{{2}[a-zA-Z0-9_-]*\}{2}/g;
148						textVars = html.match(regex);
149
150
151					$.each(textVars, function(index, value){
152						keyValue = value.replaceAll('{', '').replaceAll('}', '');
153
154						if(typeof vars[keyValue] !== 'undefined'){	
155							html = html.replace(value, vars[keyValue]);
156						}else{
157							html = html.replace(value, '');
158						}
159					});
160				}
161
162				return html;
163			},
164			setEvents = function(div){
165				var msg_conf = (div.hasClass('sync-msg')) ? syncConf : conf;
166
167				if(msg_conf.hideOnClick){
168					div.click(function(){ 
169						hide(div); 
170					}).find(msg_conf.hideTriggers).click(function(){ 
171						hide(div); 
172					});
173				}
174
175				if(msg_conf.idleTime !== false){
176					setTimeout(function(){ 
177						hide(div); 
178					}, msg_conf.idleTime);
179				}
180			},
181			show = function(type, msgConf){
182				var klass ='msg-'+type,
183					layout =  layoutLookup[type],
184					div = $('.'+klass);
185
186				if(!div.length){
187					setConf(msgConf);
188					conf.vars.klass = klass;
189				
190					var div = interpolate(layout.html);
191						setClasses(div);
192						conf.parent.prepend(div);
193						div = conf.parent.children('.'+klass);
194						
195						div.attr('class', div.attr('class').replace('/^msg$/', ''));
196						div.attr('class', 'msg '+div.attr('class'));
197
198					if(!div.hasClass('animated')){
199						div.addClass('animated').addClass(conf.showAnimation);
200					}	
201
202					setEvents(div);
203				}
204
205				return div;
206			},
207			showSync = function(div, conf){
208				if(div.prev().hasClass('mask')){
209					var mask = div.prev();
210						mask_clone = $(div.prev()).clone(); 
211						mask.remove()
212				}
213				var div_clone = $(div).clone();
214					div.remove();
215
216				if(typeof mask_clone !== 'undefined'){
217					conf.parent.append(mask_clone.show().after(div_clone));
218				}else{
219					conf.parent.append(div_clone);
220				}
221
222				setEvents(div_clone);
223				div_clone.show().addClass('animated').addClass(conf.showAnimation);
224			},
225			mapSync = function(){
226				$('.sync-msg').each(function(index, msg){
227					var msg_conf = $(msg).data();
228						msg = $(msg);
229
230					$.each(msg_conf, function(key, value){
231
232						if(key.indexOf('time') != -1){
233							value = (value * 1000);
234						}
235
236						syncConf[key.toCamel()] = value;
237					});
238
239					showSync(msg, syncConf);
240				});
241			};
242
243			return {
244				setConf: setConf,
245				show: show,
246				hide: hide,
247				mapSync: mapSync
248			}
249
250	})();
251
252	$.message.mapSync();
253});

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.