Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | var UIBootbox = function () { |
| 2 | |||
| 3 | var handleDemo = function() { |
||
| 4 | |||
| 5 | $('#demo_1').click(function(){ |
||
| 6 | bootbox.alert("Hello world!"); |
||
| 7 | }); |
||
| 8 | //end #demo_1 |
||
| 9 | |||
| 10 | $('#demo_2').click(function(){ |
||
| 11 | bootbox.alert("Hello world!", function() { |
||
| 12 | alert("Hello world callback"); |
||
| 13 | }); |
||
| 14 | }); |
||
| 15 | //end #demo_2 |
||
| 16 | |||
| 17 | $('#demo_3').click(function(){ |
||
| 18 | bootbox.confirm("Are you sure?", function(result) { |
||
| 19 | alert("Confirm result: "+result); |
||
| 20 | }); |
||
| 21 | }); |
||
| 22 | //end #demo_3 |
||
| 23 | |||
| 24 | $('#demo_4').click(function(){ |
||
| 25 | bootbox.prompt("What is your name?", function(result) { |
||
| 26 | if (result === null) { |
||
| 27 | alert("Prompt dismissed"); |
||
| 28 | } else { |
||
| 29 | alert("Hi <b>"+result+"</b>"); |
||
| 30 | } |
||
| 31 | }); |
||
| 32 | }); |
||
| 33 | //end #demo_6 |
||
| 34 | |||
| 35 | $('#demo_5').click(function(){ |
||
| 36 | bootbox.dialog({ |
||
| 37 | message: "I am a custom dialog", |
||
| 38 | title: "Custom title", |
||
| 39 | buttons: { |
||
| 40 | success: { |
||
| 41 | label: "Success!", |
||
| 42 | className: "green", |
||
| 43 | callback: function() { |
||
| 44 | alert("great success"); |
||
| 45 | } |
||
| 46 | }, |
||
| 47 | danger: { |
||
| 48 | label: "Danger!", |
||
| 49 | className: "red", |
||
| 50 | callback: function() { |
||
| 51 | alert("uh oh, look out!"); |
||
| 52 | } |
||
| 53 | }, |
||
| 54 | main: { |
||
| 55 | label: "Click ME!", |
||
| 56 | className: "blue", |
||
| 57 | callback: function() { |
||
| 58 | alert("Primary button"); |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | }); |
||
| 63 | }); |
||
| 64 | //end #demo_7 |
||
| 65 | |||
| 66 | } |
||
| 67 | |||
| 68 | return { |
||
| 69 | |||
| 70 | //main function to initiate the module |
||
| 71 | init: function () { |
||
| 72 | handleDemo(); |
||
| 73 | } |
||
| 74 | }; |
||
| 75 | |||
| 76 | }(); |
||
| 77 | |||
| 78 | jQuery(document).ready(function() { |
||
| 79 | UIBootbox.init(); |
||
| 80 | }); |