GSA/code-gov-front-end

View on GitHub
index.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
  <head>
    <script>
      // before anything else change ?p=/open-tasks to /open-tasks
      if (window.location.search.indexOf('p=') > -1) {
        var pattern = /(\?|&)p=[/a-z-_0-9]{3,500}/
        const newSearch = window.location.search
          .replace(pattern, '') // remove p=... param from url
          .replace(/^./, '?') // mark sure starting search param in a question mark

        // newPathName is usually something like '/open-tasks'
        const newPathName = (
          window.location.pathname + window.location.search.match(pattern)[0].substring(3)
        ).replace('//', '/')

        // newUrl is usually something like .../federalist-stag/open-tasks?agencies=...
        const newUrl = newPathName + newSearch

        /* global history */
        history.replaceState({}, 'title', newUrl)
      }
    </script>

    <!-- We use Google Tag Manager to participate in the Federal Government's Digital Analytics Program (DAP). You can see the data for code.gov and other federal websites at analytics.usa.gov -->
    <% if (ENABLE_GOOGLE_ANALYTICS === true) { %>
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-TYYJFE9VNQ"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-TYYJFE9VNQ'); </script>
    <% } %>
    <!-- End Google Tag Manager -->
    <% if (ENABLE_FED_ANALYTICS === true) { %>
    <script
      id="_fed_an_ua_tag"
      src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=GSA&subagency=TTS"
    ></script>
    <% } %>

    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />

    <title>Code.gov — America’s Home for Open Source Projects from the Federal Government</title>

    <meta
      name="description"
      content="We are America’s primary platform for aggregating Open Source Software from the federal government. With thousands of OSS projects made available, Code.gov offers you the opportunity to discover and contribute back to America’s code."
    />

    <meta property="og:title" content="code.gov" />
    <meta property="og:site_name" content="Code.gov" />
    <meta property="og:image" content="<%= PUBLIC_PATH %>assets/img/og.jpg" />
    <meta property="og:image:url" content="<%= PUBLIC_PATH %>assets/img/og.jpg" />
    <meta property="og:image:type" content="image/jpeg" />
    <meta property="og:image:width" content="1200" />
    <meta property="og:image:height" content="600" />

    <meta property="twitter:image:src" content="https://code.gov/assets/img/og.jpg" />
    <meta property="twitter:image:width" content="1200" />
    <meta property="twitter:image:height" content="600" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@CodeDotGov" />
    <meta name="twitter:title" content="Code.gov" />
    <meta
      name="twitter:description"
      content="Code.gov is a platform designed to improve access to the federal government’s custom-developed software."
    />
    <meta name="twitter:image" content="<%= PUBLIC_PATH %>assets/img/og.jpg" />

    <meta name="google-site-verification" content="FeV1oMKur5PZSGJtUKhKM5EnNGVXn3tTK13iUk_7NZc" />

    <link rel="image_src" type="image/jpeg" href="<%= PUBLIC_PATH %>assets/img/og.jpg" />
  </head>

  <body>
    <div id="app">
      <div
        id="load-screen"
        style="background-color: rgb(0, 0, 56); color: white; bottom: 0; font-size: 24pt; left: 0; position: absolute; right: 0; text-align: center; top: 0"
      >
        <!-- https://en.wikipedia.org/wiki/File:Flag_of_the_United_States.svg -->
        <svg
          xmlns="http://www.w3.org/2000/svg"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          width="200"
          height="200"
          viewBox="0 0 7410 3900"
          style="padding: 20px"
        >
          <rect width="7410" height="3900" fill="#b22234"></rect>
          <path
            d="M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0"
            stroke="#fff"
            stroke-width="300"
          ></path>
          <rect width="2964" height="2100" fill="#3c3b6e"></rect>
          <g fill="#fff">
            <g id="s18">
              <g id="s9">
                <g id="s5">
                  <g id="s4">
                    <path
                      id="s"
                      d="M247,90 317.534230,307.082039 132.873218,172.917961H361.126782L176.465770,307.082039z"
                    ></path>
                    <use xlink:href="#s" y="420"></use>
                    <use xlink:href="#s" y="840"></use>
                    <use xlink:href="#s" y="1260"></use>
                  </g>
                  <use xlink:href="#s" y="1680"></use>
                </g>
                <use xlink:href="#s4" x="247" y="210"></use>
              </g>
              <use xlink:href="#s9" x="494"></use>
            </g>
            <use xlink:href="#s18" x="988"></use>
            <use xlink:href="#s9" x="1976"></use>
            <use xlink:href="#s5" x="2470"></use>
          </g>
        </svg>
        <noscript>
          <p>You appear to have JavaScript disabled. Please enable JavaScript to use this site.</p>
        </noscript>
      </div>
    </div>
    <script>
      function loadScript(url) {
        var script = document.createElement('script')
        script.src = url
        script.onload = function() {
          console.warn('loaded ' + url)
        }
        document.head.appendChild(script)
      }

      /* replaced URLSearchParams polyfill with utils/url-parsing */
      /* replaced fetch polyfill with fetchJSON and fetchText */

      if (window.customElements === undefined) {
        console.warn("this browser doesn't support custom elements, so we'll load a polyfill")
        loadScript('<%= PUBLIC_PATH %>polyfills/custom-elements.js')
      }

      try {
        /* global CustomEvent */
        new CustomEvent('test')
      } catch (error) {
        console.warn("This browser doesn't support CustomEvent so we'll load a polyfill")
        loadScript('<%= PUBLIC_PATH %>polyfills/custom-event.js')
      }
    </script>
  </body>
</html>