Modified confirm box…

This commit is contained in:
Harry Bomrah 2012-04-19 15:36:03 +08:00
parent 4bad25e682
commit 3c5b7a5de3
2 changed files with 31 additions and 27 deletions

View File

@ -619,7 +619,11 @@ var orbitDesktop = function(dom){
}); });
$("a#theme_submit").click(function(){ $("a#theme_submit").click(function(){
o.confirm("Are you sure that you want to set this custom theme?",["Yes","No"],3,function(reply){ o.confirm({
message : "Are you sure that you want to save custom theme?",
highlighted : 1,
buttons : ["Yes","No"]
},function(reply){
if(reply){ if(reply){
var colors = new Array; var colors = new Array;
$("#color_input input").each(function(){ $("#color_input input").each(function(){

View File

@ -54,24 +54,24 @@ var orbitDesktopAPI = function(){
$("img#thmbackground").attr("src",o.wallpaperPath+wallpaper); $("img#thmbackground").attr("src",o.wallpaperPath+wallpaper);
o.saveWallpaper(wallpaper); o.saveWallpaper(wallpaper);
}; };
this.confirm = function(msg,btnvalues,highlighted,callbackfn){ this.confirm = function(settings,callbackfn){
if(!btnvalues)btnvalues=["Ok","Cancel"]; if(!settings.buttons)settings.buttons=["Ok","Cancel"];
if(highlighted!=1 || highlighted!=2)highlighted=2; if(settings.highlighted!=1 || settings.highlighted!=2)settings.highlighted=2;
if(!msg)msg = "Are you sure?" if(!settings.message)settings.message = "Are you sure?"
var $confirm = $("#orbitdiag"); var $confirm = $("#orbitdiag");
$confirm.find(".diag_action a").addClass("admbg admtxt"); $confirm.find(".diag_action a").addClass("admbg admtxt");
$confirm.find(".diag_message").text(msg); $confirm.find(".diag_message").text(settings.message);
if(highlighted == 1) if(settings.highlighted == 1)
$confirm.find("#diag_confirm").removeClass("admbg admtxt").addClass("thmc1 thmtxt"); $confirm.find("#diag_confirm").removeClass("admbg admtxt").addClass("thmc1 thmtxt");
if(highlighted == 2) if(settings.highlighted == 2)
$confirm.find("#diag_cancel").removeClass("admbg admtxt").addClass("thmc1 thmtxt"); $confirm.find("#diag_cancel").removeClass("admbg admtxt").addClass("thmc1 thmtxt");
$confirm.find("#diag_confirm").text(btnvalues[0]).one("click",function(){ $confirm.find("#diag_confirm").text(settings.buttons[0]).one("click",function(){
$confirm.hide(); $confirm.hide();
$confirm.find(".diag_action a").unbind(); $confirm.find(".diag_action a").unbind();
if(typeof callbackfn=="function") if(typeof callbackfn=="function")
callbackfn.call(this,true); callbackfn.call(this,true);
}); });
$confirm.find("#diag_cancel").text(btnvalues[1]).one("click",function(){ $confirm.find("#diag_cancel").text(settings.buttons[1]).one("click",function(){
$confirm.hide(); $confirm.hide();
$confirm.find(".diag_action a").unbind(); $confirm.find(".diag_action a").unbind();
if(typeof callbackfn=="function") if(typeof callbackfn=="function")