[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: fire.modal.js
// Delete to open modal (function ($, window, i) { // Bootstrap 4 Modal $.fn.fireModal = function (options) { var options = $.extend({ size: 'modal-md', center: false, animation: true, title: 'Modal Title', closeButton: false, header: true, bodyClass: '', footerClass: '', body: '', buttons: [], autoFocus: true, created: function () { }, appended: function () { }, onFormSubmit: function () { }, modal: {} }, options); this.each(function () { i++; var id = 'fire-modal-' + i, trigger_class = 'trigger--' + id, trigger_button = $('.' + trigger_class); $(this).addClass(trigger_class); // Get modal body let body = options.body; if (typeof body == 'object') { if (body.length) { let part = body; body = body.removeAttr('id').clone().removeClass('modal-part'); part.remove(); } else { body = '<div class="text-danger">Modal part element not found!</div>'; } } // Modal base template var modal_template = ' <div class="modal' + (options.animation == true ? ' fade' : '') + '" tabindex="-1" role="dialog" id="' + id + '"> ' + ' <div class="modal-dialog ' + options.size + (options.center ? ' modal-dialog-centered' : '') + '" role="document"> ' + ' <div class="modal-content bg-white"> ' + ((options.header == true) ? ' <div class="modal-header"> ' + ' <h5 class="modal-title mx-auto">' + options.title + '</h5> ' + ((options.closeButton == true) ? ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"> ' + ' <span aria-hidden="true">×</span> ' + ' </button> ' : '') + ' </div> ' : '') + ' <div class="modal-body text-center text-dark"> ' + ' </div> ' + (options.buttons.length > 0 ? ' <div class="modal-footer mx-auto"> ' + ' </div> ' : '') + ' </div> ' + ' </div> ' + ' </div> '; // Convert modal to object var modal_template = $(modal_template); // Start creating buttons from 'buttons' option var this_button; options.buttons.forEach(function (item) { // get option 'id' let id = "id" in item ? item.id : ''; // Button template this_button = '<button type="' + ("submit" in item && item.submit == true ? 'submit' : 'button') + '" class="' + item.class + '" id="' + id + '">' + item.text + '</button>'; // add click event to the button this_button = $(this_button).off('click').on("click", function () { // execute function from 'handler' option item.handler.call(this, modal_template); }); // append generated buttons to the modal footer $(modal_template).find('.modal-footer').append(this_button); }); // append a given body to the modal $(modal_template).find('.modal-body').append(body); // add additional body class if (options.bodyClass) $(modal_template).find('.modal-body').addClass(options.bodyClass); // add footer body class if (options.footerClass) $(modal_template).find('.modal-footer').addClass(options.footerClass); // execute 'created' callback options.created.call(this, modal_template, options); // modal form and submit form button let modal_form = $(modal_template).find('.modal-body form'), form_submit_btn = modal_template.find('button[type=submit]'); // append generated modal to the body $("body").append(modal_template); // execute 'appended' callback options.appended.call(this, $('#' + id), modal_form, options); // if modal contains form elements if (modal_form.length) { // if `autoFocus` option is true if (options.autoFocus) { // when modal is shown $(modal_template).on('shown.bs.modal', function () { // if type of `autoFocus` option is `boolean` if (typeof options.autoFocus == 'boolean') modal_form.find('input:eq(0)').focus(); // the first input element will be focused // if type of `autoFocus` option is `string` and `autoFocus` option is an HTML element else if (typeof options.autoFocus == 'string' && modal_form.find(options.autoFocus).length) modal_form.find(options.autoFocus).focus(); // find elements and focus on that }); } // form object let form_object = { startProgress: function () { modal_template.addClass('modal-progress'); }, stopProgress: function () { modal_template.removeClass('modal-progress'); } }; // if form is not contains button element if (!modal_form.find('button').length) $(modal_form).append('<button class="d-none" id="' + id + '-submit"></button>'); // add click event form_submit_btn.click(function () { modal_form.submit(); }); // add submit event modal_form.submit(function (e) { // start form progress form_object.startProgress(); // execute `onFormSubmit` callback options.onFormSubmit.call(this, modal_template, e, form_object); }); } $(document).on("click", '.' + trigger_class, function () { $('#' + id).modal('show'); return false; }); }); } // Bootstrap Modal Destroyer $.destroyModal = function (modal) { modal.modal('hide'); modal.on('hidden.bs.modal', function () { }); } })(jQuery, this, 0);
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.72 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002