TanchoToplineCargo/public/assets/js/pages/sweetalerts.init.js

1 line
10 KiB
JavaScript
Raw Normal View History

2024-05-05 04:47:49 +00:00
document.getElementById("sa-basic")&&document.getElementById("sa-basic").addEventListener("click",function(){Swal.fire({title:"Any fool can use a computer",confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1,showCloseButton:!0})}),document.getElementById("sa-title")&&document.getElementById("sa-title").addEventListener("click",function(){Swal.fire({title:"The Internet?",text:"That thing is still around?",icon:"question",confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1,showCloseButton:!0})}),document.getElementById("sa-success")&&document.getElementById("sa-success").addEventListener("click",function(){Swal.fire({title:"Good job!",text:"You clicked the button!",icon:"success",showCancelButton:!0,confirmButtonClass:"btn btn-primary w-xs me-2 mt-2",cancelButtonClass:"btn btn-danger w-xs mt-2",buttonsStyling:!1,showCloseButton:!0})}),document.getElementById("sa-error")&&document.getElementById("sa-error").addEventListener("click",function(){Swal.fire({title:"Oops...",text:"Something went wrong!",icon:"error",confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1,footer:'<a href="">Why do I have this issue?</a>',showCloseButton:!0})}),document.getElementById("sa-longcontent")&&document.getElementById("sa-longcontent").addEventListener("click",function(){Swal.fire({imageUrl:"https://placeholder.pics/svg/300x1500",imageHeight:1500,imageAlt:"A tall image",confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1,showCloseButton:!0})}),document.getElementById("sa-warning")&&document.getElementById("sa-warning").addEventListener("click",function(){Swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",icon:"warning",showCancelButton:!0,confirmButtonClass:"btn btn-primary w-xs me-2 mt-2",cancelButtonClass:"btn btn-danger w-xs mt-2",confirmButtonText:"Yes, delete it!",buttonsStyling:!1,showCloseButton:!0}).then(function(t){t.value&&Swal.fire({title:"Deleted!",text:"Your file has been deleted.",icon:"success",confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1})})}),document.getElementById("sa-params")&&document.getElementById("sa-params").addEventListener("click",function(){Swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",icon:"warning",showCancelButton:!0,confirmButtonText:"Yes, delete it!",cancelButtonText:"No, cancel!",confirmButtonClass:"btn btn-primary w-xs me-2 mt-2",cancelButtonClass:"btn btn-danger w-xs mt-2",buttonsStyling:!1,showCloseButton:!0}).then(function(t){t.value?Swal.fire({title:"Deleted!",text:"Your file has been deleted.",icon:"success",confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1}):t.dismiss===Swal.DismissReason.cancel&&Swal.fire({title:"Cancelled",text:"Your imaginary file is safe :)",icon:"error",confirmButtonClass:"btn btn-primary mt-2",buttonsStyling:!1})})}),document.getElementById("sa-image")&&document.getElementById("sa-image").addEventListener("click",function(){Swal.fire({title:"Sweet!",text:"Modal with a custom image.",imageUrl:"assets/images/logo-sm.png",imageHeight:40,confirmButtonClass:"btn btn-primary w-xs mt-2",buttonsStyling:!1,animation:!1,showCloseButton:!0})}),document.getElementById("sa-close")&&document.getElementById("sa-close").addEventListener("click",function(){var t;Swal.fire({title:"Auto close alert!",html:"I will close in <strong></strong> seconds.",timer:2e3,timerProgressBar:!0,showCloseButton:!0,didOpen:function(){Swal.showLoading(),t=setInterval(function(){var t=Swal.getHtmlContainer();t&&(t=t.querySelector("b"))&&(t.textContent=Swal.getTimerLeft())},100)},onClose:function(){clearInterval(t)}}).then(function(t){t.dismiss===Swal.DismissReason.timer&&console.log("I was closed by the timer")})}),document.getElementById("custom-html-alert")&&document.getElementById("custom-html-alert").addEventListener("click",function(){Swal.fire({title:"<i>HTML</i> <u>example</u>",icon:"info",html:'You can use <b>bold text</b>, <a href="//Themesbrand.in/">links</a> and other HTML tags',showCloseButton:!0,showCancelButton:!0,confirmButtonClass:"btn btn-success me-2",cancelButtonC