1 | window.alert = function(message, strong, title, callback) {
|
---|
2 | $.Zebra_Dialog("<b>"+(strong ? strong : '')+ " </b>" + message,{
|
---|
3 | 'type': 'error',
|
---|
4 | 'title': title ? title : '',
|
---|
5 | 'overlay_opacity': '0.5',
|
---|
6 | 'onClose': function(caption){
|
---|
7 | if(typeof(callback) == 'function')
|
---|
8 | callback();
|
---|
9 | }
|
---|
10 | });
|
---|
11 | zebraKeyboard();
|
---|
12 | };
|
---|
13 |
|
---|
14 | window.confirm = function(message, callback, strong, title) {
|
---|
15 | if(typeof(callback) == 'function'){
|
---|
16 | $.Zebra_Dialog("<b>"+(strong ? strong : '')+ " </b>" + message,{
|
---|
17 | 'type': 'question',
|
---|
18 | 'title': title ? title : '',
|
---|
19 | 'buttons': ['Sim', 'Não'],
|
---|
20 | 'overlay_opacity': '0.5',
|
---|
21 | 'onClose': function(caption){
|
---|
22 | callback(caption == "Sim" ? true : false);
|
---|
23 | }
|
---|
24 | });
|
---|
25 | }
|
---|
26 | zebraKeyboard();
|
---|
27 | };
|
---|
28 |
|
---|
29 | window.warning = function(){
|
---|
30 |
|
---|
31 | };
|
---|
32 |
|
---|
33 | function zebraKeyboard(){
|
---|
34 | $(".ZebraDialog:last .ZebraDialog_Buttons").attr("tabindex", "0").focus().keydown(function(e){
|
---|
35 | var selected = $(".ZebraDialog:last .ZebraDialog_Buttons .ZebraDialog_ButtonSelected");
|
---|
36 | switch (e.keyCode){
|
---|
37 | case $.ui.keyCode.ENTER:{
|
---|
38 | selected.click();
|
---|
39 | break;
|
---|
40 | }
|
---|
41 | case $.ui.keyCode.LEFT:{
|
---|
42 | if(selected.next("a").length){
|
---|
43 | selected.next().addClass("ZebraDialog_ButtonSelected");
|
---|
44 | selected.removeClass("ZebraDialog_ButtonSelected");
|
---|
45 | }
|
---|
46 | break;
|
---|
47 | }
|
---|
48 | case $.ui.keyCode.RIGHT:{
|
---|
49 | if(selected.prev("a").length){
|
---|
50 | selected.prev().addClass("ZebraDialog_ButtonSelected");
|
---|
51 | selected.removeClass("ZebraDialog_ButtonSelected");
|
---|
52 | }
|
---|
53 | break;
|
---|
54 | }
|
---|
55 | };
|
---|
56 | }).find(".ZebraDialog_Button0").addClass("ZebraDialog_ButtonSelected");
|
---|
57 | $(".ZebraDialog:last").click(function(){$(".ZebraDialog:last .ZebraDialog_Buttons").focus();})
|
---|
58 | } |
---|