<commit_before>define(function (require) {

	// Dependencies
	var $ = require('jquery')
		, _ = require('lodash')
		, Backbone = require('backbone')
	;

	// Setup view
	var View = {};
	View.initialize = function() {
		_.bindAll(this);

		// Cache
		this.encode_id = this.$el.data('encode');
		this.$file = this.$(':file');
		this.$status = this.$('.status');
		this.$progress = this.$status.find('.progress');
		this.$bar = this.$progress.find('.progress-bar');
		this.$help = this.$('.help-block');
		this.$currently = this.$help.find('.download, .upload-delete');
		this.$presetLabel = this.$('.dropdown-toggle .selected');
		this.$presetValue = this.$('[name^="_preset"]');
		this.$presetChoices = this.$('.presets a');

		// Start querying for updates
		if (this.$status.length) this.query();

		// Listen for preset changes
		this.$presetChoices.on('click', this.onPresetChange);
		this.updatePresetLabel();

	};

	// Query the server for updated status and progress.  But throttled.
	View.query = _.throttle(function() {
		$.get('/admin/encode/'+this.encode_id+'/progress', this.render);
	}, 4000);

	// Update the view with latest status
	View.render = function(data) {
		if (data.status == 'error' || data.status == 'canceled') this.renderError(data.message);
		else if (data.status == 'complete') this.renderPlayer(data.admin_player);
		else {
			this.renderProgress(data.status, data.progress);
			this.query();
		}
	};

	// Show an error
	View.renderError = function(message) {
		this.$status.remove();
		this.$el.addClass('has-error');
		this.$file.after('<span class="help-block">'+message+'</span>');
	};

	// Show the player
	View.renderPlayer = function(tag) {
		this.$status.remove();
		this.$currently.remove();
		if (this.$help.length) this.$help.after(tag);
		else this.$file.after(tag);<commit_msg>Fixing the inserting of the player on complete<commit_after>define(function (require) {

	// Dependencies
	var $ = require('jquery')
		, _ = require('lodash')
		, Backbone = require('backbone')
	;

	// Setup view
	var View = {};
	View.initialize = function() {
		_.bindAll(this);

		// Cache
		this.encode_id = this.$el.data('encode');
		this.$file = this.$(':file');
		this.$status = this.$('.status');
		this.$progress = this.$status.find('.progress');
		this.$bar = this.$progress.find('.progress-bar');
		this.$help = this.$('.help-block');
		this.$presetLabel = this.$('.dropdown-toggle .selected');
		this.$presetValue = this.$('[name^="_preset"]');
		this.$presetChoices = this.$('.presets a');

		// Start querying for updates
		if (this.$status.length) this.query();

		// Listen for preset changes
		this.$presetChoices.on('click', this.onPresetChange);
		this.updatePresetLabel();

	};

	// Query the server for updated status and progress.  But throttled.
	View.query = _.throttle(function() {
		$.get('/admin/encode/'+this.encode_id+'/progress', this.render);
	}, 4000);

	// Update the view with latest status
	View.render = function(data) {
		if (data.status == 'error' || data.status == 'canceled') this.renderError(data.message);
		else if (data.status == 'complete') this.renderPlayer(data.admin_player);
		else {
			this.renderProgress(data.status, data.progress);
			this.query();
		}
	};

	// Show an error
	View.renderError = function(message) {
		this.$status.remove();
		this.$el.addClass('has-error');
		this.$file.after('<span class="help-block">'+message+'</span>');
	};

	// Show the player
	View.renderPlayer = function(tag) {
		this.$status.after(tag);
		this.$status.remove();
{'fraction_non_alphanumeric': 0.19795802609188884, 'fraction_numerical': 0.0022688598979013048, 'mean_word_length': 3.946704067321178, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '341405', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1142, 'n_words': 222}