window.alert = function(message, strong, title, callback) { $.Zebra_Dialog(""+(strong ? strong : '')+ " " + message,{ 'type': 'error', 'title': title ? title : '', 'overlay_opacity': '0.5', 'onClose': function(caption){ if(typeof(callback) == 'function') callback(); } }); zebraKeyboard(); }; window.confirm = function(message, callback, strong, title) { if(typeof(callback) == 'function'){ $.Zebra_Dialog(""+(strong ? strong : '')+ " " + message,{ 'type': 'question', 'title': title ? title : '', 'buttons': ['Sim', 'Não'], 'overlay_opacity': '0.5', 'onClose': function(caption){ callback(caption == "Sim" ? true : false); } }); } zebraKeyboard(); }; window.warning = function(){ }; function zebraKeyboard(){ $(".ZebraDialog:last .ZebraDialog_Buttons").attr("tabindex", "0").focus().keydown(function(e){ var selected = $(".ZebraDialog:last .ZebraDialog_Buttons .ZebraDialog_ButtonSelected"); switch (e.keyCode){ case $.ui.keyCode.ENTER:{ selected.click(); break; } case $.ui.keyCode.LEFT:{ if(selected.next("a").length){ selected.next().addClass("ZebraDialog_ButtonSelected"); selected.removeClass("ZebraDialog_ButtonSelected"); } break; } case $.ui.keyCode.RIGHT:{ if(selected.prev("a").length){ selected.prev().addClass("ZebraDialog_ButtonSelected"); selected.removeClass("ZebraDialog_ButtonSelected"); } break; } }; }).find(".ZebraDialog_Button0").addClass("ZebraDialog_ButtonSelected"); $(".ZebraDialog:last").click(function(){$(".ZebraDialog:last .ZebraDialog_Buttons").focus();}) }