From 3c5b7a5de3764b340c74fd1dcc1feb85b33715f9 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 19 Apr 2012 15:36:03 +0800 Subject: [PATCH] =?UTF-8?q?Modified=20confirm=20box=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/orbitdesktop.js | 40 +++++++++++++---------- app/assets/javascripts/orbitdesktopAPI.js | 18 +++++----- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 605cae43..3783bf59 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -619,25 +619,29 @@ var orbitDesktop = function(dom){ }); $("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){ - var colors = new Array; - $("#color_input input").each(function(){ - colors[$(this).attr("for")] = $(this).val(); - }) - var dhtml =""; - $("head").find("#dyn_css").remove(); - $("head").append(dhtml); - $.post("/desktop/save_desktop_settings",{"save":"customtheme","desktopid":o.desktopId,"theme":dhtml},function(result,status){ - if(status=="success"){ - if(result[0].success=="true") - o.notify("Custom theme saved!!","success",2); - else - o.notify("Custom theme saving failed!!","imp",2); - }else{ - o.notify("Connection problem!!","alert",2); - } - }) + var colors = new Array; + $("#color_input input").each(function(){ + colors[$(this).attr("for")] = $(this).val(); + }) + var dhtml =""; + $("head").find("#dyn_css").remove(); + $("head").append(dhtml); + $.post("/desktop/save_desktop_settings",{"save":"customtheme","desktopid":o.desktopId,"theme":dhtml},function(result,status){ + if(status=="success"){ + if(result[0].success=="true") + o.notify("Custom theme saved!!","success",2); + else + o.notify("Custom theme saving failed!!","imp",2); + }else{ + o.notify("Connection problem!!","alert",2); + } + }) } }) }); diff --git a/app/assets/javascripts/orbitdesktopAPI.js b/app/assets/javascripts/orbitdesktopAPI.js index 95447c19..03686a38 100644 --- a/app/assets/javascripts/orbitdesktopAPI.js +++ b/app/assets/javascripts/orbitdesktopAPI.js @@ -54,24 +54,24 @@ var orbitDesktopAPI = function(){ $("img#thmbackground").attr("src",o.wallpaperPath+wallpaper); o.saveWallpaper(wallpaper); }; - this.confirm = function(msg,btnvalues,highlighted,callbackfn){ - if(!btnvalues)btnvalues=["Ok","Cancel"]; - if(highlighted!=1 || highlighted!=2)highlighted=2; - if(!msg)msg = "Are you sure?" + this.confirm = function(settings,callbackfn){ + if(!settings.buttons)settings.buttons=["Ok","Cancel"]; + if(settings.highlighted!=1 || settings.highlighted!=2)settings.highlighted=2; + if(!settings.message)settings.message = "Are you sure?" var $confirm = $("#orbitdiag"); $confirm.find(".diag_action a").addClass("admbg admtxt"); - $confirm.find(".diag_message").text(msg); - if(highlighted == 1) + $confirm.find(".diag_message").text(settings.message); + if(settings.highlighted == 1) $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_confirm").text(btnvalues[0]).one("click",function(){ + $confirm.find("#diag_confirm").text(settings.buttons[0]).one("click",function(){ $confirm.hide(); $confirm.find(".diag_action a").unbind(); if(typeof callbackfn=="function") 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.find(".diag_action a").unbind(); if(typeof callbackfn=="function")