Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3731 efrain 1
jQuery( document ).ready(function( $ ) {
2
 
3
 
4
	$.fn.isUrl = function(str)
5
	{
6
		regexp =  /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/;
7
		return regexp.test(str) ? true : false;
8
	}
9
 
10
	$.fn.stripHtml = function (html)
11
	{
12
	    var temporalDivElement = document.createElement("div");
13
	    temporalDivElement.innerHTML = html;
14
	    return temporalDivElement.textContent || temporalDivElement.innerText || "";
15
	}
16
 
17
	$.fn.cleanHTML = function(s)
18
	{
19
 
20
		var tag_search = [
21
		    String.fromCharCode(0x2013),
22
		    String.fromCharCode(0x2014),
23
		    String.fromCharCode(0x2018),
24
		    String.fromCharCode(0x2019),
25
		    String.fromCharCode(0x00AE),
26
		    String.fromCharCode(0x201C),
27
		    String.fromCharCode(0x201D),
28
 
29
		];
30
		var tag_replace = [
31
		    '–',
32
		    '—',
33
		    '‘',
34
		    '’',
35
		    '®',
36
		    '“',
37
		    '”'
38
		];
39
 
40
		for(i  = 0; i < tag_search.length; i++ ) {
41
			key = tag_search[i];
42
		    value = tag_replace[i];
43
 
44
			s = s.replace(new RegExp(key, 'g'), value);
45
		}
46
 
47
		return s;
48
	}
49
 
50
	$.fn.showError = function(message)
51
	{
52
		$.notify({
53
			message: message,
54
		},{
55
			element: 'body',
56
			position: null,
57
			type: 'danger',
58
			allow_dismiss: true,
59
			newest_on_top: true,
60
			showProgressbar: false,
61
			placement: {
62
				from: 'top',
63
				align: 'right'
64
			},
65
			offset: 20,
66
			spacing: 10,
67
			z_index:1052,
68
			timer: 500,
69
			url_target: '_blank',
70
			mouse_over: null,
71
			animate: {
72
				enter: 'animated fadeInDown',
73
				exit: 'animated fadeOutUp'
74
			},
75
			onShow: null,
76
			onShown: null,
77
			onClose: null,
78
			onClosed: null,
79
		});
80
	}
81
 
82
	$.fn.showWarning = function(message)
83
	{
84
		$.notify({
85
			message: message,
86
		},{
87
			element: 'body',
88
			position: null,
89
			type: 'warning',
90
			allow_dismiss: true,
91
			newest_on_top: true,
92
			showProgressbar: false,
93
			placement: {
94
				from: 'top',
95
				align: 'right'
96
			},
97
			offset: 20,
98
			spacing: 10,
99
			z_index:1052,
100
			timer: 500,
101
			url_target: '_blank',
102
			mouse_over: null,
103
			animate: {
104
				enter: 'animated fadeInDown',
105
				exit: 'animated fadeOutUp'
106
			},
107
			onShow: null,
108
			onShown: null,
109
			onClose: null,
110
			onClosed: null,
111
		});
112
	}
113
 
114
	$.fn.showInfo = function(message)
115
	{
116
		$.notify({
117
			message: message,
118
		},{
119
			element: 'body',
120
			position: null,
121
			type: 'info',
122
			allow_dismiss: true,
123
			newest_on_top: true,
124
			showProgressbar: false,
125
			placement: {
126
				from: 'top',
127
				align: 'right'
128
			},
129
			offset: 20,
130
			spacing: 10,
131
			z_index:1052,
132
			timer: 500,
133
			url_target: '_blank',
134
			mouse_over: null,
135
			animate: {
136
				enter: 'animated fadeInDown',
137
				exit: 'animated fadeOutUp'
138
			},
139
			onShow: null,
140
			onShown: null,
141
			onClose: null,
142
			onClosed: null,
143
		});
144
	}
145
 
146
	$.fn.showSuccess = function(message)
147
	{
148
		$.notify({
149
			message: message,
150
		},{
151
			element: 'body',
152
			position: null,
153
			type: 'success',
154
			allow_dismiss: true,
155
			newest_on_top: true,
156
			showProgressbar: false,
157
			placement: {
158
				from: 'top',
159
				align: 'right'
160
			},
161
			offset: 20,
162
			spacing: 10,
163
			z_index:1052,
164
			timer: 500,
165
			url_target: '_blank',
166
			mouse_over: null,
167
			animate: {
168
				enter: 'animated fadeInDown',
169
				exit: 'animated fadeOutUp'
170
			},
171
			onShow: null,
172
			onShown: null,
173
			onClose: null,
174
			onClosed: null,
175
		});
176
	}
177
});