X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=static%2Fstatic%2Fjs%2Fexpert.js;fp=static%2Fstatic%2Fjs%2Fexpert.js;h=731dddde58f991e28868b2ec48e016fe4ab21384;hp=07d1da4976d809d1a6b4474583efd528fdb6a003;hb=df34ffdb62c871885de7a0570c174b5169980943;hpb=1d08cc98005de07c416207536bcae3592fbc7b73
diff --git a/static/static/js/expert.js b/static/static/js/expert.js
index 07d1da49..731dddde 100644
--- a/static/static/js/expert.js
+++ b/static/static/js/expert.js
@@ -1,4 +1,53 @@
(function() {
+ var modal = undefined;
+
+ function showModal(content){
+ var HTML = `
`;
+ 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");
@@ -43,6 +92,7 @@
panel.find(".panel-heading [type=\"radio\"]").change(refresh);
return this.id;
});
+ initConfirm();
}
(function(oldLoad) {
if (oldLoad == undefined) {