var disallow_forward_video = 1; var disallow_forward_video_vimeo = 1; function launchToast(type, msg = '', heading = null, hideAfter = 10000) { let bgColor; let loaderBg; switch (type) { case "notice": heading = heading || "¡Felicidades!"; bgColor = '#3c763d'; loaderBg = '#76C278'; break; case "warning": heading = heading || "¡Atención!"; bgColor = '#c2653c'; loaderBg = '#FF9668'; break; case "error": case "danger": heading = heading || "¡Atención! Ha ocurrido un error."; msg = msg ?? "<p>Lamentablemente no se ha podido realizar la acción. Por favor, vuelve a intentarlo.</p> <p>En caso de persistir el problema, ponte en contacto con nosotros.</p> <p>Disculpa las molestias.</p>"; bgColor = '#a94442'; loaderBg = '#F57B78'; hideAfter = false; break; } $.toast({ text: msg, heading: heading, bgColor: bgColor, textColor: '#fff', loaderBg: loaderBg, hideAfter: hideAfter }); } $(document).ready(function () { let copyClipboardBtn = document.getElementById('js-copy-to-clipboard-btn'); // Detectamos si en la página existe algún botón de copiar al clipboard if (copyClipboardBtn) { // Si el navegador del usuario no soporta el API de clipboard, ocultamos el botón de copiar (ej: iOS 13.3 para abajo) o cuando la web no tiene certificado seguro (https) if (!navigator.clipboard) { copyClipboardBtn.classList.add("hidden"); } copyClipboardBtn.addEventListener('click', function (e) { e.preventDefault(); // Añadimos la url actual al clipboard y mostramos mensaje de feedback navigator.clipboard.writeText(window.location.href).then(function() { launchToast ('notice', '', "Dirección web copiada.", 1000); }, function(err) { launchToast('error', "No se ha podido copiar la dirección. Vuelve a intentarlo o copia manualmente la dirección desde la barra de direcciones del navegador.", null, 2500); }); }); } }); const _LOCALE = "es"; const LOCALE_ES = "es"; const FORMAT_DATETIME_PICKER = "DD\u002DMM\u002DYYYY\u0020HH\u003Amm"; const FORMAT_DATE_PICKER = "DD\u002DMM\u002DYYYY"; const PERMISSION_NONE = "\u0028\u00200\u0020\u0029"; const TYPE_LINK = "link"; const TYPE_OTHER = "Other"; const TYPE_PDF = "pdf"; const TYPE_VIDEO = "video"; const TYPE_V_AMAZON_VALUE = "amazon"; const TYPE_V_OTHER_VALUE = "other"; const TYPE_V_VIMEO_VALUE = "vimeo"; // Se utilizan en los mensajes de Swal.fire const ARE_YOU_SURE = "\u00BFEst\u00E1s\u0020seguro\/a\u003F"; const YES = "Si"; const NO = "No"; const ELEMENT_REMOVED = "Elemento\u0020eliminado"; const ELEMENT_REMOVED_PHRASE = "El\u0020elemento\u0020ha\u0020sido\u0020eliminado\u0020correctamente."; const MAX_TIME_CONTROL_EXECUTION_TIME = 5400000; $(document).ready(function () { //Save time spent let timeControl = function(millis) { $.ajax({ url: '/es/time/register/2507', //Register URL type: 'POST', data: { 'username': 'rmiro@wetak.com', //Username 'millis' : millis ? millis : 60000 }, dataType: 'json', success : function(data, status, xhr){ timeInMillis -= 60000; //console.log(data); }, error : function(xhr, status, error) { //console.log(status); } }); }; let registerTime; let registerMillis; let timeInMillis = 0; let registerSeconds; $( window ).load(function() { //Increment miliseconds registerSeconds = setInterval(function(){timeInMillis += 1000;}, 1000); //Start registering time on page load registerTime = setInterval(function(){timeControl()}, 60000); // Dejar de chequear a los MAX_TIME_CONTROL_EXECUTION_TIME milisegundos setTimeout(() => { if(registerMillis) { window.clearInterval(registerMillis); } if(registerTime) { window.clearInterval(registerTime); } }, MAX_TIME_CONTROL_EXECUTION_TIME ); }).blur(function() { //Stop registering time on losing focus clearInterval(registerTime); clearInterval(registerSeconds); }).focus(function() { //Increment miliseconds registerSeconds = setInterval(function(){timeInMillis += 1000;}, 1000); //Continue registering time on getting focus registerTime = setInterval(function(){timeControl()}, 60000); }); window.addEventListener('beforeunload', function(event) { timeControl(timeInMillis); }); });
$(document).ready(function () { });