AutorÃa | Ultima modificación | Ver Log |
jQuery( document ).ready(function( $ ) {
$.fn.isUrl = function(str)
{
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*)?$/;
return regexp.test(str) ? true : false;
}
$.fn.stripHtml = function (html)
{
var temporalDivElement = document.createElement("div");
temporalDivElement.innerHTML = html;
return temporalDivElement.textContent || temporalDivElement.innerText || "";
}
$.fn.cleanHTML = function(s)
{
var tag_search = [
String.fromCharCode(0x2013),
String.fromCharCode(0x2014),
String.fromCharCode(0x2018),
String.fromCharCode(0x2019),
String.fromCharCode(0x00AE),
String.fromCharCode(0x201C),
String.fromCharCode(0x201D),
];
var tag_replace = [
'–',
'—',
'‘',
'’',
'®',
'“',
'”'
];
for(i = 0; i < tag_search.length; i++ ) {
key = tag_search[i];
value = tag_replace[i];
s = s.replace(new RegExp(key, 'g'), value);
}
return s;
}
$.fn.showError = function(message)
{
$.notify({
message: message,
},{
element: 'body',
position: null,
type: 'danger',
allow_dismiss: true,
newest_on_top: true,
showProgressbar: false,
placement: {
from: 'top',
align: 'right'
},
offset: 20,
spacing: 10,
z_index:1052,
timer: 500,
url_target: '_blank',
mouse_over: null,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
onShow: null,
onShown: null,
onClose: null,
onClosed: null,
});
}
$.fn.showWarning = function(message)
{
$.notify({
message: message,
},{
element: 'body',
position: null,
type: 'warning',
allow_dismiss: true,
newest_on_top: true,
showProgressbar: false,
placement: {
from: 'top',
align: 'right'
},
offset: 20,
spacing: 10,
z_index:1052,
timer: 500,
url_target: '_blank',
mouse_over: null,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
onShow: null,
onShown: null,
onClose: null,
onClosed: null,
});
}
$.fn.showInfo = function(message)
{
$.notify({
message: message,
},{
element: 'body',
position: null,
type: 'info',
allow_dismiss: true,
newest_on_top: true,
showProgressbar: false,
placement: {
from: 'top',
align: 'right'
},
offset: 20,
spacing: 10,
z_index:1052,
timer: 500,
url_target: '_blank',
mouse_over: null,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
onShow: null,
onShown: null,
onClose: null,
onClosed: null,
});
}
$.fn.showSuccess = function(message)
{
$.notify({
message: message,
},{
element: 'body',
position: null,
type: 'success',
allow_dismiss: true,
newest_on_top: true,
showProgressbar: false,
placement: {
from: 'top',
align: 'right'
},
offset: 20,
spacing: 10,
z_index:1052,
timer: 500,
url_target: '_blank',
mouse_over: null,
animate: {
enter: 'animated fadeInDown',
exit: 'animated fadeOutUp'
},
onShow: null,
onShown: null,
onClose: null,
onClosed: null,
});
}
});