1$(function uil_init_yandex_static_map() { 2 3 $('.uil-yandex-static-map').find('img[src^="https://static-maps.yandex.ru/"]').each(function () { 4 5 var max_width = 600, max_height = 450; 6 var is_need_attr_width = true, is_need_attr_height = true; 7 var size_regexp = /size=\d+,\d+/; 8 9 var $img = $(this); 10 11 var base_width = $img.attr('width'); 12 if (!base_width) { 13 base_width = max_width; 14 is_need_attr_width = false; 15 } 16 17 var base_height = $img.attr('height'); 18 if (!base_height) { 19 base_height = max_height; 20 is_need_attr_height = false; 21 } 22 23 var img_ratio = base_width / base_height; 24 25 function process() { 26 27 var new_width, 28 new_height, 29 phys_width = $img.width(); 30 31 if (phys_width >= max_width) 32 new_width = max_width; 33 else 34 new_width = phys_width; 35 new_height = parseInt(new_width / img_ratio); 36 var new_value = new_width + ',' + new_height; 37 38 var src = $img.attr('src'), 39 new_src = src, 40 size_arg = size_regexp.exec(src); 41 if (size_arg) { 42 size_arg = size_arg[0]; 43 new_src = src.replace(size_arg, 'size=' + new_value); 44 } else { 45 new_src = src + '&size=' + new_value; 46 } 47 48 if (new_src !== src) { 49 $img.attr('src', new_src); 50 if (is_need_attr_width) 51 $img.attr('width', new_width); 52 if (is_need_attr_height) 53 $img.attr('height', new_height); 54 setTimeout(function () { 55 process(); 56 }, 2000); 57 } 58 59 } 60 61 $(window) 62 .on('load', function () { 63 process(); 64 }) 65 .on('resize', $.debounce(1000, function () { 66 process(); 67 })); 68 69 }); 70 71});
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.