# HG changeset patch # User Thierry Florac # Date 1506679672 -7200 # Node ID d3a67e8ba4939f57354641c174e361d220c2f52c # Parent d3c31bd9678082ebf290ad732ca2d070209bd4bf Added 'status' option to message box diff -r d3c31bd96780 -r d3a67e8ba493 src/pyams_skin/resources/js/myams-notify.js --- a/src/pyams_skin/resources/js/myams-notify.js Fri Sep 29 12:07:24 2017 +0200 +++ b/src/pyams_skin/resources/js/myams-notify.js Fri Sep 29 12:07:52 2017 +0200 @@ -45,6 +45,7 @@ var defaults = { title: "", content: "", + status: "", NormalButton: undefined, ActiveButton: undefined, buttons: undefined, @@ -83,6 +84,7 @@ var HasInput = 0; var Name = ""; var NumButtons = 0; + var btnClass; if (settings.input !== undefined) { HasInput = 1; settings.input = settings.input.toLowerCase(); @@ -122,7 +124,7 @@ } } } - Content = "
"; + Content = "
"; Content += "
"; Content += "" + settings.title + ""; Content += "

" + settings.content + "

"; @@ -145,7 +147,12 @@ } else { if (settings.buttons[i] === "]") { NumButtons = NumButtons + 1; - Name = ""; + if (NumButtons === 1) { + btnClass = 'btn-primary'; + } else { + btnClass = 'btn-default'; + } + Name = ""; Content += Name; } else { Name += settings.buttons[i]; diff -r d3c31bd96780 -r d3a67e8ba493 src/pyams_skin/resources/js/myams-notify.min.js --- a/src/pyams_skin/resources/js/myams-notify.min.js Fri Sep 29 12:07:24 2017 +0200 +++ b/src/pyams_skin/resources/js/myams-notify.min.js Fri Sep 29 12:07:52 2017 +0200 @@ -1,1 +1,1 @@ -(function(c,d){c(document).ready(function(){c("body").append("
").append("
").append("
")});function f(){c(".divMessageBox").fadeOut(300,function(){c(this).remove()});c(".LoadingBoxContainer").fadeOut(300,function(){c(this).remove()})}var a=0,b=0,h,j=0,g=0,i=0;var e=d.MyAMS;e.notify={messageBox:function(w,v){var s,n,l=e.browser.isIE8orlower();var o={title:"",content:"",NormalButton:undefined,ActiveButton:undefined,buttons:undefined,input:undefined,placeholder:"",options:undefined,sound:undefined};var m=c.extend({},o,w);if(m.sound&&(l===0)){var u=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){u.setAttribute("src",e.baseURL+"../sound/message.ogg")}else{u.setAttribute("src",e.baseURL+"../sound/message.mp3")}c.get();u.addEventListener("load",function(){u.play()},true);u.pause();u.play()}b=b+1;if(a===0){a=1;s="
";c("body").append(s);if(e.browser.isIE8orlower()===1){c("#MsgBoxBack").addClass("MessageIE")}}var r;var p="";var t=0;var q="";var k=0;if(m.input!==undefined){t=1;m.input=m.input.toLowerCase();switch(m.input){case"text":p="

";break;case"password":p="

";break;case"select":if(m.options===undefined){if(d.alert){d.alert("For this type of input, the options parameter is required.")}}else{p=""}break;default:if(d.alert){d.alert("That type of input is not handled yet")}}}n="
";n+="
";n+=""+m.title+"";n+="

"+m.content+"

";n+=p;n+="
";if(m.buttons===undefined){m.buttons="[Accept]"}m.buttons=c.trim(m.buttons);m.buttons=m.buttons.split("");if(m.NormalButton===undefined){m.NormalButton="#232323"}if(m.ActiveButton===undefined){m.ActiveButton="#ed145b"}for(r=0;r<=m.buttons.length-1;r++){if(m.buttons[r]==="["){q=""}else{if(m.buttons[r]==="]"){k=k+1;q="";n+=q}else{q+=m.buttons[r]}}}n+="
";n+="
";n+="
";if(b>1){c(".MessageBoxContainer").hide();c(".MessageBoxContainer").css("z-index",99999)}c(".MessageBox").append(n);if(t===1){c("#txt"+b).focus()}c(".botTempo").hover(function(){var x=c(this).attr("id")},function(){var x=c(this).attr("id")});c(".botTempo").click(function(){var B=c(this).attr("id");var A=B.substr(B.indexOf("-")+1);var y=c.trim(c(this).text());if(t===1){if(typeof v==="function"){var z=A.replace("Msg","");var x=c("#txt"+z).val();if(v){v(y,x)}}}else{if(typeof v==="function"){if(v){v(y)}}}c("#"+A).addClass("animated fadeOut fast");b=b-1;if(b===0){c("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function(){a=0;c(this).remove()})}})},bigBox:function(k,r){var n,o;k=c.extend({title:"",content:"",icon:undefined,number:undefined,color:undefined,sound:true,timeout:undefined,colortime:1500,colors:undefined},k);if(k.sound===true){if(e.browser.isIE8orlower()===0){var q=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){q.setAttribute("src",e.baseURL+"../snd/bigbox.ogg")}else{q.setAttribute("src",e.baseURL+"../snd/bigbox.mp3")}c.get();q.addEventListener("load",function(){q.play()},true);q.pause();q.play()}}j=j+1;n="
";if(k.icon===undefined){k.icon="fa fa-cloud"}n+="  "+k.title+"";n+="

