cdn.acgisoftware.com Open in urlscan Pro
207.97.230.210  Public Scan

URL: https://cdn.acgisoftware.com/vsn/9.0.4/prod/js/ssa-template.js
Submission: On July 05 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

jQuery.holdReady(true); // this is to prevent any instances of $(document).ready() in templates or stored docs from running until the header/footer is rendered

// Hide the <body> tag until the page is finished rendering - this resolves issues where certain clients could see their header unstyled before the page was done loading
// This is done with a dynamically added stylesheet in case the <body> tag hasn't loaded by the time this code runs
var style = `
@media screen {
    body {
        visibility: hidden !important;
    }
}
`;

var stylesheet = document.createElement("style");
stylesheet.innerText = style;
document.head.appendChild(stylesheet);

/* PRD-3379 - applying HTML/CSS/JS from template manager to SSA pages */
function applyTemplates() {
    var v_app,
        v_page_id,
        href_arr = [],
        itemnames_arr = [],
        itemvalues_arr = [],
        v_context;

    // check if page is an Apex page
    if (window.location.href.indexOf("f?p=") > -1) {
        href_arr = window.location.href.split(':');
        v_app = href_arr[1].split("f?p=")[1];
        v_page_id = href_arr[2];
        if (href_arr.length >= 9) {
            itemnames_arr = href_arr[7].split(',');
            itemvalues_arr = href_arr[8].split(',');

            $.each(itemnames_arr, function (index, value) {
                if (value == 'CUST_CONTEXT') {
                    v_context = itemvalues_arr[index];
                }
            });
        }
    }

    if (v_app == undefined) v_app = "";
    if (v_page_id == undefined) v_page_id = "";
    if (v_context == undefined) v_context = "";

    $.ajax({
        method: "POST",
        url: "stdcfgtemplatemast_getcontents",
        data: {
            "p_application": v_app,
            "p_page": v_page_id,
            "p_context_cd": v_context
        },
        datatype: "json"
    }).done(function (rsp) {
        var obj = JSON.parse(JSON.stringify(rsp));

        // wait for <body> tag to render before applying 
        var interval = setInterval(function () {
            if ($("body").html()) {
                $('head').append(obj.APP_CSS_INCLUDE);
                $('head').append(obj.PAGE_CSS_INCLUDE);
                $('#ACGITemplateManagerSSA_HeaderHTML').html(obj.HEADER_HTML);
                $('#ACGITemplateManagerSSA_BodyTop').html(obj.BODY_TOP);
                $('#ACGITemplateManagerSSA_SectionTop').html(obj.SECTION_TOP);
                $('#ACGITemplateManagerSSA_SectionBottom').html(obj.SECTION_BOTTOM);
                $('#ACGITemplateManagerSSA_BodyBottom').html(obj.BODY_BOTTOM);
                $('#ACGITemplateManagerSSA_FooterHTML').html(obj.FOOTER_HTML);
                jQuery.holdReady(false); // now that header/footer is rendered, instances of $(document).ready() can run
                clearInterval(interval);
            }
        }, 100);
    }).fail(function (rsp) {
        jQuery.holdReady(false); // if ajax fails, header/footer won't load, but instances of $(document).ready() should still run so that the rest of the page still functions
    });

    if ($("#ACGITemplateManagerSSA_CustomPageTitle").text() != "") {
        document.title = $("#ACGITemplateManagerSSA_CustomPageTitle").text();
    }
}

/* PRD-3583 - fix broken reference to favicon */
function updateFavIcon() {
    $("[rel*='icon'][href*='favicon.ico']").each(function () {
        $(this).attr("href", "../favicon.ico");
    });
}

/* PRD-4174 - Add alt text to SSA Pendo icon */
function addAltTextToPendo() {
    if ($('._pendo-resource-center-badge-image').length == 0) return;
    $('._pendo-resource-center-badge-image').attr("alt", "Resource Center icon");
}

applyTemplates();

$(document).ready(function () {
    setTimeout(function () {
        document.head.removeChild(stylesheet); // after a delay to allow time for styling to apply, show the <body> tag
    }, 1000);
    updateFavIcon();
    addAltTextToPendo();
});