Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.
HTML
  <!--
    Confluence/TDN: Cole este HTML no macro "HTML" (não em bloco de código/preformatado).
    Este arquivo é um SNIPPET (sem <html>/<head>/<body>) para reduzir quebra por sanitização.
  -->

<div style="max-width:1200px; margin:0 auto; padding:16px; font-family: Arial, Helvetica, sans-serif; background:#ffffff;">
  <div style="border:1px solid #dfe1e6; border-radius:8px; overflow:hidden;">
    <div style="max-widthbackground:1200px#0052CC; margincolor:0 auto#fff; padding:16px; font-family: Arial, Helvetica, sans-serif; background:#ffffff;">14px 16px;">
      <div style="border:1px solid #dfe1e6display:flex; borderalign-radiusitems:8pxcenter; overflowgap:hidden12px;">
        <div<img styleid="background:#0052CC; color:#fff; padding:14px 16px;">totvs-logo" alt="TOTVS"
          <div stylestyle="display:flexnone; align-itemsheight:center28px; gapwidth:12pxauto;">
        background:#ffffff; border-radius:6px; padding:4px; border:1px solid rgba(255,255,255,0.35);" />
     <!-- TOTVS logo (anexo do Confluence/TDN):
   <div id="page-title" style="font-size:18px; font-weight:700;">Dicionário de Dados</div>
      </div>
    </div>

   - Nome do anexo: "totvs logo.jpg"
      <div style="background:#f4f5f7; border-top:1px solid #dfe1e6; padding:12px 16px; display:flex; gap:12px; align-items:center; flex-wrap:wrap;">
      <div style="display:flex; gap:8px;  - O JS abaixo tenta carregar primeiro do pageId atual, e cai em fallback se não achar -->align-items:center;">
        <div style="font-weight:700; color:#172b4d;">Versão:</div>
        <div id="version-display" style="background:#fff; border:1px <img
