<!-- Generated by SpecStory, Markdown v2.1.0 -->

# 2025-03-07 14:36:22Z

<!-- VS Code Copilot IDE Session 0b427d6b-b414-4a0d-bd13-539c89a4ee75 (2025-03-07 14:36:22Z) -->

_**User (2025-03-07 14:36:22Z)**_

when this sacript is loaded, this is the opnly console log that appears:
Documentation-links.js loading...
I need help troubleshooting why the buttons defined in prependDocLinks is not working. I suspect it is the variables that are not being satisfied

---

_**Agent**_

To troubleshoot why the buttons defined in `prependDocLinks` are not working, we need to ensure that the variables used in the conditions are properly defined and accessible. Let's add some console logs to check the values of these variables.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Add console logs to check the values of the variables used in the conditions.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
// ...existing code...

$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    // Log the values of Variables
    console.log("Variables:", Variables);

    if (Variables.IsAuthoring){   //if Expere Authoring then
        // ...existing code...
    }

    if (Variables.IsDefaultData){ //if Default Data then
        // ...existing code...
    }

    if (Variables.IsPnP){ //if Packages and Packets then
        // ...existing code...
    }

    if (Variables.IsDGS){         //if DGS then
        // ...existing code...
    }

    if (Variables.IsDocViewer){   //if DocViewer then
        // ...existing code...
    }

    if (Variables.IsEngine){      //if Expere Engine then
        // ...existing code...
    }

    if (Variables.IseOriginal){   //if eOriginal then
        // ...existing code...
    }

    if (Variables.IsEZGateway){   //if EZGateway then
        // ...existing code...
    }

    if (Variables.IsI32){         //if I-32 then
        // ...existing code...
    }

    if (Variables.IsWKES){       //if WKIS  then
        // ...existing code...
    }

    function prependDocLinks() {
        console.log("Checking conditions for prependDocLinks...");
        console.log("IsAuthoring:", Variables.IsAuthoring);
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IsDGS:", Variables.IsDGS);
        console.log("IsDocViewer:", Variables.IsDocViewer);
        console.log("IsEngine:", Variables.IsEngine);
        console.log("IseOriginal:", Variables.IseOriginal);
        console.log("IsEZGateway:", Variables.IsEZGateway);
        console.log("IsI32:", Variables.IsI32);
        console.log("IsWKES:", Variables.IsWKES);

        if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
            console.log("Appending Documentation Links...");
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        }
    }

    function appendChangelogButton() {
        console.log("Checking conditions for appendChangelogButton...");
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IncRNLink:", IncRNLink);
        console.log("IsChangelogPage:", Variables.IsChangelogPage);

        if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
            console.log("Appending Changelog Button...");
            $('.DocLinks').append(
                '<div class="div-changelog-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
            );
        } else {
            console.log("Conditions not met for appending button.");
        }
    }

    prependDocLinks();
    appendChangelogButton();

    // ...existing code...
});
````

This will help you identify if the variables are being set correctly and if the conditions for appending the buttons are being met.

---

_**User (2025-03-07 14:40:40Z)**_

ok, Analyze the script. I am getting this:
Documentation-links.js loading...
jquery.min.js:2 jQuery.Deferred exception: IsAuthoring is not defined ReferenceError: IsAuthoring is not defined
    at HTMLDocument.<anonymous> (<anonymous>:20:36)
    at e (https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js:2:30038)
    at t (https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js:2:30340) undefined

The variable is defined in the variables.js file which is called first in this afterbody.js file:
$(document).ready(function() {

  // Load variables.js first
  $.getScript('/resources/webhelp/js/variables.js')
    .done(function() {
      // Now load the other scripts after variables.js is loaded
      return $.when(
        $.getScript('/resources/webhelp/js/ga.min.js'),
        $.getScript('/resources/webhelp/js/toolbar-buttons.min.js'),
        $.getScript('/resources/webhelp/js/documentation-links.min.js'),
        $.getScript('/resources/webhelp/js/dynamic-profiling.js'),
        $.getScript('/resources/webhelp/js/changelog.min.js'),
        $.getScript('/resources/webhelp/js/header.min.js'),
        $.getScript('/resources/webhelp/js/sts.min.js'),
        $.getScript('/resources/webhelp/js/permission-mapping.min.js'),
        $.getScript('/resources/webhelp/js/server-maintenance.min.js'),
        $.getScript('/resources/webhelp/js/general.min.js'),
        $.getScript('/resources/webhelp/js/search.min.js'),
        $.getScript('/resources/webhelp/js/footer.min.js')
      );
    })
    .done(function() {
        // All scripts have been loaded and executed
        // console.log("All scripts loaded successfully.");
        // You can now safely use Variables
    })
    .fail(function(jqxhr, settings, exception) {
        console.error("Failed to load scripts: ", exception);
    });

  // #region FAVICON
  $('head').append('<link rel="shortcut icon" href="/resources/img/favicons/favicon-32x32.png"></link>');
  // #endregion

  // #region REFERRER
  // Create a new <meta> element
  var metaTag = document.createElement('meta');

  // Set the name and content attributes
  metaTag.setAttribute('name', 'referrer');
  metaTag.setAttribute('content', 'no-referrer-when-downgrade');

  // Append the <meta> tag to the <head> section
  document.getElementsByTagName('head')[0].appendChild(metaTag);
  // #endregion

  $(".loader-wrapper").remove();

});

---

_**Agent**_

The error indicates that the `Variables` object is not defined when `documentation-links.js` is executed. This is likely because the script is being executed before `variables.js` has finished loading. To ensure that `documentation-links.js` is executed only after `variables.js` has been loaded, you should modify the script loading sequence in `afterbody.js`.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\afterbody.js

Ensure that `documentation-links.js` is loaded only after `variables.js` has been successfully loaded.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\afterbody.js
$(document).ready(function() {

  // Load variables.js first
  $.getScript('/resources/webhelp/js/variables.js')
    .done(function() {
      // Now load the other scripts after variables.js is loaded
      return $.when(
        $.getScript('/resources/webhelp/js/ga.min.js'),
        $.getScript('/resources/webhelp/js/toolbar-buttons.min.js'),
        $.getScript('/resources/webhelp/js/documentation-links.min.js'),
        $.getScript('/resources/webhelp/js/dynamic-profiling.js'),
        $.getScript('/resources/webhelp/js/changelog.min.js'),
        $.getScript('/resources/webhelp/js/header.min.js'),
        $.getScript('/resources/webhelp/js/sts.min.js'),
        $.getScript('/resources/webhelp/js/permission-mapping.min.js'),
        $.getScript('/resources/webhelp/js/server-maintenance.min.js'),
        $.getScript('/resources/webhelp/js/general.min.js'),
        $.getScript('/resources/webhelp/js/search.min.js'),
        $.getScript('/resources/webhelp/js/footer.min.js')
      );
    })
    .done(function() {
        // All scripts have been loaded and executed
        console.log("All scripts loaded successfully.");
        // You can now safely use Variables
    })
    .fail(function(jqxhr, settings, exception) {
        console.error("Failed to load scripts: ", exception);
    });

  // #region FAVICON
  $('head').append('<link rel="shortcut icon" href="/resources/img/favicons/favicon-32x32.png"></link>');
  // #endregion

  // #region REFERRER
  // Create a new <meta> element
  var metaTag = document.createElement('meta');
  metaTag.setAttribute('name', 'referrer');
  metaTag.setAttribute('content', 'no-referrer-when-downgrade');
  document.getElementsByTagName('head')[0].appendChild(metaTag);
  // #endregion

  $(".loader-wrapper").remove();

});
````

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Add console logs to check the values of the variables used in the conditions.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
// ...existing code...

