<!-- jQuery -->
<script type="text/javascript" src="{{pathto('_static/js/jquery-3.6.4.min.js', 1)}}"></script>

<!-- underscore.js -->
<script type="text/javascript" src="{{pathto('_static/js/underscore.js', 1)}}"></script>

<!-- Bootstrap JavaScript -->
<script type="text/javascript" src="{{pathto('_static/js/bootstrap.bundle.min.js', 1)}}"></script>

<!-- Clipboard JavaScript -->
<script type="text/javascript" src="{{pathto('_static/js/clipboard.min.js', 1)}}"></script>

<!-- Docs JS -->
<script type="text/javascript" src="{{pathto('_static/js/docs.js', 1)}}"></script>

<!-- OTC Helpers -->
<script type="text/javascript" src="{{pathto('_static/js/otc_helpers.js', 1)}}"></script>

<!-- Telekom Scale -->
<script type="module" src="{{pathto('_static/scale-components/scale-components.esm.js', 1)}}"></script>

<!-- Search Skript -->
<script
    search_environment="{{otcdocs_search_environment}}"
    search_index="{{otcdoc_search_index}}"
    search_url="{{otcdocs_search_url}}"
    search_current_doc_type="{{doc_type}}"
    search_current_doc_title="{{doc_title}}"
    search_current_service_type="{{service_type}}"
    search_current_service_title="{{service_title}}"
    src="{{pathto('_static/js/search.js', 1)}}"
    ></script>

<script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '{{ version }}',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        SOURCELINK_SUFFIX: '.txt',
        HAS_SOURCE:  true
      };
</script>

<!-- Tracking test for docs-int -->
{% if otcdocs_doc_environment == 'internal' %}
    <noscript>
        <img src="https://shynet.eco.tsi-dev.otc-service.com/ingress/f3f8d596-b9d7-4c54-9cb2-7c8df6757996/pixel.gif">
    </noscript>
    <script defer src="https://shynet.eco.tsi-dev.otc-service.com/ingress/f3f8d596-b9d7-4c54-9cb2-7c8df6757996/script.js"></script>
{% endif %}

<!-- Javascript for page -->
<script language="JavaScript">
/* build a description of this page including SHA, source location on git repo,
   build time and the project's launchpad bug tag. Set the HREF of the bug
   buttons */

{%- if bug_project %}
    var lineFeed = "%0A";
    var gitURL = "Source: Can't derive source file URL";

    /* there have been cases where "pagename" wasn't set; better check for it */
{%- if pagename %}
    /* "giturl" is the URL of the source file on Git and is auto-generated by
     * openstackdocstheme.
     *
     * "pagename" is a standard sphinx parameter containing the name of
     * the source file, without extension.
     */

    var sourceFile = "{{ pagename }}" + ".rst";
    gitURL = "Source: {{ giturl }}" + "/" + sourceFile;
{%- endif %}

    /* gitsha, project and bug_tag rely on variables in conf.py */
    var gitSha = "SHA: {{ gitsha }}";
    var repositoryName = "{{ repository_name }}";
    var bugProject = "{{ bug_project }}";
{%- if bug_title %}
    var bugTitle = "{{ bug_title }}";
{%- else %}
    var bugTitle = "{{ title|striptags }} in {{ project }}";
{%- endif %}
    var fieldTags = "{{ bug_tag }}";

    /* "last_updated" is the build date and time. It relies on the
       conf.py variable "html_last_updated_fmt", which should include
       year/month/day as well as hours and minutes                   */
    var buildstring = "Release: {{ release }} on {{ last_updated }}";

    var fieldComment = encodeURI(buildstring) +
                       lineFeed + encodeURI(gitSha) +
                       lineFeed + encodeURI(gitURL) ;

    logABug(bugTitle, bugProject, fieldComment, fieldTags, repositoryName);
{%- endif %}

{%- if pdf_link %}
    var currentSourceFile = "{{ pagename }}";
    var pdfFileName = "{{ pdf_filename }}";
    pdfLink(currentSourceFile, pdfFileName);
{%- endif %}
</script>
