Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • test-force-ruby-platform-protobuff
  • teste
3 results

pipeline-loader.js

Code owners
Assign users and groups as approvers for specific file changes. Learn more.
pipeline-loader.js 1.25 KiB
---
# frontmatter vazio para fazer o parse do liquid
---
;

const pipeline = document.getElementById("pipeline")
const queryParams = new URLSearchParams(window.location.search.substring(1));

if (queryParams.get("status") === "true") {
    const pipelineIFrame = document.createElement("iframe")

    pipelineIFrame.loading = "lazy"
    pipelineIFrame.src = "{{ '/assets/pipeline-badge.html' | prepend: site.baseurl }}"
    pipelineIFrame.style["border-width"] = "0px"
    pipelineIFrame.height = "20px"
    pipelineIFrame.width = "116px"
    
    pipeline.style.display = "block";
    pipeline.appendChild(pipelineIFrame)

    let intervalId;

    function stopPipelineLoad() {
        clearInterval(intervalId);
        intervalId = null;
        document.getElementById("stopReload").style.display = "none";
        document.getElementById("playReload").style.display = "block";
    }

    function startPipelineLoad() {
        intervalId = setInterval(() => pipelineIFrame.contentWindow.location.reload(), 3000)

        document.getElementById("stopReload").style.display = "block";
        document.getElementById("playReload").style.display = "none";
    }

    startPipelineLoad()
    console.log("visivel")
} else {
    pipeline.remove();
    console.log("removido")
}