$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    // Log the values of Variables
    console.log("Variables:", Variables);

    if (Variables.IsAuthoring){   //if Expere Authoring then
        // ...existing code...
    }

    if (Variables.IsDefaultData){ //if Default Data then
        // ...existing code...
    }

    if (Variables.IsPnP){ //if Packages and Packets then
        // ...existing code...
    }

    if (Variables.IsDGS){         //if DGS then
        // ...existing code...
    }

    if (Variables.IsDocViewer){   //if DocViewer then
        // ...existing code...
    }

    if (Variables.IsEngine){      //if Expere Engine then
        // ...existing code...
    }

    if (Variables.IseOriginal){   //if eOriginal then
        // ...existing code...
    }

    if (Variables.IsEZGateway){   //if EZGateway then
        // ...existing code...
    }

    if (Variables.IsI32){         //if I-32 then
        // ...existing code...
    }

    if (Variables.IsWKES){       //if WKIS  then
        // ...existing code...
    }

    function prependDocLinks() {
        console.log("Checking conditions for prependDocLinks...");
        console.log("IsAuthoring:", Variables.IsAuthoring);
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IsDGS:", Variables.IsDGS);
        console.log("IsDocViewer:", Variables.IsDocViewer);
        console.log("IsEngine:", Variables.IsEngine);
        console.log("IseOriginal:", Variables.IseOriginal);
        console.log("IsEZGateway:", Variables.IsEZGateway);
        console.log("IsI32:", Variables.IsI32);
        console.log("IsWKES:", Variables.IsWKES);

        if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
            console.log("Appending Documentation Links...");
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        }
    }

    function appendChangelogButton() {
        console.log("Checking conditions for appendChangelogButton...");
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IncRNLink:", IncRNLink);
        console.log("IsChangelogPage:", Variables.IsChangelogPage);

        if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
            console.log("Appending Changelog Button...");
            $('.DocLinks').append(
                '<div class="div-changelog-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
            );
        } else {
            console.log("Conditions not met for appending button.");
        }
    }

    prependDocLinks();
    appendChangelogButton();

    // ...existing code...
});
````

This will help you identify if the variables are being set correctly and if the conditions for appending the buttons are being met.

---

_**User (2025-03-07 14:42:26Z)**_

is the afterbody file coded incorrectly for the sequence?

---

_**Agent**_

The sequence in the `afterbody.js` file appears to be correct in terms of loading `variables.js` first and then loading the other scripts. However, to ensure that `documentation-links.js` is executed only after `variables.js` has been successfully loaded, we should add a check to ensure that `Variables` is defined before executing the code in `documentation-links.js`.

Let's add a check in `documentation-links.js` to ensure that `Variables` is defined before proceeding.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Add a check to ensure `Variables` is defined before executing the code.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
// ...existing code...

$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    // Ensure Variables is defined
    if (typeof Variables === 'undefined') {
        console.error("Variables is not defined.");
        return;
    }

    // Log the values of Variables
    console.log("Variables:", Variables);

    if (Variables.IsAuthoring){   //if Expere Authoring then
        // ...existing code...
    }

    if (Variables.IsDefaultData){ //if Default Data then
        // ...existing code...
    }

    if (Variables.IsPnP){ //if Packages and Packets then
        // ...existing code...
    }

    if (Variables.IsDGS){         //if DGS then
        // ...existing code...
    }

    if (Variables.IsDocViewer){   //if DocViewer then
        // ...existing code...
    }

    if (Variables.IsEngine){      //if Expere Engine then
        // ...existing code...
    }

    if (Variables.IseOriginal){   //if eOriginal then
        // ...existing code...
    }

    if (Variables.IsEZGateway){   //if EZGateway then
        // ...existing code...
    }

    if (Variables.IsI32){         //if I-32 then
        // ...existing code...
    }

    if (Variables.IsWKES){       //if WKIS  then
        // ...existing code...
    }

    function prependDocLinks() {
        console.log("Checking conditions for prependDocLinks...");
        console.log("IsAuthoring:", Variables.IsAuthoring);
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IsDGS:", Variables.IsDGS);
        console.log("IsDocViewer:", Variables.IsDocViewer);
        console.log("IsEngine:", Variables.IsEngine);
        console.log("IseOriginal:", Variables.IseOriginal);
        console.log("IsEZGateway:", Variables.IsEZGateway);
        console.log("IsI32:", Variables.IsI32);
        console.log("IsWKES:", Variables.IsWKES);

        if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
            console.log("Appending Documentation Links...");
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        }
    }

    function appendChangelogButton() {
        console.log("Checking conditions for appendChangelogButton...");
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IncRNLink:", IncRNLink);
        console.log("IsChangelogPage:", Variables.IsChangelogPage);

        if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
            console.log("Appending Changelog Button...");
            $('.DocLinks').append(
                '<div class="div-changelog-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
            );
        } else {
            console.log("Conditions not met for appending button.");
        }
    }

    prependDocLinks();
    appendChangelogButton();

    // ...existing code...
});
````

This will ensure that the code in `documentation-links.js` only runs if `Variables` is defined, preventing the `IsAuthoring is not defined` error.

---

_**User (2025-03-07 14:46:29Z)**_

