1var icms = icms || {}; 2 3icms.modal = (function ($) { 4 5 var self = this; 6 7 var modal_el; 8 9 this.onDocumentReady = function() { 10 11 /** tinymce prevent bootstrap dialog from blocking focusin **/ 12 $(document).on('focusin', function(e) { 13 if ($(e.target).closest(".tox-tinymce, .tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length) { 14 e.stopImmediatePropagation(); 15 } 16 }); 17 self.render(); 18 self.bind('a.ajax-modal'); 19 self.bind('.ajax-modal > a'); 20 $('.ajax-modal').addClass('ajax-modal-ready'); 21 }; 22 23 this.render = function (){ 24 $('body').prepend('<div class="modal" id="icms_modal" tabindex="-1" role="dialog" aria-modal="true"><div id="icms-modal-spinner" class="h-100 d-flex"><div class="sk-circle m-auto"><div class="sk-circle1 sk-child"></div><div class="sk-circle2 sk-child"></div><div class="sk-circle3 sk-child"></div><div class="sk-circle4 sk-child"></div><div class="sk-circle5 sk-child"></div><div class="sk-circle6 sk-child"></div><div class="sk-circle7 sk-child"></div><div class="sk-circle8 sk-child"></div><div class="sk-circle9 sk-child"></div><div class="sk-circle10 sk-child"></div><div class="sk-circle11 sk-child"></div><div class="sk-circle12 sk-child"></div></div></div><div class="modal-dialog modal-lg modal-primary" role="document" style="display: none;"><div class="modal-content"><div class="modal-header"><h4 class="modal-title text-truncate"></h4><button class="btn ml-auto text-white modal-close p-0" type="button" data-dismiss="modal"> <svg enable-background="new 0 0 26 26" version="1.1" viewBox="0 0 26 26" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M14.0605469,13L24.7802734,2.2802734c0.2929688-0.2929688,0.2929688-0.7675781,0-1.0605469 s-0.7675781-0.2929688-1.0605469,0L13,11.9394531L2.2802734,1.2197266c-0.2929688-0.2929688-0.7675781-0.2929688-1.0605469,0 s-0.2929688,0.7675781,0,1.0605469L11.9394531,13L1.2197266,23.7197266c-0.2929688,0.2929688-0.2929688,0.7675781,0,1.0605469 C1.3662109,24.9267578,1.5576172,25,1.75,25s0.3837891-0.0732422,0.5302734-0.2197266L13,14.0605469l10.7197266,10.7197266 C23.8662109,24.9267578,24.0576172,25,24.25,25s0.3837891-0.0732422,0.5302734-0.2197266 c0.2929688-0.2929688,0.2929688-0.7675781,0-1.0605469L14.0605469,13z" /></svg> </button></div><div class="modal-body"></div></div></div></div>'); 25 modal_el = $('#icms_modal'); 26 $(modal_el).on('hidden.bs.modal', function (e) { 27 self.onHide(); 28 }); 29 return this; 30 }; 31 32 this.onHide = function (){ 33 $('#icms-modal-spinner', modal_el).addClass('d-flex').removeClass('d-none'); 34 $(modal_el).find('.modal-dialog').hide().find('.modal-body').html(''); 35 $(modal_el).find('.modal-title').html(''); 36 $(modal_el).find('.modal-header').show(); 37 icms.forms.form_changed = false; 38 return this; 39 }; 40 41 this.showSpinner = function (){ 42 $(modal_el).modal('show'); return this; 43 }; 44 45 this.open = function (selector, title, style) { 46 $(modal_el).modal('show'); 47 var parent = $(selector).parent(); 48 var content = $(selector).detach(); 49 self.showContent(title, $(content).clone(true).removeClass('d-none').show(), style); 50 $(modal_el).on('hidden.bs.modal', function (e) { 51 content.appendTo(parent); 52 }); 53 }; 54 55 this.close = function(){ 56 $(modal_el).modal('hide'); 57 }; 58 59 this.showContent = function (title, content, style, style_body){ 60 style = style || false; 61 style_body = style_body || ''; 62 if(style){ 63 $(modal_el).find('.modal-dialog').addClass('modal-'+style); 64 $(modal_el).on('hidden.bs.modal', function (e) { 65 $(modal_el).find('.modal-dialog').removeClass('modal-'+style); 66 }); 67 } 68 $('#icms-modal-spinner', modal_el).addClass('d-none').removeClass('d-flex'); 69 $(modal_el).find('.modal-dialog').show().find('.modal-body').addClass(style_body).html(content); 70 $(modal_el).on('hidden.bs.modal', function (e) {
71 $(modal_el).find('.modal-body').removeClass(style_body); 72 }); 73 if(title){ 74 $(modal_el).find('.modal-title').show().html(title); 75 } else { 76 $(modal_el).find('.modal-title').hide(); 77 } 78 }; 79 80 this.bind = function(selector) { 81 82 $(selector).each(function (){ 83 84 var url = $(this).attr('href'); 85 86 if((new RegExp('[^\.]\.(jpg|jpeg|png|tiff|gif|webp)\\s*$', 'i')).test(url)){ 87 self.bindGallery(this); 88 } else { 89 90 $(this).off('click').on('click', function (){ 91 92 var title = $(this).attr('title'); 93 if(!title){ 94 title = $(this).data('original-title'); 95 } 96 97 var style = $(this).data('style'); 98 var params = $(this).data('params'); 99 100 if(url.charAt(0) === '#'){ 101 self.open(url, title, style); 102 } else { 103 self.openAjax(url, params, false, title); 104 } 105 106 return false; 107 }); 108 109 } 110 111 }); 112 113 }; 114 115 this.loadPhotoSwipe = function (){ 116 icms.head.addCss('photoswipe'); 117 icms.head.addJs('vendors/photoswipe/photoswipe.min', 'photoswipe_ready'); 118 }; 119 120 this.bindGallery = function(selector){ 121 icms.events.on('photoswipe_ready', function (){ 122 $(selector).jqPhotoSwipe({ 123 maxSpreadZoom: 1, 124 bgOpacity: 0.85, 125 shareEl: false, 126 forceSingleGallery: true 127 }); 128 }); 129 self.loadPhotoSwipe(); 130 }; 131 132 this.openHtml = function(html, title, style, style_body) { 133 $(modal_el).modal('show'); 134 self.showContent(title, html, style, style_body); 135 }; 136 137 this.openIframe = function(url, title){ 138 this.openHtml('<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" src="'+url+'"></iframe></div>', title, false, 'p-0'); 139 }; 140 141 this.openAjax = function(url, data, open_callback, title){ 142 143 open_callback = open_callback || false; 144 title = title || false; 145 data = data || {}; 146 147 if(data.is_iframe){ 148 return this.openIframe(url+'?'+$.param(data), title); 149 } 150 151 this.showSpinner(); 152 153 $.ajax({ 154 url: url, 155 data: data, 156 beforeSend: function(request) { 157 request.setRequestHeader('ICMS-Request-Type', 1); 158 }, 159 success: function(result){ 160 self.showContent(title, result); 161 // ÐлаÑÑ bg_gray веÑаем на .modal-content Ð´Ð»Ñ Ð¼Ð¾Ð´Ð°Ð»ÐºÐ¸ авÑоÑизаÑии (не на конÑенÑ) 162 var $content = $(modal_el).find('.modal-content'); 163 if (url && url.indexOf('/auth/login') !== -1) { 164 $content.addClass('bg_gray'); 165 } 166 $(modal_el).off('hidden.bs.modal.auth_bg').on('hidden.bs.modal.auth_bg', function () { 167 $content.removeClass('bg_gray'); 168 }); 169 if(open_callback){ 170 open_callback(); 171 } 172 }, 173 error: function(result){ 174 self.showContent(title, $('#data-wrap', result.responseText).html(), false, 'bg-dark'); 175 }, 176 dataType: 'html' 177 }); 178 179 return false; 180 181 }; 182 183 this.setCallback = function(event, callback){ 184 switch(event){ 185 case 'open': 186 $(document).on('shown.bs.modal', '#icms_modal', function (e) { 187 callback(); 188 }); 189 break; 190 case 'close': 191 $(document).on('hidden.bs.modal', '#icms_modal', function (e) { 192 callback(); 193 }); 194 break; 195 } 196 }; 197 198 this.resize = function(){ 199 $(modal_el).modal('handleUpdate'); 200 }; 201 202 this.setHeight = function(height){}; 203 204 this.alert = function(text, type) { 205 type = type || 'primary'; 206 type = type.replace('ui_', ''); 207 type = type.replace('error', 'danger'); 208 this.openHtml('<div class="alert alert-'+type+' border-0 rounded-0 m-n3">'+text+'</div>', '<b>â</b>', type); 209 }; 210 211 return this; 212 213}).call(icms.modal || {},jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.