solid #dfe1e6; border-radius:6px; padding:4px 10px; font-weight:700; color:#172b4d;">-</div>
        id="totvs-logo"
              alt="TOTVS"
              style="display:none; height:28px; width:auto; background:#ffffff; border-radius:6px; padding:4px; border:1px solid rgba(255,255,255,0.35);"
            />
            <div id="page-title" style="font-size:18px; font-weight:700;">Dicionário de Dados</div>
          </div>
        </div>

        <div style="background:#f4f5f7; border-top:1px solid #dfe1e6; padding:12px 16px; display:flex; gap:12px; align-items:center; flex-wrap:wrap;">
          <div style="display:flex; gap:8px; align-items:center;">
            <div style="font-weight:700; color:#172b4d;">Versão:</div>
            <div id="version-display" style="background:#fff; border:1px solid #dfe1e6; border-radius:6px; padding:4px 10px; font-weight:700; color:#172b4d;">-</div>
          </div>

          <div style="display:flex; gap:8px; align-items:center;">
            <div style="font-weight:700; color:#172b4d;">Atualizado:</div>
            <div id="last-update" style="background:#fff; border:1px solid #dfe1e6; border-radius:6px; padding:4px 10px; color:#172b4d;">-</div>
          </div>

          <a id="doc-link" href="#" target="_blank" style="display:none; margin-left:auto; text-decoration:none; background:#ffffff; color:#0052CC; border:1px solid #0052CC; border-radius:6px; padding:6px 10px; font-weight:700;">
            Abrir no Drive
          </a>
        </div>

        <div id="widget-container" style="min-height:520px; background:#ffffff;">
          <!--
            IMPORTANTE (TDN/Confluence):
            - Se o HTML for colado dentro de um bloco PRE/CODE, o Confluence pode inserir </pre> no final.
              Isso quebra o JavaScript e fica preso em "Carregando...".
          -->
          <div style="padding:18px; color:#6b778c;">Carregando documento...</div>
        </div>
      </div>
    </div>

    <script>
    (function() {
      // Fonte: GitHub (RAW)
      // Repo: https://github.com/Juansimeoni/ReleaseDatasul
      // Arquivo esperado: {versao}.txt (ex: 12.1.2503.15.txt)
      const GITHUB_OWNER = 'Juansimeoni';
      const GITHUB_REPO = 'ReleaseDatasul';
      const GITHUB_BRANCH = 'main';
      const GITHUB_PATH_PREFIX = ''; // ex: 'releases' (sem / no início e no fim)

      const GITHUB_RAW_BASE = 'https://raw.githubusercontent.com/' + GITHUB_OWNER + '/' + GITHUB_REPO + '/' + GITHUB_BRANCH + '/';
      const GITHUB_BLOB_BASE = 'https://github.com/' + GITHUB_OWNER + '/' + GITHUB_REPO + '/blob/' + GITHUB_BRANCH + '/';
      const GITHUB_API_BASE = 'https://api.github.com/repos/' + GITHUB_OWNER + '/' + GITHUB_REPO + '/';

      function buildRepoPath(version) {
        const filename = version + '.txt';
        return GITHUB_PATH_PREFIX ? (GITHUB_PATH_PREFIX + '/' + filename) : filename;
      }

      function setLastUpdateText(text) {
        const el = document.getElementById('last-update');
        if (el) el.textContent = text || '-';
      }

      function formatDatePtBr(value) {
        try {
          const d = new Date(value);
          if (isNaN(d.getTime())) return null;
          return d.toLocaleString('pt-BR');
        } catch (e) {
          return null;
        }
      }

      function tryFetchCommitDate(pathInRepo) {
        // Busca o último commit do arquivo (public repo, sem token)
        // Endpoint: /commits?path=...&sha=...&per_page=1
        const url = GITHUB_API_BASE + 'commits?path=' + encodeURIComponent(pathInRepo) +
          '&sha=' + encodeURIComponent(GITHUB_BRANCH) + '&per_page=1';

        return fetch(url, { cache: 'no-store' })
          .then(function(resp) {
            if (!resp.ok) return null;
            return resp.json();
          })
          .then(function(arr) {
            if (!arr || !arr.length) return null;
            const c = arr[0] || {};
            const commit = c.commit || {};
            const committer = commit.committer || {};
            const author = commit.author || {};
            // prefer committer date, fallback author date
            return committer.date || author.date || null;
          })
          .catch(function() {
            return null;
          });
      }

      function getPageVersion() {
        const versionPattern = /(\d+\.\d+\.\d+(?:\.\d+)?)/;

        const pageTitleElement = document.querySelector('h1#title-text, .page-title, h1, [data-page-title]');
        if (pageTitleElement) {
          const titleText = (pageTitleElement.textContent || '').trim();
          const match = titleText.match(versionPattern);
          if (match) return match[1];
        }

        const metaTitle = document.querySelector('meta[property="og:title"], meta[name="title"]');</div>

      <div  if (metaTitle) {style="display:flex; gap:8px; align-items:center;">
        <div  const titleText = metaTitle.getAttribute('content') || '';style="font-weight:700; color:#172b4d;">Atualizado:</div>
          const match<div id= titleText.match(versionPattern);
          if (match) return match[1];"last-update" style="background:#fff; border:1px solid #dfe1e6; border-radius:6px; padding:4px 10px; color:#172b4d;">-</div>
      </div>

      <a id="doc-link"  }

href="#" target="_blank"
        const titleMatch = (document.title || '').match(versionPattern);
        if (titleMatch) return titleMatch[1];

style="display:none; margin-left:auto; text-decoration:none; background:#ffffff; color:#0052CC; border:1px solid #0052CC; border-radius:6px; padding:6px 10px; font-weight:700;">
        Abrir returnno null;GitHub
      }
</a>
      function getPageId() {</div>

    <div id="widget-container"   try {style="min-height:520px; background:#ffffff;">
          const qs = new URLSearchParams(window.location.search);<div style="padding:18px; color:#6b778c;">Carregando documento...</div>
    </div>
    </div>
</div>

<script>
(function() {
  const fromQueryGITHUB_OWNER = qs.get('pageIdJuansimeoni');
  const GITHUB_REPO = 'ReleaseDatasul';
  const GITHUB_BRANCH  if (fromQuery) return String(fromQuery)= 'main';
  const GITHUB_PATH_PREFIX = '';

  const } catch (e) { /* ignore */ }

        // Confluence costuma expor isso quando AJS está disponível
        try {
          if (window.AJS && AJS.params && AJS.params.pageId) return String(AJS.params.pageId);
        } catch (e) { /* ignore */ }

        return null;
      }

      function setTotvsLogo() {
        const logoElGITHUB_RAW_BASE = 'https://raw.githubusercontent.com/' + GITHUB_OWNER + '/' + GITHUB_REPO + '/' + GITHUB_BRANCH + '/';
  const GITHUB_BLOB_BASE = 'https://github.com/' + GITHUB_OWNER + '/' + GITHUB_REPO + '/blob/' + GITHUB_BRANCH + '/';
  const GITHUB_API_BASE = 'https://api.github.com/repos/' + GITHUB_OWNER + '/' + GITHUB_REPO + '/';

  function buildRepoPath(version) {
    const filename = version + '.txt';
    return GITHUB_PATH_PREFIX ? (GITHUB_PATH_PREFIX + '/' + filename) : filename;
  }

  function setLastUpdateText(text) {
    const el = document.getElementById('totvslast-logoupdate');
        if (!logoElel) return;

        const pageId = getPageId();
        const filename = 'totvs logo.jpg';el.textContent = text || '-';
  }

  function formatDatePtBr(value) {
    try {
        const encodedNamed = new encodeURIComponentDate(filenamevalue);

      if (isNaN(d.getTime())) return null;
 const candidates = [];
  return d.toLocaleString('pt-BR');
    } ifcatch (pageIde) {
      return null;
    }
 // thumbnails}

 costuma funcionar melhor no Confluencefunction tryFetchCommitDate(pathInRepo) {
    const url = GITHUB_API_BASE  + candidates.push('/download/thumbnails/'commits?path=' + pageIdencodeURIComponent(pathInRepo) +
   '/   '&sha=' + encodedNameencodeURIComponent(GITHUB_BRANCH) + '?api=v2')&per_page=1';

          candidates.push('/download/attachments/' + pageId + '/' + encodedName);return fetch(url, { cache: 'no-store' })
      .then(function(resp) { }
        // fallback: página “principal” antiga (se existir o anexo lá também)
if (!resp.ok) return null; return resp.json(); })
      .then(function(arr) {
        if (!arr ||  candidates.push('/download/attachments/649987902/' + encodedName);

!arr.length) return null;
        letconst idxc = arr[0;
] || {};
        const commit function tryNext()= c.commit || {};
        const committer if (idx >= candidates.length) returncommit.committer || {};
        const author const= url = candidates[idx++]commit.author || {};
        return committer.date const probe = new Image()|| author.date || null;
      })
    probe.onload = .catch(function() { return null; });
  }

  function getPageVersion() {
    const  logoEl.srcversionPattern = url;
    /(\d+\.\d+\.\d+(?:\.\d+)?)/;

    const pageTitleElement =  logoEl.style.display = 'inline-block';
     document.querySelector('h1#title-text, .page-title, h1, [data-page-title]');
    if (pageTitleElement) {
     };
 const titleText = (pageTitleElement.textContent || '').trim();
    probe.onerror  const match = functiontitleText.match(versionPattern) {;
      if (match) return match[1];
   tryNext(); }

    const metaTitle =    }document.querySelector('meta[property="og:title"], meta[name="title"]');
    if      probe.src = url;
(metaTitle) {
      const titleText = metaTitle.getAttribute('content') || }'';

      const  tryNext(match = titleText.match(versionPattern);
      }

   if (match) return match[1];
   // Tenta}

 resolver o logo mesmoconst antes de identificar versão/documento
      setTotvsLogo(titleMatch = (document.title || '').match(versionPattern);

      functionif renderNotAvailable(titleMatch) {return titleMatch[1];

    return null;
  }

 // Mantém o link (se existir) para permitir abrir manualmente no GitHubfunction getPageId() {
    try {
      const qs  container.innerHTML == new URLSearchParams(window.location.search);
      const fromQuery   '<div style="padding:18px; border-left:4px solid #FFAB00; background:#FFFAE6; color:#172b4d;">' += qs.get('pageId');
      if (fromQuery)     '<div style="font-weight:700;">Esse documento ainda não está disponível no momento.</div>' +
   return String(fromQuery);
    } catch (e) {}

    try {
       '</div>';
      }
if (window.AJS && AJS.params && AJS.params.pageId) return String(AJS.params.pageId);
    } catch function getVersionOverrideFromQuery(e) {}

    return null;
   try {}

          const qs = new URLSearchParams(window.location.search);function setTotvsLogo() {
          const vlogoEl = qsdocument.getgetElementById('version') || qs.get('versao'totvs-logo');
    if (!logoEl) return;

    ifconst (vpageId && /^\d+\.\d+\.\d+(?:\.\d+)?$/.test(v)) return v= getPageId();
    const filename = 'totvs logo.jpg';
    const encodedName =  } catch (e) { /* ignore */ }
  encodeURIComponent(filename);

    const candidates = [];
    if (pageId) return{
 null;
      }

      const version = getPageVersion();
candidates.push('/download/thumbnails/' + pageId + '/' + encodedName + '?api=v2');
       const container = document.getElementById('widget-container'candidates.push('/download/attachments/' + pageId + '/' + encodedName);
    }
  const docLink = documentcandidates.getElementByIdpush('doc-link'/download/attachments/649987902/' + encodedName);

      const versionResolved = getVersionOverrideFromQuery() || version;
let idx = 0;
    function  if tryNext(!versionResolved) {
      if  container.innerHTML =
(idx >= candidates.length) return;
      const url = candidates[idx++];
   '<div style="padding:18px; border-left:4px solidconst #DE350B; background:#FFEBE6; color:#172b4d;">' +probe = new Image();
      probe.onload = function() { logoEl.src = '<divurl; logoEl.style="font-weight:700; margin-bottom:6px;">Versão não identificada</div>' +
            '<div>Coloque a versão no título da página, ex: <b>Dicionário de Dados 12.1.2503.14</b></div>' +
          '</div>';
        return;.display = 'inline-block'; };
      probe.onerror = function() { tryNext(); };
      probe.src = url;
    }
    tryNext();
  }

  setTotvsLogo();

  const container = document.getElementById('widget-container');
  const docLink = document.getElementById('doc-link');

  function renderNotAvailable() {
    container.innerHTML =
      }

      document.getElementById('version-display').textContent = versionResolved;
'<div style="padding:18px; border-left:4px solid #FFAB00; background:#FFFAE6; color:#172b4d;">' +
        document.getElementById('page-title').textContent = 'Dicionário de Dados ' + versionResolved;'<div style="font-weight:700;">Esse documento ainda não está disponível no momento.</div>' +
      setLastUpdateText(new Date().toLocaleString('pt-BR'));
'</div>';
  }

  function getVersionOverrideFromQuery() {
  const pathInRepo = buildRepoPath(versionResolved);try {
      const rawUrlqs = GITHUB_RAW_BASE + pathInReponew URLSearchParams(window.location.search);
      const blobUrlv = GITHUB_BLOB_BASE + pathInRepo;
qs.get('version') || qs.get('versao');
      //if Link(v para o GitHub (visual)
      docLink.href = blobUrl&& /^\d+\.\d+\.\d+(?:\.\d+)?$/.test(v)) return v;
    }  docLink.textContent = 'Abrir no GitHub'catch (e) {}
    return null;
  }

  const  docLink.style.display = 'inline-block'versionResolved = getVersionOverrideFromQuery() || getPageVersion();

  if (!versionResolved) {
    container.innerHTML =
        '<div style="padding:18px; color:#6b778c;">Carregando conteúdo do GitHub...</div>';

border-left:4px solid #DE350B; background:#FFEBE6; color:#172b4d;">' +
       fetch(rawUrl, { cache: 'no-store' }) '<div style="font-weight:700; margin-bottom:6px;">Versão não identificada</div>' +
        .then(function(resp) {
          if (!resp.ok) return { ok: false, text: '', lastModified: null }'<div>Coloque a versão no título da página, ex: <b>Dicionário de Dados 12.1.2503.14</b></div>' +
      '</div>';
    return;
  }

    const lmvEl = resp.headers ? resp.headers.getdocument.getElementById('lastversion-modifieddisplay') : null;
  const tEl       return resp.text().then(function(t) {= document.getElementById('page-title');
  if (vEl) vEl.textContent = versionResolved;
  if (tEl) tEl.textContent = return'Dicionário {de ok:Dados true, text: t, lastModified: lm }' + versionResolved;
  setLastUpdateText(new Date().toLocaleString('pt-BR'));

  const pathInRepo    }= buildRepoPath(versionResolved);
  const rawUrl = GITHUB_RAW_BASE +  })pathInRepo;
  const blobUrl = GITHUB_BLOB_BASE + pathInRepo;

 .then(function(res) {
          const txt = ((res && res.text) ? res.text : '').trim();
      docLink.href = blobUrl;
  docLink.style.display = 'inline-block';

  container.innerHTML = '<div style="padding:18px; color:#6b778c;">Carregando conteúdo do GitHub...</div>';

  fetch(rawUrl, { cache: 'no-store' })
    .then(function(resp) {
      if (!txtresp.ok) return {
 ok: false, text: '', lastModified:       renderNotAvailable()null };
      const lm = resp.headers   return;
          }

? resp.headers.get('last-modified') : null;
      return resp.text().then(function(t) { return // 1) Fallback rápido: Last-Modified do RAW (não é exatamente "commit date", mas aproxima{ ok: true, text: t, lastModified: lm }; });
    })
    .then(function(res) {
      const lmtxt = ((res && res.lastModifiedtext) ? formatDatePtBr(res.lastModified)text : null'').trim();
          if (lm!txt) setLastUpdateText{ renderNotAvailable(lm); return; }

      const lm =  // 2) Data real do commit via GitHub API (se permitido por CSP)
  res && res.lastModified ? formatDatePtBr(res.lastModified) : null;
      if (lm) setLastUpdateText(lm);

        tryFetchCommitDate(pathInRepo).then(function(commitIso) {
            const formatted = commitIso ? formatDatePtBr(commitIso) : null;
            if (formatted) setLastUpdateText(formatted);
          });

          // Renderiza texto em <pre> preservando formatação
   );
      });

       const pre = document.createElement('pre');
          pre.style.whiteSpace = 'pre-wrap';
          pre.style.margin = '0';
          pre.style.padding = '16px';
          pre.style.borderTop = '1px solid #dfe1e6';
          pre.style.fontFamily = 'Consolas, Menlo, Monaco, \"Courier New\", monospace';
          pre.textContent = txt;

          container.innerHTML = '';
          container.appendChild(pre);
        })
        .catch(function() {
          renderNotAvailable();
        });
    })(); 
    </script>