Documentation-links.js loading...
VM4866:1 Variables: {lhost: false, prod: false, tst: false, exp: false, stg: false, …}AdminToolUG: "/Expere/Authoring/AdministrationTool/"Assumptions: "/Assumptions/"AuthoringEnvInstUg: "/Expere/Authoring/AuthoringEnvironmentInstallation/"AuthoringRN: "/Expere/Authoring/ReleaseNotes/"AuthoringRNArchives: "/Expere/Authoring/ReleaseNotesArchive/"ChangelogLink: ""DGSChangelogPath: "/DGS/index.html"DefaultText: "Enter text to start filtering"DictionaryViewerUG: "/Expere/Authoring/DV/"DocViewer: "/DocViewer/"EForms: "/EForms/"EngineChangelog: "/Expere/Engine/Change-Log/"EngineInstallationUG: "/Expere/Authoring/EngineInstallation/"ExpereDeveloperGuide: "/Expere/Engine/Developer/"ExpereImpGuide: "/Expere/Engine/Implementation-Guide/"ExpereSystemReq: "/Expere/Engine/Sys-Req/"ExpereTestingSystem: "/Expere/Engine/Testing-System/"I32Changelog: "/I-32/Changelog/"I32FormsDesignUG: "/I-32/FormsDesignUserGuide/"I32ImageUpdateUG: "/I-32/ImageUpdate/"IncRNLink: ""InterfaceManager: "/InterfaceManager/"IsADA: falseIsAssumptions: falseIsAuthRN: falseIsAuthRNArchives: falseIsAuthoring: falseIsAuthoringChangelog: falseIsAuthoringChangelogHome: falseIsAuthoringEnvInstUg: falseIsAuthoringLP: falseIsChangelog: falseIsChangelogPage: falseIsDGS: falseIsDGSChangelog: falseIsDGSImpStrat: falseIsDGSMgmtServGuide: falseIsDGSMgmtToolGuide: falseIsDGSODInstallGuide: falseIsDGSServInstallGuide: falseIsDGSServUpgradeGuide: falseIsDGSToolSuite: falseIsDGSWebServices: falseIsDataConversionGuide: falseIsDefaultData: falseIsDefaultDataInstallGuide: falseIsDefaultDataODInstGuide: falseIsDefaultDataUpgradeGuide: falseIsDefaultDataUserGuide: falseIsDefaultDataWebServGuide: falseIsDictionaryViewerUG: falseIsDocMgmt: falseIsDocViewer: falseIsDocViewerChangelog: falseIsDocViewerIntGuide: falseIsDocViewerUserGuide: falseIsEDS: falseIsEForms: falseIsEOriginalQuickGuide: falseIsEZConfConsChangelog: falseIsEZConfig: falseIsEZGateway: falseIsEZGatewayInstallGuide: falseIsEZGatewayODInstGuide: falseIsEZGatewayWebServGuide: falseIsEngine: falseIsEngineChangelog: falseIsEngineInstallationUG: falseIsExpereDeveloperGuide: falseIsExpereImpGuide: falseIsExpereSystemReq: falseIsExpereTestingSystem: falseIsHosted: falseIsI32: falseIsI32Changelog: falseIsI32FormsDesignUG: falseIsI32ImageUpdateUG: falseIsIndex: falseIsInstalled: falseIsInterfaceManager: falseIsMortgage: falseIsOAuth: falseIsOAuthSetupGuide: falseIsOPPSA: falseIsPNPUpgradeGuide: falseIsPNPUserGuide: falseIsPNPWebServGuide: falseIsPnP: falseIsPnPChangelog: falseIsPnPInstallGuide: falseIsProductDownloadSite: falseIsRN: ""IsReqEd3UG: falseIsReqEd4UG: falseIsSearchPage: falseIsSecAdmin: falseIsSecAdminSelfHosted: falseIsTSoftPlus: falseIsVanceo: falseIsWKES: falseIsWKESignCaptureGuide: falseIsWKESignFAQ: falseIsWKESignLegacyUserGuide: falseIsWKESignOnsiteUG: falseIsWKESignPushStatusUG: falseIsWKESignReleaseNotes: falseIsWKESignSysReq: falseIsWKESignUserGuide: falseIsWKESignWebServices: falseIsWKHosted: falseIsWKHostedChangelog: falseIsWKHostedImpStrat: falseIsWKHostedOverview: falseIsWKHostedToolSuite: falseIsWKHostedWebServices: falseIsWorkflow: falseIseOriginal: falseMortgage: "/Mortgage/"ProductDownloadSite: "/ProductDownloadSite/"ProductLandingPage: ""ProductName: ""RemoveSearch: ""RemoveTocAss: falseRemoveTocC1: falseRemoveTocMort: falseRemoveTocSA: falseReqEd3UG: "/Expere/Authoring/RequirementsEditor/"ReqEd4UG: "/Expere/Authoring/RequirementsEditor4/"SecAdmin: "/SecurityAdministration/"SecAdminSelfHosted: "/SecurityAdministrationself-hosted/"TSoftPlus: "/TSoftPlus/"Vanceo: "/Vanceo/"WKESignCaptureGuide: "/WoltersKluwer_E-Sign/Capture/"WKESignFAQ: "/WoltersKluwer_E-Sign/FAQ/"WKESignLegacyUserguide: "/WoltersKluwer_E-Sign/LegacyUserGuide/"WKESignOnsiteUG: "/WoltersKluwer_E-Sign/Onsite/"WKESignPushStatusUG: "/WoltersKluwer_E-Sign/PushStatus/"WKESignReleaseNotes: "/WoltersKluwer_E-Sign/ReleaseNotes/"WKESignSysReq: "/WoltersKluwer_E-Sign/SystemRequirements/"WKESignUserGuide: "/WoltersKluwer_E-Sign/UserGuide/"WKESignWebServices: "/WoltersKluwer_E-Sign/Webservices/"WKHostedChangelogPath: "/WK-Hosted-Expere/index.html"WKHostedToolSuite: "/WK-Hosted-Expere/Tool-Suite/"Workflow: "/Workflow/"dev: trueexp: falselhost: falseprod: falserevLevel: "null"stg: falsetst: false[[Prototype]]: Object
jquery.min.js:2 jQuery.Deferred exception: IsAuthoring is not defined ReferenceError: IsAuthoring is not defined
    at HTMLDocument.<anonymous> (<anonymous>:1:1316)
    at e (https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js:2:30038)
    at t (https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js:2:30340) undefined

thisd is the IsAuthoring definition:
    IsAuthoring: window.location.href.toLowerCase().indexOf("/Expere/Authoring/") !== -1,

And this is the page I am on:
https://dev-documentation.wolterskluwerfs.com/Expere/Authoring/RequirementsEditor4/tasks/re4_populating_an_element_from_a_file.html?hl=populating%2Celement%2Cfrom%2Cfile

As you can see the IsAuthoring variable should return true.

---

_**Agent**_

The issue seems to be that the `Variables` object is not being properly initialized before `documentation-links.js` is executed. To ensure that `Variables` is properly initialized, we need to make sure that `variables.js` is fully loaded and executed before `documentation-links.js`.

Let's modify the `afterbody.js` file to ensure that `documentation-links.js` is loaded only after `variables.js` has been successfully loaded.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\afterbody.js

Ensure that `documentation-links.js` is loaded only after `variables.js` has been successfully loaded.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\afterbody.js
$(document).ready(function() {

  // Load variables.js first
  $.getScript('/resources/webhelp/js/variables.js')
    .done(function() {
      // Now load the other scripts after variables.js is loaded
      return $.when(
        $.getScript('/resources/webhelp/js/ga.min.js'),
        $.getScript('/resources/webhelp/js/toolbar-buttons.min.js'),
        $.getScript('/resources/webhelp/js/dynamic-profiling.js'),
        $.getScript('/resources/webhelp/js/changelog.min.js'),
        $.getScript('/resources/webhelp/js/header.min.js'),
        $.getScript('/resources/webhelp/js/sts.min.js'),
        $.getScript('/resources/webhelp/js/permission-mapping.min.js'),
        $.getScript('/resources/webhelp/js/server-maintenance.min.js'),
        $.getScript('/resources/webhelp/js/general.min.js'),
        $.getScript('/resources/webhelp/js/search.min.js'),
        $.getScript('/resources/webhelp/js/footer.min.js')
      ).done(function() {
        // Load documentation-links.js after all other scripts
        $.getScript('/resources/webhelp/js/documentation-links.min.js');
      });
    })
    .done(function() {
        // All scripts have been loaded and executed
        console.log("All scripts loaded successfully.");
        // You can now safely use Variables
    })
    .fail(function(jqxhr, settings, exception) {
        console.error("Failed to load scripts: ", exception);
    });

  // #region FAVICON
  $('head').append('<link rel="shortcut icon" href="/resources/img/favicons/favicon-32x32.png"></link>');
  // #endregion

  // #region REFERRER
  // Create a new <meta> element
  var metaTag = document.createElement('meta');
  metaTag.setAttribute('name', 'referrer');
  metaTag.setAttribute('content', 'no-referrer-when-downgrade');
  document.getElementsByTagName('head')[0].appendChild(metaTag);
  // #endregion

  $(".loader-wrapper").remove();

});
````

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Add a check to ensure `Variables` is defined before executing the code.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    // Ensure Variables is defined
    if (typeof Variables === 'undefined') {
        console.error("Variables is not defined.");
        return;
    }

    // Log the values of Variables
    console.log("Variables:", Variables);

    if (Variables.IsAuthoring){   //if Expere Authoring then
        // ...existing code...
    }

    if (Variables.IsDefaultData){ //if Default Data then
        // ...existing code...
    }

    if (Variables.IsPnP){ //if Packages and Packets then
        // ...existing code...
    }

    if (Variables.IsDGS){         //if DGS then
        // ...existing code...
    }

    if (Variables.IsDocViewer){   //if DocViewer then
        // ...existing code...
    }

    if (Variables.IsEngine){      //if Expere Engine then
        // ...existing code...
    }

    if (Variables.IseOriginal){   //if eOriginal then
        // ...existing code...
    }

    if (Variables.IsEZGateway){   //if EZGateway then
        // ...existing code...
    }

    if (Variables.IsI32){         //if I-32 then
        // ...existing code...
    }

    if (Variables.IsWKES){       //if WKIS  then
        // ...existing code...
    }

    function prependDocLinks() {
        console.log("Checking conditions for prependDocLinks...");
        console.log("IsAuthoring:", Variables.IsAuthoring);
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IsDGS:", Variables.IsDGS);
        console.log("IsDocViewer:", Variables.IsDocViewer);
        console.log("IsEngine:", Variables.IsEngine);
        console.log("IseOriginal:", Variables.IseOriginal);
        console.log("IsEZGateway:", Variables.IsEZGateway);
        console.log("IsI32:", Variables.IsI32);
        console.log("IsWKES:", Variables.IsWKES);

        if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
            console.log("Appending Documentation Links...");
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        }
    }

    function appendChangelogButton() {
        console.log("Checking conditions for appendChangelogButton...");
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IncRNLink:", IncRNLink);
        console.log("IsChangelogPage:", Variables.IsChangelogPage);

        if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
            console.log("Appending Changelog Button...");
            $('.DocLinks').append(
                '<div class="div-changelog-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
            );
        } else {
            console.log("Conditions not met for appending button.");
        }
    }

    prependDocLinks();
    appendChangelogButton();

    // ...existing code...
});
````

