1// Alert Modal Type 2 $(document).on('click', '#success', function(e) { 3 swal( 4 'Success', 5 'You clicked the <b style="color:green;">Success</b> button!', 6 'success' 7 ) 8 }); 9 10 $(document).on('click', '#error', function(e) { 11 swal( 12 'Error!', 13 'You clicked the <b style="color:red;">error</b> button!', 14 'error' 15 ) 16 }); 17 18 $(document).on('click', '#warning', function(e) { 19 swal( 20 'Warning!', 21 'You clicked the <b style="color:coral;">warning</b> button!', 22 'warning' 23 ) 24 }); 25 26 $(document).on('click', '#info', function(e) { 27 swal( 28 'Info!', 29 'You clicked the <b style="color:cornflowerblue;">info</b> button!', 30 'info' 31 ) 32 }); 33 34 $(document).on('click', '#question', function(e) { 35 swal( 36 'Question!', 37 'You clicked the <b style="color:grey;">question</b> button!', 38 'question' 39 ) 40 }); 41 42 // Alert With Custom Icon and Background Image 43 $(document).on('click', '#icon', function(event) { 44 swal({ 45 title: 'Custom icon!', 46 text: 'Alert with a custom image.', 47 imageUrl: 'https://image.shutterstock.com/z/stock-vector--exclamation-mark-exclamation-mark-hazard-warning-symbol-flat-design-style-vector-eps-444778462.jpg', 48 imageWidth: 200, 49 imageHeight: 200, 50 imageAlt: 'Custom image', 51 animation: false 52 }) 53 }); 54 55 $(document).on('click', '#image', function(event) { 56 swal({ 57 title: 'Custom background image, width and padding.', 58 width: 700, 59 padding: 150, 60 background: '#fff url(https://image.shutterstock.com/z/stock-vector--exclamation-mark-exclamation-mark-hazard-warning-symbol-flat-design-style-vector-eps-444778462.jpg)' 61 }) 62 }); 63 64 // Alert With Input Type 65 $(document).on('click', '#subscribe', function(e) { 66 swal({ 67 title: 'Submit email to subscribe', 68 input: 'email', 69 inputPlaceholder: '[email protected]', 70 showCancelButton: true, 71 confirmButtonText: 'Submit', 72 showLoaderOnConfirm: true, 73 preConfirm: (email) => { 74 return new Promise((resolve) => { 75 setTimeout(() => { 76 if (email === '[email protected]') { 77 swal.showValidationError( 78 'This email is already taken.' 79 ) 80 } 81 resolve() 82 }, 2000) 83 }) 84 }, 85 allowOutsideClick: false 86 }).then((result) => { 87 if (result.value) { 88 swal({ 89 type: 'success', 90 title: 'Thank you for subscribe!', 91 html: 'Submitted email: ' + result.value 92 }) 93 } 94 }) 95 }); 96 97 // Alert Redirect to Another Link 98 $(document).on('click', '#link', function(e) { 99 swal({ 100 title: "Are you sure?", 101 text: "You will be redirected to https://vitelglobal.com", 102 type: "warning", 103 confirmButtonText: "Yes, visit link!", 104 showCancelButton: true 105 }) 106 .then((result) => { 107 if (result.value) { 108 window.location = 'https://utopian.io'; 109 } else if (result.dismiss === 'cancel') { 110 swal( 111 'Cancelled', 112 'Your stay here :)', 113 'error' 114 ) 115 } 116 }) 117 });
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.