<commit_before><html>
  <head>
    <title>{{ title }}</title>
    <!-- scale mobile version correctly -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- third-party code -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
    <link href='https://fonts.googleapis.com/css?family=Lato:400,300,700' rel='stylesheet' type='text/css'>
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <meta name="google-signin-client_id" content="{{ cfg_GOOGLECLIENTID }}">
    <script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
    <!-- custom code -->
    <link rel="stylesheet" href="{{ domain }}{{ url_for('static', filename='style.css') }}">
    <!-- inline scripts -->
    <script>
    $(document).ready(function() {

      /*
       * Poller
       * refreshes an element at a predetermined frequency
       */
      function pollNotification(selector, frequency) {
          setTimeout(function() {
              reload(selector);
              pollNotification(selector, frequency);
          }, frequency);
      }

      // reload part of page by selector
      function reload(selector, url) {
          url = url || window.location.href;
          $('.refresh').css('opacity', 1);
          $.get(url, function(html) {
              console.log(' * Reloading "'+selector+'" from "'+url+'"');
              $(selector).replaceWith($(html).find(selector));
              $('.refresh').css('opacity', 0);
          })
      }

      {% if refresh %}
      pollNotification('.queue', {{ refresh }});
      {% endif %}
    });

    /*
     * Google Authentication
     * Signin or signout on data load
     */
    function onSignIn(googleUser) {
      if ({{ logout or 'false' }}) {
        signOut();
      } else {
        signIn(googleUser);
      }
    }

    function signIn(googleUser) {
      var id_token = googleUser.getAuthResponse().id_token;
      var xhr = new XMLHttpRequest();
      xhr.open('POST', "/tokenlogin");
      xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      xhr.send('token=' + id_token + '&return=/');
      xhr.onload = function() {
        if (xhr.status == 200) {
          url = xhr.responseText;
          if (url == '{{ current_url() }}' || url == '{{ request.path }}') {
            window.location.reload();
          }
          window.location.replace(url);
        } else {
          alert('Login failed.');
        }
      };
    }

    function signOut() {
      var auth2 = gapi.auth2.getAuthInstance();
      auth2.signOut().then(function () {
        window.location.replace('{{ current_url() }}');
      });
    }
    </script>
  </head>
  {% block body %}
  {% endblock %}
</html><commit_msg>better logout and login functoinality<commit_after><html>
  <head>
    <title>{{ title }}</title>
    <!-- scale mobile version correctly -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- third-party code -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="<KEY>" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
    <link href='https://fonts.googleapis.com/css?family=Lato:400,300,700' rel='stylesheet' type='text/css'>
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <meta name="google-signin-client_id" content="{{ cfg_GOOGLECLIENTID }}">
    <script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
    <!-- custom code -->
    <link rel="stylesheet" href="{{ domain }}{{ url_for('static', filename='style.css') }}">
    <!-- inline scripts -->
    <script>
    $(document).ready(function() {

      /*
       * Poller
       * refreshes an element at a predetermined frequency
       */
      function pollNotification(selector, frequency) {
          setTimeout(function() {
              reload(selector);
              pollNotification(selector, frequency);
          }, frequency);
      }

      // reload part of page by selector
      function reload(selector, url) {
          url = url || window.location.href;
          $('.refresh').css('opacity', 1);
          $.get(url, function(html) {
              console.log(' * Reloading "'+selector+'" from "'+url+'"');
              $(selector).replaceWith($(html).find(selector));
              $('.refresh').css('opacity', 0);
          })
      }

      {% if refresh %}
      pollNotification('.queue', {{ refresh }});
      {% endif %}
    });

    /*
     * Google Authentication
     * Signin or signout on data load
     */
    var forceSignOut = {{ logout or 'false' }};
    function onSignIn(googleUser) {
      if (forceSignOut) {
        signOut();
      } else {
        signIn(googleUser);
      }
    }

    function signIn(googleUser) {
      var id_token = googleUser.getAuthResponse().id_token;
      var xhr = new XMLHttpRequest();
      xhr.open('POST', "/tokenlogin");
      xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      xhr.send('token=' + id_token + '&return={{ current_url() }}');
      xhr.onload = function() {
        if (xhr.status == 200) {
          url = xhr.responseText;
          if (url == '{{ current_url() }}') {
            window.location.reload();
          }
          window.location.replace(url);
        } else {
          alert('Login failed.');
        }
      };
    }

    function signOut() {
      var auth2 = gapi.auth2.getAuthInstance();
      auth2.signOut().then(function () {
        forceSignOut = false;
      });
    }
    </script>
  </head>
  {% block body %}
  {% endblock %}
</html>
{'fraction_non_alphanumeric': 0.17858347386172008, 'fraction_numerical': 0.009443507588532884, 'mean_word_length': 2.360339943342776, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5600999', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1762, 'n_words': 321}