2018-06-12 12:31:38 +00:00
|
|
|
{% extends "bases/bootstrap.html" %}
|
|
|
|
{% load staticfiles %}
|
|
|
|
|
|
|
|
{% block tail_js %}
|
|
|
|
<script>
|
|
|
|
Module = {};
|
|
|
|
Module.memoryInitializerPrefixURL = "{% static 'js/' %}";
|
|
|
|
</script>
|
|
|
|
<script src="//code.jquery.com/jquery-2.2.4.min.js"></script>
|
|
|
|
<!-- <script>window.jQuery || document.write('<script src="js/jquery-1.10.1.min.js"><\/script>')</script> -->
|
|
|
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
|
2018-08-16 21:17:16 +00:00
|
|
|
<script src="https://bitwiseshiftleft.github.io/sjcl/sjcl.js"></script>
|
2018-06-12 12:31:38 +00:00
|
|
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
2018-08-16 21:17:16 +00:00
|
|
|
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
|
|
|
|
|
2018-06-12 12:31:38 +00:00
|
|
|
<script src="{% static 'js/papaparse.min.js' %}" type="text/javascript"></script>
|
2018-07-23 13:08:17 +00:00
|
|
|
<script src="{% static 'js/qrcode.min.js' %}" type="text/javascript"></script>
|
2018-06-12 12:31:38 +00:00
|
|
|
<script src="{% static 'js/create-event-poll.js' %}" type="text/javascript"></script>
|
2018-07-07 08:52:47 +00:00
|
|
|
<script src="{% static 'js/decrypt_event.js' %}" type="text/javascript"></script>
|
2018-07-13 16:19:35 +00:00
|
|
|
<script src="{% static 'js/event_vote.js' %}" type="text/javascript"></script>
|
2018-08-16 21:17:16 +00:00
|
|
|
<script src="{% static 'js/vote_audit.js' %}" type="text/javascript"></script>
|
2018-09-19 07:38:50 +00:00
|
|
|
<script src="{% static 'js/find_ballot.js' %}" type="text/javascript"></script>
|
2018-06-12 12:31:38 +00:00
|
|
|
<script src="{% static 'js/encrypt.js' %}" type="text/javascript"></script>
|
2018-09-05 10:46:57 +00:00
|
|
|
<script src="{% static 'js/event_setup.js' %}" type="text/javascript"></script>
|
2018-06-12 12:31:38 +00:00
|
|
|
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/rand.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/rom_curve.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/rom_field.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/uint64.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/aes.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/big.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/gcm.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/hash256.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/hash384.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/hash512.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/sha3.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/newhope.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/nhs.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/fp.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/fp2.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/fp4.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/fp12.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/ff.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/rsa.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/ecp.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/ecp2.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/ecdh.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/pair.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/mpin.js' %}"></script>
|
|
|
|
<script type="text/javascript" src="{% static 'js/core/ctx.js' %}"></script>
|
|
|
|
|
|
|
|
<script type="text/javascript" src="{% static 'js/demos2-booth.js' %}"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
{% block app_js %}
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
{% block app_js_vars %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
Module.memoryInitializerPrefixURL = "LOL";
|
|
|
|
var demosEncrypt = {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//these other functions might not be used
|
|
|
|
//I don't think this is used
|
|
|
|
demosEncrypt.downloadSecretKey = function() {
|
|
|
|
var blob = new Blob([sk], {type : 'text/plain'});
|
|
|
|
var dlBtn = $('a#download-btn');
|
|
|
|
$(dlBtn).attr("disabled", true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getFormsetPrefix(id) {
|
|
|
|
id = id.replace(/(?:id_)?formset_/, ""); // strip generic part
|
|
|
|
return id.replace(/([A-Za-z0-9]+)[\w-]*/, "$1"); // return prefix
|
|
|
|
}
|
|
|
|
|
|
|
|
function setFormsetIndex(ele, prefix, index) {
|
|
|
|
ele = $(ele).find("div[id^='id_formset'], input[id^='id_formset']").each(function (i, el) {
|
|
|
|
var id = $(el).attr("id");
|
|
|
|
id = "id_formset_" + prefix + '-' + index + id.match(/-\w+$/);
|
|
|
|
$(el).attr("id", id);
|
|
|
|
if ($(el).is("input")) {
|
|
|
|
$(el).attr("name", id.replace(/^id_/, ""));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$('.formset').sortable({handle:".input-group-addon", items:".formset_object",
|
|
|
|
start: function(event, ui) {
|
|
|
|
ui.item.prevPos = ui.item.index();
|
|
|
|
console.log(ui.item.prevPos);
|
|
|
|
},
|
|
|
|
update: function(event, ui) {
|
|
|
|
ui.item.prevPos = null;
|
|
|
|
},
|
|
|
|
beforeStop: function(event, ui) {
|
|
|
|
$(ui.item).css("animation", "none"); // prevents firing of entry keyframe
|
|
|
|
}
|
|
|
|
});
|
|
|
|
//$('.glyphicon.glyphicon-trash').parent().hide();
|
|
|
|
$('.formset').find
|
|
|
|
$('.formset').on('click', '.input-group-addon', function() { // this makes the label a delete btn too :(
|
|
|
|
var ele = $(this).closest(".formset_object");
|
|
|
|
var prefix = $(this).closest(".formset_object").data("prefix") || getFormsetPrefix($(this).closest(".formset_object").find('input:first').attr("id"));
|
|
|
|
var current_total = parseInt($("#id_formset_" + prefix + "-TOTAL_FORMS").val());
|
|
|
|
if (current_total <= $("#id_formset_" + prefix + "-MIN_NUM_FORMS").val()) {
|
|
|
|
return; // don't allow removal of last element
|
|
|
|
}
|
|
|
|
ele.remove();
|
|
|
|
$("#id_formset_" + prefix + "-TOTAL_FORMS").val(current_total - 1);
|
|
|
|
$(".formset").sortable( "refresh" );
|
|
|
|
$(".formset").sortable( "refreshPositions" );
|
|
|
|
});
|
|
|
|
$('.add-another-btn').on('click',function() {
|
|
|
|
var new_formset_item = $(this).prevAll(".formset_object:first").clone();
|
|
|
|
var prefix = getFormsetPrefix(new_formset_item.find("input:first").attr("id"));
|
|
|
|
var current_total = parseInt($("#id_formset_" + prefix + "-TOTAL_FORMS").val());
|
|
|
|
if (current_total >= $("#id_formset_" + prefix + "-MAX_NUM_FORMS").val()) {
|
|
|
|
return; // don't allow more than max forms
|
|
|
|
}
|
|
|
|
new_formset_item.data("prefix", prefix);
|
|
|
|
$(this).before(new_formset_item);
|
|
|
|
new_formset_item.find("input").val("");
|
|
|
|
setFormsetIndex(new_formset_item, prefix, parseInt($("#id_formset_" + prefix + "-TOTAL_FORMS").val()));
|
|
|
|
$("#id_formset_" + prefix + "-TOTAL_FORMS").val(parseInt($("#id_formset_" + prefix + "-TOTAL_FORMS").val()) +1);
|
|
|
|
$(".formset").sortable( "refresh" );
|
|
|
|
$(".formset").sortable( "refreshPositions" );
|
|
|
|
});
|
|
|
|
|
|
|
|
// rudimentary accordion error handling
|
|
|
|
$('.has-error').closest('.panel').find('.panel-heading').addClass("error");
|
|
|
|
$('.alert.alert-block.alert-danger').closest('.panel').find('.panel-heading').addClass("error");
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% endblock %}
|