This will ensure that `documentation-links.js` is loaded only after `variables.js` has been successfully loaded and executed, preventing the `IsAuthoring is not defined` error.

---

_**User (2025-03-07 14:49:03Z)**_

that only results in this:
Documentation-links.js loading...
VM4966:1 Variables: {lhost: false, prod: false, tst: false, exp: false, stg: false, …}
jquery.min.js:2 jQuery.Deferred exception: IsAuthoring is not defined ReferenceError: IsAuthoring is not defined
    at HTMLDocument.<anonymous> (<anonymous>:1:1316)
    at e (https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js:2:30038)
    at t (https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js:2:30340) undefined
S.Deferred.exceptionHook @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
add @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
Deferred @ jquery.min.js:2
then @ jquery.min.js:2
S.fn.ready @ jquery.min.js:2
(anonymous) @ VM4966:1
b @ jquery.min.js:2
globalEval @ jquery.min.js:2
text script @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
XMLHttpRequest.send
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getScript @ jquery.min.js:2
(anonymous) @ afterbody.js:21
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
XMLHttpRequest.send
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getScript @ jquery.min.js:2
(anonymous) @ afterbody.js:15
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
B @ jquery.min.js:2Understand this warningAI
jquery.min.js:2 Uncaught ReferenceError: IsAuthoring is not defined
    at HTMLDocument.<anonymous> (<anonymous>:1:1316)
    at e (jquery.min.js:2:30038)
    at t (jquery.min.js:2:30340)
(anonymous) @ VM4966:1
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
add @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
Deferred @ jquery.min.js:2
then @ jquery.min.js:2
S.fn.ready @ jquery.min.js:2
(anonymous) @ VM4966:1
b @ jquery.min.js:2
globalEval @ jquery.min.js:2
text script @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
XMLHttpRequest.send
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getScript @ jquery.min.js:2
(anonymous) @ afterbody.js:21
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
XMLHttpRequest.send
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getScript @ jquery.min.js:2
(anonymous) @ afterbody.js:15
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
B @ jquery.min.js:2Understand this errorAI
jquery.min.js:2 
            
            
           GET https://dev-documentation.wolterskluwerfs.com/Token.json?_=1741358916892 404 (Not Found)
send @ jquery.min.js:2
ajax @ jquery.min.js:2
(anonymous) @ VM4977:1
b @ jquery.min.js:2
globalEval @ jquery.min.js:2
text script @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
XMLHttpRequest.send
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getScript @ jquery.min.js:2
(anonymous) @ afterbody.js:26
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
l @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
XMLHttpRequest.send
send @ jquery.min.js:2
ajax @ jquery.min.js:2
S.<computed> @ jquery.min.js:2
getScript @ jquery.min.js:2
(anonymous) @ afterbody.js:15
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
B @ jquery.min.js:2Understand this errorAI
VM4996:1 Documentation-links.js loading...
VM4996:1 Variables: {lhost: false, prod: false, tst: false, exp: false, stg: false, …}

---

_**Agent**_

The error indicates that the `IsAuthoring` variable is not defined. This suggests that the `Variables` object is not being properly initialized before `documentation-links.js` is executed. 

To ensure that `documentation-links.js` is executed only after `variables.js` has been successfully loaded, we should modify the script loading sequence in `afterbody.js` to load `documentation-links.js` only after `variables.js` has been fully loaded.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\afterbody.js

Ensure that `documentation-links.js` is loaded only after `variables.js` has been successfully loaded.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\afterbody.js
$(document).ready(function() {

  // Load variables.js first
  $.getScript('/resources/webhelp/js/variables.js')
    .done(function() {
      // Now load the other scripts after variables.js is loaded
      return $.when(
        $.getScript('/resources/webhelp/js/ga.min.js'),
        $.getScript('/resources/webhelp/js/toolbar-buttons.min.js'),
        $.getScript('/resources/webhelp/js/dynamic-profiling.js'),
        $.getScript('/resources/webhelp/js/changelog.min.js'),
        $.getScript('/resources/webhelp/js/header.min.js'),
        $.getScript('/resources/webhelp/js/sts.min.js'),
        $.getScript('/resources/webhelp/js/permission-mapping.min.js'),
        $.getScript('/resources/webhelp/js/server-maintenance.min.js'),
        $.getScript('/resources/webhelp/js/general.min.js'),
        $.getScript('/resources/webhelp/js/search.min.js'),
        $.getScript('/resources/webhelp/js/footer.min.js')
      ).done(function() {
        // Load documentation-links.js after all other scripts
        $.getScript('/resources/webhelp/js/documentation-links.min.js');
      });
    })
    .done(function() {
        // All scripts have been loaded and executed
        console.log("All scripts loaded successfully.");
        // You can now safely use Variables
    })
    .fail(function(jqxhr, settings, exception) {
        console.error("Failed to load scripts: ", exception);
    });

  // #region FAVICON
  $('head').append('<link rel="shortcut icon" href="/resources/img/favicons/favicon-32x32.png"></link>');
  // #endregion

  // #region REFERRER
  // Create a new <meta> element
  var metaTag = document.createElement('meta');
  metaTag.setAttribute('name', 'referrer');
  metaTag.setAttribute('content', 'no-referrer-when-downgrade');
  document.getElementsByTagName('head')[0].appendChild(metaTag);
  // #endregion

  $(".loader-wrapper").remove();

});
````

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Add a check to ensure `Variables` is defined before executing the code.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    // Ensure Variables is defined
    if (typeof Variables === 'undefined') {
        console.error("Variables is not defined.");
        return;
    }

    // Log the values of Variables
    console.log("Variables:", Variables);

    if (Variables.IsAuthoring){   //if Expere Authoring then
        // ...existing code...
    }

    if (Variables.IsDefaultData){ //if Default Data then
        // ...existing code...
    }

    if (Variables.IsPnP){ //if Packages and Packets then
        // ...existing code...
    }

    if (Variables.IsDGS){         //if DGS then
        // ...existing code...
    }

    if (Variables.IsDocViewer){   //if DocViewer then
        // ...existing code...
    }

    if (Variables.IsEngine){      //if Expere Engine then
        // ...existing code...
    }

    if (Variables.IseOriginal){   //if eOriginal then
        // ...existing code...
    }

    if (Variables.IsEZGateway){   //if EZGateway then
        // ...existing code...
    }

    if (Variables.IsI32){         //if I-32 then
        // ...existing code...
    }

    if (Variables.IsWKES){       //if WKIS  then
        // ...existing code...
    }

    function prependDocLinks() {
        console.log("Checking conditions for prependDocLinks...");
        console.log("IsAuthoring:", Variables.IsAuthoring);
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IsDGS:", Variables.IsDGS);
        console.log("IsDocViewer:", Variables.IsDocViewer);
        console.log("IsEngine:", Variables.IsEngine);
        console.log("IseOriginal:", Variables.IseOriginal);
        console.log("IsEZGateway:", Variables.IsEZGateway);
        console.log("IsI32:", Variables.IsI32);
        console.log("IsWKES:", Variables.IsWKES);

        if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
            console.log("Appending Documentation Links...");
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        }
    }

    function appendChangelogButton() {
        console.log("Checking conditions for appendChangelogButton...");
        console.log("IsDefaultData:", Variables.IsDefaultData);
        console.log("IsPnP:", Variables.IsPnP);
        console.log("IncRNLink:", IncRNLink);
        console.log("IsChangelogPage:", Variables.IsChangelogPage);

        if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
            console.log("Appending Changelog Button...");
            $('.DocLinks').append(
                '<div class="div-changelog-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
            );
        } else {
            console.log("Conditions not met for appending button.");
        }
    }

    prependDocLinks();
    appendChangelogButton();

    // ...existing code...
});
````