"+k.content+"

";n+="
";if(k.number!==undefined){n+=k.number}n+="
";n+="
";c("#divBigBoxes").append(n);if(k.color===undefined){k.color="#004d60"}c("#bigBox"+j).css("background-color",k.color);c("#divMiniIcons").append("
");c("#miniIcon"+j).bind("click",function(){var w=c(this).attr("id");var v=w.replace("miniIcon","bigBox");var u=w.replace("miniIcon","bigBoxColor");c(".cajita").each(function(y){var x=c(this).attr("id");var z=x.replace("miniIcon","bigBox");c("#"+z).css("z-index",9998)});c("#"+v).css("z-index",9999);c("#"+u).removeClass("animated fadeIn").delay(1).queue(function(){c(this).show();c(this).addClass("animated fadeIn");c(this).clearQueue()})});var l=c("#btnClose"+j);var p=c("#bigBox"+j);var t=c("#miniIcon"+j);var s;if(k.colors!==undefined&&k.colors.length>0){l.attr("colorcount","0");s=setInterval(function(){var u=l.attr("colorcount");l.animate({backgroundColor:k.colors[u].color});p.animate({backgroundColor:k.colors[u].color});t.animate({backgroundColor:k.colors[u].color});if(u
"}else{m="
"}if(l.icon===undefined){n="
"+l.title+"

"+l.content+"

"+m+"
"}else{n="
"+l.title+"

"+l.content+"

"+m+"
"}if(g===1){c("#divSmallBoxes").append(n);i=c("#smallbox"+g).height()+40}else{var q=c(".SmallBox").size();if(q===0){c("#divSmallBoxes").append(n);i=c("#smallbox"+g).height()+40}else{c("#divSmallBoxes").append(n);c("#smallbox"+g).css("top",i);i=i+c("#smallbox"+g).height()+20;c(".SmallBox").each(function(u){if(u===0){c(this).css("top",20);h=c(this).height()+40;i=c(this).height()+40}else{c(this).css("top",h);h=h+c(this).height()+20;i=i+c(this).height()+20}})}}var t=c("#smallbox"+g);if(l.color===undefined){t.css("background-color","#004d60")}else{t.css("background-color",l.color)}var s;if(l.colors!==undefined&&l.colors.length>0){t.attr("colorcount","0");s=setInterval(function(){var u=t.attr("colorcount");t.animate({backgroundColor:l.colors[u].color});if(u
").append("
").append("
")});function f(){c(".divMessageBox").fadeOut(300,function(){c(this).remove()});c(".LoadingBoxContainer").fadeOut(300,function(){c(this).remove()})}var a=0,b=0,h,j=0,g=0,i=0;var e=d.MyAMS;e.notify={messageBox:function(x,w){var t,o,m=e.browser.isIE8orlower();var p={title:"",content:"",status:"",NormalButton:undefined,ActiveButton:undefined,buttons:undefined,input:undefined,placeholder:"",options:undefined,sound:undefined};var n=c.extend({},p,x);if(n.sound&&(m===0)){var v=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){v.setAttribute("src",e.baseURL+"../sound/message.ogg")}else{v.setAttribute("src",e.baseURL+"../sound/message.mp3")}c.get();v.addEventListener("load",function(){v.play()},true);v.pause();v.play()}b=b+1;if(a===0){a=1;t="
";c("body").append(t);if(e.browser.isIE8orlower()===1){c("#MsgBoxBack").addClass("MessageIE")}}var s;var q="";var u=0;var r="";var l=0;var k;if(n.input!==undefined){u=1;n.input=n.input.toLowerCase();switch(n.input){case"text":q="

";break;case"password":q="

";break;case"select":if(n.options===undefined){if(d.alert){d.alert("For this type of input, the options parameter is required.")}}else{q=""}break;default:if(d.alert){d.alert("That type of input is not handled yet")}}}o="
";o+="
";o+=""+n.title+"";o+="

