1$(function() { 2 3 // Ìåíÿåì ïîëîæåíèå ôèêñèðóåìîé áîêîâîé êíîïêè íà ðàçíûõ ðàçðåøåíèÿõ 4 $.attachPosition = (function() { 5 6 var $window = $(window), 7 $buttonAttach = $('.button-attach'); 8 9 function positionAttach() { 10 if ($window.width() < 768) { 11 $buttonAttach 12 .removeClass('-left') 13 .addClass('-down'); 14 } else { 15 $buttonAttach 16 .removeClass('-down') 17 .addClass('-left'); 18 } 19 } 20 21 positionAttach(); 22 $buttonAttach.removeClass('-hide'); 23 24 $window.on('resize', function() { 25 positionAttach(); 26 }); 27 28 }()); 29 30 31 // Ðàñòÿãèâàåì ôîí íà âåñü áëîê 32 if ($('.cover').length) { 33 $(window).on('load', function(){ 34 $('.cover').each(function(){ 35 var $this = $(this), 36 $parent = $(this).parent() 37 $this.liCover({ 38 parent: $parent, 39 position: 'absolute' 40 }); 41 }); 42 }); 43 } 44 45 // óñòàíàâëèâàåì min-height äëÿ äëÿ îáëàñòè êîíòåíòà ïî âûñîòå áîêîâûõ áàííåðîâ (òîëüêî åñëè îíè îòîáðàæàþòñÿ) 46 $(window).on('load', function(){ 47 var adv_height = Math.max($(".adt-left-col.adDesktop").height(),$(".adt-right-col.adDesktop").height()); 48 if(adv_height) { 49 var style = $('<style>@media screen and (min-width:1590px) { main { min-height: '+adv_height+'px } }</style>'); 50 $('html > head').append(style); 51 } 52 }); 53 54 // placeholder 55 $.fn.placeholder = function(){ 56 var make = function(){ 57 58 if ($(this).hasClass('init')) return; 59 60 var dataPlaceholder = $(this).attr('placeholder'), 61 dataType = $(this).attr('type'), 62 dataValue = $(this).attr('value'); 63 64 $(this) 65 .addClass('init') 66 .removeAttr('placeholder') 67 .attr('data-placeholder', dataPlaceholder) 68 .val(dataValue) 69 .attr('data-value', dataValue) 70 .on('focus', function(){ 71 if ($(this).hasClass('placeholder')) $(this).val('').removeClass('placeholder'); 72 if (dataType == 'password') $(this).attr('type','password'); 73 }) 74 .on('blur', function(){ 75 dataPlaceholder = $(this).attr('data-placeholder'); 76 if ($(this).val() == '') { 77 $(this).val(dataPlaceholder).addClass('placeholder'); 78 if (dataType == 'password') 79 $(this).attr('type','text'); 80 } 81 82 }); 83 84 if ($(this).val() == '') { 85 $(this).val(dataPlaceholder).addClass('placeholder'); 86 if (dataType == 'password') { 87 $(this) 88 .attr('type','text') 89 .attr('data-type','password') 90 } 91 } 92 93 } 94 return this.each(make); 95 }; 96 97 98 // Ïîäêëþ÷àåì placeholder 99 $('input:text, input:password, textarea').placeholder(); 100 101 102 // åñëè íà äåòàëüíîé ñòðàíèöå òîëüêî îäèí èç áëîêîâ íå ïóñòîé - "Íîâîñòè ïî òåìå" èëè "Ãëàâíîå çà 24 ÷àñà", îäèí èç íèõ ïðÿ÷åì è äåëàåì äðóãîé â 2 ñòîëáöà, åñëè îáà ïóñòûå - ïðÿ÷åì çàãîëîâêè 103 var col_count = $('.other-news.two-col-multiple li:has(article)').length; 104 if(col_count==0) { 105 $('.other-news.two-col-multiple p.h2').remove(); 106 } else if(col_count==1) { 107 $('.other-news.two-col-multiple .adt-horizontal').insertAfter('.other-news.two-col-multiple'); 108 $('.other-news.two-col-multiple li:not(:has(article))').remove(); 109 $('.other-news.two-col-multiple p.h2').insertBefore('.other-news.two-col-multiple'); 110 var articles = []; 111 $('.other-news.two-col-multiple article').each(function(){ 112 articles.push( 113 $("<li>").append( 114 $("<div>").addClass("narrow").append($(this)) 115 ) 116 ); 117 }); 118 $('.other-news.two-col-multiple').removeClass("two-col-multiple").addClass("two-col-single").empty(); 119 for(var index in articles) 120 $('.other-news.two-col-single').append(articles[index]); 121 } 122 123 124 $('aside article:last-child, .other-news.two-col-multiple li article:last-child, aside .adt-horizontal:last, aside .adt-vertical:last, main:has(article.detail) .mainbar .adt-horizontal:last').addClass('last'); 125 $('.other-news.two-col li .adt-horizontal').prev('article').addClass('last'); 126 127 $('.other-news.two-col-single li:even:last').find('article').addClass("last"); 128 $('.other-news.two-col-single li:even:last').next().find('article').addClass("last"); 129 130 $('blockquote').append('<i class="bg"/>'); 131 132 133 // header äëÿ òåëåôîíà â âåðòèêàëüíîé îðèåíòàöèè 134 var mobileHeader = $('<div class="mobile-header"/>'), 135 socialHeader = $('header .social').clone(true), 136 navHeader = $('header nav').clone(true), 137 linksHeader = $('header .links').clone(true), 138 logoHeader = $('header .logo').clone(true), 139 dropdownLinkHeader = $('<a href="#" class="link-dropdown"><i></i><i></i><i></i></a>'), 140 blankLink = $('<a href="#" class="link-blank"></a>'); 141 142 logoHeader.find('img').each(function(){ 143 var src = $(this).attr('src').replace('.png','-small.png'); 144 $(this).attr('src', src) 145 }); 146 147 navHeader.find('a').wrapInner('<span/>'); 148 149// logoHeader.prepend('<a href="http://Mil.Press"><span style="color: #db0b11; padding: 0 0 5px;">Mil.Press - 20 ëåò îíëàéí</span></a>'); 150 151 $('header .hhead .wrapper').prepend(logoHeader).prepend(dropdownLinkHeader); 152 153 $('header .search .bt_loop').on('click', function(){ 154 var $closest = $(this).closest('.search'); 155 $closest.addClass('visible'); 156 $('input:text', $closest).focus(); 157 return false;
158 }); 159 160 $('header .search .bt_close').on('click', function(){ 161 $(this).closest('.search').removeClass('visible'); 162 return false; 163 }); 164 165 mobileHeader.append(navHeader).append(socialHeader).append(linksHeader).prependTo('.main-block'); 166 167 $('.main-block').append(blankLink); 168 169 dropdownLinkHeader.on('click', function(){ 170 $('.main-block').toggleClass('show-mobile-header'); 171 return false; 172 }); 173 174 blankLink.on('click', function(){ 175 $('.main-block').removeClass('show-mobile-header'); 176 return false; 177 }); 178 179 // Ïîêàçàòü/ñêðûòü 180 $('.toggle-show dt').on('click', function(){ 181 $(this).next('dd').slideToggle(500); 182 }); 183 184 185 // Ôèêñèðóåì ñîöèëêè 186 function fixedSocial(){ 187 if(!$('.social-container').length) 188 return; 189 var offsetSoc = $('.social-container').offset().top+7, 190 posScrollTop = $(window).scrollTop(), 191 $Soc = $('.social-share'); 192 if (posScrollTop >= offsetSoc && !$Soc.hasClass('fixed')) { 193 $Soc.addClass('fixed'); 194 } else if (posScrollTop < offsetSoc && $Soc.hasClass('fixed')) { 195 $Soc.removeClass('fixed'); 196 } 197 198 } 199 200 $('.social-share').wrap('<div class="social-container"/>'); 201 202 function heightSocial(){ 203 $('.social-container').css('height','auto').height($('.social-share').outerHeight(true)); 204 $('.social-share').width($('.social-container').width()-parseInt($('.social-share').css('margin-left'))); 205 } 206 207 if ($('.social-share').length) { 208 209 heightSocial(); 210 211 $(window).on('load resize', function(){ 212 heightSocial(); 213 }); 214 215 $(window).on('scroll touchmove', function(){ 216 fixedSocial(); 217 }); 218 219 } 220 221 heightEquallyDetail(); 222 $(window).on('load resize', function(){ 223 heightEquallyDetail(); 224 }); 225 226}); 227 228// Îäèíàêîâàîé âûñîòû áëîêè ïðåâüþ íîâîñòåé 229function heightEquallyDetail(){ 230 $('.other-news.two-col-multiple li:first-child .narrow > *').each(function(){ 231 var index = $(this).index(), 232 $articleL = $(this), 233 $articleR = $(this).closest('.other-news').find('li:last-child .narrow > *').eq(index); 234 $articleL.add($articleR).css('height','auto'); 235 var heightL = $(this).height(), 236 heightR = $articleR.height(); 237 if (heightL > heightR) { 238 $articleL.add($articleR).height(heightL); 239 } 240 else if (heightR > heightL) { 241 $articleR.add($articleL).height(heightR); 242 } 243 }); 244 $('.other-news.two-col-single li:nth-child(2n+1)').each(function(){ 245 var $articleOne = $(this).find('article'), 246 $articleTwo = $(this).next().find('article'); 247 $articleOne.add($articleTwo).css('height','auto'); 248 var heightAll = 0, 249 heightOne = $articleOne.height(), 250 heightTwo = $articleTwo.height(); 251 if(heightOne > heightAll) 252 heightAll = heightOne; 253 if(heightTwo > heightAll) 254 heightAll = heightTwo; 255 $articleOne.add($articleTwo).height(heightAll); 256 }); 257 $('.other-news.three-col li:nth-child(3n+1)').each(function(){ 258 var $articleOne = $(this).find('article'), 259 $articleTwo = $(this).next().find('article'), 260 $articleThree = $(this).next().next().find('article'); 261 $articleOne.add($articleTwo).add($articleThree).css('height','auto'); 262 var heightAll = 0, 263 heightOne = $articleOne.height(), 264 heightTwo = $articleTwo.height(), 265 heightThree = $articleThree.height(); 266 if(heightOne > heightAll) 267 heightAll = heightOne; 268 if(heightTwo > heightAll) 269 heightAll = heightTwo; 270 if(heightThree > heightAll) 271 heightAll = heightThree; 272 $articleOne.add($articleTwo).add($articleThree).height(heightAll); 273 }); 274 $('.other-news.four-col li:nth-child(4n+1)').each(function(){ 275 var $articleOne = $(this).find('article'), 276 $articleTwo = $(this).next().find('article'), 277 $articleThree = $(this).next().next().find('article'), 278 $articleFour = $(this).next().next().next().find('article'); 279 $articleOne.add($articleTwo).add($articleThree).add($articleFour).css('height','auto'); 280 var heightAll = 0, 281 heightOne = $articleOne.height(), 282 heightTwo = $articleTwo.height(), 283 heightThree = $articleThree.height(), 284 heightFour = $articleFour.height(); 285 if(heightOne > heightAll) 286 heightAll = heightOne; 287 if(heightTwo > heightAll) 288 heightAll = heightTwo; 289 if(heightThree > heightAll) 290 heightAll = heightThree; 291 if(heightFour > heightAll) 292 heightAll = heightFour;
293 $articleOne.add($articleTwo).add($articleThree).add($articleFour).height(heightAll); 294 }); 295} 296 297/* Countdown removed. It targeted "Mar 31, 2021 15:00:00" and ran on a 298 1s setInterval writing into #topteaser, an element that exists in no 299 template on the site so every tick threw 300 "Cannot set properties of null (setting 'innerHTML')". 301 302 It could never stop itself: the `if (distance < 0) clearInterval(x)` 303 that would have retired it sat *after* the throwing line, so it was 304 never reached. Its #sideteaser write was already commented out. 305 306 pad() and declOfNum() below are left in place nothing else calls them 307 today, but they are harmless generic helpers. */ 308 309function pad(num, size) { 310 var s = num+""; 311 while (s.length < size) s = "0" + s; 312 return s; 313} 314 315function declOfNum(number, words) { 316 return words[(number % 100 > 4 && number % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(number % 10 < 5) ? number % 10 : 5]]; 317}
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.