1 2!function($) { 3 "use strict"; 4 5 var SweetAlert = function() {}; 6 7 //examples 8 SweetAlert.prototype.init = function() { 9 10 //Basic 11 $('#sa-basic').click(function(){ 12 swal("Here's a message!"); 13 }); 14 15 //A title with a text under 16 $('#sa-title').click(function(){ 17 swal("Here's a message!", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lorem erat eleifend ex semper, lobortis purus sed.") 18 }); 19 20 //Success Message 21 $('#sa-success').click(function(){ 22 swal("Good job!", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lorem erat eleifend ex semper, lobortis purus sed.", "success") 23 }); 24 25 //Warning Message 26 $('#sa-warning').click(function(){ 27 swal({ 28 title: "Are you sure?", 29 text: "You will not be able to recover this imaginary file!", 30 type: "warning", 31 showCancelButton: true, 32 confirmButtonColor: "#DD6B55", 33 confirmButtonText: "Yes, delete it!", 34 closeOnConfirm: false 35 }, function(){ 36 swal("Deleted!", "Your imaginary file has been deleted.", "success"); 37 }); 38 }); 39 40 //Parameter 41 $('#sa-params').click(function(){ 42 swal({ 43 title: "Are you sure?", 44 text: "You will not be able to recover this imaginary file!", 45 type: "warning", 46 showCancelButton: true, 47 confirmButtonColor: "#DD6B55", 48 confirmButtonText: "Yes, delete it!", 49 cancelButtonText: "No, cancel plx!", 50 closeOnConfirm: false, 51 closeOnCancel: false 52 }, function(isConfirm){ 53 if (isConfirm) { 54 swal("Deleted!", "Your imaginary file has been deleted.", "success"); 55 } else { 56 swal("Cancelled", "Your imaginary file is safe :)", "error"); 57 } 58 }); 59 }); 60 61 //Custom Image 62 $('#sa-image').click(function(){ 63 swal({ 64 title: "Govinda!", 65 text: "Recently joined twitter", 66 imageUrl: "../assets/images/users/agent2.jpg" 67 }); 68 }); 69 70 //Auto Close Timer 71 $('#sa-close').click(function(){ 72 swal({ 73 title: "Auto close alert!", 74 text: "I will close in 2 seconds.", 75 timer: 2000,
76 showConfirmButton: false 77 }); 78 }); 79 80 81 }, 82 //init 83 $.SweetAlert = new SweetAlert, $.SweetAlert.Constructor = SweetAlert 84}(window.jQuery), 85 86//initializing 87function($) { 88 "use strict"; 89 $.SweetAlert.init() 90}(window.jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.