<commit_before>{% extends "project/base.html" %}
{% set page_title = _("Processing ") + project.title %}

{% block pnav %}
{% from 'project/macros.html' import nav with context%}
{{ nav('build') }}
{% endblock %}

{% block pbody %}
{% from 'project/macros.html' import subnav_build with context%}
{{ subnav_build('log') }}

<pre id="log"></pre>

<p class="jumbotron" id="toTop"><a href="javascript:window.scrollTo(0,0);">{{ _("Top of page") }}</a></p>

{% endblock %}


{% block extrajs %}
<script type="text/javascript">
/* fast analog of python .startswith string type method function */
if (typeof String.prototype.startswith != 'function') {
  String.prototype.startswith = function (str){
    if (str === '') return true;
    if (this == null || str == null) return false;
    return this.length >= str.length && this.slice(0, str.length) === str;
  };
}

$(document).ready(function () {

$('#secondaryNav').affix({
    offset: 0
});

$('#logEndButtons').hide();
$('#logEndButtonRebake').hide();
$('#logEndButtonSuccess').hide();

var socket = io.connect("/build", {'force new connection': true});

socket.on("connect", function(e) {
  console.log("Connected", arguments);
  socket.emit('subscribe', '{{ log_file|signify }}');
});

socket.on("disconnect", function(e) {
  console.log("Disconnected", arguments);
});

socket.on('message', function (logs) {
    var logString = String(logs);
//  console.log(logString);
    var lines = logString.match(/^.*((\r\n|\n|\r)|$)/gm);
//  console.log(lines);
    lines.forEach( function(data) {
//      console.log(data);
    if (data.startswith('### ')) {
        $('#log').append($('<h4>').addClass('text-header').html(data.slice('### '.length)));
    } else if (data.startswith('Error: ')) {
        $('#log').append($('<span>').addClass('text-error').html(data.slice('Error: '.length)));
    } else if (data.startswith('Fatal: ')) {
        $('#log').append($('<span>').addClass('text-error').html('<span class="label label-important">{{ _("Fatal") }}</span> ' + data.slice('Fatal: '.length)));
        $('#logEndButtonRebake').show();
        $('#logEndButtons').slideDown();
    } else if (data.startswith('Start: ')){
        $('#log').append($('<span>').addClass('text-success').html('<span class="label label-success">{{ _("Start") }}</span> ' + data.slice('Start: '.length)));
    } else if (data.startswith('Wait: ')){
        $('#log').append($('<span>').addClass('text-info').html('<span class="label label-info">{{ _("Wait") }}</span> ' + data.slice('Wait: '.length)));
    } else if (data.startswith('End: ')){
        $('#log').append($('<span>').addClass('text-success').html('<span class="label label-success label-end">{{ _("End") }}</span> ' + data.slice('End: '.length)));
        $('#logEndButtonSuccess').show();
        $('#logEndButtons').slideDown();
    }  else if (data.startswith('End: ')){
        $('#log').append($('<span>').addClass('text-success').html('<span class="label label-success label-end">{{ _("End" }}</span> ' + data.slice('End: '.length)));
        $('#logEndButtonSuccess').show();
        $('#logEndButtons').slideDown();
    }  else if (data.startswith('$ ')){
        $('#log').append($('<span>').addClass('text-command').html("$ " + data.slice('$ '.length)));
    }  else {
        $('#log').append($('<span>').addClass('text-info').html(data));
    };
  });
});

function userCanSeeItWithoutScrolling() {
    var userCanSeeItWithoutScrolling = $("#toTop").offset().top < $(window).height();
    if (userCanSeeItWithoutScrolling == true){
        $('#toTop').hide();
    } else {
        $('#toTop').show();
    };
};

// hide toTop if user can see it without scrolling
userCanSeeItWithoutScrolling();

// If the page resizes, show toTop if user now can't see it
$(window).resize(function() {
    userCanSeeItWithoutScrolling();
});<commit_msg>Ouch.<commit_after>{% extends "project/base.html" %}
{% set page_title = _("Processing ") + project.title %}

{% block pnav %}
{% from 'project/macros.html' import nav with context%}
{{ nav('build') }}
{% endblock %}

{% block pbody %}
{% from 'project/macros.html' import subnav_build with context%}
{{ subnav_build('log') }}

<pre id="log"></pre>

<p class="jumbotron" id="toTop"><a href="javascript:window.scrollTo(0,0);">{{ _("Top of page") }}</a></p>

{% endblock %}


{% block extrajs %}
<script type="text/javascript">
/* fast analog of python .startswith string type method function */
if (typeof String.prototype.startswith != 'function') {
  String.prototype.startswith = function (str){
    if (str === '') return true;
    if (this == null || str == null) return false;
    return this.length >= str.length && this.slice(0, str.length) === str;
  };
}

$(document).ready(function () {

$('#secondaryNav').affix({
    offset: 0
});

$('#logEndButtons').hide();
$('#logEndButtonRebake').hide();
$('#logEndButtonSuccess').hide();

var socket = io.connect("/build", {'force new connection': true});

socket.on("connect", function(e) {
  console.log("Connected", arguments);
  socket.emit('subscribe', '{{ log_file|signify }}');
});

socket.on("disconnect", function(e) {
  console.log("Disconnected", arguments);
});

socket.on('message', function (logs) {
    var logString = String(logs);
//  console.log(logString);
    var lines = logString.match(/^.*((\r\n|\n|\r)|$)/gm);
//  console.log(lines);
    lines.forEach( function(data) {
//      console.log(data);
    if (data.startswith('### ')) {
        $('#log').append($('<h4>').addClass('text-header').html(data.slice('### '.length)));
    } else if (data.startswith('Error: ')) {
        $('#log').append($('<span>').addClass('text-error').html(data.slice('Error: '.length)));
    } else if (data.startswith('Fatal: ')) {
        $('#log').append($('<span>').addClass('text-error').html('<span class="label label-important">{{ _("Fatal") }}</span> ' + data.slice('Fatal: '.length)));
        $('#logEndButtonRebake').show();
        $('#logEndButtons').slideDown();
    } else if (data.startswith('Start: ')){
        $('#log').append($('<span>').addClass('text-success').html('<span class="label label-success">{{ _("Start") }}</span> ' + data.slice('Start: '.length)));
    } else if (data.startswith('Wait: ')){
        $('#log').append($('<span>').addClass('text-info').html('<span class="label label-info">{{ _("Wait") }}</span> ' + data.slice('Wait: '.length)));
    } else if (data.startswith('End: ')){
        $('#log').append($('<span>').addClass('text-success').html('<span class="label label-success label-end">{{ _("End") }}</span> ' + data.slice('End: '.length)));
        $('#logEndButtonSuccess').show();
        $('#logEndButtons').slideDown();
    }  else if (data.startswith('End: ')){
        $('#log').append($('<span>').addClass('text-success').html('<span class="label label-success label-end">{{ _("End") }}</span> ' + data.slice('End: '.length)));
        $('#logEndButtonSuccess').show();
        $('#logEndButtons').slideDown();
    }  else if (data.startswith('$ ')){
        $('#log').append($('<span>').addClass('text-command').html("$ " + data.slice('$ '.length)));
    }  else {
        $('#log').append($('<span>').addClass('text-info').html(data));
    };
  });
});

function userCanSeeItWithoutScrolling() {
    var userCanSeeItWithoutScrolling = $("#toTop").offset().top < $(window).height();
    if (userCanSeeItWithoutScrolling == true){
        $('#toTop').hide();
    } else {
        $('#toTop').show();
    };
};

// hide toTop if user can see it without scrolling
userCanSeeItWithoutScrolling();

// If the page resizes, show toTop if user now can't see it
$(window).resize(function() {
    userCanSeeItWithoutScrolling();
});
{'fraction_non_alphanumeric': 0.25355048859934853, 'fraction_numerical': 0.0013029315960912053, 'mean_word_length': 4.264746227709191, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '501511', 'n_tokens_mistral': 2456, 'n_tokens_neox': 2459, 'n_words': 446}