This will ensure that `documentation-links.js` is loaded only after `variables.js` has been successfully loaded and executed, preventing the `IsAuthoring is not defined` error.

---

_**User (2025-03-07 17:44:58Z)**_

how do I import  the variables.js file in this file?

---

_**Agent**_

To ensure that `variables.js` is properly loaded and its variables are available in `documentation-links.js`, you should load `variables.js` before executing any code in `documentation-links.js`. You can use jQuery's `$.getScript` method to load `variables.js` and then execute the rest of the code in the callback function.

Here is how you can modify `documentation-links.js` to load `variables.js` first:

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Load `variables.js` before executing the rest of the code.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
// documentation-links.js

// ...existing code...

$(document).ready(function() {
    console.log("Documentation-links.js loading...");

    // Load variables.js first
    $.getScript('/resources/webhelp/js/variables.js')
        .done(function() {
            // Ensure Variables is defined
            if (typeof Variables === 'undefined') {
                console.error("Variables is not defined.");
                return;
            }

            // Log the values of Variables
            console.log("Variables:", Variables);

            IsHosted = sessionStorage.getItem("audience");

            if (Variables.IsAuthoring){   //if Expere Authoring then
                ProductName             = "Expere Authoring";
                ProductLandingPage      = "/Expere/Authoring/index.html";
                IncRNLink               = "yes";
                ChangelogLink           = "/Expere/Authoring/ReleaseNotes/index.html";
                EngineChangelogLink     = "/Expere/Engine/Change-Log";
                IsRN                    = ChangelogLink;
                var IsReUG 	            = window.location.href.indexOf("Authoring/RequirementsEditor") != -1;
                var IsAdminUG 			= window.location.href.indexOf("Authoring/AdministrationTool/webhelp") != -1;
                var IsDdvUG 	   		= window.location.href.indexOf("Authoring/DDV") != -1;
                var IsAuthInstallUG     = window.location.href.indexOf("Authoring/EngineInstallation") != -1;
            }

            if (Variables.IsDefaultData){ //if Default Data then
                ProductName             = "Default Data";
                if(IsHosted){
                    console.log("IsHosted = " + IsHosted);
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    console.log("IsInstalled = " + IsInstalled);
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
                var IsDD_InstallGuide   = window.location.href.indexOf("/DefaultData/InstallationGuide") != -1;
                var IsDD_UpgradeGuide   = window.location.href.indexOf("/DefaultData/UpgradeGuide") != -1;
                var IsDD_USerGuide      = window.location.href.indexOf("/DefaultData/UserGuide") != -1;
                var IsDD_WebServGuide   = window.location.href.indexOf("/DefaultData/WebServicesGuide") != -1;
            }

            if (Variables.IsPnP){ //if Packages and Packets then
                ProductName             = "Packages and Packets";
                if(IsHosted){
                    console.log("IsHosted = " + IsHosted);
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    console.log("IsInstalled = " + IsInstalled);
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
                var IsPnP_InstallGuide   = window.location.href.indexOf("/ExpereEZConfig/InstallGuide") != -1;
                var IsPnP_UpgradeGuide   = window.location.href.indexOf("/PackagesAndPackets/UpgradeGuide") != -1;
                var IsPnP_USerGuide      = window.location.href.indexOf("/PackagesAndPackets/UserGuide") != -1;
                var IsPnP_WebServGuide   = window.location.href.indexOf("/ExpereEZConfig//WebservicesGuide") != -1;
            }

            if (Variables.IsDGS){         //if DGS then
                ProductName             = "Document Generation Services";
                ProductLandingPage      = "/DGS/";
                IncRNLink               = "yes";
                ChangelogLink           = "/DGS/Change-Log/index.html";
                IsRN                    = window.location.href.indexOf("/DGS/Change-Log") != -1;
                var IsDGS_Changelog     = window.location.href.indexOf("/DGS/Change-Log/") != -1;
            }

            if (Variables.IsDocViewer){   //if DocViewer then
                ProductName             = "DocViewer";
                if(IsHosted){
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                ChangelogLink           = "/DocViewer/ReleaseNotes/index.html";
                IsRN                    = window.location.href.indexOf("/DocViewer/ReleaseNotes") != -1;
            }

            if (Variables.IsEngine){      //if Expere Engine then
                ProductName             = "Expere Engine";
                ProductLandingPage      = "/Expere/Engine/";
                IncRNLink               = "yes";
                ChangelogLink           = "/Expere/Engine/Change-Log";
                IsRN                    = window.location.href.indexOf("Engine/Change-Log") != -1;
            }

            if (Variables.IseOriginal){   //if eOriginal then
                console.log("IseOriginal = " + IseOriginal);
                ProductName             = "eOriginal";
                if(IsHosted){
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                ChangelogLink           = "/WK-Hosted-Expere/Change-Log/index.html";
                IsRN                    = window.location.href.indexOf("/WK-Hosted-Expere/Change-Log") != -1;
                var IsQuickGuide     = window.location.href.indexOf("eOriginal/QuickGuide") != -1;
            }

            if (Variables.IsEZGateway){   //if EZGateway then
                ProductName             = "EZGateway";
                ChangelogLink           = "/ExpereEZConfig/Changelog/index.html";
                IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
                if (IsRN){
                    IncRNLink = "no";
                }
                else{
                    IncRNLink = "yes";
                }
                if(IsHosted){
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    ProductLandingPage  = "/DGS/";
                }
            }

            if (Variables.IsI32){         //if I-32 then
                ProductName             = "I-32";
                ProductLandingPage      = "/I-32/";
                IncRNLink               = "yes";
                ChangelogLink           = "/I-32/Changelog/index.html";
                IsRN                    = window.location.href.indexOf("I-32/Changelog") != -1;
                var IsFormsDesignUG     = window.location.href.indexOf("I-32/FormsDesignUserGuide") != -1;
                var IsImageUpdateUG     = window.location.href.indexOf("I-32/ImageUpdate") != -1;
            }

            if (Variables.IsWKES){       //if WKIS  then
                ProductName             = "ESign";
                ProductLandingPage      = "/WoltersKluwer_E-Sign/index.html";
                IncRNLink               = "yes";
                ChangelogLink           = "/WoltersKluwer_E-Sign/ReleaseNotes/index.html";
                IsRN                    = window.location.href.indexOf("/WoltersKluwer_E-Sign/ReleaseNotes") != -1;
                var IsWKES_UserGuide   = window.location.href.indexOf("//WoltersKluwer_E-Sign/UserGuide/") != -1;
            }

            function prependDocLinks() {
                console.log("Appending Documentation Links...");
                if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
                    console.log("IsAuthoring = " + Variables.IsAuthoring);
                    $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                        '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                        '<div class="div-landing-page-btn">' +
                        '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                        '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                        '</div>'
                    );
                }
            }

            function appendChangelogButton() {
                if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
                    $('.DocLinks').append(
                        '<div class="div-changelog-btn">' +
                        '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                        '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
                    );
                } else {
                    console.log("Conditions not met for appending button.");
                }
            }

            prependDocLinks();
            appendChangelogButton();

            if (Variables.IsDefaultData || Variables.IsPnP) {
                $('#LandingPageLink').attr('href', ProductLandingPage + 'index.html');
                $.get('/WK-Hosted-Expere/index.html', function (data) {
                    const NewChangelogLink = $(data).find('#EzConfigChangeLogLink').attr('href');
                    if (IncRNLink == "yes" && !(Variables.IsChangelogPage)) {
                        $('.DocLinks').append(
                            '<div class="div-changelog-btn">' +
                            '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                            '<a class="link-primary" href="' + NewChangelogLink + '" target="_blank">View Changelog</a></button></div>'
                        );
                    }
                });
            }

            if (Variables.IsRN && (!(Variables.IsAuthoring))) {
                $('#searchForm').remove();
            }

            if (Variables.IsEForms) {
                console.log(Variables.IsEForms);
                $('.ChangelogLink').remove();
            }
        })
        .fail(function(jqxhr, settings, exception) {
            console.error("Failed to load variables.js: ", exception);
        });
});
````

This modification ensures that `variables.js` is loaded and its variables are available before executing the rest of the code in `documentation-links.js`.

---

_**User (2025-03-07 18:40:58Z)**_

analyze the Variables file. It is telling me that the 'IsAuthoring' variable is false. However, the page I am on includes this in the URL: https://dev-documentation.wolterskluwerfs.com/Expere/Authoring/RequirementsEditor4/topics/re4_introduction.html
Please identify the issue. 

---

_**Agent**_

The issue seems to be that the `IsAuthoring` variable is not being set correctly in `variables.js`. Let's analyze the `variables.js` file to ensure that the `IsAuthoring` variable is being set based on the URL.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js

Ensure that the `IsAuthoring` variable is being set correctly based on the URL.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js
var Variables = {
    // ...existing code...
    IsAuthoring: window.location.href.toLowerCase().indexOf("/expere/authoring/") !== -1,
    // ...existing code...
};
````

If the `IsAuthoring` variable is still not being set correctly, it might be due to the case sensitivity of the URL. Ensure that the URL is being converted to lowercase before checking for the substring.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js

Ensure that the URL is being converted to lowercase before checking for the substring.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js
var Variables = {
    // ...existing code...
    IsAuthoring: window.location.href.toLowerCase().indexOf("/expere/authoring/") !== -1,
    // ...existing code...
};
````

If the issue persists, you can add a console log to check the value of `window.location.href` and ensure that it contains the expected substring.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js

Add a console log to check the value of `window.location.href`.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js
var Variables = {
    // ...existing code...
    IsAuthoring: window.location.href.toLowerCase().indexOf("/expere/authoring/") !== -1,
    // ...existing code...
};

console.log("window.location.href:", window.location.href);
console.log("IsAuthoring:", Variables.IsAuthoring);
````

This will help you identify if the URL is being correctly checked and if the `IsAuthoring` variable is being set correctly.

---

_**User (2025-03-07 18:50:13Z)**_

I am still getting this. 
Variables loaded successfully.
VM2073:201 window.location.href: https://dev-documentation.wolterskluwerfs.com/Expere/Authoring/RequirementsEditor4/topics/re4_introduction.html
VM2073:202 IsAuthoring: false
jquery.min.js:2 [Intervention] Slow network is detected. See https://www.chromestatus.com/feature/5636954674692096 for more details. Fallback font will be used while loading: https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.2/font/fonts/bootstrap-icons.woff2?08efbba7c53d8c5413793eecb19b20bb
VM2085:17 Documentation-links.js loading...
VM2085:238 Appending Documentation Links...

---

_**Agent**_

The issue seems to be that the `IsAuthoring` variable is not being set correctly in `variables.js`. Let's ensure that the `IsAuthoring` variable is being set based on the URL correctly.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js

Add console logs to check the value of `window.location.href` and ensure that the `IsAuthoring` variable is being set correctly.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\variables.js
var Variables = {
    // ...existing code...
    IsAuthoring: window.location.href.toLowerCase().indexOf("/expere/authoring/") !== -1,
    // ...existing code...
};

console.log("window.location.href:", window.location.href);
console.log("IsAuthoring:", Variables.IsAuthoring);
````

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Ensure that `variables.js` is loaded before executing the rest of the code.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    $.getScript('/resources/webhelp/js/variables.js')
        .done(function() {
            // Ensure Variables is defined
            if (typeof Variables === 'undefined') {
                console.error("Variables is not defined.");
                return;
            }

            // Log the values of Variables
            console.log("Variables loaded successfully.");
            console.log("window.location.href:", window.location.href);
            console.log("IsAuthoring:", Variables.IsAuthoring);

            if (Variables.IsAuthoring){   //if Expere Authoring then
                ProductName             = "Expere Authoring";
                ProductLandingPage      = "/Expere/Authoring/index.html";
                IncRNLink               = "yes";
                ChangelogLink           = "/Expere/Authoring/ReleaseNotes/index.html";
                EngineChangelogLink     = "/Expere/Engine/Change-Log";
                IsRN                    = ChangelogLink;
                var IsReUG 	            = window.location.href.indexOf("Authoring/RequirementsEditor") != -1;
                var IsAdminUG 			= window.location.href.indexOf("Authoring/AdministrationTool/webhelp") != -1;
                var IsDdvUG 	   		= window.location.href.indexOf("Authoring/DDV") != -1;
                var IsAuthInstallUG     = window.location.href.indexOf("Authoring/EngineInstallation") != -1;
            }

            if (Variables.IsDefaultData){ //if Default Data then
                ProductName             = "Default Data";
                if(IsHosted){
                    console.log("IsHosted = " + IsHosted);
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    console.log("IsInstalled = " + IsInstalled);
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
                var IsDD_InstallGuide   = window.location.href.indexOf("/DefaultData/InstallationGuide") != -1;
                var IsDD_UpgradeGuide   = window.location.href.indexOf("/DefaultData/UpgradeGuide") != -1;
                var IsDD_USerGuide      = window.location.href.indexOf("/DefaultData/UserGuide") != -1;
                var IsDD_WebServGuide   = window.location.href.indexOf("/DefaultData/WebServicesGuide") != -1;
            }

            if (Variables.IsPnP){ //if Packages and Packets then
                ProductName             = "Packages and Packets";
                if(IsHosted){
                    console.log("IsHosted = " + IsHosted);
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    console.log("IsInstalled = " + IsInstalled);
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
                var IsPnP_InstallGuide   = window.location.href.indexOf("/ExpereEZConfig/InstallGuide") != -1;
                var IsPnP_UpgradeGuide   = window.location.href.indexOf("/PackagesAndPackets/UpgradeGuide") != -1;
                var IsPnP_USerGuide      = window.location.href.indexOf("/PackagesAndPackets/UserGuide") != -1;
                var IsPnP_WebServGuide   = window.location.href.indexOf("/ExpereEZConfig//WebservicesGuide") != -1;
            }

            if (Variables.IsDGS){         //if DGS then
                ProductName             = "Document Generation Services";
                ProductLandingPage      = "/DGS/";
                IncRNLink               = "yes";
                ChangelogLink           = "/DGS/Change-Log/index.html";
                IsRN                    = window.location.href.indexOf("/DGS/Change-Log") != -1;
                var IsDGS_Changelog     = window.location.href.indexOf("/DGS/Change-Log/") != -1;
            }

            if (Variables.IsDocViewer){   //if DocViewer then
                ProductName             = "DocViewer";
                if(IsHosted){
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                ChangelogLink           = "/DocViewer/ReleaseNotes/index.html";
                IsRN                    = window.location.href.indexOf("/DocViewer/ReleaseNotes") != -1;
            }

            if (Variables.IsEngine){      //if Expere Engine then
                ProductName             = "Expere Engine";
                ProductLandingPage      = "/Expere/Engine/";
                IncRNLink               = "yes";
                ChangelogLink           = "/Expere/Engine/Change-Log";
                IsRN                    = window.location.href.indexOf("Engine/Change-Log") != -1;
            }

            if (Variables.IseOriginal){   //if eOriginal then
                console.log("IseOriginal = " + IseOriginal);
                ProductName             = "eOriginal";
                if(IsHosted){
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    ProductLandingPage  = "/DGS/";
                }
                IncRNLink               = "yes";
                ChangelogLink           = "/WK-Hosted-Expere/Change-Log/index.html";
                IsRN                    = window.location.href.indexOf("/WK-Hosted-Expere/Change-Log") != -1;
                var IsQuickGuide     = window.location.href.indexOf("eOriginal/QuickGuide") != -1;
            }

            if (Variables.IsEZGateway){   //if EZGateway then
                ProductName             = "EZGateway";
                ChangelogLink           = "/ExpereEZConfig/Changelog/index.html";
                IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
                if (IsRN){
                    IncRNLink = "no";
                }
                else{
                    IncRNLink = "yes";
                }
                if(IsHosted){
                    ProductLandingPage  = "/WK-Hosted-Expere/";
                }
                if(IsInstalled){
                    ProductLandingPage  = "/DGS/";
                }
            }

            if (Variables.IsI32){         //if I-32 then
                ProductName             = "I-32";
                ProductLandingPage      = "/I-32/";
                IncRNLink               = "yes";
                ChangelogLink           = "/I-32/Changelog/index.html";
                IsRN                    = window.location.href.indexOf("I-32/Changelog") != -1;
                var IsFormsDesignUG     = window.location.href.indexOf("I-32/FormsDesignUserGuide") != -1;
                var IsImageUpdateUG     = window.location.href.indexOf("I-32/ImageUpdate") != -1;
            }

            if (Variables.IsWKES){       //if WKIS  then
                ProductName             = "ESign";
                ProductLandingPage      = "/WoltersKluwer_E-Sign/index.html";
                IncRNLink               = "yes";
                ChangelogLink           = "/WoltersKluwer_E-Sign/ReleaseNotes/index.html";
                IsRN                    = window.location.href.indexOf("/WoltersKluwer_E-Sign/ReleaseNotes") != -1;
                var IsWKES_UserGuide   = window.location.href.indexOf("//WoltersKluwer_E-Sign/UserGuide/") != -1;
            }

            function prependDocLinks() {
                console.log("Appending Documentation Links...");
                if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
                    console.log("IsAuthoring = " + Variables.IsAuthoring);
                    $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                        '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                        '<div class="div-landing-page-btn">' +
                        '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                        '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                        '</div>'
                    );
                }
            }

            function appendChangelogButton() {
                if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
                    $('.DocLinks').append(
                        '<div class="div-changelog-btn">' +
                        '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                        '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
                    );
                } else {
                    console.log("Conditions not met for appending button.");
                }
            }

            prependDocLinks();
            appendChangelogButton();

            if (Variables.IsDefaultData || Variables.IsPnP) {
                $('#LandingPageLink').attr('href', ProductLandingPage + 'index.html');
                $.get('/WK-Hosted-Expere/index.html', function (data) {
                    const NewChangelogLink = $(data).find('#EzConfigChangeLogLink').attr('href');
                    if (IncRNLink == "yes" && !(Variables.IsChangelogPage)) {
                        $('.DocLinks').append(
                            '<div class="div-changelog-btn">' +
                            '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                            '<a class="link-primary" href="' + NewChangelogLink + '" target="_blank">View Changelog</a></button></div>'
                        );
                    }
                });
            }

            if (Variables.IsRN && (!(Variables.IsAuthoring))) {
                $('#searchForm').remove();
            }

            if (Variables.IsEForms) {
                console.log(Variables.IsEForms);
                $('.ChangelogLink').remove();
            }
        })
        .fail(function(jqxhr, settings, exception) {
            console.error("Failed to load variables.js: ", exception);
        });
});
````

