1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- function showStagPopup(_key, _noAutoFocus) {
- /*$('html, body').addClass('no-scroll');
- $(window.top.document.body).find('#stag_mcp_lhs').addClass('no-scroll');*/
- let stagPopup = $('[stag-popup-key="' + _key + '"]');
- stagPopup.addClass('show');
- stagPopup.find('[moe][initialized]').removeAttr('initialized');
- initMoes();
- if(!_noAutoFocus) {
- window.setTimeout(function() {
- stagPopup.find('input[type="text"]:not([readonly]):visible,select:visible').first().focus();
- }, 150);
- }
- return false;
- }
- function submitStagPopup(_form) {
- if(!_form[0].checkValidity()) {
- _form[0].reportValidity();
- return false;
- }
- showMask();
- $.post(_form.attr('action'), _form.serialize(), function(_data) {
- fastReload();
- });
- return false;
- }
- function closeStagPopup() {
- $('.stag-popup').removeClass('show');
- $('html, body').removeClass('no-scroll');
- $(window.top.document.body).find('#stag_mcp_lhs').removeClass('no-scroll');
- return false;
- }
- (function() {
- window.initStagPopupEvents = function () {
- $(document).on('click', '.stag-popup', function(_e) {
- if($(_e.target).is('.stag-popup')) {
- closeStagPopup();
- }
- });
- // catch ESC and discard any visible popups
- $(document)
- .off('keydown.stag-popup-escape')
- .on('keydown.stag-popup-escape', function (e) {
- if(e.which === 27) {
- let visiblePopups = $('.stag-popup.show');
- if (visiblePopups.length) {
- closeStagPopup();
- return false;
- }
- }
- });
- }
- addMCInitializer('stag-popups', window.initStagPopupEvents);
- })();
|