87
| <![CDATA[<script>
let slug = 'secretarias-e-governo/cultura';
let secName = 'Cultura';
let pathname = window.location.pathname;
pathname = pathname.replace(/^\/|\/$/g, '');
let basename = env.BASE_DIR + slug;
basename = basename.replace(/^\/|\/$/g, '');
let path = pathname.replace(basename, '');
path = path.replace(/^\/|\/$/g, '');
let url = '';
if(path == '')
url = 'files/?slug=' + slug + '&tree=1&node=1';
else
url = 'files/?slug=' + slug + '/' + path + '&tree=1&node=1';
const boxSec = document.querySelector('.box-sec');
fetchData(url).then(response => {
const boxText = boxSec.querySelector('.text');
const boxLink = boxSec.querySelector('.link');
const title = boxSec.querySelector('.title');
const bread = document.getElementById('breadcrumb');
const breadContent = bread.querySelector('.container');
let text = '';
let tran = '';
let link = '';
let a = 0;
response.data.forEach(obj => {
let {ID, name, file_id, file, slug, description, external} = obj;
if(a == 0){
text = description;
boxText.innerHTML = text;
title.innerHTML = path == '' ? name : secName + ' - ' + name;
strTitle = path == '' ? name : secName + ' ' + name;
if(path != '')
breadContent.innerHTML += '<span class="sep"> > </span><span>' + name.toUpperCase() + '</span>';
a = 1;
}else{
if(file != ''){
link += `<article>
<a href="https://files.barretos.sp.gov.br/pdf/${file}" class="action" target="_blank">
<span class="category">${strTitle}</span>
<span class="title">${name}</span>
</a>
<a href="https://files.barretos.sp.gov.br/pdf/${file}" class="btn online" target="_blank">ACESSAR</a>
</article>`;
}else if(external != ''){
link += `<article>
<a href="${external}" class="action" target="_blank">
<span class="category">${strTitle}</span>
<span class="title">${name}</span>
</a>
<a href="${external}" class="btn online" target="_blank">ACESSAR</a>
</article>`;
}else{
link += `<article>
<a href="${env.URL + slug}" class="action">
<span class="category">${strTitle}</span>
<span class="title">${name}</span>
</a>
<a href="${env.URL + slug}" class="btn">+ VEJA MAIS</a>
</article>`;
}
}
});
boxLink.innerHTML = link;
});
</script>]]>
|