This will help you identify if the URL is being correctly checked and if the `IsAuthoring` variable is being set correctly.

---

_**User (2025-03-07 19:08:29Z)**_

function prependDocLinks() {
        console.log("Appending Documentation Links...");
        // if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
        //     console.log("IsAuthoring = " + Variables.IsAuthoring);
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        // }
    }

    This function is not working correctly. The log statement shows in the console, but nothing is prepended. 

---

_**Agent**_

The issue might be related to the timing of when the `prependDocLinks` function is called or the state of the DOM elements it is trying to manipulate. To ensure that the elements are available and the function is executed at the right time, you can try the following steps:

1. Ensure that the `Variables` object is properly loaded and defined.
2. Ensure that the DOM elements are available before attempting to prepend the documentation links.

Let's update the `documentation-links.js` file to include these checks and ensure that the `prependDocLinks` function is called at the right time.

### \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js

Ensure that the `Variables` object is properly loaded and defined, and that the DOM elements are available before attempting to prepend the documentation links.

````javascript
// filepath: \\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev\resources\webhelp\js\documentation-links.js
$(document).ready(function() {
    console.log("Documentation-links.js loading...");
    IsHosted = sessionStorage.getItem("audience");

    // Ensure Variables is defined
    if (typeof Variables === 'undefined') {
        console.error("Variables is not defined.");
        return;
    }

    // Log the values of Variables
    console.log("Variables loaded successfully.");
    console.log("window.location.href:", window.location.href);
    console.log("IsAuthoring:", Variables.IsAuthoring);

    if (Variables.IsAuthoring){   //if Expere Authoring then
        ProductName             = "Expere Authoring";
        ProductLandingPage      = "/Expere/Authoring/index.html";
        IncRNLink               = "yes";
        ChangelogLink           = "/Expere/Authoring/ReleaseNotes/index.html";
        EngineChangelogLink     = "/Expere/Engine/Change-Log";
        IsRN                    = ChangelogLink;
        var IsReUG 	            = window.location.href.indexOf("Authoring/RequirementsEditor") != -1;
        var IsAdminUG 			= window.location.href.indexOf("Authoring/AdministrationTool/webhelp") != -1;
        var IsDdvUG 	   		= window.location.href.indexOf("Authoring/DDV") != -1;
        var IsAuthInstallUG     = window.location.href.indexOf("Authoring/EngineInstallation") != -1;
    }

    if (Variables.IsDefaultData){ //if Default Data then
        ProductName             = "Default Data";
        if(IsHosted){
            console.log("IsHosted = " + IsHosted);
            ProductLandingPage  = "/WK-Hosted-Expere/";
        }
        if(IsInstalled){
            console.log("IsInstalled = " + IsInstalled);
            ProductLandingPage  = "/DGS/";
        }
        IncRNLink               = "yes";
        IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
        var IsDD_InstallGuide   = window.location.href.indexOf("/DefaultData/InstallationGuide") != -1;
        var IsDD_UpgradeGuide   = window.location.href.indexOf("/DefaultData/UpgradeGuide") != -1;
        var IsDD_USerGuide      = window.location.href.indexOf("/DefaultData/UserGuide") != -1;
        var IsDD_WebServGuide   = window.location.href.indexOf("/DefaultData/WebServicesGuide") != -1;
    }

    if (Variables.IsPnP){ //if Packages and Packets then
        ProductName             = "Packages and Packets";
        if(IsHosted){
            console.log("IsHosted = " + IsHosted);
            ProductLandingPage  = "/WK-Hosted-Expere/";
        }
        if(IsInstalled){
            console.log("IsInstalled = " + IsInstalled);
            ProductLandingPage  = "/DGS/";
        }
        IncRNLink               = "yes";
        IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
        var IsPnP_InstallGuide   = window.location.href.indexOf("/ExpereEZConfig/InstallGuide") != -1;
        var IsPnP_UpgradeGuide   = window.location.href.indexOf("/PackagesAndPackets/UpgradeGuide") != -1;
        var IsPnP_USerGuide      = window.location.href.indexOf("/PackagesAndPackets/UserGuide") != -1;
        var IsPnP_WebServGuide   = window.location.href.indexOf("/ExpereEZConfig//WebservicesGuide") != -1;
    }

    if (Variables.IsDGS){         //if DGS then
        ProductName             = "Document Generation Services";
        ProductLandingPage      = "/DGS/";
        IncRNLink               = "yes";
        ChangelogLink           = "/DGS/Change-Log/index.html";
        IsRN                    = window.location.href.indexOf("/DGS/Change-Log") != -1;
        var IsDGS_Changelog     = window.location.href.indexOf("/DGS/Change-Log/") != -1;
    }

    if (Variables.IsDocViewer){   //if DocViewer then
        ProductName             = "DocViewer";
        if(IsHosted){
            ProductLandingPage  = "/WK-Hosted-Expere/";
        }
        if(IsInstalled){
            ProductLandingPage  = "/DGS/";
        }
        IncRNLink               = "yes";
        ChangelogLink           = "/DocViewer/ReleaseNotes/index.html";
        IsRN                    = window.location.href.indexOf("/DocViewer/ReleaseNotes") != -1;
    }

    if (Variables.IsEngine){      //if Expere Engine then
        ProductName             = "Expere Engine";
        ProductLandingPage      = "/Expere/Engine/";
        IncRNLink               = "yes";
        ChangelogLink           = "/Expere/Engine/Change-Log";
        IsRN                    = window.location.href.indexOf("Engine/Change-Log") != -1;
    }

    if (Variables.IseOriginal){   //if eOriginal then
        console.log("IseOriginal = " + IseOriginal);
        ProductName             = "eOriginal";
        if(IsHosted){
            ProductLandingPage  = "/WK-Hosted-Expere/";
        }
        if(IsInstalled){
            ProductLandingPage  = "/DGS/";
        }
        IncRNLink               = "yes";
        ChangelogLink           = "/WK-Hosted-Expere/Change-Log/index.html";
        IsRN                    = window.location.href.indexOf("/WK-Hosted-Expere/Change-Log") != -1;
        var IsQuickGuide     = window.location.href.indexOf("eOriginal/QuickGuide") != -1;
    }

    if (Variables.IsEZGateway){   //if EZGateway then
        ProductName             = "EZGateway";
        ChangelogLink           = "/ExpereEZConfig/Changelog/index.html";
        IsRN                    = window.location.href.indexOf("/ExpereEZConfig/Changelog") != -1;
        if (IsRN){
            IncRNLink = "no";
        }
        else{
            IncRNLink = "yes";
        }
        if(IsHosted){
            ProductLandingPage  = "/WK-Hosted-Expere/";
        }
        if(IsInstalled){
            ProductLandingPage  = "/DGS/";
        }
    }

    if (Variables.IsI32){         //if I-32 then
        ProductName             = "I-32";
        ProductLandingPage      = "/I-32/";
        IncRNLink               = "yes";
        ChangelogLink           = "/I-32/Changelog/index.html";
        IsRN                    = window.location.href.indexOf("I-32/Changelog") != -1;
        var IsFormsDesignUG     = window.location.href.indexOf("I-32/FormsDesignUserGuide") != -1;
        var IsImageUpdateUG     = window.location.href.indexOf("I-32/ImageUpdate") != -1;
    }

    if (Variables.IsWKES){       //if WKIS  then
        ProductName             = "ESign";
        ProductLandingPage      = "/WoltersKluwer_E-Sign/index.html";
        IncRNLink               = "yes";
        ChangelogLink           = "/WoltersKluwer_E-Sign/ReleaseNotes/index.html";
        IsRN                    = window.location.href.indexOf("/WoltersKluwer_E-Sign/ReleaseNotes") != -1;
        var IsWKES_UserGuide   = window.location.href.indexOf("//WoltersKluwer_E-Sign/UserGuide/") != -1;
    }

    function prependDocLinks() {
        console.log("Appending Documentation Links...");
        if (Variables.IsAuthoring || Variables.IsDefaultData || Variables.IsPnP || Variables.IsDGS || Variables.IsDocViewer || Variables.IsEngine || Variables.IseOriginal || Variables.IsEZGateway || Variables.IsI32 || Variables.IsWKES) {
            console.log("IsAuthoring = " + Variables.IsAuthoring);
            $('.wh_right_tools').prepend('<div class="row DocLinks">' + 
                '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
                '<div class="div-landing-page-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a id="LandingPageLink" class="link-primary" href="' + ProductLandingPage + '" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
                '</div>'
            );
        }
    }

    function appendChangelogButton() {
        if ((!(Variables.IsDefaultData) && !(Variables.IsPnP)) && (IncRNLink == "yes" && !(Variables.IsChangelogPage))) {
            $('.DocLinks').append(
                '<div class="div-changelog-btn">' +
                '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                '<a class="link-primary" href="' + ChangelogLink + '" target="_blank">View Changelog</a></button></div>'
            );
        } else {
            console.log("Conditions not met for appending button.");
        }
    }

    // Ensure the DOM is fully loaded before calling the functions
    $(window).on('load', function() {
        prependDocLinks();
        appendChangelogButton();
    });

    if (Variables.IsDefaultData || Variables.IsPnP) {
        $('#LandingPageLink').attr('href', ProductLandingPage + 'index.html');
        $.get('/WK-Hosted-Expere/index.html', function (data) {
            const NewChangelogLink = $(data).find('#EzConfigChangeLogLink').attr('href');
            if (IncRNLink == "yes" && !(Variables.IsChangelogPage)) {
                $('.DocLinks').append(
                    '<div class="div-changelog-btn">' +
                    '<button type="button" class="btn btn-outline-primary link-landing-page">' +
                    '<a class="link-primary" href="' + NewChangelogLink + '" target="_blank">View Changelog</a></button></div>'
                );
            }
        });
    }

    if (Variables.IsRN && (!(Variables.IsAuthoring))) {
        $('#searchForm').remove();
    }

    if (Variables.IsEForms) {
        console.log(Variables.IsEForms);
        $('.ChangelogLink').remove();
    }
});
````

This modification ensures that the `prependDocLinks` function is called only after the DOM is fully loaded, which should resolve the issue of elements not being available when the function is called.
