// JavaScript Document
function createCookie(name,value,days,path,domain,secure,recargar="No") {
var expires="";
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires=" +date.toGMTString();
}
path=path==""?"; path=/":"; path=" + path;
domain=domain=="" ? "" : "; domain=" + domain;
secure=secure==("" || false) ? "" : "; secure";
document.cookie = name + "=" + escape(value) + expires + path + domain + secure;
if(recargar=='1'){
window.location.reload();
}
}
function aceptoCookies(name){
crear_cookie_ley(name);
}
function crear_cookie_ley(name){
createCookie(name+'','ok','1000','','',false,'1');
//document.cookie = "leyCookie=ok; expires=Thu, 18 Dic 2219 12:00:00 UTC; path=/";
$( "#leyCookies" ).modal('toggle');
}
function confirmar_eliminar(){
return confirm('Quieres Eliminar este dato? ,se eliminara para siempre y no ahy vuelta atras');
}
$(document).ready(function(){
$(".pagination").rPage();// paginador responsive
if($("table").hasClass("responsiveTable")){
$('.responsiveTable').resTables(); // table responsive
}
/*Subir arriba Scroll */
$('body #botonSubir').append('
Subir
');
$(window).scroll(function () {
if ($(this).scrollTop() !== 0) {
$('#toTop').fadeIn();
} else {
$('#toTop').fadeOut();
}
});
$('#toTop').click(function(){
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
/*fin de Subir arriba del todo */
/*Bajar a bajo scroll*/
/*$('body #botonSubir').append('Bajar
');
var valorBottom=$( "html, body" ).height() - $(window).height();
$(window).scroll(function () {
if ($(this).scrollTop() <= valorBottom) {
$('#toBottom').fadeIn();
} else {
$('#toBottom').fadeOut();
}
});
$('#toBottom').click(function(){
$("html, body").animate({
scrollTop: $( "html, body" ).height() }, 600);
return false;
});*/
/* fin de Bajar Scroll */
// my lightbox
$('a[data-lightboxM], button[data-lightboxM]').click(function() {
var videoAyuda =$(this).attr('data-video-ayuda');
var tipoVista =$(this).attr('data-tipo');
var lightboxM =$(this).attr('data-lightboxM');
var idSeparado =lightboxM.split('-');
var miId =idSeparado[2];
var titulo =$(this).attr('data-title');
var hrefer =$(this).attr('href');
var dataExtra =$(this).attr('data-extra');
var dataContenido =$(this).attr('data-contenido')!=undefined?$(this).attr('data-contenido'):'';
var contenido="error";
if(tipoVista=='imagen'){
contenido=dataContenido;
}else if(tipoVista=='video'){
var iframe=dataContenido+'';
contenido='
'+ iframe + '';
}else if(tipoVista=='pdf'){
var iframe=dataContenido+'';
contenido='
'+ iframe ;
}
if(videoAyuda!==undefined){
sumarVistaVideoAyuda(videoAyuda);
}
var href = $(this).attr('href');
var tipoEmail = $(this).attr('data-email_tipo');
if ($('#vision-id-'+ miId).length <= 0) {
var btnCierre='';
$('body').append('');
}
$('#btn_zoom_minus_'+miId).hide();
if(dataExtra=='agrandar'){
$('#btn_zoom_plus_' + miId).trigger('click');
}
$('#vision-id-'+miId).modal('show');
return false;
});
// Fin de mi lightbox
function zoomLightbox(tipo,id){
if(tipo=='plus'){
ponerBtnClose(id);
$('#vision-id-'+id+' div').addClass('modal-lg');// version bootstrap 4.0
$('#vision-id-'+id+' div').addClass('modal-xl');// version bootstrap 4.3
$('#btn_zoom_plus_'+id).hide();
$('.modal-header').hide();
$('.modal-footer').hide();
$('#btn_zoom_minus_'+id).show();
}else if(tipo=='minus'){
$('#btn-modal-close').hide();
$('#vision-id-'+id+' div').removeClass('modal-lg');// version bootstrap 4.0
$('#vision-id-'+id+' div').removeClass('modal-xl');// version bootstrap 4.3
$('#btn_zoom_plus_'+id).show();
$('.modal-header').show();
$('.modal-footer').show();
$('#btn_zoom_minus_'+id).hide();
}
}
function launchFullScreen(element,id) {
/*
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(!element.fullscreenElement) {// mozzila
element.requestFullscreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
*/
//Si el navegador es Mozilla Firefox
if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
}
//Si el navegador es Google Chrome
else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
//Si el navegador es otro
else if(element.requestFullScreen) {
element.requestFullScreen();
}
zoomLightbox('plus',id);
$('#view-fullscreen').addClass('d-none');
$('#cancel-fullscreen').removeClass('d-none');
}
function cancelFullscreen(id) {
console.error('Estamos en cancel full screen');
if (!window.screenTop && !window.screenY) {
/*
if(document.cancelFullScreen) {
document.cancelFullScreen();
}else if (document.exitFullscreen) {// mozzila
document.exitFullscreen();
} else if(document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
*/
//Mozilla Firefox
if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
//Google Chrome
else if(document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
//Otro
else if(document.cancelFullScreen) {
document.cancelFullScreen();
}
}
zoomLightbox('minus',id);
$('#cancel-fullscreen').addClass('d-none');
$('#view-fullscreen').removeClass('d-none');
}
var myModal = new bootstrap.Modal(document.getElementById('myModal'));
const toast = msg => {
const $toast = document.querySelectorAll(".toast")[0]
const $toastbody = $toast.getElementsByClassName("toast-body")[0]
//como segundo parĂ¡metro admite opciones como: animation, autohide, delay
const bootToast = new bootstrap.Toast($toast)
if($toastbody) {
$toastbody.innerText = msg
bootToast.show()
}
}// toast()
/*
document.getElementById("btn-toast").addEventListener("click", () => {
const $txtmessage = document.getElementById("txt-message")
const msg = $txtmessage.value
toast(msg)
})// btn-toast.on-click
*/
});