523
| <![CDATA[<script type="text/javascript">
function topo() {
window.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
}
// smoothScroll.init();
document.addEventListener('keydown', (event) => {
if (event.code == "ArrowLeft") {
$('.slider-controle.esquerda').click()
}
if (event.code == "ArrowRight") {
$('.slider-controle.direita').click()
}
}, false);
var botao = document.querySelector(".fab-container");
var listaBotao = document.querySelector(".fab-options");
var idiomas = {};
var url = location.href;
var arrayVariableUrl = getUrlVars();
if (url.indexOf("onepage/thankyou") != -1) {
var thankYouPage = $('.thankyou');
if (url.indexOf("&pdf=1") != -1 || url.indexOf("?pdf=1") != -1) {
$(".imagem-download").css("display", "block");
$(".thankyou-message").text(
"FAÃA O DOWNLOAD ACIMA E APRESENTE NO BANCO PARA DAR ENTRADA AO SEU PEDIDO DE CRÃDITO!"
);
$('#conteudo').append();
thankYouPage.css("display", "block");
} else {
$(".thankyou-message").text(
"FORMULÃRIO ENVIADO COM SUCESSO!"
);
$('#conteudo').append();
thankYouPage.css("display", "block");
}
}
$(botao).on("click", function() {
if ($(listaBotao).css("display") == "none") {
$(listaBotao).fadeIn();
$(listaBotao).fadeIn("slow");
$(listaBotao).fadeIn(300);
$(listaBotao).css("transform", "scale(1)");
} else {
$(listaBotao).fadeOut(300);
setTimeout(function() {
$(listaBotao).hide();
}, 400);
$(listaBotao).css("transform", "scale(0)");
}
});
window.MyReset = () => jQuery('#\\:1\\.container').contents().find('#\\:1\\.restore').click();
var siglaIdioma = window.navigator.language.toLowerCase();
if ((siglaIdioma in idiomas) && !/idiomaDefinido=true/.exec(document.cookie)) {
document.cookie = 'idiomaDefinido=true';
if (confirm("Gostaria de visualizar esse site no idioma " + idiomas[siglaIdioma].nome + "?")) {
location.href = idiomas[siglaIdioma].link;
}
}
FastClick.attach(document.body);
termFilter = '?filtro=' + $('#form_data_ban_tag').val();
if (navigator.userAgent.match(/Android/i) !== null) {
document.documentElement.className += " android";
}
preload = new Image(240, 45);
preload.src = '/publico/layouts/onepage/img/loading.gif';
$(document).ready(function() {
var body = [];
function merge_options(obj1, obj2) {
var obj3 = {};
for (var attrname in obj1) {
obj3[attrname] = obj1[attrname];
}
for (var attrname in obj2) {
obj3[attrname] = obj2[attrname];
}
return obj3;
}
function forEach(array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]);
}
};
if (arrayVariableUrl["nomeApp"] == null && arrayVariableUrl["codigo"] == null) {
$.getJSON(
'/publico/service/onepage/select.geral.bandeiras.php' + termFilter,
function(data) {
var menu = $('.menu-pagina');
var ativo = 0;
function percorrerOnepage(webservice) {
if (webservice == 'videos') {
var dados = data.videos;
} else {
var dados = data.bandeiras;
};
$.each(dados, function(key, value) {
if (value.ban_local != 'onepage-cabecalho' && value.ban_local != 'onepage-custom') {
value.ban_descricao = value.ban_descricao.replace(
/(\n\r|\r\n|\n)/g,
'<br/>');
}
for (var f = 0; f < value.filhos.length; f++) {
value.filhos[f].ban_texto = value.filhos[f].ban_texto.replace(
/(\n\r|\r\n|\n)/g, '<br/>');
if (value.filhos[f].ban_descricao == '') {
value.filhos[f].ban_descricao = "#void";
value.filhos[f].blank =
'onclick="return false;" class="nocursor"';
} else if (value.filhos[f].ban_aba == 0) {
value.filhos[f].blank = '';
} else if (value.filhos[f].ban_aba == 1) {
value.filhos[f].blank = 'target="_blank"';
}
value.filhos[f].slide_indice = (f * 100) + "%";
value.filhos[f].slide_background = (((f * 100) / 2) * -1) + "%";
}
if (value.ban_tipo_link_menu != 1) {
try {
if (value.ban_local == "onepage-cabecalho") {
templateHeader = $('#onepage-cabecalho').html();
$('.main-cabecalho').prepend(Mustache.render(
templateHeader,
merge_options({
pai_codigo: value.ban_codigo
}, value)));
} else if (webservice != 'videos') {
template = $('#' + value.ban_local).html();
$('#conteudo').append(Mustache.render(template,
merge_options({
pai_codigo: value.ban_codigo
}, value)));
}
} catch (e) {
console.info("não encontrei: " + value.ban_local);
}
}
// if(value.filhos.length > 0 && value.ban_menu != ""){
// menu.append(Mustache.render(`
// <li class="nav-item dropdown">
// <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenu-{{ban_codigo}}" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
// {{ban_menu}}
// </a>
// <div class="dropdown-menu" id="navbarDropdownItens-{{ban_codigo}}" aria-labelledby="navbarDropdownMenu-{{ban_codigo}}">
// <a class="dropdown-item" href="#" style="display:none">Action</a>
// </div>
// </li>`, value))
// value.filhos.forEach(function(key){
// console.log(key)
// if(key.blank == 'target="_blank"'){
// $(`#navbarDropdownItens-${key.ban_pai}`).append(`<a class="dropdown-item" href="${key.ban_descricao}" target="_blank">${key.ban_nome}</a>`)
// }else if(key.ban_link_blank == 1){
// $(`#navbarDropdownItens-${key.ban_pai}`).append(`<a class="dropdown-item" href="${key.ban_descricao}" target="_blank">${key.ban_nome}</a>`)
// }
// else{
// $(`#navbarDropdownItens-${key.ban_pai}`).append(`<a class="dropdown-item" href="${key.ban_descricao}">${key.ban_nome}</a>`)
// }
// })
// }else{
if (value.ban_tipo_link_menu == 1) {
var target = '';
if (value.ban_link_blank == 1) {
target = 'target="_blank"';
}
menu.append(Mustache.render(
'<li id="menu-item-{{ban_codigo}}" class="menu-item"><a id="link_menu" href="{{ban_link_menu}}" ' +
target + ' data-scroll>{{ban_menu}}</a></li>',
value));
} else if (value.ban_local != 'onepage-cabecalho' && webservice == 'bandeiras') {
menu.append(Mustache.render(
'<li id="menu-item-{{ban_codigo}}" class="menu-item"><a href="#link_{{ban_codigo}}" data-scroll>{{ban_menu}}</a></li>',
value));
}
//}
});
}
percorrerOnepage('bandeiras');
percorrerOnepage('videos');
document.querySelectorAll("#player").forEach((item, index) => {
new Plyr(item);
});
var nav = document.querySelector(".menu-navegacao .menu-pagina"),
links = nav.querySelectorAll("[data-scroll]");
var content;
var setupLocations = function() {
content = [];
forEach(links, function(i, el) {
var href = links[i].getAttribute("href").replace("#", "");
var link_menu = $('#link_menu');
if (links[i].id != 'link_menu' && el.innerHTML != "") {
content.push(document.getElementById(href).offsetTop);
} else {
links[i].parentNode.className.replace("active", "");
content.push(null);
}
});
};
window.addEventListener("load", setupLocations, false);
window.addEventListener("resize", setupLocations, false);
var selectActiveMenuItem = function(i) {
forEach(links, function(i, el) {
links[i].parentNode.className = links[i].parentNode.className
.replace(/[\s]{0,}active/, "");
});
links[i].parentNode.className += links[i].parentNode.className ? " active" :
"active";
};
var valoresTop = function() {
var topAtual = window.pageYOffset;
var janelaNavegador = window.innerHeight;
// body = document.body,
// html = document.documentElement,
// bodyheight = Math.max(
// body.scrollHeight,
// body.offsetHeight,
// html.clientHeight,
// html.scrollHeight,
// html.offsetHeight
// );
if (!wasNavigationTapped) {
forEach(content, function(i, loc) {
if ((topAtual + (janelaNavegador * 0.3)) > loc && loc !=
null) {
selectActiveMenuItem(i);
}
// if ((loc > topAtual && (loc < topAtual + 300 || (topAtual + janelaNavegador) >= bodyheight))) {
// selectActiveMenuItem(i);
// }
});
}
}
$('.center-carrossel').slick({
centerMode: true,
centerPadding: '60px',
autoplaySpeed: 4500,
slidesToScroll: 1,
pauseOnFocus: false,
pauseOnHover: false,
slidesToShow: 1,
dots: true,
infinite: true,
speed: 300,
autoplay: true,
variableWidth: true,
adaptiveHeight: true
});
var wasNavigationTapped = false;
var navigation = responsiveNav(".menu-navegacao", {
closeOnNavClick: true
});
var mask = document.createElement("div");
mask.className = "mascara";
document.body.appendChild(mask);
mask.addEventListener("click", function(e) {
e.preventDefault();
navigation.close();
}, false);
window.addEventListener("scroll", valoresTop, false);
window.addEventListener("load", valoresTop, false);
window.addEventListener("resize", valoresTop, false);
// Componente Imagem
$(".images .row:odd").each(function() {
$(this).find(".col-md-6:first").addClass("order-1");
});
slideBS();
// <Galeria>
var modal = document.getElementById("myModal");
var modalImg = $("#img01");
var captionText = document.getElementById("caption");
var tituloModal = $('#caption h2');
var legendaModal = $('#caption p');
var arrayFotos = $('.galeria-container').children();
var elements = $('.galeria-container').children();
var span = document.getElementsByClassName("fechar")[0];
$(arrayFotos).on("click", function() {
var indiceElementoClicado = $(this).index();
var index = indiceElementoClicado;
var image = $(this).children().css('background-image');
var url = $(this).attr('url');
var blank = $(this).attr('blank');
if (blank == 'target="_blank"') {
blank = '_blank';
} else {
blank = '_self';
}
modalImg.attr('onclick', `window.open("${url}", "${blank}")`);
modal.style.display = "block";
modalImg.css('background-image', image);
tituloModal.text($(this).children().find('h2').text());
legendaModal.text($(this).children().find('p').text());
function passarImagemDireita() {
// Verifica se esta na ultima foto
if (index < (elements.length - 1)) {
++index;
} else {
index = 0;
}
modal.style.display = "block";
var imgProximo = $(elements[index]).children().css(
'background-image');
var linkProximo = $(elements[index]).attr('url');
var blankProximo = $(elements[index]).attr('blank');
if (blankProximo == 'target="_blank"') {
blankProximo = '_blank';
} else {
blankProximo = '_self';
}
modalImg.css('background-image', imgProximo);
modalImg.attr('onclick',
`window.open("${linkProximo}", "${blankProximo}")`);
tituloModal.text($(elements[index]).find('h2').text());
legendaModal.text($(elements[index]).find('p').text());
}
function passarImagemEsquerda() {
if (index > 0) {
--index;
} else {
index = elements.length - 1;
}
modal.style.display = "block";
var imgProximo = $(elements[index]).children().css(
'background-image');
var linkProximo = $(elements[index]).attr('url');
var blankProximo = $(elements[index]).attr('blank');
if (blankProximo == 'target="_blank"') {
blankProximo = '_blank';
} else {
blankProximo = '_self';
}
modalImg.css('background-image', imgProximo);
modalImg.attr('onclick',
`window.open("${linkProximo}", "${blankProximo}")`);
modalImg.css('background-image', imgProximo);
tituloModal.text($(elements[index]).find('h2').text());
legendaModal.text($(elements[index]).find('p').text());
}
$(document).on('keydown', function(e) {
if (e.keyCode == 39) {
passarImagemDireita();
} else if (e.keyCode == 37) {
passarImagemEsquerda();
} else if (e.keyCode == 27) {
modal.style.display = "none";
index = 0;
}
});
$('.foto-anterior').on('click', function() {
passarImagemEsquerda();
});
$('.proxima-foto').on('click', function() {
passarImagemDireita();
});
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
});
function runVideo() {
document.querySelectorAll('.container-videos').forEach((item, index) => {
let firstCard = $(item).find('.card').eq(0);
firstCard.css('background-color', '#ececec');
firstCard.find('.iconPlay').css('display', 'block');
let linkVideo = $(item).find('.card').attr('src');
$(item).find('video source').attr('src', linkVideo);
});
}
runVideo();
$('.card').on('click', (e) => {
let idPai = $(e.currentTarget).parent().parent().parent().parent().attr(
'id');
$(`#${idPai} .card`).find('.iconPlay').css('display', 'none');
$(`#${idPai} .card`).css('background-color', 'white');
$(e.currentTarget).find('.iconPlay').css('display', 'block');
$(e.currentTarget).css('background-color', '#ececec');
$(e.currentTarget).parent().parent().parent().find('video').attr('src',
$(e.currentTarget).attr('src'));
});
function ajustePaddingSectionMenu() {
var altura_cabecalho = $('.main-cabecalho').height();
document.querySelectorAll('section').forEach((element, i) => {
if ($(element).attr('section-onepage') == "") {
codigo_bandeira = ($(element).attr('code'));
// element.style.paddingTop = altura_cabecalho - 4 + "px";
data.bandeiras.forEach((dadosBandeira) => {
if (dadosBandeira.ban_codigo == $(element).attr('code') && (dadosBandeira.ban_visualizacao == 'full')) {
element.style.minHeight =
`calc(100vh - ${altura_cabecalho - 4}px)`;
}
});
}
});
}
ajustePaddingSectionMenu();
/* Ajuste topo */
// $("#conteudo section:first").css("margin-top", "62px")
// $(".main-cabecalho").css("margin-top", "-62px")
$('.close').on('click', function() {
modal.style.display = "none";
index = 0;
});
}
);
}
});
</script>]]>
|