"+n.content+"

";o+=q;o+="
";if(n.buttons===undefined){n.buttons="[Accept]"}n.buttons=c.trim(n.buttons);n.buttons=n.buttons.split("");if(n.NormalButton===undefined){n.NormalButton="#232323"}if(n.ActiveButton===undefined){n.ActiveButton="#ed145b"}for(s=0;s<=n.buttons.length-1;s++){if(n.buttons[s]==="["){r=""}else{if(n.buttons[s]==="]"){l=l+1;if(l===1){k="btn-primary"}else{k="btn-default"}r="";o+=r}else{r+=n.buttons[s]}}}o+="
";o+="
";o+="
";if(b>1){c(".MessageBoxContainer").hide();c(".MessageBoxContainer").css("z-index",99999)}c(".MessageBox").append(o);if(u===1){c("#txt"+b).focus()}c(".botTempo").hover(function(){var y=c(this).attr("id")},function(){var y=c(this).attr("id")});c(".botTempo").click(function(){var C=c(this).attr("id");var B=C.substr(C.indexOf("-")+1);var z=c.trim(c(this).text());if(u===1){if(typeof w==="function"){var A=B.replace("Msg","");var y=c("#txt"+A).val();if(w){w(z,y)}}}else{if(typeof w==="function"){if(w){w(z)}}}c("#"+B).addClass("animated fadeOut fast");b=b-1;if(b===0){c("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function(){a=0;c(this).remove()})}})},bigBox:function(k,r){var n,o;k=c.extend({title:"",content:"",icon:undefined,number:undefined,color:undefined,sound:true,timeout:undefined,colortime:1500,colors:undefined},k);if(k.sound===true){if(e.browser.isIE8orlower()===0){var q=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){q.setAttribute("src",e.baseURL+"../snd/bigbox.ogg")}else{q.setAttribute("src",e.baseURL+"../snd/bigbox.mp3")}c.get();q.addEventListener("load",function(){q.play()},true);q.pause();q.play()}}j=j+1;n="
";if(k.icon===undefined){k.icon="fa fa-cloud"}n+="  "+k.title+"";n+="

"+k.content+"

";n+="
";if(k.number!==undefined){n+=k.number}n+="
";n+="
";c("#divBigBoxes").append(n);if(k.color===undefined){k.color="#004d60"}c("#bigBox"+j).css("background-color",k.color);c("#divMiniIcons").append("
");c("#miniIcon"+j).bind("click",function(){var w=c(this).attr("id");var v=w.replace("miniIcon","bigBox");var u=w.replace("miniIcon","bigBoxColor");c(".cajita").each(function(y){var x=c(this).attr("id");var z=x.replace("miniIcon","bigBox");c("#"+z).css("z-index",9998)});c("#"+v).css("z-index",9999);c("#"+u).removeClass("animated fadeIn").delay(1).queue(function(){c(this).show();c(this).addClass("animated fadeIn");c(this).clearQueue()})});var l=c("#btnClose"+j);var p=c("#bigBox"+j);var t=c("#miniIcon"+j);var s;if(k.colors!==undefined&&k.colors.length>0){l.attr("colorcount","0");s=setInterval(function(){var u=l.attr("colorcount");l.animate({backgroundColor:k.colors[u].color});p.animate({backgroundColor:k.colors[u].color});t.animate({backgroundColor:k.colors[u].color});if(u
"}else{m="
"}if(l.icon===undefined){n="
"+l.title+"

"+l.content+"

"+m+"
"}else{n="
"+l.title+"

"+l.content+"

"+m+"
"}if(g===1){c("#divSmallBoxes").append(n);i=c("#smallbox"+g).height()+40}else{var q=c(".SmallBox").size();if(q===0){c("#divSmallBoxes").append(n);i=c("#smallbox"+g).height()+40}else{c("#divSmallBoxes").append(n);c("#smallbox"+g).css("top",i);i=i+c("#smallbox"+g).height()+20;c(".SmallBox").each(function(u){if(u===0){c(this).css("top",20);h=c(this).height()+40;i=c(this).height()+40}else{c(this).css("top",h);h=h+c(this).height()+20;i=i+c(this).height()+20}})}}var t=c("#smallbox"+g);if(l.color===undefined){t.css("background-color","#004d60")}else{t.css("background-color",l.color)}var s;if(l.colors!==undefined&&l.colors.length>0){t.attr("colorcount","0");s=setInterval(function(){var u=t.attr("colorcount");t.animate({backgroundColor:l.colors[u].color});if(u