(function($) { let $modals = null; let $modal = null; $('.wikiplugin-include-replace').on('click', function() { let index = $(this).data().index; let page = $(this).data().page; let ticket = $(this).data().ticket; let tpl = '
'; $modals = $('.modal.fade'); $modal = $modals.filter(':not(.show)').first(); $modal.find('.modal-dialog').html(tpl); $modal.modal('show'); }); $.fn.replaceInclude = function(index, page, ticket) { $modal.modal('hide'); ajaxLoadingShow('page-data'); $.ajax({ type: 'POST', url: 'tiki-ajax_services.php', dataType: 'json', data: { controller: 'plugin', action: 'replace', type: 'include', page: page, ticket: ticket, index: index, appendParams: 1, message: tr('Include Plugin was replaced with its content.'), params: { replace: 1, } } }).always(function() { window.location = window.location.href; }); }; })(jQuery);