PageSourceSearch

https://sadei.es/v_portal/javascript/mensajes.js

js sadei.es collected 2026-10-02 11:22:03 UTC 8,976 bytes, 269 lines download raw bytes

1// jQuery Alert Dialogs Plugin
2//
3// Version 1.1
4//
5// Cory S.N. LaViska
6// A Beautiful Site (http://abeautifulsite.net/)
7// 14 May 2009
8//
9// Visit http://abeautifulsite.net/notebook/87 for more information
10//
11// Usage:
12//		jAlert( message, [title, callback] )
13//		jConfirm( message, [title, callback] )
14//		jPrompt( message, [value, title, callback] )
15// 
16// History:
17//
18//		1.00 - Released (29 December 2008)
19//
20//		1.01 - Fixed bug where unbinding would destroy all resize events
21//
22//    2.00 - Modificado por Sentido Común internet para adecuarlo al fucionamiento de sus ventanas modales
23// License:
24// 
25// This plugin is dual-licensed under the GNU General Public License and the MIT License and
26// is copyright 2008 A Beautiful Site, LLC. 
27//
28(function($) {
29	
30	$.alerts = {
31		
32		// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
33		
34		verticalOffset: -75,                // vertical offset of the dialog from center screen, in pixels
35		horizontalOffset: 0,                // horizontal offset of the dialog from center screen, in pixels/
36		repositionOnResize: true,           // re-centers the dialog on window resize
37		overlayOpacity: .5,                 // transparency level of overlay
38		overlayColor: '#FFF',               // base color of overlay
39		draggable: true,                    // make the dialogs draggable (requires UI Draggables plugin)
40		okButton: ' OK ',         // text for the OK button
41		cancelButton: ' Cancel ', // text for the Cancel button
42		dialogClass: null,                  // if specified, this class will be applied to all dialogs
43		
44		// Public methods
45		
46		alert: function(message, title, callback) {
47			if( title == null ) title = 'Alert';
48			$.alerts._show(title, message, null, 'alert', function(result) {
49				if( callback ) callback(result);
50			});
51		},
52		
53		confirm: function(message, title, callback) {
54			if( title == null ) title = 'Confirm';
55			$.alerts._show(title, message, null, 'confirm', function(result) {
56				if( callback ) callback(result);
57			});
58		},
59			
60		prompt: function(message, value, title, callback) {
61			if( title == null ) title = 'Prompt';
62			$.alerts._show(title, message, value, 'prompt', function(result) {
63				if( callback ) callback(result);
64			});
65		},
66		
67		empty: function() {
68		  $.alerts._show('', '', '', 'empty', function(result) {
69				//if( callback ) callback(result);
70			});
71		},
72		
73		// Private methods
74		
75		_show: function(title, msg, value, type, callback) {
76			
77			$.alerts._hide();
78      $.alerts._overlay('show');
79			
80			$("BODY").append(						  
81			  '<div id="popup_container">' +
82			    '<div id="popup_title" class="blq cp txa_r"></div>' +
83			    '<div id="popup_content" class="bl_izq t92 cs pad4p">' +
84			      '<div id="popup_message" class="blq mart8 marb16 v_normsobcs"></div>' +
85				  '</div>' +
86			  '</div>');
87      			  
88			if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
89			
90			// IE6 Fix
91//			var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed'; 
92			
93			var pos='fixed';
94			
95			$("#popup_container").css({
96				position: pos,
97				zIndex: 99999,
98				padding: 0,
99				margin: 0
100			});
101			
102			$("#popup_title").text(title);
103			//añado al título el boton de cerrar
104			$("#popup_title").append('<a id="popup_close" href="#" class="a_cerrarvw v_normsobcp blq"><i class="fa fa-close padr4 fs_1_25"></i></a>'); 
105			$("#popup_close").click( function() {
106			  $.alerts._hide();
107        callback(false);
108      });			
109			$("#popup_content").addClass(type);
110			$("#popup_message").text(msg);
111			$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
112			
113			$("#popup_container").css({
114				minWidth: $("#popup_container").outerWidth(),
115				maxWidth: $("#popup_container").outerWidth()
116			});
117			
118			$.alerts._reposition();
119			$.alerts._maintainPosition(true);
120			
121			switch( type ) {
122				case 'alert':
123					$("#popup_message").after('<div id="popup_panel" class="blq pad8 t98 txa_c"><input type="button" class="bt_form" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
124					$("#popup_ok").click( function() {
125						$.alerts._hide();
126						callback(true);
127					});
128					$("#popup_ok").focus().keypress( function(e) {
129						if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
130					});
131				break;
132				case 'confirm':
133					$("#popup_message").after('<div id="popup_panel" class="blq pad8 t98 txa_c"><input type="button" class="bt_form" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" class="bt_form" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
134					$("#popup_ok").click( function() {
135						$.alerts._hide();
136						if( callback ) callback(true);
137					});
138					$("#popup_cancel").click( function() {
139						$.alerts._hide();
140						if( callback ) callback(false);
141					});
142					$("#popup_ok").focus();
143					$("#popup_ok, #popup_cancel").keypress( function(e) {
144						if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
145						if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
146					});
147				break;
148				case 'prompt':
149					$("#popup_message").append('<p><input type="text" class="t100 form brcg fl_l bgb" size="30" id="popup_prompt" /></p>').after('<div id="popup_panel" class="blq pad8 t98 txa_c"><input type="button" class="bt_form" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" class="bt_form" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
150					$("#popup_prompt").width( $("#popup_message").width() );
151					$("#popup_ok").click( function() {
152						var val = $("#popup_prompt").val();
153						$.alerts._hide();
154						if( callback ) callback( val );
155					});
156					$("#popup_cancel").click( function() {
157						$.alerts._hide();
158						if( callback ) callback( null );
159					});
160					$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
161						if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
162						if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
163					});
164					if( value ) $("#popup_prompt").val(value);
165					$("#popup_prompt").focus().select();
166				case 'empty':
167				
168				break;
169			}
170			
171			// Make draggable
172			if( $.alerts.draggable ) {
173				try {
174					//$("#popup_container").draggable({ handle: $("#popup_title") });
175					$("#popup_title").css({ cursor: 'move' });
176				} catch(e) { /* requires jQuery UI draggables */ }
177			}
178		},
179		
180		_hide: function() {
181			$("#popup_container").remove();
182			$.alerts._overlay('hide');
183			$.alerts._maintainPosition(false);
184		},
185		
186		_overlay: function(status) {
187			switch( status ) {
188				case 'show':
189					$.alerts._overlay('hide');
190					$("BODY").append('<div id="popup_overlay"></div>');
191					$("#popup_overlay").css({
192						position: 'absolute',
193						zIndex: 99998,
194						top: '0px',
195						left: '0px',
196						width: '100%',
197						height: $(document).height(),
198						background: $.alerts.overlayColor,
199						opacity: $.alerts.overlayOpacity
200					});
201				break;
202				case 'hide':
203					$("#popup_overlay").remove();
204				break;
205			}
206		},
207		
208		_reposition: function() {
209			var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
210			var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
211			if( top < 0 ) top = 0;
212			if( left < 0 ) left = 0;
213			
214			// IE6 fix
215			//if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
216			
217			$("#popup_container").css({
218				top: top + 'px',
219				left: left + 'px'
220			});
221			$("#popup_overlay").height( $(document).height() );
222		},
223		
224		_maintainPosition: function(status) {
225			if( $.alerts.repositionOnResize ) {
226				switch(status) {
227					case true:
228						$(window).bind('resize', $.alerts._reposition);
229					break;
230					case false:
231						$(window).unbind('resize', $.alerts._reposition);
232					break;
233				}
234			}
235		}
236		
237	}
238	
239	// Shortuct functions
240	esenciaAlert = function(message, title, callback) {
241		$.alerts.alert(message, title, callback);
242	}
243	
244	esenciaConfirm = function(message, title, callback) {
245		$.alerts.confirm(message, title, callback);
246	};
247		
248	esenciaPrompt = function(message, value, title, callback) {
249		$.alerts.prompt(message, value, title, callback);
250	};
251	
252	//Funciones esencia
253	//VERPROMPT
254	verprompt = function(msg,e,value,title,callback) {
255	  $.alerts.prompt(msg, value, title, callback);
256	}	 
257	
258	//VERPROMPT_TXT
259	verprompt_txt = function(msg,e,value,title,callback) {
260	  verprompt(msg,e,value,title,callback);
261	}
262	
263	//VERPROMPT_BORRAR
264	verprompt_borrar = function (msg,e,value,title,callback) {
265	  $.alerts.confirm(msg, title, callback);	  
266  }
267	
268	
269})(jQuery);

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.