File manager - Edit - /var/www/payraty/inventory_main/public/admin/pages/sweet-alert.init.js
Back
!function ($) { "use strict"; var SweetAlert = function () { }; //examples SweetAlert.prototype.init = function () { //Basic $('#sa-basic').on('click', function () { Swal.fire('Any fool can use a computer') }); //A title with a text under $('#sa-title').on('click', function () { Swal.fire( 'The Internet?', 'That thing is still around?', 'question' ) }); //Success Message $('#sa-success').on('click', function () { Swal.fire( { title: 'Good job!', text: 'You clicked the button!', type: 'success', showCancelButton: true, confirmButtonColor: '#626ed4', cancelButtonColor: "#ec4561" } ) }); //Warning Message $('#sa-warning').on('click',function () { Swal.fire({ title: "Are you sure?", text: "You won't be able to revert this!", type: "warning", showCancelButton: true, confirmButtonColor: "#02a499", cancelButtonColor: "#ec4561", confirmButtonText: "Yes, delete it!" }).then(function (result) { if (result.value) { Swal.fire("Deleted!", "Your file has been deleted.", "success"); } }); }); $('.sa-delete').on('click',function () { let form_id = $(this).data("form-id"); Swal.fire({ title: "Are you sure?", text: "You won't be able to revert this!", type: "warning", showCancelButton: true, confirmButtonColor: "#02a499", cancelButtonColor: "#ec4561", confirmButtonText: "Yes, delete it!" }).then(function (result) { if (result.value) { $('#'+form_id).submit(); } }); }); //Parameter $('#sa-params').on('click',function () { const swalWithBootstrapButtons = Swal.mixin({ customClass: { confirmButton: 'btn btn-success', cancelButton: 'btn btn-danger mr-2' }, buttonsStyling: false, }) swalWithBootstrapButtons.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonText: 'Yes, delete it!', cancelButtonText: 'No, cancel!', reverseButtons: true }).then((result) => { if (result.value) { swalWithBootstrapButtons.fire( 'Deleted!', 'Your file has been deleted.', 'success' ) } else if ( // Read more about handling dismissals result.dismiss === Swal.DismissReason.cancel ) { swalWithBootstrapButtons.fire( 'Cancelled', 'Your imaginary file is safe :)', 'error' ) } }) }); //Custom Image $('#sa-image').on('click', function () { Swal.fire({ title: 'Sweet!', text: 'Modal with a custom image.', imageUrl: 'assets/images/logo-dark.png', imageHeight: 20, animation: false }) }); //Auto Close Timer $('#sa-close').on('click', function () { let timerInterval Swal.fire({ title: 'Auto close alert!', html: 'I will close in <strong></strong> seconds.', timer: 2000, onBeforeOpen: () => { Swal.showLoading() timerInterval = setInterval(() => { Swal.getContent().querySelector('strong') .textContent = Swal.getTimerLeft() }, 100) }, onClose: () => { clearInterval(timerInterval) } }).then((result) => { if ( // Read more about handling dismissals result.dismiss === Swal.DismissReason.timer ) { console.log('I was closed by the timer') } }) }); //custom html alert $('#custom-html-alert').on('click',function () { Swal.fire({ title: '<i>HTML</i> <u>example</u>', type: 'info', html: 'You can use <b>bold text</b>, ' + '<a href="//Themesbrand.in/">links</a> ' + 'and other HTML tags', showCloseButton: true, showCancelButton: true, confirmButtonClass: 'btn btn-success', cancelButtonClass: 'btn btn-danger m-l-10', confirmButtonColor: "#02a499", cancelButtonColor: "#ec4561", confirmButtonText: '<i class="fa fa-thumbs-up"></i> Great!', cancelButtonText: '<i class="fa fa-thumbs-down"></i>' }) }); //Custom width padding $('#custom-padding-width-alert').on('click',function () { Swal.fire({ title: 'Custom width, padding, background.', width: 600, padding: 100, background: '#fff url(//subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/geometry.png)' }) }); //Ajax $('#ajax-alert').on('click',function () { Swal.fire({ title: 'Submit email to run ajax request', input: 'email', showCancelButton: true, confirmButtonText: 'Submit', showLoaderOnConfirm: true, confirmButtonColor: "#626ed4", cancelButtonColor: "#ec4561", preConfirm: function (email) { return new Promise(function (resolve, reject) { setTimeout(function () { if (email === 'taken@example.com') { reject('This email is already taken.') } else { resolve() } }, 2000) }) }, allowOutsideClick: false }).then(function (email) { Swal.fire({ type: 'success', title: 'Ajax request finished!', html: 'Submitted email: ' + email }) }) }); //chaining modal alert $('#chaining-alert').on('click',function () { Swal.mixin({ input: 'text', confirmButtonText: 'Next →', showCancelButton: true, progressSteps: ['1', '2', '3'] }).queue([ { title: 'Question 1', text: 'Chaining swal2 modals is easy' }, 'Question 2', 'Question 3' ]).then((result) => { if (result.value) { Swal.fire({ title: 'All done!', html: 'Your answers: <pre><code>' + JSON.stringify(result.value) + '</code></pre>', confirmButtonText: 'Lovely!' }) } }) }); //Danger $('#dynamic-alert').on('click',function () { swal.queue([{ title: 'Your public IP', confirmButtonText: 'Show my public IP', text: 'Your public IP will be received ' + 'via AJAX request', showLoaderOnConfirm: true, preConfirm: function () { return new Promise(function (resolve) { $.get('https://api.ipify.org?format=json') .done(function (data) { swal.insertQueueStep(data.ip) resolve() }) }) } }]).catch(swal.noop) }); }, //init $.SweetAlert = new SweetAlert, $.SweetAlert.Constructor = SweetAlert }(window.jQuery), //initializing function ($) { "use strict"; $.SweetAlert.init() }(window.jQuery);
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings