(function() {
+ var modal = undefined;
+
+ function showModal(content){
+ var HTML = `<div class="modal fade" id="confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">🗙</span></button>
+ <h4 class="modal-title" id="myModalLabel"> </h4>
+ </div>
+ <div class="modal-body">
+ Body
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default btn-cancel" data-dismiss="modal">🗙</button>
+ <button type="button" class="btn btn-danger btn-confirm">✓</button>
+ </div>
+ </div>
+ </div>
+</div>`;
+ if(modal === undefined) {
+ modal = $(HTML);
+ modal.action = function(){};
+ modal.appendTo("body");
+ $(modal.get(0)).find(".modal-footer .btn-confirm").click(function(){
+ modal.action();
+ modal.modal("hide");
+ });
+ }
+ var m = $(modal.get(0));
+ m.find(".modal-body").text($(content).attr("data-confirm"));
+ var reply = $(content).attr("data-reply").split(",");
+ m.find(".modal-footer .btn-cancel").text(reply[0]);
+ m.find(".modal-footer .btn-confirm").text(reply[1]);
+ modal.action=function(){
+ content.confirmed=true;
+ $(content).click();
+ };
+ modal.modal("show");
+ }
+ function initConfirm() {
+ $(".btn-confirm").click(function(){
+ if(this.confirmed === true){
+ return true;
+ }
+ showModal(this);
+ return false;
+ });
+ }
function showExpert(isExpert)
{
var elements = document.getElementsByClassName("expert");
panel.find(".panel-heading [type=\"radio\"]").change(refresh);
return this.id;
});
+ initConfirm();
}
(function(oldLoad) {
if (oldLoad == undefined) {