1var wnd,scrld=0; 2//Menu position 3var wc_width,wc_style,am_width,am_style,wi_width,mm_width; 4 5$(document).ready(function(){ 6 scroller(); 7 shFrame(); 8 if($('.feedback').length>0) 9 { 10 $('.feedback input[type=submit]').addClass('button').addClass('disable').addClass('a_comment').attr('disabled','disabled'); 11 $('.feedback .field_name, .feedback .field_desc, .feedback .field_input').each(function(){ 12 if(($(this).html()=='')||($(this).html()=='<span>*</span>')) 13 $(this).remove(); 14 }); 15 } 16 //console.log($('.feedback input')); 17 18 $('.static_page img').each(function(){ 19 $(this).wrap('<a href="'+$(this).attr('src')+'" class="fancybox"></a>'); 20 }); 21 $('.static_page .fancybox').fancybox(); 22 if($('.ms').is(':visible')) 23 { 24 $('.six_plus').css('bottom',$('.footer table td:first-child').height()-$('.six_plus').height()+25); 25 } 26 if($('.events_for_activity').length>0) 27 { 28 if($('.notgreyclass').length==0) 29 { 30 $('.grey').show(); 31 $('.alahomora').hide(); 32 } 33 } 34if($(window).width()<701) 35{ 36 37 if($('.note_anons').length>0) 38 { 39 if($('.note_anons').html().length<5) 40 { 41 console.log('ok na'); 42 $('.note_anons').css('padding','0 10px 20px'); 43 } 44 } 45} 46if (window!=window.top) {$('.all').css({'opacity':'1'});} 47 var tmp=top.location.href.split('#'); 48 var tmp2=tmp[0].split('/'); 49 if((tmp2[tmp2.length-2]=='activity')&&(tmp.length>1)) 50 { 51 52 var destination=$('a[name='+tmp[1]+']').offset().top-79; 53 var dst1=$('a[name='+tmp[1]+']').offset().top; 54 if($('.am-menu').is(':visible')) 55 { 56 destination=$('a[name='+tmp[1]+']').offset().top-$('.am-menu').outerHeight()-30; 57 } 58 //console.log(destination+' '+$('a[name='+tmp[1]+']').offset().top+' '+$('.headline_activity').offset().top); 59 $("body,html").animate({ scrollTop: destination}, 300 ,function(){ 60 var dst=$('a[name='+tmp[1]+']').offset().top-dst1; 61 $("body,html").scrollTop(destination+dst); 62 }); 63 } 64 65 $('.fancybox, a.[rel=article_images]').fancybox(); 66 //if($(window).outerHeight()>$('body>.all').height()) 67 //{ 68 //$('body>.all').css('min-height',$(window).outerHeight()-38); 69 //$('body>.all').css('min-height','100vh'); 70 //$('body>.all').css('padding-bottom','185px'); 71 //$('body>.all').css('box-sizing','border-box'); 72 //$('.footer').closest('.content').css('position','absolute'); 73 //$('.footer').closest('.content').css('bottom','0'); 74 //} 75 $('body').html($('body').html().replace(/ -- /gi, ' — ')); 76 $(document).keyup(function(e){ 77 //console.log(e.keyCode); 78 if(e.keyCode==27) 79 { 80 $('.hregion span').show() 81 $('.hregion .r_changer').hide(); 82 } 83 }); 84 $.post('/include/getFavorites.php',function(data){ 85 var res=$.parseJSON(data); 86 for(var i=0;i<res.length;i++) 87 { 88 $('.fav[data='+res[i]+']').addClass('added'); 89 $('.fav[data='+res[i]+']').find('span').removeClass('icon-star'); 90 $('.fav[data='+res[i]+']').find('span').addClass('icon-fstar'); 91 } 92 }); 93 $('.hregion .r_name').click(function(){ 94 $(this).hide(); 95 $('.hregion .r_changer input').val($(this).text().trim()); 96 //$(this).css({'left':14,'right':'auto'}); 97 $('.hregion .r_changer').css({'display':'inline-block'},function(){$('.hregion .r_changer input').focus();}); 98 //$(this).fadeOut(500); 99 }); 100 101 102 $('.spoiler').click(function(){ 103 //aler('ok'); 104 $(this).closest('div.spoiler_block').find('div.data').toggle(); 105 }); 106 107 108 109 if($('.notification').length) 110 { 111 console.log($('body').width()+'>'+$('.notification').outerWidth()) 112 if($('body').width()>$('.notification').outerWidth()) 113 { 114 $('.notification').css('border-radius','5px'); 115 } 116 $('.notification.fs img').css('left',$('a.favorites').position().left+$('a.favorites').width()/2+23-parseInt($('.notification img').attr('min'))); 117 $('.notification.ms img').css('left',$('a.favorites').position().left+$('a.favorites').width()/2+3-parseInt($('.notification img').attr('min'))); 118 } 119 if($('#white_container').length) 120 { 121 wc_width=$('#white_container').width(); 122 wc_style=$('#white_container').attr('style'); 123 am_width=$('#activity_menu').width(); 124 am_style=$('#activity_menu').attr('style'); 125 wi_width=$('div.all').width(); 126 mm_width=$('.main_menu').width(); 127 if(am_style==undefined) 128 am_style=''; 129 console.log(am_style); 130 } 131 132 if($('.yellow_block').length>0) 133 { 134 $('.yellow_block').each(function(){ 135 $(this).html('<div class="inner">'+$(this).html()+'<div style="clear:both"></div></div>'); 136 }); 137 138 } 139 $(window).load(function(){ 140 141$('.feedback input, .feedback textarea').on('keyup change',function(){ 142 console.log('ok'); 143 var go=true; 144 console.log('ok'); 145 $('.feedback input, .feedback textarea').each(function(){ 146 if($(this).val().length<1) 147 { 148 console.log($(this).attr('name')); 149 go=false; 150 } 151 }); 152 if(go) 153 { 154 $('.feedback input[type=submit]').removeClass('disable').removeAttr('disabled'); 155 } 156 else 157 {
158 $('.feedback input[type=submit]').addClass('disable').attr('disabled','disabled'); 159 } 160 }); 161 162 if($(window).width()>999) 163 { 164 $('html').css('overflow-x','hidden'); 165 } 166 else 167 { 168 var stp=1; 169 } 170 //$('body, html').css('overflow-x','auto'); 171 if($('.events_for_activity').length) 172 { 173 var d_hgt=$('.events_for_activity').height(); 174 var d_wdt=$('.events_for_activity').width(); 175 $('.events_for_activity').css({'z-index':1,'position':'relative'}); 176 $('.events_for_activity').after('<div id="efa_selection"></div>'); 177 $('#efa_selection').css({ 178 'display':'block', 179 'position':'relative', 180 'height':d_hgt, 181 'width':'110%', 182 'margin-left':'-5%', 183 'margin-top':-(d_hgt+4)+'px'}); 184 if($(window).width()>699) 185 { 186 $('#efa_selection').css({ 187 'margin-bottom':'30px' 188 }); 189 } 190 var k=0; 191 if(!$('.events_for_activity tr.alahomora').is(':visible')) 192 { 193 $('.events_for_activity tr.alahomora').remove(); 194 } 195 $('.events_for_activity tr:visible').each(function(){ 196 k++; 197 console.log($(this).attr('data')); 198 var txt=''; 199 var cls=''; 200 var polig=''; 201 if($(this).attr('data')=='yell') 202 { 203 if($(this).index()==0) 204 { 205 $(this).closest('table').find('thead td').css('border','none'); 206 } 207 console.log('tr_num'+$(this).index()); 208 txt='background-color:#fff18c;'; 209 polig='0 0,0.98 0,1 1,0 1'; 210 cls='class="roundable"'; 211 } 212 if($(this).attr('data')=='now') 213 { 214 if($(this).index()==0) 215 { 216 $(this).closest('table').find('thead td').css('border','none'); 217 } 218 console.log('tr_num'+$(this).index()); 219 220 //txt="background:url('/images/event-selected.svg'); background-size:cover;"; 221 txt='background-color:#e51d26;'; 222 polig='0 0,0.98 0,1 1,0 1'; 223 cls='class="roundable"'; 224 } 225 $('#efa_selection').append('<div style="display:block; height:'+($(this).height()-4)+'px; margin:4px 0 0px;'+txt+'" polig="'+polig+'"" '+cls+' corners="1 1 1 1" ></div>'); 226 }); 227 /*var numbloc=1000; 228 $('#efa_selection div.roundable').each(function(){ 229 numbloc++; 230 drawCorners($(this),numbloc,5); 231 }); 232 numbloc=0;*/ 233 } 234 $('#efa_selection div.roundable').each(function(){ 235 numbloc++; 236 drawCorners($(this),numbloc,5); 237 }); 238 numbloc=0; 239 /*if($('.main_olimp.black span.act_back_arrow').length) 240 { 241 $('#white_container').css('width',wc_width+'px'); 242 $('#white_container').css({'position':'fixed','top':'-185px','margin-left':'-'+($('.activity_img').width()/2)+'px','left':'50%','z-index':'2'}); 243 $('#activity_menu').css({'position':'fixed','top':($('.activity_img').height()-185)+'px','width':am_width,'z-index':'2', 'background-color':'#fff'}); 244 //$('#activity_menu table').css('border-bottom','1px solid #ccc'); 245 $('.white_icon_container').hide(); 246 if($('#activity_img_after').length==0) 247 { 248 $('#white_container').after('<div id="activity_img_after" style="display:block; height:'+($('.activity_img').height()-265+$('#activity_menu').height())+'px"></div>'); 249 } 250 }*/ 251 if($('.all').width()>=$(window).width()) 252 { 253 $('#tlink0').attr('corner','0 1 0 0'); 254 $('#tlink4').attr('corner','0 0 1 0'); 255 } 256 else 257 { 258 $('#tlink0').attr('corner','0 1 1 0'); 259 $('#tlink4').attr('corner','0 1 1 0'); 260 } 261 numbloc=700; 262 $('.note_top_image, .note_headline_bg, .participate, #reklama, .grey_div, .publication_item, .org_contacts_for_event, .podborka_image, .search_otb, .choose_olimps').each(function(){ 263 var l1=5; 264 if($(this).attr('corner')==undefined) 265 { 266 $(this).attr('corner','1 1 1 1'); 267 $(this).attr('polig',img_poligons[c%img_poligons.length]); 268 c++; 269 } 270 else 271 { 272 if($(this).width()>=$(window).width()) 273 l1=0; 274 } 275 drawCorners($(this),numbloc,l1); 276 numbloc++; 277 278 }); 279 console.log('resizing...'); 280 //resizeBlocks(); 281 console.log('resizing...'); 282 resizeBlocks(); 283 /*$('img').each(function(){ 284 $(this).attr('src',$(this).attr('src_pl')); 285 });*/ 286 $('.all').animate({'opacity':'1'},100); 287 }); 288 289 290 $('.liker').click(function(){ 291 var t=$(this).attr('id').split('_'); 292 var el=$(this); 293 var del=0; 294 console.log('liker'); 295 if(parseInt(t[1])==0) 296 del=1; 297 $.post('/include/favorite.php',{id:t[2],del:del},function(data) { 298 if(data=='error') autorization(); 299 else 300 {
301 if(del==0) 302 { 303 yaCounter46311342.reachGoal('izbrannoe_list'); 304 //console.log('ÐеÑÑика ебаÑиÑ!'); 305 } 306 $('#Layer_'+((parseInt(t[1])+1)%2)+'_'+t[2]).css('display','inline-block'); 307 if((el.attr('favpage')=='1')&&(top.location.href.indexOf('favorites')>-1)) 308 { 309 if(parseInt(t[1])==0) 310 { 311 el.closest('.fav_olimp').find('.o-block').css({'filter':'grayscale(100%)','opacity':'0.2'}); 312 el.closest('.fav_olimp').find('td:nth-child(2)').css({'display':'none'}); 313 el.closest('.fav_olimp').find('.none_a').css({'padding-right':'0'}); 314 //el.closest('.fav_olimp').find('.none_a span').css(); 315 el.closest('.fav_olimp').find('.timeline, .fav_news, .red, .liker, .rait_text, .pl_rating').hide(); 316 el.closest('.fav_olimp').removeClass('new_data_fav'); 317 el.closest('.fav_olimp').find('.il_be_back, .white_grad').show(); 318 } 319 else 320 { 321 322 el.closest('.fav_olimp').find('.o-block').css({'filter':'grayscale(0%)','opacity':'1'}); 323 el.closest('.fav_olimp').find('td:nth-child(2)').css({'display':'table-cell'}); 324 el.closest('.fav_olimp').find('.timeline, .fav_news, .red, .liker[data=1], .rait_text, .pl_rating').show(); 325 el.closest('.fav_olimp').find('.il_be_back, .white_grad').hide(); 326 el.closest('.fav_olimp').find('.none_a').css({'padding-right':'80px'}); 327 } 328 } 329 el.hide(); 330 } 331 }); 332 333 334 335 }); 336 337 $('.il_be_back').click(function(){ 338 var t=$(this).attr('idi').split('_'); 339 var el=$(this); 340 var del=0; 341 $.post('/include/favorite.php',{id:t[2],del:del},function(data) { 342 if(data=='error') autorization(); 343 else 344 { 345 if(del==0) 346 { 347 yaCounter46311342.reachGoal('izbrannoe_list'); 348 } 349 if((el.attr('favpage')=='1')&&(top.location.href.indexOf('favorites')>-1)) 350 { 351 el.closest('.fav_olimp').find('.o-block').css({'filter':'grayscale(0%)','opacity':'1'}); 352 el.closest('.fav_olimp').find('td:nth-child(2)').css({'display':'table-cell'}); 353 el.closest('.fav_olimp').find('.timeline, .fav_news, .red, .liker[data=1], .rait_text, .pl_rating').show(); 354 el.closest('.fav_olimp').find('.il_be_back, .white_grad').hide(); 355 el.closest('.fav_olimp').find('.none_a').css({'padding-right':'80px'}); 356 } 357 el.hide(); 358 $('#Layer_'+((parseInt(t[1])+1)%2)+'_'+t[2]).css('display','inline-block'); 359 } 360 }); 361 362 }); 363 364 $('#c_textarea').placeholder(); 365 if($('#activity_menu .a_menu').length) 366 { 367 /*if($(window).scrollTop()>260) 368 { 369 //$('#white_container').css('width',wc_width+'px'); 370 //$('#white_container').css({'position':'fixed','top':'-185px','margin-left':'-'+($('.activity_img').width()/2)+'px','left':'50%','z-index':'2'}); 371 $('#activity_menu').css({'position':'fixed','top':($('.activity_img').height()-185)+'px','width':am_width,'z-index':'2', 'background-color':'#fff'}); 372 $('#activity_menu table').css('border-bottom','1px solid #ccc'); 373 $('#act_name_in_menu').show(); 374 //$('.white_icon_container').hide(); 375 //if($('#activity_img_after').length==0) 376 //{ 377 // $('#white_container').after('<div id="activity_img_after" style="display:block; height:'+($('.activity_img').height()+$('#activity_menu').height()+16)+'px"></div>'); 378 //} 379 } 380 else 381 { 382 //$('#white_container').attr('style',wc_style);//css({'position':'relative','top':'auto','margin-left':'auto','left':'auto'}); 383 $('#activity_menu').attr('style',am_style);//css({'position':'relative','top':'auto','margin-left':'auto','width':'auto'}); 384 $('#activity_menu table').css('border-bottom','1px solid #fff'); 385 $('#act_name_in_menu').hide(); 386 //if($('#activity_img_after').length>0) 387 // $('#activity_img_after').remove(); 388 }*/ 389 } 390 391 /*$('.publ_name').mouseenter(function(){ 392 $(this).closest('.block_inner').find('.type').css('color','#e11000'); 393 }); 394 395 $('.publ_name').mouseout(function(){ 396 $(this).closest('.block_inner').find('.type').css('color','#006cd9'); 397 });*/ 398 399 $('#activity_menu .a_menu, .color.a_menu').click(function(){ 400 var tmp=$(this).attr('href').split('#'); 401 if(tmp[1]=='sendreview') 402 console.log('ok епÑ'); 403 var destination=$('a[name='+tmp[1]+']').offset().top-$('.activity_menu').outerHeight()-$('#scroll_helper').outerHeight(); 404 if($('.am-menu').is(':visible')) 405 { 406 destination=$('a[name='+tmp[1]+']').offset().top-$('.am-menu').outerHeight()-30; 407 } 408 var dst1=$('a[name='+tmp[1]+']').offset().top; 409 console.log(destination+' '+$('a[name='+tmp[1]+']').offset().top+' '+$('.headline_activity').offset().top); 410 var minus=0; 411 if(top.location.href.split('#').length==1) 412 minus=30; 413 else 414 minus=0; 415 $("body,html").animate({ scrollTop: destination}, 300 ,function(){ 416 //var dst=$('a[name='+tmp[1]+']').offset().top-dst1; 417 destination=$('a[name='+tmp[1]+']').offset().top-$('.activity_menu').outerHeight()-$('#scroll_helper').outerHeight(); 418 if($('.am-menu').is(':visible')) 419 { 420 destination=$('a[name='+tmp[1]+']').offset().top-$('.am-menu').outerHeight()-30; 421 } 422 $("body,html").animate({ scrollTop: destination}, 0); 423 }); 424 //return false;
425 }); 426 if($('a[name=features]').length) 427 { 428 $('body').prepend('<a name="start"></a>'); 429 $('body').append('<a name="finish"></a>'); 430 } 431 $(window).scroll(function(){ 432 //console.log('scrol!!!'); 433 scroller(); 434 }); 435 436 $(window).resize(function(){ 437 $('.olimp_img').each(function() { 438 $('img[clone=clone]').css({'left':$(this).offset().left,'top':$(this).offset().top}); 439 }); 440 if($('.ms').is(':visible')) 441 { 442 $('.six_plus').css('bottom',$('.footer table td:first-child').height()-$('.six_plus').height()+25); 443 } 444 if($('.notification').length) 445 { 446 if($('body').width()>$('.notification').outerWidth()) 447 { 448 $('.notification').css('border-radius','5px'); 449 } 450 else 451 $('.notification').css('border-radius','0px'); 452 $('.notification img').css('left',$('a.favorites').position().left+$('a.favorites').width()/2+23-parseInt($('.notification img').attr('min'))); 453 } 454 var d=wi_width-$('div.all').width(); 455 wi_width=$('div.all').width(); 456 wc_width=wc_width-(d); 457 am_width=am_width-(d); 458 mm_width=mm_width-(d); 459 scroller(); 460 if($(window).width()>999) 461 { 462 $('body, html').css('overflow-x','hidden'); 463 } 464 else 465 $('body, html').css('overflow-x','auto'); 466 console.log(mm_width); 467 /*if($('#white_container').length>0) 468 { 469 $('.main_menu').css('width',mm_width+'px'); 470 if($(window).scrollTop()>260) 471 { 472 473 $('#white_container').css('width',wc_width+'px'); 474 $('#white_container').css({'margin-left':'-'+($('#white_container').width()/2)+'px'}); 475 $('#activity_menu').css('width',am_width+'px'); 476 } 477 }*/ 478 if($('.all').width()>=$(window).width()) 479 { 480 $('#tlink0').attr('corner','0 1 0 0'); 481 $('#tlink4').attr('corner','0 0 1 0'); 482 } 483 else 484 { 485 $('#tlink0').attr('corner','0 1 1 0'); 486 $('#tlink4').attr('corner','0 1 1 0'); 487 } 488 resizeBlocks(); 489 numbloc=700; 490 $('.note_top_image, .note_headline_bg, .participate, #reklama, .publication_item, .org_contacts_for_event').each(function(){ 491 var l1=5; 492 if($(this).attr('corner')==undefined) 493 { 494 $(this).attr('corner','1 1 1 1'); 495 $(this).attr('polig',img_poligons[c%img_poligons.length]); 496 c++; 497 } 498 else 499 { 500 if($(this).width()>=$(window).width()) 501 l1=0; 502 } 503 drawCorners($(this),numbloc,l1); 504 numbloc++; 505 506 }); 507 }); 508 $('.search a').click(function(){ 509 if(!$(this).hasClass('close')) 510 { 511 //if(yaCounter46311342!=undefined) 512 // yaCounter46311342.reachGoal('search'); 513 /*if($('.fs').is(':visible')) 514 {*/ 515 $('.main_menu').addClass('search-mode'); 516 $('.search').css('text-align','right'); 517 $('#search').css('width','0'); 518 $('#search').css('display','inline-block'); 519 $('#search').animate({'width':$('.search').width()-$('.search>a').width()-20},100,function(){ 520 var t=($(this).width()/$('.main_menu').width())*100; 521 console.log(t); 522 523 }); 524 /*} 525 else 526 { 527 $('.main_menu').css('grid-template-areas','"logo search search search search search search search" "menu menu menu menu menu menu menu menu"'); 528 $('.main_menu .morda, .main_menu .favorites').hide(); 529 $('.search form').css('width','0%'); 530 $('.search form').css('display','block'); 531 $('.search form input[name=q]').css('display','none'); 532 $('.search form .close').css('display','none'); 533 $('.search form').animate({'width':$('.search').width()-20},110,function(){ 534 $(this).css('left',$(this).position().left); 535 $(this).css('right',0); 536 $(this).css('position','absolute'); 537 $(this).css('width','auto'); 538 }); 539 $('.main_menu').addClass('search-mode'); 540 $('.search').css('text-align','right'); 541 $('#search').css('width','0'); 542 $('#search').css('display','inline-block'); 543 $('#search').animate({'width':$('.search').width()-$('.search>a').width()-20},100,function(){ 544 var t=($(this).width()/$('.main_menu').width())*100; 545 console.log(t); 546 547 }); 548 }*/ 549 setTimeout(function(){ 550 551 $('.search form input[name=q]').fadeIn(); 552 $('.search form .close').fadeIn(); 553 $('.search form input[name=q]').focus(); 554 },10); 555 556 } 557 }); 558 $('.search form .close').click(function(){ 559 if($('.fs').is(':visible')) 560 { 561 $('.search form').hide(); 562 $('.search').css('left','auto'); 563 $('.main_menu').removeClass('search-mode'); 564 //$('.search').animate({'width':$(this).closest('div').find('a svg').width()},100); 565 } 566 else 567 { 568 $('.search form').hide(); 569 $('.main_menu').removeClass('search-mode'); 570 //$('.main_menu').css('grid-template-areas','"logo search search search search search favorite user" "menu menu menu menu menu menu menu menu"'); 571 //$('.main_menu .morda, .main_menu .favorites').show(); 572 } 573 }); 574 $('.search form input[name=q]').keyup(function(e){ 575 yaCounter46311342.reachGoal('search2'); 576 if (!(e.keyCode === 27)) { 577 $.post('/include/fast_search.php',{q:$(this).val()},function(data){ 578 if(data.length>10) 579 { 580 $('#fast_search').html(data); 581 $('#fast_search').show(); 582 if(!$('.fs').is(':visible')) 583 { 584 $('#fast_search').css('left',-$('input[name=q]').offset().left); 585 $('#fast_search').css('width',$(window).width()); 586 } 587 } 588 else 589 {
590 $('#fast_search').html(''); 591 $('#fast_search').hide(); 592 } 593 }); 594 } 595 }); 596 $('.blocks .olimp_img').each(function(){ 597 var el=$(this).clone(); 598 $(this).closest('.block').append(el); 599 $(this).closest('.block').find('.block_inner').addClass('bimg-padding'); 600 console.log('ok '+$(this).closest('.block').find('.block_inner').attr('style')); 601 $(this).remove(); 602 }); 603 604 $('.participate').click(function(){ 605 if(!$('.participate').hasClass('grey_medium_bg')) mp_show(); 606 }); 607 608 $('#krest_ept').click(function(){ 609 $('#megapop').fadeOut(10); 610 $('html, body').css('overflow','auto'); 611 var pn=window.location.pathname.split('?'); 612 613 614 history.pushState('', '', 'https://'+window.location.hostname+pn[0]); 615 }); 616 $('.y_changer.y_news, .y_changer').click(function(){ 617 var el=$(this).closest('div').find('#years_list'); 618 if($(this).attr('resize')!='0') 619 el.css({'width':$(this).closest('div').width(),'top':$(this).closest('div').height()+10,left:0}); 620 else 621 el.css({'top':$(this).closest('div').height()+10,left:20}); 622 el.slideToggle(); 623 el.find('a').css('float','none'); 624 }); 625 $('.fav').click(function(){ 626 var el=$(this).find('span').clone(); 627 var el2=$(this).find('span'); 628 var del=0; 629 if($(this).hasClass('added')) 630 del=1; 631 //top.location.href="/favorites"; 632 //else 633 //{ 634 $.post('/include/favorite.php',{id:$(this).attr('data'),del:del},function(data){ 635 if(data=='error') autorization(); 636 else 637 { 638 console.log(data); 639 el.appendTo('body'); 640 if(del==0) 641 { 642 el.css({'position':'absolute','top':el2.offset().top,'left':el2.offset().left,'color':'#e11000'}); 643 el.removeClass('icon-star'); 644 el.addClass('icon-fstar'); 645 el.animate({'top':$('.favorites').offset().top+18,'left':$('.favorites').offset().left+4},250,function(){el.remove();}); 646 el2.removeClass('icon-star'); 647 el2.addClass('icon-fstar'); 648 el2.closest('.fav').addClass('added'); 649 yaCounter46311342.reachGoal('izbrannoe_main'); 650 } 651 else 652 { 653 el.remove(); 654 //el.css({'position':'absolute','top':$('.favorites').offset().top+18,'left':$('.favorites').offset().left+4}); 655 //el.animate({'top':el2.offset().top,'left':el2.offset().left},250,function(){el.remove();}); 656 el2.addClass('icon-star'); 657 el2.removeClass('icon-fstar'); 658 el2.closest('.fav').removeClass('added'); 659 } 660 } 661 }); 662 //} 663 }); 664 $('.to_fav_icon_in_menu_line').click(function(){ 665 var el=$(this).clone(); 666 var el2=$(this); 667 var del=0; 668 if($(this).hasClass('added')) 669 del=1; 670 //top.location.href="/favorites"; 671 //else 672 //{ 673 $.post('/include/favorite.php',{id:$(this).attr('data'),del:del},function(data){ 674 if(data=='error') autorization(); 675 else 676 { 677 if(del==0) 678 { 679 //console.log(data); 680 //el.appendTo('body'); 681 el2.addClass('added'); 682 //el.css({'position':'absolute','top':el2.offset().top,'left':el2.offset().left,'color':'#e11000'}); 683 //el.animate({'top':$('.favorites').offset().top+18,'left':$('.favorites').offset().left+4},250,function(){el.remove();}); 684 yaCounter46311342.reachGoal('izbrannoe_str'); 685 } 686 else 687 { 688 el2.removeClass('added'); 689 } 690 } 691 }); 692 //} 693 }); 694 $('.popup_closer').click(function(){$('#shadow').hide();}); 695 var img_poligons=new Array( 696 '0.008 0.0,0.98 0.0,1.0 1.0,0.01 1.0', 697 '0.0 0.0,1.0 0.0,0.995 1.0,0.002 1.0'); 698 var c=0; 699 var numbloc=500; 700 $('.standart_text_block img,.images_block img').each(function(){ 701 $(this).attr('polig',img_poligons[c%img_poligons.length]); 702 $(this).attr('corner','1 1 1 1'); 703 drawCorners($(this),numbloc,5); 704 numbloc++; 705 c++; 706 }); 707 $('.note_headline_bg').each(function(){ 708 drawCorners($(this),numbloc,5); 709 numbloc++; 710 711 }); 712 drawCorners($('.send_review'),numbloc,5); 713 numbloc++; 714 var numbloc_rt=numbloc; 715 716 $('.white_icon_container').each(function(){ 717 drawCorners($(this),numbloc,5); 718 numbloc++; 719 $('.white_icon_container div, .white_icon_container img').each(function(){ 720 drawCorners($(this),numbloc,5); 721 numbloc++; 722 }); 723 }); 724 725 $('.div_container_sel_sub a').click(function(){ 726 if(!($(this).closest('.div_container_sel_sub').find('.div_selected_subjects').is(':visible'))) 727 { 728 $('.div_selected_subjects').hide(); 729 $(this).closest('.div_container_sel_sub').find('.div_selected_subjects').slideDown();
730 } 731 else 732 { 733 $(this).closest('.div_container_sel_sub').find('.div_selected_subjects').slideUp(); 734 } 735 }); 736 $(document).click(function(event) { 737 if (!($(event.target).closest(".search").length)) 738 { 739 //console.log($(event.target).closest(".search").length); 740 $('#fast_search').html(''); 741 $('#fast_search').hide(); 742 $('.search form .close').trigger('click'); 743 event.stopPropagation(); 744 } 745 746 747 748 //console.log('t_years: '+$(event.target).closest("#t_years").length); 749 /*if (!($(event.target).closest("#t_years").length)) 750 { 751 //console.log($(event.target).closest(".search").length); 752 //$('#fast_search').html(''); 753 //$('#fast_search').hide(); 754 //$('.search form .close').trigger('click'); 755 $('#t_years div').hide(); 756 event.stopPropagation(); 757 }*/ 758 //console.log('ev'+$(".div_container_sel_sub").has(event.target).length); 759 }); 760 $(document).mouseup(function(e){ 761 //console.log('ev'+$(".div_container_sel_sub").has(e.target).length); 762 var elem=$(".div_container_sel_sub"); 763 if(e.target!=elem[0]&&!elem.has(e.target).length){ 764 $('.div_selected_subjects').hide(); 765 e.stopPropagation(); 766 } 767 elem=$("#t_years"); 768 if(e.target!=elem[0]&&!elem.has(e.target).length){ 769 770 $('#t_years div').hide(); 771 e.stopPropagation(); 772 } 773 elem=$("#t_years2"); 774 if(e.target!=elem[0]&&!elem.has(e.target).length){ 775 776 $('#t_years2 div').hide(); 777 e.stopPropagation(); 778 } 779 elem=$(".hregion"); 780 if(e.target!=elem[0]&&!elem.has(e.target).length){ 781 782 $('.hregion span').show() 783 $('.hregion .r_changer').hide(); 784 785 e.stopPropagation(); 786 } 787 elem=$(".regs_list"); 788 if(e.target!=elem[0]&&!elem.has(e.target).length){ 789 790 $('.regs').hide(); 791 $('.results_counter2 .regs').show(); 792 e.stopPropagation(); 793 } 794 elem=$("#region_filter"); 795 elem2=$("[data=region]"); 796 if((e.target!=elem[0]&&!elem.has(e.target).length)&&(e.target!=elem2[0]&&!elem2.has(e.target).length)){ 797 if($('#region_filter').is(':visible')) 798 { 799 $('#region_filter').hide(); 800 if($('a[data=region]').hasClass('hover')) $('a[data=region]').removeClass('hover'); else $('a[data=region]').addClass('hover'); 801 e.stopPropagation(); 802 } 803 } 804 }); 805 $(document).keyup(function(e) { 806 //if (e.keyCode === 13) $('.save').click(); // enter 807 if (e.keyCode === 27) { 808 $('#fast_search').html(''); 809 $('#fast_search').hide(); 810 $('.search form .close').trigger('click'); 811 } 812 }); 813 $('.send_review .mark_line a').click(function(){ 814 var name=$(this).closest('span').attr('data'); 815 $('span.mark_line[data='+name+'] a').removeClass('selected'); 816 $(this).addClass('selected'); 817 $('.send_review input[name='+name+']').val($(this).attr('data')); 818 testActRev(); 819 }); 820 $('.send_review .who_are_you a').click(function(){ 821 var name='user_status'; 822 $('span.who_are_you a').removeClass('selected'); 823 $(this).addClass('selected'); 824 $('.send_review input[name='+name+']').val($(this).html()); 825 testActRev(); 826 }); 827 $('.send_review .who_are_you input').keyup(function(){ 828 var name='user_status'; 829 $('span.who_are_you a').removeClass('selected'); 830 $('.send_review input[name='+name+']').val($(this).val()); 831 testActRev(); 832 }); 833 $('#review_text').keyup(function(){ 834 drawCorners($('.send_review'),numbloc,5); 835 testActRev(); 836 }); 837 $('.send_review .button').click(function(){ 838 if(!($(this).hasClass('disable'))) 839 { 840 var dat={ 841 'score_org':parseInt($('.send_review input[name=score_org]').val()), 842 'score_tasks':parseInt($('.send_review input[name=score_tasks]').val()), 843 'user_status':$('.send_review input[name=user_status]').val(), 844 'text_org':$('.send_review #review_text').html(), 845 'activity':parseInt($('.send_review input[name=activity]').val()) 846 }; 847 $.post('/include/activity/send_review.php',dat,function(data){ 848 //console.log(data); 849 $('.send_review form').html(data); 850 if(!$('.ms').is(':visible')) 851 $('#letadlo').show(); 852 $('.send_review .title').remove(); 853 /*$('span.mark_line a').removeClass('selected'); 854 $('.send_review .who_are_you input').val(''); 855 $('span.who_are_you a').removeClass('selected'); 856 $('#review_text').html(''); 857 $('.send_review .button').addClass('disable');*/ 858 }); 859 } 860 }); 861 $('#show_all_regions').click(function(){ 862 863 if($(this).html().split(':').length==1) 864 { 865 $(this).html($(this).html()+':'); 866 $(this).closest('span').find('.hidden').css('display','block');//removeClass('hidden'); 867 } 868 else 869 { 870 var t=$(this).html().split(':'); 871 $(this).html(t[0]); 872 $(this).closest('span').find('.hidden').css('display','none');//removeClass('hidden'); 873 } 874 }); 875}); 876 877function scroller() 878{ 879 //if($(window).scrollTop()>270) 880 if($(window).scrollTop()>200) 881 { 882 $('.totop').show();
883 var ttb=20; 884 if($(window).scrollTop()-($('.footer').offset().top-$(window).height()-60)>0) 885 ttb=$(window).scrollTop()-($('.footer').offset().top-$(window).height()-60); 886 $('.totop').css('bottom',ttb); 887 console.log($('.totop').offset().top); 888 } 889 else 890 { 891 $('.totop').hide(); 892 } 893 if($('#activity_menu').length>0) 894 { 895 if($('#scroll_helper').is(':visible')) 896 { 897 var top_marker=$('#scroll_helper').offset().top; 898 } 899 else 900 { 901 var top_marker=$('#activity_menu').offset().top; 902 } 903 if($(window).scrollTop()>top_marker) 904 { 905 //console.log('fixing'); 906 $('#activity_menu').addClass('am-fixed');//css({'position':'fixed','padding-top':'23px','top':0,'width':$('.menu_for_inner').width(),'z-index':'2', 'background-color':'#fff'}); 907 //$('#activity_menu table').css('border-bottom','1px solid #ccc'); 908 //$('#act_name_in_menu').show(); 909 910 $('#scroll_helper').show(); 911 } 912 else 913 { 914 //console.log('ok'); 915 $('#activity_menu').removeClass('am-fixed');//attr('style','background: #fff; max-width: 1340px; min-width: 940px;');//css({'position':'relative','top':'auto','margin-left':'auto','width':'auto'}); 916 //$('#activity_menu table').css('border-bottom','1px solid #fff'); 917 //$('#act_name_in_menu').hide(); 918 $('#scroll_helper').hide(); 919 } 920 var s_top = $(window).scrollTop(); 921 var anch=new Array('start','new','participation','features','preparation','discussion','reviews','finish'); 922 var anchors=new Array(); 923 for(var i=0;i<anch.length;i++) 924 { 925 if($('a[name='+anch[i]+']').length) 926 { 927 anchors[anchors.length]=anch[i]; 928 } 929 } 930 //console.log(anchors); 931 if($('a[name=start]').length) 932 { 933 for(var i=0;i<anchors.length-1;i++) 934 { 935 //console.log(s_top+'>'+($("a[name="+anchors[i]+"]").offset().top-80-200)+' '+anchors[i]+' '+s_top+'<'+($("a[name="+anchors[i+1]+"]").offset().top-80-200)+' '+anchors[i+1]+' '+($("a[name=features]").offset().top-80-200)); 936 if((s_top > $("a[name="+anchors[i]+"]").offset().top-80-200)&&(s_top < $("a[name="+anchors[i+1]+"]").offset().top-80-200)) 937 { 938 if(!($('#activity_menu a[href=#'+anchors[i]+']').hasClass('selected'))) 939 { 940 941 $('#activity_menu a').removeClass('selected'); 942 $('#activity_menu a[href=#'+anchors[i]+']').addClass('selected'); 943 } 944 } 945 946 } 947 } 948 } 949 950} 951 952function auth(link) 953 { 954 var twnd=top.location; 955 wnd = window.open(link, 'autorization', "width=600,height=500"); 956 957 958 } 959function closeWindow() 960{ 961 wnd.close(); 962 top.location.reload(); 963} 964function showPopup(title,text) 965{ 966 $('#popup_content').html(text); 967 $('#shadow #popup').css('border-radius','5px'); 968 $('#shadow').fadeIn(); 969 //function(){drawCorners($('#shadow #popup'),10000,5);} 970} 971 972function autorization() 973{ 974 $.post('/include/autorization.php',function(data){ 975 showPopup('ÐвÑоÑизаÑиÑ',data); 976 }); 977} 978 979function autorization2(el,l) 980{ 981 if(l!=1) 982 { 983 if(el.hasClass('small')) 984 { 985 $('#login_block').css({top:el.offset().top-2,right:parseInt(el.css('right'))+22}); 986 } 987 else 988 { 989 $('#login_block').css({top:el.offset().top+43,right:parseInt(el.css('right'))+22}); 990 } 991 } 992 else 993 { 994 if(el.hasClass('small')) 995 { 996 $('#login_block').css({top:el.offset().top-4,right:parseInt(el.css('right'))+21}); 997 } 998 else 999 { 1000 $('#login_block').css({top:el.offset().top+1,right:parseInt(el.css('right'))+22}); 1001 } 1002 } 1003 $('#login_block').css('display','block'); 1004 $('#login_block').addClass('exitlb'); 1005 1006 $(document).mouseup(function (e) { 1007 var container = $("#login_block"); 1008 var container2 = el; 1009 if ((container.has(e.target).length === 0)&&(container2.has(e.target).length === 0)){ 1010 container.hide(); 1011 } 1012 }); 1013 1014} 1015 1016function resizeBlocks2() 1017{ 1018 if(confirm('Ð Ñе, Ñак не оÑенÑ?')) 1019 resizeBlocks(); 1020} 1021 1022function resizeBlocks() 1023{ 1024 $('.blocks table td').each(function(){ 1025 if($(this).attr('colspan')!=undefined) 1026 { 1027 $(this).css({'grid-column':'span '+$(this).attr('colspan'),'width':'auto'}); 1028 } 1029 else 1030 { 1031 if($(this).attr('span')!=undefined) 1032 { 1033 $(this).css({'grid-column':'span '+$(this).attr('span'),'width':'auto'}); 1034 } 1035 } 1036 }); 1037 1038 $('.blocks table tr').each(function(){ 1039 var k=0; 1040 $(this).find('td').each(function(){ 1041 if($(this).attr('colspan')!=undefined) 1042 { 1043 k=k+parseInt($(this).attr('colspan')); 1044 } 1045 else 1046 {
1047 if($(this).attr('span')!=undefined) 1048 { 1049 k=k+parseInt($(this).attr('span')); 1050 } 1051 else 1052 k++; 1053 } 1054 }); 1055 $(this).css({'grid-template-columns':'repeat('+k+',1fr)'}); 1056 1057 }); 1058 1059 if($('.blocks td').length>0) 1060 { 1061 /*$('.blocks td .block').css('height','auto'); 1062 $('.subject_block .block_inner').each(function(){ 1063 var pad=0; 1064 $(this).css('padding',pad+'px 10px'); 1065 }); 1066 if($('.most_important_articles').length) 1067 { 1068 if($(window).width()>1400) 1069 { 1070 $('.most_important_articles td:first-child a').css('border-bottom-left-radius','5px'); 1071 $('.most_important_articles td:last-child a').css('border-bottom-right-radius','5px'); 1072 } 1073 else 1074 { 1075 $('.most_important_articles td:first-child a').css('border-bottom-left-radius','0px'); 1076 $('.most_important_articles td:last-child a').css('border-bottom-right-radius','0px'); 1077 } 1078 } 1079 //$('.block_inner').find('.subject_tags').closest('.olimpiada').find('.block_inner').removeAttr('style'); 1080 $('.block_inner').find('.subject_tags').closest('.olimpiada').find('.block_inner').css({'padding-bottom':'66px'}); 1081 //console.log($('.block_inner').find('.subject_tags').closest('.olimpiada').find('.block_inner').css('padding-bottom')); 1082 $('.block_inner').find('.subject_tags').closest('.task_block').find('.block_inner').css('padding-bottom','66px'); 1083 var padleft=0; 1084 var padrights=0; 1085 var padright=0; 1086 var padtop=new Array(); 1087 $('.blocks td .block').each(function(){ 1088 if($(this).attr('pad')==undefined) 1089 var pad=new Array(0,0,0,0); 1090 else 1091 var pad=$(this).attr('pad').split(' '); 1092 padt=0+$(this).closest('td').height()*pad[0]/100; 1093 padb=0+$(this).closest('td').height()*pad[2]/100; 1094 padr=0+$(this).closest('td').width()*pad[1]/100; 1095 padl=0+$(this).closest('td').width()*pad[3]/100; 1096 if($(this).closest('td').index()==0) 1097 { 1098 if(padl>padleft) 1099 padleft=padl; 1100 } 1101 1102 if($(this).closest('tr').index()==0) 1103 { 1104 var el=$(this).closest('div.blocks:not(.otbivka)'); 1105 var els=$('div.blocks:not(.otbivka)') 1106 if(padtop[els.index(el)]!=undefined) 1107 { 1108 if(padtop[els.index(el)][0]<padt) 1109 padtop[els.index(el)][0]=padt; 1110 } 1111 else 1112 padtop[els.index(el)]=new Array(padt,el); 1113 } 1114 1115 if($(this).closest('td').index()+1==$(this).closest('td').closest('tr').find('td').length) 1116 { 1117 if(padr>padright) 1118 padright=padr; 1119 //console.log($(this).attr('class')); 1120 1121 1122 } 1123 //padb 1124 $(this).css('padding',padt+'px '+padr+'px '+0+'px '+padl+'px '); 1125 $(this).find('.block_inner').css({'padding-top':'20px','padding-bottom':'40px'}); 1126 if($(this).hasClass('task_block')) 1127 { 1128 $(this).find('.block_inner').css({'padding-top':'20px','padding-bottom':'40px'}); 1129 } 1130 $(this).css('width','auto'); 1131 //$(this).css('height',$(this).closest('td').height()+'px'); 1132 }); 1133 //console.log('PadTop:'); 1134 //console.log(padtop); 1135 for(var i=0;i<padtop.length;i++) 1136 { 1137 padtop[i][1].find('tr:first-child td .block').css('padding-top',padtop[i][0]+'px'); 1138 //padtop[i][1].find('tr:first-child td .block').each(function(){console.log($(this));}); 1139 //console.log(padtop[i][1].find('tr:first-child .block').length+' '+i); 1140 } 1141 //console.log($('div.blocks:not(.otbivka)').length); 1142 //console.log(padleft); 1143 //console.log(padright); 1144 1145 $('.main_menu').css('width','auto'); 1146 $('.main_menu').css('min-width','900px'); 1147 //$('.main_menu').css('width',$('.main_menu').width()-2*(padleft-6)); 1148 //$('.main_menu').css('padding-left',(padleft-11)+'px'); 1149 //$('.main_menu').css('padding-right',(padright-11)+'px'); 1150 //$('.main_menu .search').css('right',45+(padright-11)+'px'); 1151 $('.footer').css({'padding-left':(padleft-11)+'px','padding-right':(padright-11)+'px'}); 1152 $('#tlink0').css('background-position',(padleft+19)+'px 2px'); 1153 $('#tlink0').css('padding-left',(padleft+19+5+66)+'px'); 1154 $('.blocks table tr td:first-child .block').css('padding-left',padleft+'px'); 1155 $('.blocks table tr td:last-child .block').css('padding-right',padright+'px'); 1156 //console.log(padrights); 1157 1158 $('#tlink4').css('padding-right',(padright+9)+'px'); 1159 /*$('.blocks td .block').each(function() 1160 { 1161 1162 if($(this).hasClass('olimpiada')) 1163 { 1164 if($(this).closest('td').index()+1==$(this).closest('td').closest('tr').find('td').length) 1165 { 1166 var pos=$(this).attr('topc').split(' '); 1167 //var top=$(this).innerHeight()*parseInt(pos[1])/100; 1168 //console.log($(this).innerWidth()); 1169 //console.log($(this).find('.fav').position().left+' '+$(this).find('.fav').width()); 1170 var right=10-(($(this).innerWidth()-$(this).find('.block_inner').innerWidth())-($(this).innerWidth()-$(this).innerWidth()*parseInt(pos[0])/100)); 1171 //console.log(padr+' '+padr2); 1172 if(-right>$(this).find('.fav').width()) 1173 { 1174 right=-$(this).find('.fav').width()+($(this).find('.block_inner').innerWidth()-$(this).find('.block_inner').width())/2; 1175 } 1176 //$(this).find('.fav').css('right',right+'px'); 1177 } 1178 } 1179 });*/ 1180 /*$('.blocks td .block').each(function(){ 1181 //$(this).css('height',($(this).closest('td').height()-parseInt($(this).css('padding-top'))-parseInt($(this).css('padding-bottom'))-1)+'px'); 1182 //console.log(($(this).closest('td').height()-parseInt($(this).css('padding-top'))-parseInt($(this).css('padding-bottom')))); 1183 $(this).find('svg').removeAttr('viewBox'); 1184 $(this).find('svg').attr('viewBox','0 0 10 '+(($(this).innerHeight()+10))); 1185 }); 1186 //$('.block_inner').css('padding-bottom','0'); 1187 var ttt=0; 1188 $('.subject_block .block_inner').each(function(){ 1189 //var pad=($(this).closest('.subject_block').height()-$(this).height()-$(this).find('.num').height()-$(this).find('.sub_name').height())/2; 1190 // console.log(pad+' '+$(this).closest('.subject_block').height()+' '+$(this).height()); 1191 //$(this).css('padding','0'); 1192 $(this).height($(this).closest('.subject_block').height()); 1193 var pad=($(this).height()-$(this).find('.num').height()-$(this).find('.sub_name').height())/2-10; 1194 //if(ttt==0) 1195 // console.log('ok'+$(this).css('height'));
1196 $(this).css({'padding':(pad-10)+'px 30px '+(pad+10)+'px','height':$(this).height()-pad*2}); 1197 1198 ttt++; 1199 }); 1200 1201 $('.most_important_articles td a').css('height','66px'); 1202 //$('.most_important_articles td a').each(function(){ 1203 // $(this).css('height',($(this).closest('td').height()-parseInt($(this).css('padding-top'))-parseInt($(this).css('padding-bottom')))+'px'); 1204 //}); 1205 //var hgt=$('.most_important_articles td').height(); 1206 $('.most_important_articles td svg').each(function(){ 1207 $(this).css('height','94px'); 1208 }); 1209 if($('.yellow_block').length>0) 1210 { 1211 //console.log('ok'); 1212 $('.yellow_block').each(function(){ 1213 var pad=$(this).height()*0.1; 1214 //console.log($(this).height()*0.1); 1215 $(this).find('.inner').css('padding-top',pad); 1216 $(this).find('.inner').css('padding-bottom',pad); 1217 }); 1218 }*/ 1219 1220 } 1221 else 1222 { 1223 var numbloc=0; 1224 $('.standart_text_block .olimpiada').css('padding-top',$('.standart_text_block .olimpiada').outerHeight()*0.05+10); 1225 1226 } 1227 var numbloc=0; 1228 var l=5; 1229 $('.blocks .block').each(function(){ 1230 drawCorners($(this),numbloc,l); 1231 console.log('ok block'); 1232 numbloc++; 1233 1234 }); 1235 $('.most_important_articles td a').each(function(){ 1236 //drawCorners($(this),numbloc,l); 1237 //numbloc++; 1238 }); 1239 $('.main_menu a.selected').each(function(){ 1240 /*$(this).attr('corner','1 1 1 1'); 1241 drawCorners($(this),numbloc,l); 1242 numbloc++;*/ 1243 }); 1244 $('.yellow_block').each(function(){ 1245 $(this).attr('corner','1 1 1 1'); 1246 $(this).attr('polig','0 0.03,1 0,1 1,0 0.97'); 1247 drawCorners($(this),numbloc,l); 1248 numbloc++; 1249 }); 1250 $('.standart_text_block .olimpiad_block .block').each(function(){ 1251 $(this).attr('corner','1 1 1 1'); 1252 $(this).attr('polig','0 0,0.94 0.0,1 1,0 1'); 1253 drawCorners($(this),numbloc,l); 1254 numbloc++; 1255 }); 1256 1257 $('.block_inner').each(function(){ 1258 if($(this).closest('.block').find('.olimp_img').length==0) 1259 { 1260 if(window.location.pathname!='/articles') 1261 $(this).css('padding-right','35px'); 1262 } 1263 }); 1264 console.log(window.location.pathname); 1265 if(window.location.pathname=='/articles') 1266 { 1267 $('.block>*').each(function(){ 1268 //$(this).css('padding','20px 20px')//$(this).closest('.block').css('padding')); 1269 }); 1270 console.log('ok'); 1271 $('.block').css({'padding':'0px 0px !important','padding-top':'0 !important','padding-bottom':'0 !important','height':'100%'}); 1272 1273 } 1274} 1275 1276function drawCorners(elem,numbloc,l) 1277{ 1278 if(elem.length>0) 1279 { 1280 elem.load(function(){ 1281 if(numbloc>-1) 1282 { 1283 1284 var crds=elem.attr('polig').split(','); 1285 if(crds.length==4) 1286 { 1287 var coords=new Array(); 1288 var ncrds=new Array(); 1289 var d=new Array(); 1290 for(var i=0;i<crds.length;i++) 1291 coords[coords.length]=crds[i].split(' '); 1292 1293 for(var i=0;i<coords.length;i++) 1294 { 1295 coords[i][0]=parseFloat(coords[i][0])*elem.outerWidth(); 1296 coords[i][1]=parseFloat(coords[i][1])*elem.outerHeight(); 1297 } 1298 1299 for(var i=0;i<crds.length;i++) 1300 { 1301 1302 d[i]=Math.sqrt((coords[(i+1)%4][0]-coords[i][0])*(coords[(i+1)%4][0]-coords[i][0])+(coords[(i+1)%4][1]-coords[i][1])*(coords[(i+1)%4][1]-coords[i][1])); 1303 } 1304 ncrds[0]=new Array( 1305 coords[0][0]+l*(coords[1][0]-coords[0][0])/d[0], 1306 coords[0][1]-l*(coords[0][1]-coords[1][1])/d[0] 1307 ); 1308 ncrds[1]=new Array( 1309 coords[1][0]-l*(coords[1][0]-coords[0][0])/d[0], 1310 coords[1][1]+l*(coords[0][1]-coords[1][1])/d[0] 1311 ); 1312 ncrds[2]=new Array( 1313 coords[1][0]+l*(coords[2][0]-coords[1][0])/d[1], 1314 coords[1][1]+l*(coords[2][1]-coords[1][1])/d[1] 1315 ); 1316 ncrds[3]=new Array( 1317 coords[2][0]-l*(coords[2][0]-coords[1][0])/d[1], 1318 coords[2][1]-l*(coords[2][1]-coords[1][1])/d[1] 1319 ); 1320 ncrds[4]=new Array( 1321 coords[2][0]-l*(coords[2][0]-coords[3][0])/d[2], 1322 coords[2][1]-l*(coords[2][1]-coords[3][1])/d[2] 1323 ); 1324 ncrds[5]=new Array( 1325 coords[3][0]+l*(coords[2][0]-coords[3][0])/d[2], 1326 coords[3][1]+l*(coords[2][1]-coords[3][1])/d[2] 1327 ); 1328 ncrds[6]=new Array( 1329 coords[3][0]+l*(coords[0][0]-coords[3][0])/d[3], 1330 coords[3][1]-l*(coords[3][1]-coords[0][1])/d[3] 1331 ); 1332 ncrds[7]=new Array( 1333 coords[0][0]-l*(coords[0][0]-coords[3][0])/d[3], 1334 coords[0][1]+l*(coords[3][1]-coords[0][1])/d[3] 1335 ); 1336 var k1=0,k2=0; 1337 1338 var cc=new Array(); 1339 k1=0;k2=0;b1=0;b2=0; 1340 console.log(coords); 1341 if((coords[1][1]-coords[0][1]!=0)) 1342 { 1343 k1=-((coords[1][0]-coords[0][0])/(coords[1][1]-coords[0][1])); 1344 k2=-(coords[0][0]-coords[3][0])/(coords[0][1]-coords[3][1]); 1345 b1=ncrds[0][1]-k1*ncrds[0][0]; 1346 b2=ncrds[7][1]-k2*ncrds[7][0]; 1347 cc[3]=new Array((b2-b1)/(k1-k2), (k1*b2-b1*k2)/(k1-k2)); 1348 } 1349 else 1350 { 1351 if((coords[1][1]-coords[0][1]==0)) 1352 { 1353 k2=-(coords[0][0]-coords[3][0])/(coords[0][1]-coords[3][1]); 1354 b2=ncrds[7][1]-k2*ncrds[7][0]; 1355 cc[3]=new Array(ncrds[0][0], ncrds[0][0]*k2+b2); 1356 } 1357 } 1358 1359 if((coords[1][1]-coords[0][1]!=0)) 1360 { 1361 k1=-((coords[1][0]-coords[0][0])/(coords[1][1]-coords[0][1])); 1362 k2=-(coords[2][0]-coords[1][0])/(coords[2][1]-coords[1][1]); 1363 b1=ncrds[1][1]-k1*ncrds[1][0]; 1364 b2=ncrds[2][1]-k2*ncrds[2][0]; 1365 cc[0]=new Array((b2-b1)/(k1-k2), (k1*b2-b1*k2)/(k1-k2)); 1366 } 1367 else 1368 { 1369 if((coords[1][1]-coords[0][1]==0)) 1370 { 1371 k2=-(coords[2][0]-coords[1][0])/(coords[2][1]-coords[1][1]); 1372 b2=ncrds[2][1]-k2*ncrds[2][0]; 1373 1374 cc[0]=new Array(ncrds[1][0], ncrds[1][0]*k2+b2); 1375 } 1376 } 1377 1378 if((coords[2][1]-coords[3][1]!=0)) 1379 { 1380 k1=-((coords[2][0]-coords[3][0])/(coords[2][1]-coords[3][1])); 1381 k2=-(coords[2][0]-coords[1][0])/(coords[2][1]-coords[1][1]); 1382 b1=ncrds[4][1]-k1*ncrds[4][0]; 1383 b2=ncrds[3][1]-k2*ncrds[3][0]; 1384 cc[1]=new Array((b2-b1)/(k1-k2), (k1*b2-b1*k2)/(k1-k2)); 1385 } 1386 else 1387 { 1388 if((coords[2][1]-coords[3][1]==0)) 1389 { 1390 k2=-(coords[2][0]-coords[1][0])/(coords[2][1]-coords[1][1]); 1391 b2=ncrds[3][1]-k2*ncrds[3][0]; 1392 cc[1]=new Array(ncrds[4][0], ncrds[4][0]*k2+b2); 1393 } 1394 } 1395 1396 if((coords[2][1]-coords[3][1]!=0)) 1397 { 1398 k1=-((coords[2][0]-coords[3][0])/(coords[2][1]-coords[3][1])); 1399 k2=-(coords[3][0]-coords[0][0])/(coords[3][1]-coords[0][1]); 1400 b1=ncrds[5][1]-k1*ncrds[5][0]; 1401 b2=ncrds[6][1]-k2*ncrds[6][0]; 1402 cc[2]=new Array((b2-b1)/(k1-k2), (k1*b2-b1*k2)/(k1-k2)); 1403 } 1404 else 1405 { 1406 if((coords[2][1]-coords[3][1]==0)) 1407 { 1408 k2=-(coords[3][0]-coords[0][0])/(coords[3][1]-coords[0][1]); 1409 b2=ncrds[6][1]-k2*ncrds[6][0]; 1410 cc[2]=new Array(ncrds[5][0], ncrds[5][0]*k2+b2); 1411 } 1412 } 1413 1414 1415 1416 var r=new Array(); 1417 r[3]=(ncrds[0][0]-cc[3][0])*(ncrds[0][0]-cc[3][0])+(ncrds[0][1]-cc[3][1])*(ncrds[0][1]-cc[3][1]); 1418 r[2]=(ncrds[6][0]-cc[2][0])*(ncrds[6][0]-cc[2][0])+(ncrds[6][1]-cc[2][1])*(ncrds[6][1]-cc[2][1]); 1419 r[1]=(ncrds[4][0]-cc[1][0])*(ncrds[4][0]-cc[1][0])+(ncrds[4][1]-cc[1][1])*(ncrds[4][1]-cc[1][1]); 1420 r[0]=(ncrds[2][0]-cc[0][0])*(ncrds[2][0]-cc[0][0])+(ncrds[2][1]-cc[0][1])*(ncrds[2][1]-cc[0][1]); 1421 var ncrds2=new Array(); 1422 var ncrds3=new Array(); 1423 var h=0; 1424 var step=10; 1425 var corner=new Array(1,1,1,1); 1426 if(elem.attr('corner')!=undefined) 1427 { 1428 corner=elem.attr('corner').split(' '); 1429 } 1430 1431 if(!((elem.attr('cremoveble')!==undefined))&&($(window).outerWidth()<elem.width())) 1432 { 1433 1434 corner=new Array(0,0,0,0); 1435 } 1436 1437 for(i=1;i<8;i+=2) 1438 { 1439 n=i; 1440 np=n+1; 1441 if(n==7) 1442 np=0; 1443 1444 if(corner[(n-1)/2]==1) 1445 { 1446 ncrds2[ncrds2.length]=((ncrds[n][0]/elem.outerWidth())*100).toFixed(6)+'% '+((ncrds[n][1]/elem.outerHeight())*100).toFixed(6)+'%'; 1447 ncrds3[ncrds3.length]=((ncrds[n][0]/elem.outerWidth())).toFixed(6)+' '+((ncrds[n][1]/elem.outerHeight())).toFixed(6)+''; 1448 var h=(ncrds[np][0]-ncrds[n][0])/step; 1449 var x=(ncrds[n][0]); 1450 for(var j=-1;j<step; j++) 1451 { 1452 1453 x=x+h; 1454 if(isNaN(x)) 1455 x=0; 1456 var sq=Math.sqrt(r[(n-1)/2]-(x-cc[(n-1)/2][0])*(x-cc[(n-1)/2][0])); 1457 if(isNaN(sq)) 1458 sq=-1; 1459 if(((n-1)/2==0)||((n-1)/2==3)) 1460 var y=-sq+cc[(n-1)/2][1]; 1461 else 1462 { 1463 var y=sq+cc[(n-1)/2][1]; 1464 } 1465 1466 if(isNaN(y)) 1467 y=0; 1468 ncrds2[ncrds2.length]=parseFloat(x*100/elem.outerWidth()).toFixed(6)+'% '+parseFloat(y*100/elem.outerHeight()).toFixed(6)+'%'; 1469 ncrds3[ncrds3.length]=parseFloat(x/elem.outerWidth()).toFixed(6)+' '+parseFloat(y/elem.outerHeight()).toFixed(6)+''; 1470 } 1471 } 1472 else 1473 { 1474 var cnum=(n-1)/2+1; 1475 if(cnum==4) 1476 cnum=0; 1477 ncrds2[ncrds2.length]=((coords[cnum][0]/elem.outerWidth())*100).toFixed(6)+'% '+((coords[cnum][1]/elem.outerHeight())*100).toFixed(6)+'%'; 1478 ncrds3[ncrds3.length]=((coords[cnum][0]/elem.outerWidth())).toFixed(6)+' '+((coords[cnum][1]/elem.outerHeight())).toFixed(6)+''; 1479 } 1480 } 1481 } 1482 else 1483 {
1484 var ncrds2=new Array(); 1485 var ncrds3=new Array(); 1486 for(var i=0;i<crds.length;i++) 1487 { 1488 var t=crds[i].split(' '); 1489 ncrds3[i]=crds[i]; 1490 ncrds2[i]=(parseFloat(t[0])*100)+'% '+(parseFloat(t[1])*100)+'%'; 1491 } 1492 elem.css({'-webkit-clip-path':'polygon('+ncrds2.join(',')+')'}); 1493 1494 } 1495 1496 var polig=ncrds2.join(','); 1497 var polig2=ncrds3.join(','); 1498 console.log(polig); 1499 elem.css({'-webkit-clip-path':'polygon('+polig+')'}); 1500 console.log('add polig'); 1501 //elem.css({'-webkit-clip-path':'url(#blocks_polygon'+numbloc+')'}); 1502 elem.css({'clip-path':'url(#blocks_polygon'+numbloc+')'}); 1503 1504 } 1505 $('body svg #blocks_polygon'+(numbloc)).closest('svg').remove(); 1506 var poliblock='<svg width="0" height="0"><defs><clipPath id="blocks_polygon'+(numbloc)+'" clipPathUnits="objectBoundingBox"><polygon points="'+polig2+'" /></clipPath></defs></svg>'; 1507 $('body').append(poliblock); 1508 }); 1509 } 1510 1511} 1512 1513$(function(){ 1514 jQuery('img.svg').each(function(){ 1515 var $img = jQuery(this); 1516 var imgID = $img.attr('id'); 1517 var imgClass = $img.attr('class'); 1518 var imgURL = $img.attr('src'); 1519 1520 jQuery.get(imgURL, function(data) { 1521 // Get the SVG tag, ignore the rest 1522 var $svg = jQuery(data).find('svg'); 1523 1524 // Add replaced image's ID to the new SVG 1525 if(typeof imgID !== 'undefined') { 1526 $svg = $svg.attr('id', imgID); 1527 } 1528 // Add replaced image's classes to the new SVG 1529 if(typeof imgClass !== 'undefined') { 1530 $svg = $svg.attr('class', imgClass+' replaced-svg'); 1531 } 1532 1533 // Remove any invalid XML tags as per http://validator.w3.org 1534 $svg = $svg.removeAttr('xmlns:a'); 1535 // Check if the viewport is set, else we gonna set it if we can. 1536 if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) { 1537 $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width')) 1538 } 1539 1540 // Replace image with new SVG 1541 $img.replaceWith($svg); 1542 1543 }, 'xml'); 1544 1545 }); 1546}); 1547 1548function declOfNum(number, titles) { 1549 cases = [2, 0, 1, 1, 1, 2]; 1550return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; 1551} 1552 1553 1554function placeCaretAtEnd(el) { 1555 el.focus(); 1556 if (typeof window.getSelection != "undefined" 1557 && typeof document.createRange != "undefined") { 1558 var range = document.createRange(); 1559 range.selectNodeContents(el); 1560 range.collapse(false); 1561 var sel = window.getSelection(); 1562 sel.removeAllRanges(); 1563 sel.addRange(range); 1564 } else if (typeof document.body.createTextRange != "undefined") { 1565 var textRange = document.body.createTextRange(); 1566 textRange.moveToElementText(el); 1567 textRange.collapse(false); 1568 textRange.select(); 1569 } 1570} 1571 1572function testActRev() 1573{ 1574 var go=true; 1575 if(parseInt($('.send_review input[name=score_org]').val())<1) 1576 go=false; 1577 if(parseInt($('.send_review input[name=score_tasks]').val())<1) 1578 go=false; 1579 if($('.send_review input[name=user_status]').val().length<2) 1580 go=false; 1581 if($('#review_text').text().length<5) 1582 go=false; 1583 if(go) 1584 { 1585 $('.send_review .button').removeClass('disable'); 1586 } 1587 else 1588 $('.send_review .button').addClass('disable'); 1589} 1590 1591function toggleHistory(el) 1592 { 1593 $('#tt').css('display','none'); 1594 $('#history').slideToggle(200); 1595 el.hide(); 1596 } 1597 1598function findRegion(text) 1599{ 1600 $('.r_changer span').hide(); 1601 $.post('/include/findRegion.php',{text:text},function(data){ 1602 if(data!='') 1603 { 1604 $('#found_regions .fr_content').html(data); 1605 $('#found_regions').show(function(){ 1606 drawCorners($('.ya_poterialsa'),11000,5); 1607 }); 1608 } 1609 else 1610 { 1611 $('#found_regions .fr_content').html(data); 1612 $('#found_regions').hide(); 1613 } 1614 }); 1615} 1616 1617function setRegion(id) 1618{ 1619 $.post('/include/setRegion.php',{id:id},function(data){ 1620 top.location.href=top.location.href; 1621 }); 1622} 1623 1624function mp_show() 1625{ 1626 history.pushState('', '', 'https://'+window.location.hostname+window.location.pathname+'?participate'); 1627 $('#megapop').fadeIn(100,function(){}); 1628 drawCorners($('#megapop_cont'),10000,5); 1629 $("html,body").css("overflow","hidden"); 1630} 1631 1632function setMyRegion(region) 1633{ 1634 $.post('/include/setMyRegion.php',{region:region},function(data){$('#shadow').hide(); top.location.reload();}); 1635} 1636 1637function setCheck() 1638{ 1639 $('#shadow').fadeOut(); 1640 var date = new Date(new Date().getTime() + 60 * 100000000); 1641 document.cookie = 'reg_results=1; path=/; expires=' + date.toUTCString(); 1642} 1643 1644function showSubChecker() 1645 { 1646 $.post('/include/vos_subject_checker.php',function(data){ 1647 showPopup('',data); 1648 $('.popup_closer').attr('href','javascript:setCheck()'); 1649 $('.liker').click(function(){ 1650 var t=$(this).attr('id').split('_'); 1651 var el=$(this); 1652 var del=0; 1653 console.log('liker'); 1654 if(parseInt(t[1])==0) 1655 del=1; 1656 $.post('/include/favorite.php',{id:t[2],del:del},function(data) { 1657 if(data=='error') autorization(); 1658 else 1659 {
1660 if(del==0) 1661 { 1662 yaCounter46311342.reachGoal('izbrannoe_list'); 1663 //console.log('ÐеÑÑика ебаÑиÑ!'); 1664 } 1665 $('#Layer_'+((parseInt(t[1])+1)%2)+'_'+t[2]).css('display','inline-block'); 1666 if((el.attr('favpage')=='1')&&(top.location.href.indexOf('favorites')>-1)) 1667 { 1668 if(parseInt(t[1])==0) 1669 { 1670 el.closest('.fav_olimp').find('.o-block').css({'filter':'grayscale(100%)','opacity':'0.2'}); 1671 el.closest('.fav_olimp').find('td:nth-child(2)').css({'display':'none'}); 1672 el.closest('.fav_olimp').find('.none_a').css({'padding-right':'0'}); 1673 //el.closest('.fav_olimp').find('.none_a span').css(); 1674 el.closest('.fav_olimp').find('.timeline, .fav_news, .red, .liker, .rait_text, .pl_rating').hide(); 1675 el.closest('.fav_olimp').removeClass('new_data_fav'); 1676 el.closest('.fav_olimp').find('.il_be_back, .white_grad').show(); 1677 } 1678 else 1679 { 1680 1681 el.closest('.fav_olimp').find('.o-block').css({'filter':'grayscale(0%)','opacity':'1'}); 1682 el.closest('.fav_olimp').find('td:nth-child(2)').css({'display':'table-cell'}); 1683 el.closest('.fav_olimp').find('.timeline, .fav_news, .red, .liker[data=1], .rait_text, .pl_rating').show(); 1684 el.closest('.fav_olimp').find('.il_be_back, .white_grad').hide(); 1685 el.closest('.fav_olimp').find('.none_a').css({'padding-right':'80px'}); 1686 } 1687 } 1688 el.hide(); 1689 } 1690 }); 1691 }); 1692 }); 1693 } 1694 1695function findBen(txt) 1696{ 1697 $.post('/include/searchBen.php',{q:txt},function(data){ 1698 var res=$.parseJSON(data); 1699 if(res.result.length>0) 1700 { 1701 $('#ben_res').html(''); 1702 for(var i=0;i<res.result.length;i++) 1703 { 1704 $('#ben_res').append(res.result[i]); 1705 } 1706 $('#ben_res').show(); 1707 } 1708 else 1709 { 1710 $('#ben_res').hide(); 1711 } 1712 }); 1713} 1714 1715function shFrame() 1716{ 1717 console.log(window.location.pathname.split('/')); 1718 var tmp=window.location.pathname.split('/'); 1719 if(tmp[tmp.length-2]=='news') 1720 { 1721 $.post('/include/ajax/opros.php',{id:tmp[tmp.length-1]},function(data){ 1722 console.log(data); 1723 if(data!='hide') 1724 { 1725 if($('.full_text iframe#oprf').length==0) 1726 $('.full_text').append('<iframe id="oprf" src="'+data+'" style="width:100%; height:600px; border:none"></iframe>'); 1727 } 1728 else 1729 $('.full_text iframe#oprf').remove(); 1730 }); 1731 } 1732 //setTimeout(function(){shFrame();},1000); 1733} 1734 1735function closeNoti() 1736{ 1737 $.post('/include/closeNoti.php',function(data){$('.notification').hide();}); 1738}
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.