<commit_before>{% extends "base.html" %}

{% block title %}ItchApe{% endblock %}

{% block content %}
{% include "itchape-header.html" %}
<script src="itchape.js"></script>
<script>
function scratch() {
	var itch = $('input[name=itch]').val()
	var secret_phrase = $('input[name=secret_phrase]').val()
	var secret_key = $('input[name=secret_key]').val()
	var ape_id = $('input[name=ape_id]').val()
	var the_itch = {
			itch: itch,
			secret_phrase: secret_phrase,
			secret_key: secret_key,
			ape_id: ape_id
			};
	$.post(document.location.protocol + '//' + document.location.host + '/itchape/scratch',
		the_itch, function(data) {
			if (data.ape_says.indexOf('Oooh') && window.localStorage) {
				localStorage['ia_secret_phrase'] = secret_phrase;
				localStorage['ia_secret_key'] = secret_key;
				localStorage['ia_ape_id'] = ape_id;
				}
		show_itch(data, 'itch');
			}, 'json');
	}
$(function() {
	if (document.location.hostname != 'localhost' && window.localStorage) {
		$('input[name=secret_phrase]').val(localStorage['ia_secret_phrase']);
		$('input[name=secret_key]').val(localStorage['ia_secret_key']);
		$('input[name=ape_id]').val(localStorage['ia_ape_id']);
		}
});
</script>
<style>
label {
clear: both;
display:block;
width: 360px;
}
label > input {
float: right;
}
input[type=button] {
float: right;
}
#itch {
background-color: #eee;
border-radius: 0.5ex;
-moz-border-radius: 0.5ex;
-webkit-border-radius: 0.5ex;
margin: 0.5ex;
padding: 0.5ex;
}
</style>
<h2>Scratch your ape!</h2>
<form method="POST">
<label>Description of the Itch <input type="text" name="itch" value="{{ itch }}" maxlength="140"/></label>
<label>Secret Phrase <input type="text" name="secret_phrase" value="{{ secret_phrase }}" maxlength="40"/></label>
<label>Secret Key <input type="text" name="secret_key" value="{{ secret_key }}" maxlength="16"/></label>
<label>Ape ID <input type="text" name="ape_id" value="{{ ape_id }}" maxlength="16"/></label>
<div style="clear:both;width:360px"><input type="button" value="Scratch" onclick="scratch()"/></div>
</form>
<br style="clear:both"/>
<hr/>
<div id="itch"></div>
{% endblock %}
{# vim: set sw=2 ts=2 noet: #}
<commit_msg>Fix ItchApe scratch page does not store the form data<commit_after>{% extends "base.html" %}

{% block title %}ItchApe{% endblock %}

{% block content %}
{% include "itchape-header.html" %}
<script src="itchape.js"></script>
<script>
function scratch() {
	var itch = $('input[name=itch]').val()
	var secret_phrase = $('input[name=secret_phrase]').val()
	var secret_key = $('input[name=secret_key]').val()
	var ape_id = $('input[name=ape_id]').val()
	var the_itch = {
			itch: itch,
			secret_phrase: secret_phrase,
			secret_key: secret_key,
			ape_id: ape_id
			};
	$.post(document.location.protocol + '//' + document.location.host + '/itchape/scratch',
		the_itch, function(data) {
			if (data.ape_says.indexOf('Oooh')>=0 && window.localStorage) {
				localStorage['ia_secret_phrase'] = secret_phrase;
				localStorage['ia_secret_key'] = secret_key;
				localStorage['ia_ape_id'] = ape_id;
				}
		show_itch(data, 'itch');
			}, 'json');
	}
$(function() {
	if (document.location.hostname != 'localhost' && window.localStorage) {
		$('input[name=secret_phrase]').val(localStorage['ia_secret_phrase']);
		$('input[name=secret_key]').val(localStorage['ia_secret_key']);
		$('input[name=ape_id]').val(localStorage['ia_ape_id']);
		}
});
</script>
<style>
label {
clear: both;
display:block;
width: 360px;
}
label > input {
float: right;
}
input[type=button] {
float: right;
}
#itch {
background-color: #eee;
border-radius: 0.5ex;
-moz-border-radius: 0.5ex;
-webkit-border-radius: 0.5ex;
margin: 0.5ex;
padding: 0.5ex;
}
</style>
<h2>Scratch your ape!</h2>
<form method="POST">
<label>Description of the Itch <input type="text" name="itch" value="{{ itch }}" maxlength="140"/></label>
<label>Secret Phrase <input type="text" name="secret_phrase" value="{{ secret_phrase }}" maxlength="40"/></label>
<label>Secret Key <input type="text" name="secret_key" value="{{ secret_key }}" maxlength="16"/></label>
<label>Ape ID <input type="text" name="ape_id" value="{{ ape_id }}" maxlength="16"/></label>
<div style="clear:both;width:360px"><input type="button" value="Scratch" onclick="scratch()"/></div>
</form>
<br style="clear:both"/>
<hr/>
<div id="itch"></div>
{% endblock %}
{# vim: set sw=2 ts=2 noet: #}

{'fraction_non_alphanumeric': 0.21187800963081863, 'fraction_numerical': 0.013529007108461362, 'mean_word_length': 5.815625, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 64, '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': '4913122', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1610, 'n_words': 305}