//afterbody.js
// 
// TODO:
// - 
// 

// $(window).on("load", function () {
// 		//Get the browser and version. Alert if unsupported.
// 		$.getScript("/resources/webhelp-includes/modules/browser-version.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/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/documentation-links.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();

});