4 function showModal(content){
5 var HTML = `<div class="modal fade" id="confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
6 <div class="modal-dialog" role="document">
7 <div class="modal-content">
8 <div class="modal-header">
9 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">🗙</span></button>
10 <h4 class="modal-title" id="myModalLabel"> </h4>
12 <div class="modal-body">
15 <div class="modal-footer">
16 <button type="button" class="btn btn-default btn-cancel" data-dismiss="modal">🗙</button>
17 <button type="button" class="btn btn-danger btn-confirm">✓</button>
22 if(modal === undefined) {
24 modal.action = function(){};
25 modal.appendTo("body");
26 $(modal.get(0)).find(".modal-footer .btn-confirm").click(function(){
31 var m = $(modal.get(0));
32 m.find(".modal-body").text($(content).attr("data-confirm"));
33 var reply = $(content).attr("data-reply").split(",");
34 m.find(".modal-footer .btn-cancel").text(reply[0]);
35 m.find(".modal-footer .btn-confirm").text(reply[1]);
36 modal.action=function(){
37 content.confirmed=true;
42 function initConfirm() {
43 $(".btn-confirm").click(function(){
44 if(this.confirmed === true){
51 function showExpert(isExpert)
53 var elements = document.getElementsByClassName("expert");
54 for(var i = 0; elements.length > i; i++)
57 elements[i].setAttribute("class","expert experthidden");
59 elements[i].setAttribute("class","expert");
65 var expert = document.getElementById("expertbox");
67 expert.onchange = (function(expert){return function(){showExpert(expert.checked)}})(expert);
69 $(".panel-activatable").map(function() {
71 var refresh = function(){
72 var radio = this.type == "radio";
73 if(radio && this.form.currentRadios === undefined) {
74 this.form.currentRadios = {};
77 panel.find(".panel-body").removeClass("hidden");
79 var rds = this.form.currentRadios;
80 if(rds[this.name] !== undefined){
81 $(rds[this.name]).trigger("change");
83 rds[this.name] = this;
86 panel.find(".panel-body").addClass("hidden");
89 panel.find(".panel-heading [type=\"checkbox\"]").map(refresh);
90 panel.find(".panel-heading [type=\"checkbox\"]").change(refresh);
91 panel.find(".panel-heading [type=\"radio\"]").map(refresh);
92 panel.find(".panel-heading [type=\"radio\"]").change(refresh);
98 if (oldLoad == undefined) {
101 window.onload = function() {