1var ya_adv_start_page = 5; 2 3$.getScript(baseurl + 'scripts/functions.js',function() 4{ 5 // checkLang(); 6 // $(window).checkLang(); 7 8 if($('.choose_avatar_block').length) 9 { 10 $.fancybox( 11 { 12 autoSize: false, 13 width: 480, 14 padding: 20, 15 autoHeight: true, 16 closeClick: false, 17 closeBtn : false, 18 content: $('.choose_avatar_block').html(), 19 helpers: { 20 overlay: { 21 locked: false, 22 closeClick: false 23 } 24 }, 25 keys : { 26 close: null 27 }, 28 tpl: { 29 wrap : '<div class="fancybox-wrap form_block" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 30 image : '<img class="fancybox-image" src="{href}" alt="" />', 31 error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 32 closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>', 33 next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 34 prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' 35 }, 36 afterShow: function() 37 { 38 39 } 40 }) 41 } 42 43 $('body').on('change','form.choose_avatar_form',function() 44 { 45 $(this).find('[name="submit"]').click(); 46 }); 47 48 $('body').on('change','form.choose_currency',function() 49 { 50 var currency = $('[name="currency"]:checked',this).val(); 51 var params = { 52 ajax: true, 53 currency: currency, 54 option: 'viewSubscribtions' 55 }; 56 57 $('#subscribtion.tab').addClass('loading'); 58 59 $.ajax({ 60 method: "POST", 61 type: "POST", 62 cache: false, 63 url: baseurl + 'user', 64 data: params 65 }) 66 .done(function( result ) 67 { 68 $('#subscribtion.tab').removeClass('loading'); 69 $('#subscribtion.tab').html(result); 70 }); 71 }); 72 73 $('body').on('click','a[rel]',function(e) 74 { 75 if($(this).attr('rel')) 76 { 77 var rel = $(this).attr('rel'); 78 79 var parts = rel.split(' '); 80 81 for (var i = 0; i < parts.length; i++) 82 { 83 var part = parts[i]; 84 85 if(part.indexOf('reachGoal:') >= 0) 86 { 87 var goal_parts = part.split(':'); 88 89 if (typeof ya_counter_id !== 'undefined') 90 ym(ya_counter_id,'reachGoal',goal_parts[1]); 91 } 92 } 93 } 94 }); 95 96 $('body').on('click','.call-js',function(e) 97 { 98 e.preventDefault(); 99 100 var name = $(this).attr('data-option'); 101 var options = {}; 102 103 $.each(this.attributes, function() 104 { 105 var n = this.name; 106 var v = this.value; 107 108 if(n.indexOf('data-') >= 0) 109 options[n.replace('data-','')] = v; 110 111 }); 112 113 $(this).getOption(name,options); 114 }); 115 116 var prev_key = null; 117 $(window).keydown(function(e) 118 { 119 var current_key = e.key; 120 if 121 ( 122 (current_key == 'Enter' && prev_key == 'Control') || 123 (current_key == 'Control' && prev_key == 'Enter') || 124 (current_key == 'Enter' && prev_key == 'Meta') || 125 (current_key == 'Meta' && prev_key == 'Enter') 126 ) 127 { 128 var selObj = window.getSelection(); 129 var selectedText = selObj.toString(); 130 131 var html = ''; 132 133 html+= '<div class="form-content align-center" id="comment_warning">'; 134 html+= ' <h4>' + lang['title_form_about_error'] + '</h4>'; 135 html+= ' <p><b><i>' + selectedText + '</i></b><br></p><br>'; 136 html+= ' <form method="post" enctype="multipart/form-data" action="' + baseurl + '">'; 137 html+= ' <input type="hidden" name="selected_text" value="' + selectedText + '">'; 138 html+= ' <p><textarea name="comment_text" rows="2" cols="40" placeholder="' + lang['your_comment'] + '"></textarea></p>'; 139 html+= ' <p><button type="submit" name="submit" value="text_error">' + lang['send'] + '</button></p>'; 140 html+= ' </form>'; 141 html+= '</div>'; 142 143 if(selectedText.length) 144 { 145 $.fancybox( 146 { 147 autoSize: false, 148 width: 480, 149 padding: 20, 150 autoHeight: true, 151 content: html, 152 helpers: { 153 overlay: { 154 locked: false 155 } 156 }, 157 tpl: { 158 wrap : '<div class="fancybox-wrap form_block" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 159 image : '<img class="fancybox-image" src="{href}" alt="" />', 160 error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 161 closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>', 162 next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 163 prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' 164 }, 165 afterShow: function() 166 { 167 168 } 169 }) 170 } 171 172 } 173 174 175 prev_key = current_key; 176 console.log(e); 177 }); 178 179 $.getScript(baseurl + "scripts/inputmask.js", function () { 180 $.getScript(baseurl + "scripts/inputmask.extensions.js", function () { 181 $.getScript(baseurl + "scripts/jquery.inputmask.js", function () { 182 183 $("form").find('input[name="user_phone"]').inputmask("+7 (999) 999-99-99"); 184 185 $("form").find('input[name="email"]').inputmask("email"); 186 }); 187 }); 188 }); 189 190 $('body').on('submit','#frmfooterform',function(e) 191 { 192 e.preventDefault(); 193 }); 194 195 $('.payment_form').on('change','#is_rf',function() 196 { 197 if(!$(this).is(':checked')) 198 { 199 $('.payment_form').find('#address').addClass('hidden').removeClass('r'); 200 $('.payment_form').find('#address ~ .er').remove(); 201 $('.payment_form').find('[name="address"]').removeClass('hidden'); 202 $('.payment_form').find('[name="address"] ~ input').removeClass('r'); 203 $('.payment_form').find('[name="address"] ~ .er').remove(); 204 } 205 else 206 { 207 $('.payment_form').find('#address').removeClass('hidden').addClass('r'); 208 $('.payment_form').find('[name="address"]').addClass('hidden'); 209 $('.payment_form').find('[name="address"] ~ input').addClass('r'); 210 } 211 }); 212 213 $('.payment_form').on('click','[data-amount]',function() 214 { 215 var amount = $(this).attr('data-amount'); 216 217 $(this).closest('form').find('[name="amount"]').val(amount); 218 }); 219 220 if($('input#address').length) 221 { 222 $('input#address').keyup(function() 223 { 224 $('input[name="address"]').val(''); 225 }); 226 227 $.getScript(baseurl + 'scripts/jquery.suggestions.min.js', function() 228 { 229 $('head').append( $('<link rel="stylesheet" type="text/css" />').attr('href', baseurl + 'styles/suggestions.min.css') ); 230 231 $('input#address').suggestions( 232 { 233 token: "384ffdb0e47e27c4e25b264af01cd1bf9576fe8c", 234 type: "ADDRESS", 235 deferRequestBy: 300, 236 minChars: 4, 237 /* ÐÑзÑваеÑÑÑ, когда полÑзоваÑÐµÐ»Ñ Ð²ÑбиÑÐ°ÐµÑ Ð¾Ð´Ð½Ñ Ð¸Ð· подÑказок */ 238 onSelect: function(suggestion) 239 { 240 if(suggestion.data.street && suggestion.data.house) 241 { 242 $('input[name="address"]').val(suggestion.value); 243 if(suggestion.data.settlement) 244 $('input[name="city_name"]').val(suggestion.data.settlement); 245 if(suggestion.data.city_with_type) 246 $('input[name="city_name"]').val(suggestion.data.city_with_type); 247 $('input[name="postal_code"]').val(suggestion.data.postal_code); 248 } 249 else 250 { 251 $('input[name="address"]').val(''); 252 $('input[name="city_name"]').val(''); 253 $('input[name="postal_code"]').val(''); 254 } 255 console.log(suggestion.data); 256 } 257 }); 258 259 console.log('suggestions!'); 260 }); 261 262 } 263 264 $('#yellow_card, #red_card').on('click','.btn_rm', function(e) 265 { 266 if (!confirm(lang['confirm_action'])) 267 e.preventDefault(); 268 }); 269 270 $('[href~="' + baseurl + 'forum/block"]').click(function(e) 271 { 272 e.preventDefault(); 273 }); 274 275 $('.warning.active').click(function(e) 276 { 277 if (!confirm(lang['confirm_action'])) 278 e.preventDefault(); 279 }); 280 281 $('.call_message').click(function(e) 282 { 283 var message = !$(this).attr('data-message') ? null : $(this).attr('data-message'); 284 var type = !$(this).attr('data-type') ? 0 : $(this).attr('data-type'); 285 var link = !$(this).attr('data-link') ? null : $(this).attr('data-link'); 286 var link_title = !$(this).attr('data-link-title') ? null : $(this).attr('data-link-title'); 287 288 if(message.length) 289 { 290 e.preventDefault(); 291 292 $(window).mesKh(message,type,link,link_title); 293 } 294 }); 295 296 297 298 if(typeof disabled_border !== 'undefined' && disabled_border) 299 { 300 $('.article .text br + img, .article .text p + img, .article .text p + * img, .article .text div + img, .article .text div + * img, .article .text script + * img, .article .text style + * img, .article .text blockquote + * img').each(function(index) 301 { 302 var style = $(this).attr('style'); 303 var img = $(this).clone( true ); 304 //$(this).replaceWith('<span class="img_super_border img_super_border' + index + '"></span>'); 305 //$('.img_super_border' + index).append(img); 306 307 //if(typeof style !== 'undefined') 308 //{ 309 // if(style.indexOf('float: left') >= 0) 310 // { 311 // $('.img_super_border' + index).addClass('inline_block').css('margin-right','10px').css('float','left'); 312 // $('.img_super_border' + index + ' img').removeAttr('style'); 313 // return; 314 // } 315 // 316 // if(style.indexOf('float: right') >= 0) 317 // { 318 // $('.img_super_border' + index).addClass('inline_block').css('margin-left','10px').css('float','right'); 319 // $('.img_super_border' + index + ' img').removeAttr('style'); 320 // return; 321 // } 322 // 323 // 324 //} 325 326 327 console.log(img); 328 }); 329 } 330 331 332 $('.currencies > .currencies').on('click','li',function() 333 { 334 var code = $(this).find('span:first').text(); 335 var href = baseurl + 'currencies?code=' + code; 336 document.location.href = href; 337 }); 338 339 $('.messages_item .messages form').submit(function(e) 340 { 341 $(this).find('button').addClass('disabled'); 342 }); 343 344 $('.user').on('submit','form.addcomment',function(e) 345 { 346 e.preventDefault(); 347 var article_id = $('input[name="article_id"]',this).val(); 348 var comment_text = $('textarea[name="comment_text"]',this).val(); 349 var to = $('input[name="to"]',this).val(); 350 var option = 'comment_add2'; 351 var t = $(this); 352 353 $.ajax({ 354 method: "POST", 355 type: "POST", 356 cache: false, 357 url: baseurl + 'articles', 358 data: { ajax: true, option: 'comment_add2', article_id: article_id, comment_text: comment_text, to: to } 359 }) 360 .done(function( msg ) 361 { 362 if(!msg) 363 return; 364 365 var comment = renderComment($.parseJSON( msg )); 366 $( comment ).insertAfter( t ); 367 t.parent().find('.usercomansver').remove(); 368 t.find('[name="submit"]').removeClass('disabled'); 369 t.remove(); 370 }); 371 }); 372 373 $('body').on('change','.payment_form .type', function() 374 { 375 $(this).parent().parent().find('label').removeClass('checked'); 376 $(this).parent().addClass('checked'); 377 378 $(this).parent().parent().parent().find('.user_info').removeAttr('style'); 379 }); 380 381 // ÑикÑиÑованное Ð¼ÐµÐ½Ñ 382 //var start = $('.head > .center').height(); 383 //if($(window).scrollTop() >= start) 384 //{ 385 // $('#start').css('margin-bottom',$('.head > .menu.pc-only.tablet-only').height()); 386 // $('.head > .menu.pc-only.tablet-only').addClass('fixed'); 387 //} 388 // 389 //$(window).scroll(function() 390 //{ 391 // if($(window).scrollTop() >= start) 392 // { 393 // $('.head > .center').css('margin-bottom',$('.head > .menu.pc-only.tablet-only').height()); 394 // $('.head > .menu.pc-only.tablet-only').addClass('fixed'); 395 // } 396 // else 397 // { 398 // $('.head > .center').removeAttr('style'); 399 // $('.head > .menu.pc-only.tablet-only').removeClass('fixed'); 400 // } 401 //}); 402
403 $('body').on('hover','.wysibb-toolbar-btn.wbb-img',function(e) 404 { 405 var content = $(this).parent().parent().next().find('.wysibb-text-editor').html(); 406 if(content.indexOf('<img') >= 0) 407 { 408 if(!$(this).next().hasClass('disabled')) 409 $('<span class="disabled" title="' + lang['error_insert_image_comment'] + '"></span>').insertAfter( $(this) ); 410 } 411 else 412 { 413 if($(this).next().hasClass('disabled')) 414 $(this).next().remove(); 415 } 416 }); 417 $('body').on('hover','.wysibb-toolbar-btn.wbb-img + .disabled',function(e) 418 { 419 var content = $(this).parent().parent().next().find('.wysibb-text-editor').html(); 420 if(content.indexOf('<img') < 0) 421 $(this).remove(); 422 }); 423 $('body').on('click','.wysibb-toolbar-btn.wbb-img + .disabled',function(e) 424 { 425 alert($(this).attr('title')); 426 }); 427 428 429 $('.pagination form').change(function() 430 { 431 $('.submit',this).click(); 432 }); 433 434 // лайки 435 $('body').on('click', '.comment a.like', function(e) 436 { 437 e.preventDefault(); 438 439 var t = $(this); 440 441 if(typeof $(this).parent().parent().attr('id') !== 'undefined') 442 var comment_id = $(this).parent().parent().attr('id').replace(/c-/g,''); 443 else 444 var comment_id = $(this).parent().parent().parent().attr('id').replace(/c-/g,''); 445 446 $.ajax({ 447 method: "POST", 448 type: "POST", 449 cache: false, 450 url: baseurl + 'forum', 451 data: { ajax: true, option: 'like', comment_id: comment_id } 452 }) 453 .done(function( msg ) 454 { 455 if(!msg) 456 return; 457 458 var result = jQuery.parseJSON( msg ); 459 460 var title1 = ''; 461 var title2 = ''; 462 var title3 = ''; 463 464 var like_this = result[3]; 465 var dislike_this = result[4]; 466 var nothing_this = result[5]; 467 468 if(like_this.length) 469 title1 = lang['supported'] + ': ' + like_this; 470 471 if(dislike_this.length) 472 title2 = lang['unsupported'] + ': ' + dislike_this; 473 474 if(nothing_this.length) 475 title3 = lang['opinion_on_the_lack'] + ': ' + nothing_this; 476 477 t.attr('title',title1); 478 t.next().attr('title',title3); 479 t.next().next().attr('title',title2); 480 481 if(t.hasClass('active')) 482 { 483 t.removeClass('active').text(result[0]); 484 t.next().text(result[2]); 485 t.next().next().text(result[1]); 486 } 487 else 488 { 489 //if(t.parent().find('a.dislike').hasClass('active')) 490 // t.parent().find('a.dislike').removeClass('active').text((parseInt(t.parent().find('a.dislike').text()) - 1)); 491 //if(t.parent().find('a.nothings').hasClass('active')) 492 // t.parent().find('a.nothings').find('span').removeClass('active').text((parseInt(t.parent().find('a.nothings').find('span').text()) - 1)); 493 t.addClass('active').text(result[0]); 494 t.next().text(result[2]); 495 t.next().next().text(result[1]); 496 } 497 }); 498 }); 499 500 // дизлайки 501 $('body').on('click', '.comment a.dislike', function(e) 502 { 503 e.preventDefault(); 504 505 var t = $(this); 506 507 if(typeof $(this).parent().parent().attr('id') !== 'undefined') 508 var comment_id = $(this).parent().parent().attr('id').replace(/c-/g,''); 509 else 510 var comment_id = $(this).parent().parent().parent().attr('id').replace(/c-/g,''); 511 512 $.ajax({ 513 method: "POST", 514 type: "POST", 515 cache: false, 516 url: baseurl + 'forum', 517 data: { ajax: true, option: 'dislike', comment_id: comment_id } 518 }) 519 .done(function( msg ) 520 { 521 //console.log(msg); 522 //return; 523 if(!msg) 524 return; 525 526 var result = jQuery.parseJSON( msg ); 527 528 var title1 = ''; 529 var title2 = ''; 530 var title3 = ''; 531 532 var like_this = result[3]; 533 var dislike_this = result[4]; 534 var nothing_this = result[5]; 535 536 if(like_this.length) 537 title1 = lang['supported'] + ': ' + like_this; 538 539 if(dislike_this.length) 540 title2 = lang['unsupported'] + ': ' + dislike_this; 541 542 if(nothing_this.length) 543 title3 = lang['opinion_on_the_lack'] + ': ' + nothing_this; 544 545 t.prev().prev().attr('title',title1); 546 t.attr('title',title2); 547 t.prev().attr('title',title3); 548 549 550 if(t.hasClass('active')) 551 { 552 t.prev().prev().text(result[0]); 553 t.removeClass('active').text(result[1]); 554 t.prev().text(result[2]); 555 } 556 else 557 { 558 //if(t.parent().find('a.like').hasClass('active')) 559 // t.parent().find('a.like').removeClass('active').text((parseInt(t.parent().find('a.like').text()) - 1)); 560 //if(t.parent().find('a.nothings').hasClass('active')) 561 // t.parent().find('a.nothings').find('span').removeClass('active').text((parseInt(t.parent().find('a.nothings').find('span').text()) - 1)); 562 t.addClass('active').text(result[1]); 563 t.prev().prev().text(result[0]); 564 t.prev().text(result[2]); 565 } 566 }); 567 }); 568 569 // ни о ÑÑм 570 $('body').on('click', '.comment a.nothings', function(e) 571 { 572 e.preventDefault(); 573 574 var t = $(this); 575 576 if(typeof $(this).parent().parent().attr('id') !== 'undefined') 577 var comment_id = $(this).parent().parent().attr('id').replace(/c-/g,''); 578 else 579 var comment_id = $(this).parent().parent().parent().attr('id').replace(/c-/g,''); 580 581 $.ajax({ 582 method: "POST", 583 type: "POST", 584 cache: false, 585 url: baseurl + 'forum', 586 data: { ajax: true, option: 'nothing', comment_id: comment_id } 587 }) 588 .done(function( msg ) 589 { 590 //console.log(msg); 591 //return; 592 if(!msg) 593 return; 594 595 var result = jQuery.parseJSON( msg ); 596 597 var title1 = ''; 598 var title2 = ''; 599 var title3 = ''; 600 601 var like_this = result[3]; 602 var dislike_this = result[4]; 603 var nothing_this = result[5]; 604 605 if(like_this.length)
606 title1 = lang['supported'] + ': ' + like_this; 607 608 if(dislike_this.length) 609 title2 = lang['unsupported'] + ': ' + dislike_this; 610 611 if(nothing_this.length) 612 title3 = lang['opinion_on_the_lack'] + ': ' + nothing_this; 613 614 t.prev().attr('title',title1); 615 t.attr('title',title3); 616 t.next().attr('title',title2); 617 618 619 if(t.hasClass('active')) 620 { 621 t.prev().text(result[0]); 622 t.removeClass('active').text(result[2]); 623 t.next().text(result[1]); 624 } 625 else 626 { 627 //if(t.parent().find('a.like').hasClass('active')) 628 // t.parent().find('a.like').removeClass('active').text((parseInt(t.parent().find('a.like').text()) - 1)); 629 //if(t.parent().find('a.dislike').hasClass('active')) 630 // t.parent().find('a.dislike').removeClass('active').text((parseInt(t.parent().find('a.dislike').text()) - 1)); 631 t.addClass('active').text(result[2]); 632 t.prev().text(result[0]); 633 t.next().text(result[1]); 634 } 635 }); 636 }); 637 638 // окно авÑоÑизаÑии 639 // $('a').click(function(e) 640 $('body').on('click', 'a', function(e) 641 { 642 var href = $(this).attr('href'); 643 var width = $(window).width(); 644 645 if((href == baseurl + 'login' || $(this).attr('data-login')) && width >= 768) 646 { 647 e.preventDefault(); 648 var html = ''; 649 html+= '<div class="container_big align-center">'; 650 html+= '<h1 class="bold">' + lang['title_login'] + '</h1>'; 651 html+= '<form action="' + baseurl + 'login" method="post">'; 652 html+= ' <p><input type="text" name="login" id="login" class="r" placeholder="' + lang['people_email'] + '" value="" /></p>'; 653 html+= ' <p><input type="password" name="password" id="password" class="r" placeholder="' + lang['people_password'] + '" value="" /></p>'; 654 655 if($(this).attr('data-login')) 656 html+= ' <input type="hidden" name="path" value="' + href.slice(1) + '">'; 657 658 html+= ' <p><button type="submit" name="submit">' + lang['btn_login'] + '</button></p>'; 659 html+= '</form>'; 660 html+= '<div class="social">'; 661 html+= ' <p class="subtitle">' + lang['title_login_services'] + ':</p>'; 662 html+= ' <ul class="unstyled">'; 663 // html+= ' <li class="fb">'; 664 // html+= ' <a href="' + baseurl + 'facebook">Facebook</a>'; 665 // html+= ' </li>'; 666 // html+= ' <li class="tw">'; 667 // html+= ' <a href="' + baseurl + 'twitter">Twitter</a>'; 668 // html+= ' </li>'; 669 html+= ' <li class="vk">'; 670 html+= ' <a href="' + baseurl + 'vkontakte">vk.com</a>'; 671 html+= ' </li>'; 672 html+= ' <li class="clr"></li>'; 673 html+= ' </ul>'; 674 html+= ' <p><a href="' + baseurl + 'remind">' + lang['forget_password'] + '</a></p>'; 675 html+= ' <br/>'; 676 html+= ' <p><a href="' + baseurl + 'registration">' + lang['title_registration_short'] + '</a></p>'; 677 html+= '</div>'; 678 html+= '</div>'; 679 $.fancybox( 680 { 681 autoSize: false, 682 width: 640, 683 padding: 20, 684 autoHeight: true, 685 content: html, 686 helpers: { 687 overlay: { 688 locked: false 689 } 690 }, 691 tpl: { 692 wrap : '<div class="fancybox-wrap form_block" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 693 image : '<img class="fancybox-image" src="{href}" alt="" />', 694 error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 695 closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>', 696 next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 697 prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' 698 }, 699 afterShow: function() 700 { 701 702 } 703 }) 704 } 705 }); 706 707 708 //денаим баÑÑон 709 710 $('body').on('click','form.addcomment button', function(){ 711 $(this).addClass('disabled'); 712 }); 713 714 $('body').on('click','button.disabled', function(e){ 715 e.preventDefault(); 716 }); 717 718 //ÑекбокÑÑ 719 720 $('body').on('click','.danger',function(e) 721 { 722 var isGood=confirm(lang['confirm_action']);
723 if (!isGood) 724 e.preventDefault(); 725 }); 726 727 $('body').on('click','.to_black_list',function(e) 728 { 729 if($(this).text() == lang['forum_black_list_short']) 730 { 731 var isGood=confirm(lang['confirm_add_user_in_black_list']); 732 if (!isGood) 733 e.preventDefault(); 734 } 735 }); 736 737 $('body').on('click','.to_black_list2',function(e) 738 { 739 var isGood=confirm(lang['confirm_block_user']); 740 if (!isGood) 741 e.preventDefault(); 742 }); 743 744 $('body').on('click','.actions a.block',function(e) 745 { 746 e.preventDefault(); 747 $(this).getOption('setBlock',{}); 748 }); 749 750 $('body').on('click','.actions a.warning:not(.active)',function(e) 751 { 752 e.preventDefault(); 753 $(this).getOption('setWarning',{}); 754 }); 755 756 $('body').on('submit','.form-grp.forumwarning',function() 757 { 758 $(this).find('[name="submit"]').addClass('disabled'); 759 var dataarray = $(this).serializeArray(); 760 var comment_id = $(this).find('input[name=path]').val(); 761 var path = baseurl + 'forum/warning/' + comment_id; 762 $.ajax({ 763 url:path, 764 type:'POST', 765 data:dataarray, 766 dataType:"html", 767 success:function(data) 768 { 769 //console.log(data); 770 document.location.href = '?c=' + comment_id; 771 // location.reload(); 772 },//success 773 error:function(e) 774 { 775 //console.log(e); 776 document.location.href = '?c=' + comment_id; 777 // location.reload(); 778 } 779 });//ajax 780 return false; 781 });//form-grp 782 783 $(".fancy:not(.warning)").fancybox(); 784 785 //$('body').on('click','.block.unblock',function(e) 786 //{ 787 // var isGood=confirm('ÐÑ ÑвеÑенÑ, ÑÑо Ñ Ð¾ÑиÑе ÑазблокиÑоваÑÑ Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ полÑзоваÑелÑ?');
788 // if (!isGood) 789 // e.preventDefault(); 790 //}); 791 792 // ÑилÑÑÑ Ð½Ð° ÑоÑÑме 793 //$('.forum_filter form button').hide(); 794 $('body').on('click','.rate form label',function() 795 { 796 //console.log($(this).parent().find('button').serialize()); 797 //return; 798 var t = $(this); 799 setTimeout(function() { t.parent().parent().find('button').click(); }, 500); 800 //$(this).parent().parent().submit(); 801 //$(this).parent().parent().find('button').click(); 802 }); 803 804 $('body').on('submit','.rate form', function(e) 805 { 806 var t = $(this); 807 e.preventDefault(); 808 var data = $( this ).serialize() + '&option=rate&ajax=true'; 809 $.ajax({ 810 method: "POST", 811 type: "POST", 812 cache: false, 813 url: baseurl + 'articles', 814 data: data 815 }) 816 .done(function( msg ) 817 { 818 if(!msg) 819 { 820 document.location.href = baseurl + 'login'; 821 return; 822 } 823 824 $('input:checked',t).prop('checked',false); 825 t.find('[name="submit"]').removeClass('disabled'); 826 827 alert(strip_tags(msg)); 828 }); 829 }); 830 831 // Ðнопка "ÑиÑаÑÑ Ð´Ð°Ð»ÐµÐµ" на главной ( 832 // ÐобавлÑеÑÑÑ ÐµÑли "<a>" не помеÑаеÑÑÑ Ð² "<div class="intro">" 833 // ÐоÑÐµÐ¼Ñ Ñак Ñделано? 834 // 1. ÐакомменÑил (инаÑе кнопка не добавлÑеÑÑÑ) в style.css "div.latest_article .desc .intro {height: 107px;" 835 // 2. ÐÐ½Ð¾Ð¿ÐºÑ "ÑÑебÑÑÑ", пÑÑÑÑ Ð¿Ð¾ÐºÐ° вÑегда поÑвлÑеÑÑÑ. 836 var href = $('div.latest_article h2 a').attr('href'); 837 var blockh = $('div.latest_article .desc .intro').height(); 838 var innerh = $('div.latest_article .desc .intro > a').height(); 839 //if (innerh > blockh) { 840 if (true) { 841 // console.log("Ðобавлено: ÑиÑаÑÑ Ð´Ð°Ð»ÐµÐµ"); 842 $('div.latest_article .desc').append('<p class="align"><a href="'+href+'" class="button">' + lang['more2'] + '</a></p>'); 843 } else { 844 // console.log("Ðе добавлено: ÑиÑаÑÑ Ð´Ð°Ð»ÐµÐµ"); 845 } 846 // Ðнопка "ÑиÑаÑÑ Ð´Ð°Ð»ÐµÐµ" на главной ) 847 848 /*ÑÐ°Ð±Ñ Ð½Ð° главной в мобилÑнике*/ 849 $('.main_tabs ul.tabs li a').bind('touchstart', function(){ 850 var id = $(this).attr('href'); 851 $('.main_tabs ul.tabs li').each(function(){ 852 $(this).removeClass('active'); 853 }); 854 $('.tabs_containers .tab').each(function(){ 855 $(this).hide(); 856 }); 857 $(this).parent().addClass('active'); 858 $('.main_tabs .tabs_containers '+id).show(); 859 }); 860 /*ÑкÑолим до ÑоÑки*/ 861 $(window).scroll(function(){ 862 if ( $(document).scrollTop() > 0 ) { 863 $('#scrollup').fadeIn('fast'); 864 } else { 865 $('#scrollup').fadeOut('fast'); 866 } 867 }); 868 869 $('a.scroll,li.scroll a').on('click', function(e){ 870 var href = $(this).attr('href'); 871 $('html,body').stop().animate({ scrollTop: $(href).offset().top - 50}, 500); 872 e.preventDefault(); 873 }); 874 875 if($("#message").length > 0) 876 { 877 var message = $("#message").html(); 878 var message = $('body').find("#message").html(); 879 if (message.length > 10) 880 { 881 //setTimeout( function() 882 //{ 883 // $('body').find("#message").empty(); 884 //} , 20000); 885 } 886 $('#message').on('click','.close', function() 887 { 888 $('#message').empty(); 889 }); 890 } 891 892 $('body').on('click','.show_all_comments',function() 893 { 894 $('.comments .drop.plus').click(); 895 $(this).removeClass('show_all_comments').addClass('unshow_all_comments').text(lang['dialogs_close']); 896 }); 897 898 $('body').on('click','.unshow_all_comments',function() 899 { 900 $('.comments .all_comments .drop.minus').click(); 901 $(this).removeClass('unshow_all_comments').addClass('show_all_comments').text(lang['dislogs_open']); 902 }); 903 904 /* комменÑаÑии ÑазвеÑнÑÑÑ/ÑвеÑнÑÑÑ ÑÑаÑÑ */ 905 $('.comments .drop').click(function() 906 { 907 var list = $(this).next(); 908 var t = $(this); 909 var count = list.find('li').length; 910 list.slideToggle( "slow", function() 911 { 912 if(!list.hasClass('unvisible')) 913 { 914 //console.log(t); 915 //console.log(count); 916 t.addClass('plus').removeClass('minus').text(lang['open_list_comments'] + ' (' + count + ')'); 917 list.addClass('unvisible'); 918 } 919 else 920 { 921 t.addClass('minus').removeClass('plus').empty(); 922 list.removeClass('unvisible'); 923 } 924 }); 925 }); 926 927 $('.comments').find('> ul').each(function() 928 { 929 $(this).find('.drop').each(function() 930 { 931 var list = $(this).next(); 932 var t = $(this); 933 var count = list.find('li').length; 934 935 t.addClass('plus').removeClass('minus').text(lang['open_list_comments'] + ' (' + count + ')'); 936 list.hide().addClass('unvisible'); 937 }); 938 }); 939 940 941 942 if (location.hash) 943 { 944 var hash = location.hash; 945 var answer = false;
946 947 if(location.hash.indexOf('#answer:') == 0) 948 { 949 var comment = '#c-' + location.hash.split(':')[1]; 950 answer = true; 951 hash = comment; 952 953 console.log(hash); 954 } 955 956 //console.log(location.hash); 957 if(hash.indexOf('#c-') == 0) 958 { 959 $('.comments').find('ul').each(function() 960 { 961 962 if($(this).find(hash).length > 0) 963 { 964 console.log($(this).find(hash).length); 965 966 $(this).find('> .comment > .drop').each(function() 967 { 968 var list = $(this).next(); 969 var t = $(this); 970 var count = list.find('li').length; 971 972 t.addClass('minus').removeClass('plus').empty(); 973 list.show().removeClass('unvisible'); 974 }); 975 } 976 }); 977 978 if(answer) 979 { 980 var button = $('body').find(hash).find('.comansver'); 981 982 if($('body').find("#comment_text").length < 1 && $('body').find("#bb").length < 1 && $('body').find("#comment_hidden").length < 1) 983 { 984 document.location.href = baseurl + 'login'; 985 return; 986 } 987 var highlight = window.getSelection().toString(); 988 var link = button.parent().parent().find('.cel').attr('href'); 989 var to = button.attr('rel'); 990 991 var author = $('#c-'+to+' span.dname').html(); 992 var comdate = $('#c-'+to+' span.ddate').html(); 993 var tmp = $.parseHTML( comdate ); 994 comdate = tmp[0].textContent; 995 996 var article_id = 0; 997 var parse = to.split(':'); 998 if(parse.length == 2) 999 article_id = parse[1]; 1000 1001 var comment = button.parent().parent().find('.comtext').html(); 1002 if (highlight.length > 0) { 1003 comment = highlight; 1004 } 1005 var html = ''; 1006 html+= '<form method="post" action="" class="addcomment">'; 1007 html+= '<textarea class="comment_text" id="comment_text" name="comment_text" placeholder="' + lang['comment_text'] + '"></textarea>'; 1008 html+= '<input type="hidden" name="to" value="' + to + '">'; 1009 html+= '<p><button type="submit" name="submit" class="gbutton" value="comment_add">' + lang['send'] + '</button></p>'; 1010 html+= '</form>'; 1011 1012 if (!button.hasClass('comhide')) 1013 { 1014 var text = '<a class="citating" href="'+link+'"><dt>' + lang['quote'] + ': '+author+' ' + lang['from_date'] + ' '+comdate+'</dt></a><blockquote>'+comment+'</blockquote>\n'; 1015 $(html).insertAfter(button.parent()); 1016 //$('html, body').animate( 1017 //{ 1018 // scrollTop: $('body').find('#c-'+to).find("#comment_text").offset().top - 100 1019 //}, 500); 1020 $('body').find('#c-'+to).find("#comment_text").focus(); 1021 button.addClass('comhide').text(lang['cancel']); 1022 1023 $('body').find('#c-'+to).find("#comment_text").wysibb({ 1024 lang: "ru", 1025 buttons: "quote,link,img,bold,italic,underline,justifyleft,justifycenter,justifyright" 1026 }); 1027 $('body').find('#c-'+to).find('#comment_text').htmlcode(); 1028 $('body').find('#c-'+to).find('#comment_text').focus(); 1029 } 1030 else 1031 { 1032 if($('body').find('#c-'+to).find('#comment_text').length > 0) 1033 $('body').find('#c-'+to).find('#comment_text').htmlcode(); 1034 1035 button.parent().parent().find('.addcomment').remove(); 1036 button.parent().parent().find('.editcomment').remove(); 1037 button.parent().parent().find('.complainform').remove(); 1038 button.removeClass('comhide').text(lang['reply']); 1039 } 1040 } 1041 }; 1042 1043 1044 1045 setTimeout(function() 1046 { 1047 if($('body').find(hash).lenght){ 1048 $('html, body').animate( 1049 { 1050 scrollTop: $('body').find(hash).offset().top 1051 }, 100);} 1052 }, 100); 1053 } 1054 1055 $('.comments > ul').addClass('cl'); 1056 1057 $('.comments ul').each(function() 1058 { 1059 //var count_ul = $(this).find('ul').length; 1060 //if($(window).width() < 1180 && $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().hasClass('cl')) 1061 if 1062 ( 1063 $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().hasClass('cl') && 1064 $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().hasClass('all_comments') 1065 ) 1066 { 1067 $(this).addClass('cl'); 1068 } 1069 else if($(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().hasClass('cl')) 1070 { 1071 $(this).parent().parent().addClass('cl'); 1072 } 1073 }) 1074 /* комменÑаÑии ÑазвеÑнÑÑÑ/ÑвеÑнÑÑÑ ÐºÐ¾Ð½ÐµÑ */ 1075 1076 /* вÑÑавиÑÑ ÑоÑÐ¼Ñ Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñа в ÑÑаÑÑе*/ 1077 $('body').on('click','a.comansver', function() 1078 { 1079 if($('body').find("#comment_text").length < 1 && $('body').find("#bb").length < 1 && $('body').find("#comment_hidden").length < 1) 1080 { 1081 document.location.href = baseurl + 'login'; 1082 return; 1083 } 1084 var highlight = window.getSelection().toString(); 1085 var link = $(this).parent().parent().find('.cel').attr('href'); 1086 var to = $(this).attr('rel'); 1087 1088 var author = $('#c-'+to+' span.dname').html(); 1089 var comdate = $('#c-'+to+' span.ddate').html(); 1090 var tmp = $.parseHTML( comdate ); 1091 comdate = tmp[0].textContent; 1092 1093 var article_id = 0; 1094 var parse = to.split(':'); 1095 if(parse.length == 2) 1096 article_id = parse[1]; 1097 //var string = (strip_tags($(this).parent().parent().find('.comtext').html())).trim(); 1098 //var comment = cutString(string,120); 1099 var comment = $(this).parent().parent().find('.comtext').html(); 1100 if (highlight.length > 0) { 1101 comment = highlight; 1102 } 1103 var html = ''; 1104 //html+= '<form method="post" action="" class="addcomment">'; 1105 //html+= '<textarea class="comment_text" id="comment_text" name="comment_text" placeholder="' + lang['comment_text'] + '">['+comment+'...]\n</textarea>'; 1106 //html+= '<input type="hidden" name="to" value="' + to + '">'; 1107 //html+= '<p><button type="submit" name="submit" class="gbutton" value="comment_add">
1107' + lang['send'] + '</button></p>'; 1108 //html+= '</form>'; 1109 1110 html+= '<form method="post" action="" class="addcomment">'; 1111 html+= '<textarea class="comment_text" id="comment_text" name="comment_text" placeholder="' + lang['comment_text'] + '"></textarea>'; 1112 html+= '<input type="hidden" name="to" value="' + to + '">'; 1113 html+= '<p><button type="submit" name="submit" class="gbutton" value="comment_add">' + lang['send'] + '</button></p>'; 1114 html+= '</form>'; 1115 1116 //if (!$(this).hasClass('comhide')) { 1117 // $(html).insertAfter($(this).parent()); 1118 // $('html, body').animate( 1119 // { 1120 // scrollTop: $('body').find('#c-'+to).find("#comment_text").offset().top - 100 1121 // }, 100); 1122 // $('body').find('#c-'+to).find("#comment_text").focus(); 1123 // $(this).addClass('comhide').text(lang['cancel']); 1124 //} 1125 //else { 1126 // $(this).parent().parent().find('.addcomment').remove(); 1127 // $(this).removeClass('comhide').text(lang['reply']); 1128 //} 1129 1130 if (!$(this).hasClass('comhide')) { 1131 var text = '<a class="citating" href="'+link+'"><dt>' + lang['quote'] + ': '+author+' ' + lang['from_date'] + ' '+comdate+'</dt></a><blockquote>'+comment+'</blockquote>\n'; 1132 $(html).insertAfter($(this).parent()); 1133 $('html, body').animate( 1134 { 1135 scrollTop: $('body').find('#c-'+to).find("#comment_text").offset().top - 100 1136 }, 500); 1137 $('body').find('#c-'+to).find("#comment_text").focus(); 1138 $(this).addClass('comhide').text(lang['cancel']); 1139 $('body').find('#c-'+to).find("#comment_text").wysibb({ 1140 lang: "ru", 1141 buttons: "quote,link,img,bold,italic,underline,justifyleft,justifycenter,justifyright" 1142 }); 1143 $('body').find('#c-'+to).find('#comment_text').htmlcode(); 1144 $('body').find('#c-'+to).find('#comment_text').focus(); 1145 } 1146 else { 1147 if($('body').find('#c-'+to).find('#comment_text').length > 0) 1148 $('body').find('#c-'+to).find('#comment_text').htmlcode(); 1149 1150 $(this).parent().parent().find('.addcomment').remove(); 1151 $(this).parent().parent().find('.editcomment').remove(); 1152 $(this).parent().parent().find('.complainform').remove(); 1153 $(this).removeClass('comhide').text(lang['reply']); 1154 } 1155 }); 1156 1157 /* вÑÑавиÑÑ ÑоÑÐ¼Ñ ÑедакÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑообÑÐµÐ½Ð¸Ñ Ð´Ð»Ñ ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñа в ÑÑаÑÑе*/ 1158 $('body').on('click','a.comedit', function() 1159 { 1160 $(this).parent().parent().find('.editcomment').remove(); 1161 $(this).parent().parent().find('.addcomment').remove(); 1162 $(this).parent().parent().find('.complainform').remove(); 1163 var id = $(this).attr('rel'); 1164 var comtext = $(this).parent().parent().find('.comtext').html(); 1165 var html = ''; 1166 html+= '<form method="post" action="" class="editcomment">'; 1167 html+= '<textarea class="comment_text" id="comment_text" name="comment_text" placeholder="' + lang['comment_text'] + '"></textarea>'; 1168 html+= '<input type="hidden" name="comment_id" id="comment_id" value="' + id + '">'; 1169 html+= '<p><button type="submit" name="submit" class="gbutton" value="comment_add">' + lang['send'] + '</button></p>'; 1170 html+= '</form>'; 1171 1172 if (!$(this).hasClass('comhide')) 1173 { 1174 1175 var t = $(this); 1176 1177 $.ajax( 1178 { 1179 method: "POST", 1180 type: "POST", 1181 cache: false, 1182 url: baseurl + 'articles', 1183 data: { comment_id: id, ajax: true, option: 'checkRightEditComment' } 1184 }) 1185 .done(function( msg ) 1186 { 1187 if(msg) 1188 { 1189 alert(msg); 1190 return; 1191 } 1192 1193 1194 if(user_group_id != 2 && user_group_id != 4) 1195 { 1196 // if (confirm("ÐоÑле ÑедакÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑиÑло одобÑений ÑÑÐ°Ð½ÐµÑ ÑавнÑм нÑлÑ. ÐÑодолжиÑÑ?")) 1197 // { 1198 t.parent().parent().append(html); 1199 //t.addClass('comhide'); 1200 //t.addClass('comhide'); 1201 $('body').find('#c-'+id).find("#comment_text").wysibb({ 1202 lang: "ru", 1203 buttons: "quote,link,img,bold,italic,underline,justifyleft,justifycenter,justifyright" 1204 }); 1205 $('body').find('#c-'+id).find('#comment_text').htmlcode(comtext); 1206 $('html, body').animate( 1207 { 1208 scrollTop: $('body').find('#c-'+id).find(".wysibb-body").offset().top - 100 1209 }, 500); 1210 $('body').find('#c-'+id).find('.comansver').addClass('comhide').text(lang['cancel']); 1211 // } 1212 } 1213 else 1214 { 1215 t.parent().parent().append(html); 1216 //t.addClass('comhide'); 1217 //t.addClass('comhide'); 1218 $('body').find('#c-'+id).find("#comment_text").wysibb({ 1219 lang: "ru", 1220 buttons: "quote,link,img,bold,italic,underline,justifyleft,justifycenter,justifyright" 1221 }); 1222 $('body').find('#c-'+id).find('#comment_text').htmlcode(comtext); 1223 $('html, body').animate( 1224 { 1225 scrollTop: $('body').find('#c-'+id).find(".wysibb-body").offset().top - 100 1226 }, 500); 1227 $('body').find('#c-'+id).find('.comansver').addClass('comhide').text(lang['cancel']); 1228 } 1229 1230 }); 1231 } 1232 else { 1233 $(this).parent().parent().find('.editcomment').remove(); 1234 $(this).removeClass('comhide'); 1235 } 1236 }); 1237 1238 //$('body').on('click','a.comedit', function() 1239 //{ 1240 // var id = $(this).attr('rel'); 1241 // var comtext = $(this).parent().parent().find('.comtext').html(); 1242 // var to = $(this).attr('rel'); 1243 // var html = ''; 1244 // html+= '<form method="post" action="" class="editcomment">'; 1245 // html+= '<textarea class="comment_text" id="comment_text" name="comment_text" placeholder="' + lang['comment_text'] + '"></textarea>'; 1246 // html+= '<input type="hidden" name="comment_id" id="comment_id" value="' + id + '">'; 1247 // html+= '<p><button type="submit" name="submit" class="gbutton" value="comment_add">
1247' + lang['send'] + '</button></p>'; 1248 // html+= '</form>'; 1249 // 1250 // if (!$(this).hasClass('comhide')) { 1251 // var text = comtext; 1252 // $(html).insertAfter($(this).parent()); 1253 // $('html, body').animate( 1254 // { 1255 // scrollTop: $('body').find('#c-'+to).find("#comment_text").offset().top - 100 1256 // }, 500); 1257 // $('body').find('#c-'+to).find("#comment_text").focus(); 1258 // $(this).addClass('comhide').text(lang['cancel']); 1259 // $('body').find('#c-'+to).find("#comment_text").wysibb({ 1260 // lang: "ru", 1261 // buttons: "quote,link,img,bold,italic,underline,justifyleft,justifycenter,justifyright" 1262 // }); 1263 // $('body').find('#c-'+to).find('#comment_text').htmlcode(text); 1264 // $('body').find('#c-'+to).find('#comment_text').focus(); 1265 // } 1266 // else { 1267 // $('body').find('#c-'+to).find('#comment_text').htmlcode(); 1268 // $(this).parent().parent().find('.editcomment').remove(); 1269 // $(this).removeClass('comhide').text(lang['reply']); 1270 // } 1271 //}); 1272 1273 $('body').on('submit','.editcomment', function(e){ 1274 e.preventDefault(); 1275 var t = $(this); 1276 var comment_id = $('#comment_id',this).val(); 1277 var comment_text = $('#comment_text',this).val(); 1278 $.ajax({ 1279 method: "POST", 1280 type: "POST", 1281 cache: false, 1282 url: baseurl + 'articles', 1283 data: { ajax: true, option: 'editComment', comment_id: comment_id, comment_text: comment_text } 1284 }) 1285 .done(function( msg ) 1286 { 1287 if (msg!=0) 1288 { 1289 msg = nl2br(msg); 1290 $('body').find('#c-'+comment_id+' .editcomment').remove(); 1291 $('body').find('a.comedit[rel="'+comment_id+'"]').removeClass('comhide'); 1292 $('body').find('#c-'+comment_id+' .comtext').html('<p>' + msg + '</p>'); 1293 } 1294 1295 t.find('[name="submit"]').removeClass('disabled'); 1296 }); 1297 }); 1298 /*end*/ 1299 1300 /* пожаловаÑÑÑÑ Ð½Ð° ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñ ÑÑаÑÑ */ 1301 $('body').on('click','.complain,.complain9',function(e) 1302 { 1303 e.preventDefault(); 1304 $(this).parent().parent().find('.editcomment').remove(); 1305 $(this).parent().parent().find('.addcomment').remove(); 1306 $(this).parent().parent().find('.complainform').remove(); 1307 var id = $(this).attr('rel'); 1308 var html = ''; 1309 html+= '<form method="post" action="" class="complainform" rel="'+id+'">'; 1310 html+= '<textarea class="comment_text" id="complain_text" name="comment_text" placeholder="' + lang['text_complain'] + '"></textarea>'; 1311 html+= '<input type="hidden" name="comment_id" id="comment_id" value="' + id + '">'; 1312 html+= '<p><button type="submit" name="submit" class="gbutton" value="complain">' + lang['btn_complain'] + '</button></p>'; 1313 html+= '</form>'; 1314 if (!$(this).hasClass('comphide')) { 1315 $(this).parent().parent().append(html); 1316 $('body').find('#c-'+id).find('.comansver').addClass('comhide').text(lang['cancel']); 1317 //$(this).addClass('comphide'); 1318 } 1319 else { 1320 $(this).parent().parent().find('.complainform').remove(); 1321 $(this).removeClass('comphide'); 1322 } 1323 }); 1324 1325 $('body').on('submit','.complainform', function(e){ 1326 e.preventDefault(); 1327 var t = $(this); 1328 var text = $('#complain_text', this).val(); 1329 var comment_id = t.attr('rel'); 1330 t.find('button').parent().html('<br /><img src="' + baseurl + 'images/ajax-loader.gif" />'); 1331 1332 1333 $.ajax( 1334 { 1335 method: "POST", 1336 type: "POST", 1337 cache: false, 1338 url: baseurl + 'articles', 1339 data: { comment_id: comment_id, ajax: true, text: text, option: 'complain' } 1340 }) 1341 .done(function( msg ) 1342 { 1343 1344 if(!msg) 1345 { 1346 document.location.href = baseurl + 'login'; 1347 return; 1348 } 1349 t.find('[name="submit"]').removeClass('disabled'); 1350 t.remove(); 1351 $('body a.complain[rel='+comment_id+']').remove(); 1352 }); 1353 }); 1354 /* пожаловаÑÑÑÑ Ð½Ð° ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñ ÐºÐ¾Ð½ÐµÑ */ 1355 /* галеÑÐµÑ ÑÑаÑÑ */ 1356 $('.text a').each(function() 1357 { 1358 var href = $(this).attr('href'); 1359 if 1360 ( 1361 typeof href !== "undefined" && 1362 ( 1363 href.indexOf('.jpg') >= 0 || 1364 href.indexOf('.png') >= 0 || 1365 href.indexOf('.jpeg') >= 0 || 1366 href.indexOf('.gif') >= 0 || 1367 href.indexOf('.JPG') >= 0 || 1368 href.indexOf('.PNG') >= 0 || 1369 href.indexOf('.JPEG') >= 0 || 1370 href.indexOf('.GIF') >= 0 1371 ) 1372 ) 1373 $(this).addClass('fn'); 1374 }); 1375 $('body').on('click','.fn', function() 1376 { 1377 1378 }); 1379 $('.fn').fancybox( 1380 { 1381 helpers : { 1382 overlay: {
1383 locked: false 1384 } 1385 } 1386 }); 1387 /* галеÑÐµÑ ÐºÐ¾Ð½ÐµÑ */ 1388 1389 /* iframe */ 1390 $('body').on('click','.open_iframe',function(e) 1391 { 1392 var link = $(this).attr('data-link'); 1393 1394 $.fancybox.open( 1395 { 1396 padding : 0, 1397 href: link, 1398 type: 'iframe', 1399 helpers: { 1400 overlay: { 1401 locked: false 1402 } 1403 }, 1404 openEffect: 'elastic', 1405 afterShow: function( instance, current ) { 1406 if($('body').find('.popup_adv_left').length) 1407 { 1408 var id_block = $('body').find('.popup_adv_left').attr('id'); 1409 1410 var width_video_window = $('.fancybox-type-iframe').width(); 1411 var width_adv_block = ($(window).width() - width_video_window - 200) / 2; 1412 1413 if(width_adv_block > 100) 1414 { 1415 $('.popup_adv').width(width_adv_block) 1416 $('.popup_adv').show(); 1417 1418 } 1419 // console.log(width_adv_block); 1420 } 1421 if($('body').find('.popup_adv_right').length) 1422 { 1423 // (function(w, d, n, s, t) { 1424 // w[n] = w[n] || []; 1425 // w[n].push(function() { 1426 // Ya.Context.AdvManager.render({ 1427 // blockId: "R-A-1947532-102", 1428 // renderTo: "adv-block-right", 1429 // async: true, 1430 // pageNumber: 1 }); 1431 // }); 1432 // t = d.getElementsByTagName("script")[0]; 1433 // s = d.createElement("script"); 1434 // s.type = "text/javascript"; 1435 // s.src = "//an.yandex.ru/system/context.js"; 1436 // s.async = true; 1437 // t.parentNode.insertBefore(s, t); 1438 // })(this, this.document, "yandexContextAsyncCallbacks"); 1439 } 1440 }, 1441 afterClose: function( instance, current ) { 1442 $('.popup_adv').hide(); 1443 } 1444 }); 1445 }); 1446 1447 1448 /* видео наÑало */ 1449 1450 $('body').on('click','.video > .playvideo span',function(e) 1451 { 1452 e.preventDefault(); 1453 $(this).parent().next().removeClass('hide'); 1454 $(this).parent().next().find('iframe').attr('src', $(this).parent().next().find('iframe').attr('src') + '&autoplay=1'); 1455 $(this).parent().remove(); 1456 }); 1457 $('body').on('click','.videos_list .playvideo,.video_item > .playvideo,.video_item > .img_block > .playvideo',function(e) 1458 { 1459 if(1 == 0) 1460 { 1461 if($(this).attr('data-video')) 1462 { 1463 e.preventDefault(); 1464 1465 var video_id = $(this).attr('data-video'); 1466 $( this ).replaceWith( '<iframe width="100%" height="214" src="https://www.youtube.com/embed/' + video_id + '?autoplay=1" frameborder="0" allowfullscreen></iframe><br /><br />' ); 1467 1468 //$(this).parent().next().removeClass('hide'); 1469 //$(this).parent().next().find('iframe').attr('src', $(this).parent().next().find('iframe').attr('src') + '&autoplay=1'); 1470 //$(this).parent().remove(); 1471 } 1472 else if($(this).attr('data-video-rutube')) 1473 { 1474 e.preventDefault(); 1475 1476 var video_id = $(this).attr('data-video-rutube'); 1477 $( this ).replaceWith( '<iframe width="100%" height="214" src="https://rutube.ru/play/embed/' + video_id + '?autoplay=1" frameborder="0" allowfullscreen></iframe><br /><br />' ); 1478 } 1479 else if($(this).attr('data-video-link')) 1480 { 1481 e.preventDefault(); 1482 1483 var video_link = $(this).attr('data-video-link'); 1484 $( this ).replaceWith( '<iframe width="100%" height="214" src="' + video_link + '&autoplay=1" frameborder="0" allowfullscreen></iframe><br /><br />' ); 1485 } 1486 } 1487 1488 }); 1489 /* видео ÐºÐ¾Ð½ÐµÑ */ 1490 1491 /*вÑÐ±Ð¾Ñ ÑоÑо*/ 1492 $('body').on('click','.file_photo button', function() { 1493 $(this).parent().find('input').click(); 1494 }); 1495 $('body').on('change','.file_photo input', function() 1496 { 1497 var value = $(this).val(); 1498 var parts = value.split(/[\/\\]/); 1499 value = parts[(parts.length - 1)]; 1500 if(value.length > 0) 1501 $(this).parent().find('button').text(value); 1502 }); 1503 /* оÑмена ÑкÑола еÑли еÑÑÑ Ñ ÑÑ ÑÑаÑÑ */ 1504 if (location.hash) 1505 { 1506 if(location.hash.indexOf('#c-') < 0) 1507 { 1508 setTimeout(function() 1509 { 1510 window.scrollTo(0, 0); 1511 1512 if(location.hash == '#candidates' || location.hash == '#rejected') 1513 { 1514 $('.user_sub_menu .item').each(function() 1515 { 1516 if($('a', this).attr('href') == location.hash) 1517 $(this).addClass('active'); 1518 }); 1519 $('.tabs .tab').hide(); 1520 $('.tabs ' + location.hash).show(); 1521 $('html, body').animate( 1522 { 1523 scrollTop: $('body').find(location.hash).offset().top 1524 }, 100); 1525 } 1526 }, 1); 1527 } 1528 } 1529 /* оÑмена ÑкÑола еÑли еÑÑÑ Ñ ÑÑ ÐºÐ¾Ð½ÐµÑ */ 1530 1531 /* инÑеÑеÑнÑй ajax ÑÑаÑÑ */ 1532 $('body').on('click','.ajax .pagination a', function(e) 1533 { 1534 e.preventDefault(); 1535 }); 1536 1537 $('.ajax').mouseover(function() 1538 { 1539 var t = $(this); 1540 var block = t.attr('id'); 1541 var option = 'get' + ucfirst(block); 1542 if(t.find('.pagination').length > 0) 1543 { 1544 t.find('.pagination a').click(function(e) 1545 { 1546 if(t.hasClass('updated')) 1547 return; 1548 1549 console.log(1); 1550 1551 var url = $(this).attr('href'); 1552 var parse = url.split('='); 1553 var start = parse[(parse.length - 1)]; 1554 1555 t.addClass('updated'); 1556 1557 $.ajax({ 1558 method: "POST", 1559 type: "POST", 1560 cache: false, 1561 url: baseurl + 'articles', 1562 data: { start: start, ajax: true, option: option, uid: user_id } 1563 }) 1564 .done(function( msg ) 1565 { 1566 if(!msg) 1567 return; 1568 var result = jQuery.parseJSON( msg ); 1569 1570 var html = '<ul class="unstyled all_comments">'; 1571 if(block == 'comments_admin' || block == 'comments_admin_complaints' || block == 'comments' || block == 'comments_to_my_articles' || block == 'comments_to_my_comments') 1572 { 1573 html+='<li>'; 1574 html+=' <div>'; 1575 } 1576 1577 if(!result.items.length) 1578 { 1579 html+= '<p>' + lang['comments_empty'] + '</p>'; 1580 } 1581 1582 for (var i = 0; i < result.items.length; i++) 1583 { 1584 var item = result.items[i]; 1585 1586 if(block == 'bookmarks') 1587 html+= renderArticle(item,true); 1588 1589 if(block == 'comments_likes') 1590 html+= renderComment(item); 1591 1592 if(block == 'comments_dislikes') 1593 html+= renderComment(item); 1594 1595 if(block == 'articles') 1596 html+= renderArticle(item); 1597 1598 if(block == 'articles_checkout') 1599 html+= renderArticle(item); 1600 1601 if(block == 'yellow_card') 1602 html+= renderYellowCard(item); 1603 1604 if(block == 'red_card') 1605 html+= renderRedCard(item); 1606 1607 if(block == 'comments_hazin') 1608 html+= renderComment(item,user_group_id); 1609 1610 if(block == 'comments' || block == 'comments_to_my_comments') 1611 html+= renderComment(item,user_group_id); 1612 1613 if(block == 'comments_admin' || block == 'comments_admin_complaints') 1614 html+= renderComment(item,user_group_id); 1615 1616 if(block == 'comments_to_my_articles') 1617 html+= renderComment(item,user_group_id,true); 1618 }; 1619 if(block == 'comments_admin' || block == 'comments_admin_complaints' || block == 'comments' || block == 'comments_to_my_articles' || 'comments_to_my_comments') 1620 { 1621 html+=' </div>'; 1622 html+='</li>'; 1623 } 1624 html+='</ul>'; 1625 //console.log(html); 1626 //console.log(result.pagination); 1627 html+= result.pagination; 1628 t.html(html).removeClass('updated'); 1629 1630 $('html,body').animate( 1631 { 1632 scrollTop: (t.offset().top - 50) 1633 }, 300); 1634 }); 1635 }) 1636 } 1637 }); 1638 1639 1640 /* инÑеÑеÑнÑй ajax ÐºÐ¾Ð½ÐµÑ */ 1641 1642 $('body').on('click','.open_comments',function(){ 1643 $(this).parent().parent().find('.comments_block').animate({ 1644 height: "toggle" 1645 }, 500, function() { 1646 // Animation complete. 1647 }); 1648 }); 1649 1650 1651 /* ÑбÑаÑÑ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÑ ÑÑаÑÑ */ 1652 $('body').on('click','.featured_rm',function(e) 1653 { 1654 e.preventDefault(); 1655 var t = $(this); 1656 var article_id = t.attr('rel'); 1657 $.ajax({ 1658 method: "POST", 1659 type: "POST", 1660 cache: false, 1661 url: baseurl + 'articles', 1662 data: { article_id: article_id, ajax: true, option: 'updateBookmarks' } 1663 }) 1664 .done(function( msg ) 1665 { 1666 if(!msg) 1667 return; 1668 t.parent().remove(); 1669 }); 1670 }); 1671 /* ÑбÑаÑÑ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÑ ÐºÐ¾Ð½ÐµÑ */ 1672 1673 /* ÑбÑаÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ ÑÑаÑÑ */ 1674 $('body').on('click','.subs_rm',function(e) 1675 { 1676 e.preventDefault(); 1677 var t = $(this); 1678 var author_id = t.attr('rel'); 1679 $.ajax({ 1680 method: "POST", 1681 type: "POST", 1682 cache: false, 1683 url: baseurl + 'articles', 1684 data: { author_id: author_id, ajax: true, option: 'updateSubs' } 1685 }) 1686 .done(function( msg ) 1687 { 1688 if(!msg) 1689 return; 1690 t.parent().remove(); 1691 }); 1692 }); 1693 /* ÑбÑаÑÑ Ð¿Ð¾Ð´Ð¿Ð¸ÑÐºÑ ÐºÐ¾Ð½ÐµÑ */ 1694 1695 /* ÑкÑÑÑÑ Ð°Ð²ÑоÑа из ленÑÑ! ÑÑаÑÑ */ 1696 $('body').on('click','.hidden_author',function(e) 1697 { 1698 e.preventDefault(); 1699 var t = $(this); 1700 var author_id = t.attr('rel'); 1701 $.ajax({ 1702 method: "POST", 1703 type: "POST", 1704 cache: false, 1705 url: baseurl + 'articles', 1706 data: { author_id: author_id, ajax: true, option: 'updateHiddenAuthor' } 1707 }) 1708 .done(function( msg ) 1709 { 1710 if(!msg) 1711 return; 1712 if(t.hasClass('bbutton')) 1713 t.removeClass('bbutton').text(lang['btn_hide_from_main']); 1714 else 1715 t.addClass('bbutton').text(lang['btn_back_to_main']); 1716 }); 1717 }); 1718 /* ÑкÑÑÑÑ Ð°Ð²ÑоÑа из ленÑÑ! ÐºÐ¾Ð½ÐµÑ */ 1719 1720 /* ÑбÑаÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑаÑий ÑÑаÑÑ */ 1721 $('body').on('click','.comdelete',function(e) 1722 { 1723 e.preventDefault(); 1724 1725 if (confirm(lang['remove_comments_Q'])) 1726 { 1727 var t = $(this); 1728 var comment_id = t.attr('rel'); 1729 $.ajax({ 1730 method: "POST", 1731 type: "POST", 1732 cache: false, 1733 url: baseurl + 'articles', 1734 data: { comment_id: comment_id, ajax: true, option: 'deleteComment' } 1735 }) 1736 .done(function( msg ) 1737 { 1738 if(!msg) 1739 return; 1740 1741 if(msg != 1) 1742 { 1743 alert(msg); 1744 return; 1745 } 1746 1747 var cc = $(t.parent().parent().parent().parent()).find('li').length; 1748 console.log(cc); 1749 if (cc==1) 1750 t.parent().parent().parent().find('.drop').remove(); 1751 t.parent().parent().parent().remove(); 1752 }); 1753 } 1754 1755 })
1756 /* дизейблим ÐºÐ½Ð¾Ð¿ÐºÑ Ð¾ÑпÑавиÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñ*/ 1757 1758 $('body').on('submit','.addcomment', function(){ 1759 //$(this).find('button').attr('disabled','disabled'); 1760 }); 1761 1762 /* в закладки! ÑÑаÑÑ */ 1763 $('body').on('click','.featured_btn',function(e) 1764 { 1765 e.preventDefault(); 1766 var t = $(this); 1767 var article_id = t.attr('rel'); 1768 $.ajax({ 1769 method: "POST", 1770 type: "POST", 1771 cache: false, 1772 url: baseurl + 'articles', 1773 data: { article_id: article_id, ajax: true, option: 'updateBookmarks' } 1774 }) 1775 .done(function( msg ) 1776 { 1777 if(!msg) 1778 return; 1779 if(t.hasClass('active')) 1780 t.removeClass('active'); 1781 else 1782 t.addClass('active'); 1783 }); 1784 }); 1785 /* в закладки! ÐºÐ¾Ð½ÐµÑ */ 1786 1787 /* в подпиÑки! ÑÑаÑÑ */ 1788 $('body').on('click','.subscribe',function(e) 1789 { 1790 e.preventDefault(); 1791 var t = $(this); 1792 var author_id = t.attr('rel'); 1793 $.ajax({ 1794 method: "POST", 1795 type: "POST", 1796 cache: false, 1797 url: baseurl + 'articles', 1798 data: { author_id: author_id, ajax: true, option: 'updateSubs' } 1799 }) 1800 .done(function( msg ) 1801 { 1802 if(!msg) 1803 return; 1804 if(t.hasClass('bbutton')) 1805 t.removeClass('bbutton').text(lang['btn_subscribe']); 1806 else 1807 t.addClass('bbutton').text(lang['btn_unsubscribe']); 1808 }); 1809 }); 1810 /* в подпиÑки! ÐºÐ¾Ð½ÐµÑ */ 1811 1812 var currenturl = location.href; 1813 1814 /* ÑаÑÑ ÑÑаÑÑ */ 1815 1816 var link_parts = currenturl.split('#'); 1817 if(link_parts.length < 2) 1818 link_parts = currenturl.split('?'); 1819 1820 $('.tabs').each(function() 1821 { 1822 console.log(123); 1823 // if($(this).find('li.active').length == 0) 1824 // { 1825 $(this).find('li:first').addClass('active'); 1826 var block_class = $(this).attr('rel'); 1827 1828 if($('body').hasClass('user')) 1829 { 1830 var href = $(this).find('a').attr('href'); 1831 var t = $(href); 1832 1833 var exppp = ['bookmarks','settings','my_black_list','subscribtion','statistics','articles_checkout','statistics_articles']; 1834 1835 console.log(exppp); 1836 console.log(link_parts[1]); 1837 console.log(currenturl); 1838 console.log(exppp.indexOf(link_parts[1])); 1839 1840 if(link_parts.length < 2) 1841 { 1842 $('.' + block_class + ' > .tab').hide(); 1843 $('.' + block_class + ' .tab:first').show(); 1844 1845 return false; 1846 } 1847 1848 // if(href == '#bookmarks' || href == '#settings' || href == '#my_black_list') 1849 if(exppp.indexOf(link_parts[1]) >= 0) 1850 { 1851 console.log('efwf4gr'); 1852 $(this).find('li.active').removeClass('active'); 1853 $(this).find('[href="#' + link_parts[1] + '"]').parent().addClass('active'); 1854 $('.' + block_class + ' > .tab').hide(); 1855 $('.' + block_class + ' #' + link_parts[1]).show(); 1856 return false; 1857 } 1858 1859 if(t.find('li').length > 0 || t.find('.comment').length > 0) 1860 { 1861 $(this).parent().find('li.active').removeClass('active'); 1862 $(this).addClass('active'); 1863 $('.' + block_class + ' > .tab').hide(); 1864 $('.' + block_class + ' ' + href).show(); 1865 return true; 1866 } 1867 1868 $('#tabs').addClass('loading'); 1869 1870 var block = href.replace('#',''); 1871 var start = 0; 1872 var option = 'get' + ucfirst(block); 1873 1874 t.addClass('updated'); 1875 1876 $.ajax({ 1877 method: "POST", 1878 type: "POST", 1879 cache: false, 1880 url: baseurl + 'articles', 1881 data: { start: start, ajax: true, option: option, uid: user_id } 1882 }) 1883 .done(function( msg ) 1884 { 1885 if(!msg) 1886 return; 1887 var result = jQuery.parseJSON( msg ); 1888 1889 var html = '<ul class="unstyled all_comments">'; 1890 if(block == 'comments_admin' || block == 'comments_admin_complaints' || block == 'comments' || block == 'comments_to_my_articles' || block == 'comments_to_my_comments') 1891 { 1892 html+='<li>'; 1893 html+=' <div>'; 1894 } 1895 1896 if(!result.items.length) 1897 { 1898 html+= '<p>' + lang['comments_empty'] + '</p>'; 1899 } 1900 1901 for (var i = 0; i < result.items.length; i++) 1902 { 1903 var item = result.items[i]; 1904 1905 if(block == 'bookmarks') 1906 html+= renderArticle(item,true); 1907 1908 if(block == 'comments_likes') 1909 html+= renderComment(item); 1910 1911 if(block == 'comments_dislikes') 1912 html+= renderComment(item); 1913 1914 if(block == 'articles') 1915 html+= renderArticle(item); 1916 1917 if(block == 'articles_checkout') 1918 html+= renderArticle(item); 1919 1920 if(block == 'yellow_card') 1921 html+= renderYellowCard(item); 1922 1923 if(block == 'red_card') 1924 html+= renderRedCard(item); 1925 1926 if(block == 'comments_hazin') 1927 html+= renderComment(item,user_group_id); 1928 1929 if(block == 'comments' || block == 'comments_to_my_comments') 1930 html+= renderComment(item,user_group_id); 1931 1932 if(block == 'comments_admin' || block == 'comments_admin_complaints') 1933 html+= renderComment(item,user_group_id); 1934 1935 if(block == 'comments_to_my_articles') 1936 html+= renderComment(item,user_group_id,true); 1937 }; 1938 if(block == 'comments_admin' || block == 'comments_admin_complaints' || block == 'comments' || block == 'comments_to_my_articles' || 'comments_to_my_comments') 1939 { 1940 html+=' </div>'; 1941 html+='</li>'; 1942 } 1943 html+='</ul>'; 1944 //console.log(html); 1945 //console.log(result.pagination); 1946 html+= result.pagination; 1947 t.html(html).removeClass('updated'); 1948 1949 $('#tabs').removeClass('loading'); 1950 1951 $('.' + block_class + ' > .tab').hide(); 1952 $('.' + block_class + ' ' + href).show(); 1953 1954 1955 }); 1956 1957 return; 1958 } 1959 1960 $('.' + block_class + ' > .tab').hide(); 1961 $('.' + block_class + ' .tab:first').show(); 1962 1963 if($('.' + block_class + ' .tab:first .videos-block').length) 1964 { 1965 $.getScript(baseurl + 'scripts/owl.carousel.min.js', function() 1966 { 1967 $('.' + block_class + ' .tab:first .videos-block').owlCarousel( 1968 { 1969 nav: true, 1970 dots: true, 1971 autoplay: false, 1972 items: 4, 1973 loop: false, 1974 responsive:{ 1975 0:{ 1976 items:1 1977 }, 1978 600:{ 1979 items:2 1980 }, 1981 1000:{ 1982 items:4 1983 } 1984 } 1985 }); 1986 }); 1987 1988 } 1989 // } 1990 }); 1991 1992 $('.tabs li a, .tabs a.li').each(function() 1993 { 1994 // var href = $(this).attr('href'); 1995 1996 // if(link_parts.length > 1 && href == '#' + link_parts[1]) 1997 // { 1998 // // var block_class = $(this).parent().parent().attr('rel'); 1999 // var block_class = $(this).closest('.tabs').attr('rel'); 2000 // console.log(block_class); 2001 2002 // $(this).parent().parent().find('li.active').removeClass('active'); 2003 // $(this).parent().addClass('active'); 2004 // $('.' + block_class + ' > .tab').hide(); 2005 // $('.' + block_class + ' ' + href).show(); 2006 // } 2007 }); 2008 2009 $('.tabs').on('click', 'li a, a.li',function(e) 2010 { 2011 var href = $(this).attr('href'); 2012 2013 if(href.charAt(0) == '#') 2014 { 2015 e.preventDefault(); 2016 //window.history.pushState('', '', href.replace('#','?')); 2017 window.history.pushState('', '', href); 2018 console.log(href); 2019 2020 2021 var block_class = $(this).parent().parent().attr('rel'); 2022 $(this).parent().parent().find('li.active').removeClass('active'); 2023 $(this).parent().addClass('active'); 2024 2025 $('.' + block_class + ' > .tab').hide(); 2026 $('.' + block_class + ' ' + href).show(); 2027 2028 if($('.' + block_class + ' ' + href + ' .videos-block').length) 2029 { 2030 $.getScript(baseurl + 'scripts/owl.carousel.min.js', function() 2031 { 2032 $('.' + block_class + ' ' + href + ' .videos-block').owlCarousel( 2033 { 2034 nav: true, 2035 dots: true, 2036 autoplay: false, 2037 items: 4, 2038 loop: false, 2039 responsive:{ 2040 0:{ 2041 items:1 2042 }, 2043 600:{ 2044 items:2 2045 }, 2046 1000:{ 2047 items:4 2048 } 2049 } 2050 }); 2051 }); 2052 2053 } 2054 } 2055 }); 2056 2057 /* ÑÐ°Ð±Ñ ÐºÐ¾Ð½ÐµÑ */ 2058 2059 $('.head .login_block form').submit(function(e) 2060 { 2061 e.preventDefault(); 2062 var value = $('input', this).val(); 2063 var action = 'title'; 2064 //if($('#tags',this).length && $('#tags',this).is(":checked")) 2065 // action = 'tag'; 2066 //if($('#authors',this).length && $('#authors',this).is(":checked")) 2067 // action = 'author';
2068 //if($('#title',this).length && $('#title',this).is(":checked")) 2069 // action = 'title'; 2070 //if($('#users',this).length && $('#users',this).is(":checked")) 2071 // action = 'users'; 2072 2073 if(value.length > 0) 2074 { 2075 var url = baseurl + 'search/' + action + '/' + value; 2076 //console.log(url); 2077 //return; 2078 window.location.href = url; 2079 } 2080 }); 2081 2082 $('.search_module form, .fade.search form').submit(function(e) 2083 { 2084 e.preventDefault(); 2085 var value = $('input', this).val(); 2086 var action = 'keyword'; 2087 if($('#tags',this).length && $('#tags',this).is(":checked")) 2088 action = 'tag'; 2089 if($('#authors',this).length && $('#authors',this).is(":checked")) 2090 action = 'author'; 2091 if($('#title',this).length && $('#title',this).is(":checked")) 2092 action = 'title'; 2093 if($('#users',this).length && $('#users',this).is(":checked")) 2094 action = 'users'; 2095 2096 if(value.length > 0) 2097 { 2098 var url = baseurl + 'search/' + action + '/' + value; 2099 //console.log(url); 2100 //return; 2101 window.location.href = url; 2102 } 2103 }); 2104 2105 $('.search_module form .checkbox > input').change(function(e) 2106 { 2107 if(!$(this).is(":checked")) 2108 return; 2109 2110 $('.search_module form .checkbox > input').each(function() 2111 { 2112 if($(this).is(":checked")) 2113 $(this).parent().click(); 2114 }); 2115 2116 $(this).parent().click(); 2117 }); 2118 2119 //$('.search_module form #tags').change(function(e) 2120 //{ 2121 // if 2122 // ( 2123 // $(this).length && 2124 // $(this).is(":checked") && 2125 // $('.search_module form #authors').length && 2126 // $('.search_module form #authors').is(":checked") 2127 // ) 2128 // $('.search_module form #authors').parent().click(); 2129 //}); 2130 // 2131 //$('.search_module form #authors').change(function(e) 2132 //{ 2133 // if 2134 // ( 2135 // $(this).length && 2136 // $(this).is(":checked") && 2137 // $('.search_module form #tags').length && 2138 // $('.search_module form #tags').is(":checked") 2139 // ) 2140 // $('.search_module form #tags').parent().click(); 2141 //}); 2142 2143 2144 2145 $('.head .login_block form input, .search_module form input').keyup(function(e) 2146 { 2147 var form = $(this).parent(); 2148 $('.login_block form').find('.results-list').remove(); 2149 $('.search_module form').find('.results-list').remove(); 2150 var value = jQuery(this).val(); 2151 if(value.length > 2) 2152 { 2153 $.ajax({ 2154 method: "POST", 2155 type: "POST", 2156 cache: false, 2157 url: baseurl + 'search', 2158 data: { keyword: value, ajax: true } 2159 }) 2160 .done(function( msg ) { 2161 form.find('.results-list').remove(); 2162 var msg = jQuery.parseJSON( msg ); 2163 if(msg.length > 0) 2164 { 2165 form.append('<ul class="list unstyled results-list"></ul>'); 2166 var count = 10; 2167 if(msg.length < count) 2168 count = msg.length; 2169 for (var i = 0; i < count; i++) 2170 form.find('.results-list').append('<li class="item"><a href="' + msg[i]['link'] + '">' + msg[i]['name'] + '</a></li>'); 2171 } 2172 }); 2173 } 2174 }); 2175 2176 $(document).click(function(event) 2177 { 2178 if ($(event.target).closest('.results-list').length) return; 2179 if ($(event.target).closest('.head .login_block form input, .search_module form input').length) return; 2180 $('body').find('.results-list').empty().hide(); 2181 event.stopPropagation(); 2182 }); 2183 2184 document.loadArticles = false; 2185 2186 $(window).scroll(function() 2187 { 2188 if($('.list2colls .item:last').length > 0) 2189 { 2190 var top = $('.list2colls .item:last').offset().top - $(window).scrollTop() - $(window).height(); 2191 if(top < 0) 2192 $('.bmore a').click(); 2193 } 2194 if($('.news_list.events li').length > 0) 2195 { 2196 var top = $('.news_list.events li:last').offset().top - $(window).scrollTop() - $(window).height(); 2197 if(top < 0) 2198 $('.bmore a').click(); 2199 } 2200 2201 if($('.videos_list .item:last').length > 0) 2202 { 2203 var top = $('.videos_list .item:last').offset().top - $(window).scrollTop() - $(window).height(); 2204 if(top < 0) 2205 $('.bmore a').click(); 2206 } 2207 2208 if($('.search_module + div .news_list li').length > 0) 2209 { 2210 var top = $('.search_module + div .news_list li:last').offset().top - $(window).scrollTop() - $(window).height(); 2211 if(top < 0) 2212 $('.bmore a').click(); 2213 } 2214 if($('.author_articles li').length > 0) 2215 { 2216 var top = $('.author_articles li:last').offset().top - $(window).scrollTop() - $(window).height(); 2217 if(top < 0) 2218 $('.bmore a').click(); 2219 } 2220 2221 if($('.coll .container.article_page:last').length > 0 && !$('.coll .container.article_page').hasClass('event')) 2222 { 2223 2224 } 2225 2226 }); 2227 2228 $('.bmore').remove(); 2229 $('.bmore a').click(function(e) 2230 { 2231 e.preventDefault(); 2232 if($(this).hasClass('disabled')) 2233 return; 2234 $(this).addClass('disabled'); 2235 if($('.list2colls .item').length > 0) 2236 var start = $('.list2colls .item > div').length; 2237 2238 if($('.special_list .item').length > 0) 2239 var start = $('.special_list .item > div').length; 2240 2241 if($('.videos_list .item').length > 0) 2242 var start = $('.videos_list .item').length; 2243 2244 if($('.author_articles li').length > 0) 2245 var start = $('.author_articles li').length; 2246 2247 if($('.search_module + div .news_list li').length > 0) 2248 var start = $('.search_module + div .news_list li').length; 2249 2250 var url = baseurl + 'articles'; 2251 var option = 'getArticles'; 2252 2253 if($('.ctysis_theory .authors .item').length > 0) 2254 { 2255 var start = $('.ctysis_theory .authors .item').length; 2256 var url = baseurl + 'authors'; 2257 var option = 'getAuthors'; 2258 } 2259 2260 if($('.news_list.events li').length > 0) 2261 { 2262 var start = $('.news_list.events li').length; 2263 var url = baseurl + 'events'; 2264 var option = 'getEvents'; 2265 } 2266 2267 $.ajax({ 2268 method: "POST", 2269 type: "POST", 2270 cache: false, 2271 url: url, 2272 data: 2273 { 2274 start: start, 2275 rid: rid, 2276 keywords: keywords, 2277 tag: tag, 2278 important: important, 2279 is_news: is_news, 2280 order: order, 2281 type: type, 2282 uid: author, 2283 ajax: true, 2284 option: option 2285 } 2286 }) 2287 .done(function( result ) 2288 { 2289 result = $.parseJSON(result); 2290 if(!result) 2291 $('.bmore').remove(); 2292 var html = ''; 2293 if($('.videos_list .item:last').length > 0) 2294 { 2295 for (var i = 0; i < result.items.length; i++) 2296 { 2297 var item = result.items[i]; 2298 2299 html+= '<li class="item">'; 2300 html+= '<a href="' + item.link + '" class="playvideo img">'; 2301 html+= '<span></span>'; 2302 html+= '<img src="' + item.video_image + '" alt="' + item.title + '" title="' + item.title + '">'; 2303 html+= '</a>'; 2304 html+= '<div class="desc">'; 2305 html+= ' <p class="date">' + item.date + '</p>'; 2306 html+= ' <p class="tags"><a href="' + item.category_link + '">' + item.category_title + '</a></p>'; 2307 html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2308 if(item.author) 2309 html+= '<p class="author"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2310 2311 html+= '</div>'; 2312 html+= '</li>'; 2313 }; 2314 $('.videos_list').append(html); 2315 } 2316 if($('.news_list.events li:last').length > 0) 2317 { 2318 for (var i = 0; i < result.items.length; i++) 2319 { 2320 var item = result.items[i]; 2321 2322 html+= '<li>'; 2323 if(item.images.square_mini) 2324 { 2325 html+= ' <a href="' + item.link + '" class="img">'; 2326 html+= ' <img src="' + item.images.square_mini + '" />'; 2327 html+= ' </a>'; 2328 } 2329 2330 html+= ' <div class="desc">'; 2331 html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2332 html+= ' <p class="date">' + item.date_start + '</p>'; 2333 html+= ' <p>' + item.location + '</p>'; 2334 html+= ' </div>'; 2335 html+= ' <div class="clr"></div>'; 2336 html+= '</li>'; 2337 }; 2338 $('.news_list.events').append(html); 2339 } 2340 if($('.list2colls .item:last').length > 0 && !$('.list2colls').hasClass('special_list')) 2341 { 2342 var left_html = ''; 2343 var right_html = ''; 2344 2345 var i = 0; 2346 2347 for (var j = 0; j < result.items.length; j++) 2348 { 2349 if(!(j % 2)) 2350 { 2351 var item = result.items[j]; 2352 2353 left_html+= '<div>'; 2354 if(item.images.square) 2355 { 2356 left_html+= '<a href="' + item.link + '" class="img">'; 2357 left_html+= '<img src="' + item.images.square + '" alt="' + item.title + '" title="' + item.title + '">'; 2358 left_html+= '</a>'; 2359 } 2360 left_html+= '<div class="desc">'; 2361 left_html+= ' <p class="date">' + item.date + '</p>'; 2362 left_html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2363 if(item.author) 2364 left_html+= '<p class="author"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2365 2366 left_html+= '</div>'; 2367 left_html+= '</div>'; 2368 } 2369 else 2370 { 2371 var item = result.items[j]; 2372 2373 right_html+= '<div>'; 2374 if(item.images.square) 2375 { 2376 right_html+= '<a href="' + item.link + '" class="img">'; 2377 right_html+= '<img src="' + item.images.square + '" alt="' + item.title + '" title="' + item.title + '">'; 2378 right_html+= '</a>'; 2379 } 2380 right_html+= '<div class="desc">'; 2381 right_html+= ' <p class="date">' + item.date + '</p>'; 2382 right_html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2383 if(item.author) 2384 right_html+= '<p class="author"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2385 2386 right_html+= '</div>'; 2387 right_html+= '</div>'; 2388 } 2389 2390 i++; 2391 }; 2392 2393 $('.list2colls li:first').append(left_html); 2394 $('.list2colls li:last').append(right_html); 2395 } 2396 2397 if($('.special_list .item:last').length > 0) 2398 { 2399 var left_html = ''; 2400 var right_html = ''; 2401 2402 var i = 0; 2403 2404 for (var j = 0; j < result.items.length; j++) 2405 { 2406 if(!(j % 2)) 2407 { 2408 var item = result.items[j]; 2409 2410 left_html+= '<div>'; 2411 if(item.images.xl) 2412 { 2413 left_html+= '<div class="hasimage">'; 2414 left_html+= ' <a href="' + item.link + '" class="img" style="background-image: url(' + item.images.xl + ');"></a>'; 2415 left_html+= ' <div class="desc">'; 2416 if(item.author) 2417 left_html+= '<p class="tags"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2418 2419 left_html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2420 left_html+= ' </div>'; 2421 left_html+= '</div>'; 2422 } 2423 else 2424 { 2425 left_html+= '<div class="noimage">'; 2426 left_html+= ' <div class="desc">'; 2427 if(item.author) 2428 left_html+= '<p class="tags"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2429 2430 left_html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2431 left_html+= ' </div>'; 2432 left_html+= '</div>'; 2433 } 2434 left_html+= '</div>'; 2435 } 2436 else 2437 { 2438 var item = result.items[j]; 2439 2440 right_html+= '<div>'; 2441 if(item.images.xl) 2442 { 2443 right_html+= '<div class="hasimage">'; 2444 right_html+= ' <a href="' + item.link + '" class="img" style="background-image: url(' + item.images.xl + ');"></a>'; 2445 right_html+= ' <div class="desc">'; 2446 if(item.author) 2447 right_html+= '<p class="tags"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2448 2449 right_html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2450 right_html+= ' </div>'; 2451 right_html+= '</div>'; 2452 } 2453 else 2454 { 2455 right_html+= '<div class="noimage">'; 2456 right_html+= ' <div class="desc">'; 2457 if(item.author) 2458 right_html+= '<p class="tags"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2459 2460 right_html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2461 right_html+= ' </div>'; 2462 right_html+= '</div>'; 2463 } 2464 right_html+= '</div>'; 2465 } 2466 2467 i++; 2468 } 2469 $('.list2colls li:first').append(left_html); 2470 $('.list2colls li:last').append(right_html); 2471 } 2472 2473 if($('.search_module + div .news_list li').length > 0) 2474 { 2475 for (var i = 0; i < result.items.length; i++) 2476 { 2477 var item = result.items[i]; 2478 2479 html+= '<li>'; 2480 if(item.images.square) 2481 { 2482 html+= '<a href="' + item.link + '" class="img">'; 2483 html+= '<img src="' + item.images.square + '" alt="' + item.title + '" title="' + item.title + '">'; 2484 html+= '</a>'; 2485 } 2486 html+= '<div class="desc">'; 2487 html+= ' <p class="date">' + item.date + '</p>'; 2488 if(item.tags.length > 0) 2489 { 2490 html+= '<p class="tags">'; 2491 var sep = ','; 2492 for (var j = 0; j < item.tags.length; j++) 2493 { 2494 if((item.tags.length - 1) == j) 2495 sep = ''; 2496 html+= ' <a href="' + item.tags[j].link + '">' + item.tags[j].name + '</a>' + sep; 2497 }; 2498 2499 html+= '</p>'; 2500 } 2501 2502 html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2503 if(item.author) 2504 html+= '<p class="author"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2505 2506 html+= '</div>'; 2507 html+= '</li>'; 2508 } 2509 $('.search_module + div .news_list').append(html); 2510 } 2511 2512 if($('.author_articles li').length > 0) 2513 { 2514 for (var i = 0; i < result.items.length; i++) 2515 { 2516 var item = result.items[i]; 2517 2518 html+= '<li>'; 2519 if(item.images.square) 2520 { 2521 html+= '<a href="' + item.link + '" class="img">'; 2522 html+= '<img src="' + item.images.square + '" alt="' + item.title + '" title="' + item.title + '">'; 2523 html+= '</a>'; 2524 } 2525 html+= '<div class="desc">'; 2526 html+= ' <p class="date">' + item.date + '</p>'; 2527 if(item.tags.length > 0) 2528 { 2529 html+= '<p class="tags">'; 2530 var sep = ','; 2531 for (var j = 0; j < item.tags.length; j++) 2532 { 2533 if((item.tags.length - 1) == j) 2534 sep = ''; 2535 html+= ' <a href="' + item.tags[j].link + '">' + item.tags[j].name + '</a>' + sep; 2536 }; 2537 2538 html+= '</p>'; 2539 } 2540 html+= ' <h5><a href="' + item.link + '">' + item.title + '</a></h5>'; 2541 if(item.author) 2542 html+= '<p class="author"><a href="' + item.author.link + '">' + item.author.surname + ' ' + item.author.name + '</a></p>'; 2543 2544 html+= '</div>'; 2545 html+= '</li>'; 2546 } 2547 $('.author_articles').append(html); 2548 } 2549 2550 if($('.ctysis_theory .authors .item').length > 0) 2551 { 2552 var lists = array_chunk(result.items,2); 2553 2554 for (var i = 0; i < lists.length; i++) 2555 { 2556 var list = lists[i]; 2557 html+= '<li>'; 2558 for (var j = 0; j < list.length; j++) 2559 { 2560 var item = list[j]; 2561 html+= '<div class="item">'; 2562 html+= ' <a href="' + item.link + '" class="photo">'; 2563 html+= ' <img src="' + item.avatar + '">'; 2564 html+= ' </a>'; 2565 html+= ' <div class="shortdesc">'; 2566 html+= ' <h4><a href="' + item.link + '">' + item.surname + ' ' + item.name + '</a></h4>'; 2567 html+= ' <p class="lvl">' + item.count_articles + ' ' + lang['publications'] + '</p>'; 2568 html+= ' <div class="intro">'; 2569 html+= ' <p>' + item.about + '</p>'; 2570 html+= ' </div>'; 2571 html+= ' </div>'; 2572 html+= '</div>'; 2573 }; 2574 html+= '<div class="clr"></div>'; 2575 html+= '</li>'; 2576 } 2577 $('.ctysis_theory .authors').append(html); 2578 i = j; 2579 } 2580 2581 $('.bmore a').removeClass('disabled'); 2582 if(i < 48) 2583 $('.bmore').remove(); 2584 }); 2585 }); 2586 2587 // ÑекбокÑÑ Ð½Ð¾Ð²Ñй ÑкÑÐ¸Ð¿Ñ 2588 $('body').on('change', 'label.checkbox input', function() 2589 { 2590 if (!$(this).parent().find('input').is(':checked')) 2591 $(this).parent().find('span').removeClass('checked') 2592 else 2593 $(this).parent().find('span').addClass('checked') 2594 }); 2595 // radio новÑй ÑкÑÐ¸Ð¿Ñ 2596 $('body').on('change', 'label.radio input', function() 2597 { 2598 var id
2598= $(this).attr('id'); 2599 $(this).parent().parent().parent().find('label').each(function() 2600 { 2601 var rel = $(this).attr('for'); 2602 if(rel == id) 2603 $(this).find('span').addClass('checked'); 2604 else 2605 $(this).find('span').removeClass('checked'); 2606 }); 2607 //console.log($(this).parent().parent().parent().find('label').length); 2608 //$(this).parent().parent().parent().find('span').removeClass('checked'); 2609 //$(this).parent().parent().parent().find('label[rel="' + id + '"]').find('span').addClass('checked'); 2610 //$(this).parent().parent().find('label').each(function(){ 2611 // $(this).find('span').removeClass('checked'); 2612 //}); 2613 //$(this).parent().find('span').addClass('checked') 2614 }); 2615 2616 $('.vote-form').each(function() 2617 { 2618 var max_votes = !$(this).attr('data-max-votes') ? 0 : parseInt($(this).attr('data-max-votes')); 2619 var t = $(this); 2620 2621 if(max_votes > 0) 2622 { 2623 $('input[name="answer_id[]"]', t).change(function(e) 2624 { 2625 var count_votes = 0; 2626 var label = $(this).parent(); 2627 2628 $('input[name="answer_id[]"]', t).each(function() 2629 { 2630 if($(this).is(':checked')) 2631 count_votes++; 2632 }); 2633 2634 if(count_votes > max_votes) 2635 { 2636 alert(lang['you_choose_max_options']); 2637 label.find('.checked').removeClass('checked'); 2638 label.find('input').prop('checked', false); 2639 } 2640 }); 2641 } 2642 }); 2643 2644 // болÑÑе ÑÑбÑик 2645 $('body').on('click', 'a.show_more', function(){ 2646 if ($(this).hasClass('toggled')) { 2647 $(this).removeClass('toggled'); 2648 $(this).text(lang['rubrics_show']); 2649 $(this).parent().parent().find('ul').css('height', '85px'); 2650 } 2651 else { 2652 $(this).addClass('toggled'); 2653 $(this).text(lang['rubrics_hide']); 2654 $(this).parent().parent().find('ul').css('height', 'inherit'); 2655 } 2656 }); 2657 2658 //пÑовеÑка на мобилÑнÑй бÑаÑÐ·ÐµÑ 2659 2660 // var isMobile = { 2661 // Android: function() { 2662 // return navigator.userAgent.match(/Android/i); 2663 // }, 2664 // BlackBerry: function() { 2665 // return navigator.userAgent.match(/BlackBerry/i); 2666 // }, 2667 // iOS: function() { 2668 // return navigator.userAgent.match(/iPhone|iPad|iPod/i); 2669 // }, 2670 // Opera: function() { 2671 // return navigator.userAgent.match(/Opera Mini/i); 2672 // }, 2673 // Windows: function() { 2674 // return navigator.userAgent.match(/IEMobile/i); 2675 // }, 2676 // any: function() { 2677 // return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 2678 // } 2679 // }; 2680 2681 // if(!isMobile.any()){ 2682 2683 // } 2684 2685 if(typeof jcarousel_interval == "undefined") 2686 jcarousel_interval = 6000; 2687 2688 //каÑÑÑелÑка авÑоÑов 2689 $('.jcarousel').jcarousel({ 2690 wrap: 'circular' 2691 }) 2692 .jcarouselAutoscroll({ 2693 interval: jcarousel_interval, 2694 target: '+=1', 2695 autostart: true 2696 }); 2697 $('.jcarousel-pagination') 2698 .on('jcarouselpagination:active', 'a', function() { 2699 $(this).addClass('active'); 2700 }) 2701 .on('jcarouselpagination:inactive', 'a', function() { 2702 $(this).removeClass('active'); 2703 }) 2704 .jcarouselPagination(); 2705 $('.jcarousel-control-prev') 2706 .on('jcarouselcontrol:active', function() { 2707 $(this).removeClass('inactive'); 2708 }) 2709 .on('jcarouselcontrol:inactive', function() { 2710 $(this).addClass('inactive'); 2711 }) 2712 .jcarouselControl({ 2713 // Options go here 2714 target: '-=1' 2715 }); 2716 2717 $('.jcarousel-control-next') 2718 .on('jcarouselcontrol:active', function() { 2719 $(this).removeClass('inactive'); 2720 }) 2721 .on('jcarouselcontrol:inactive', function() { 2722 $(this).addClass('inactive'); 2723 }) 2724 .jcarouselControl({ 2725 // Options go here 2726 target: '+=1' 2727 }); 2728 2729 2730 2731 //каÑÑÑелÑка коÑоÑÐºÐ¸Ñ Ð½Ð¾Ð²Ð¾ÑÑей 2732 if(typeof jcarousel_interval_short_news == "undefined") 2733 jcarousel_interval_short_news = 6000; 2734 if(typeof jcarousel_duration_short_news == "undefined") 2735 jcarousel_duration_short_news = 3000; 2736 if(typeof jcarousel_easing_short_news == "undefined") 2737 jcarousel_easing_short_news = null; 2738 2739 $('.short_news_block').jcarousel( 2740 { 2741 wrap: 'circular', 2742 animation: {
2743 easing: jcarousel_easing_short_news, 2744 duration: jcarousel_duration_short_news 2745 } 2746 }) 2747 .jcarouselAutoscroll({ 2748 interval: jcarousel_interval_short_news, 2749 target: '+=1', 2750 autostart: true 2751 }); 2752 2753 //клик по мобилÑÐ½Ð¾Ð¼Ñ Ð¼ÐµÐ½Ñ 2754 $('body').on('click', '#menu-mobile', function(e){ 2755 e.preventDefault(); 2756 2757 $('.menu .buttons .fade').hide(); 2758 2759 if ($(this).hasClass('active')) { 2760 $(this).removeClass('active'); 2761 $('body #overlay').hide(); 2762 $(this).parent().find('ul.dropmenu').hide(); 2763 } 2764 else { 2765 $('body #overlay').show(); 2766 $(this).parent().find('ul.dropmenu').show(); 2767 $(this).addClass('active'); 2768 } 2769 2770 }); 2771 $('body').on('click', '#search-mobile', function(e){ 2772 e.preventDefault(); 2773 2774 $('.menu .buttons .fade').hide(); 2775 2776 if ($(this).hasClass('active')) { 2777 $(this).removeClass('active'); 2778 $('body #overlay').hide(); 2779 $(this).parent().find('.search').hide(); 2780 } 2781 else { 2782 $('body #overlay').show(); 2783 $(this).parent().find('.search').show(); 2784 $(this).addClass('active'); 2785 } 2786 2787 }); 2788 $('body').on('click', '#login-mobile', function(e){ 2789 e.preventDefault(); 2790 2791 $('.menu .buttons .fade').hide(); 2792 2793 if ($(this).hasClass('active')) { 2794 $(this).removeClass('active'); 2795 $('body #overlay').hide(); 2796 $(this).parent().find('.login_block').hide(); 2797 } 2798 else { 2799 $('body #overlay').show(); 2800 $(this).parent().find('.login_block').show(); 2801 $(this).addClass('active'); 2802 } 2803 }); 2804 $('body').on('touchstart', '#overlay', function(e){ 2805 $(this).fadeOut(); 2806 $('.head .buttons li').each(function(){ 2807 $(this).find('a').removeClass('active'); 2808 }); 2809 $('.head .fade').each(function(){ 2810 $(this).fadeOut(); 2811 }); 2812 }); 2813 //запÑÐµÑ ÐºÐ»Ð¸ÐºÐ¾Ð² вÑÑÐºÐ¸Ñ Ð»ÐµÐ²ÑÑ 2814 $('body').on('click','.jcarousel-pagination a', function(e){ 2815 e.preventDefault(); 2816 }); 2817 $('body').on('click','a[href="#"]', function(e){ 2818 e.preventDefault(); 2819 }); 2820 2821 setTimeout(function(){ 2822 $('.fancybox, a.fn').fancybox( 2823 { 2824 helpers : { 2825 thumbs : { 2826 width : 50, 2827 height : 50 2828 }, 2829 overlay: { 2830 locked: false 2831 } 2832 } 2833 }); 2834 2835 $('.fancybox-media') 2836 .attr('rel', 'media-gallery') 2837 .fancybox({ 2838 openEffect : 'none', 2839 closeEffect : 'none', 2840 prevEffect : 'none', 2841 nextEffect : 'none', 2842 arrows : false, 2843 helpers : { 2844 media : {}, 2845 buttons : {}, 2846 overlay: { 2847 locked: false 2848 } 2849 } 2850 }); 2851 2852 },100); 2853 2854 $('body').on('click','a.call',function(e) 2855 { 2856 e.preventDefault(); 2857 var content = '<div class="form align-center"><h3>' + lang['title_form_consultation'] + '</h3>'; 2858 content += '<p class="note">' + lang['subtitle_form_consultation'] + '</p>'; 2859 content += '<form method="post" action="" enctype="multipart/form-data">'; 2860 content += '<p class="relative"><label>' + lang['people_name'] + '</label><input type="text" name="name" id="name" class="r"/></p>'; 2861 content += '<p class="relative"><label>' + lang['people_phone'] + '</label><input type="text" name="phone" id="phone" class="r"/></p>'; 2862 content += '<p class="lite">' + lang['personal_data_is_protected'] + '</p>'; 2863 content += '<p><button type="submit" name="submit" value="send_monial">' + lang['send'] + '</button></p></form></div>'; 2864 if (content.length > 10) { 2865 $.fancybox({ 2866 autoSize: false, 2867 width: 640, 2868 padding: 20, 2869 autoHeight: true, 2870 content: content, 2871 helpers: { 2872 overlay: { 2873 locked: false 2874 } 2875 }, 2876 tpl: { 2877 wrap : '<div class="fancybox-wrap form_block" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 2878 image : '<img class="fancybox-image" src="{href}" alt="" />', 2879 error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 2880 closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>', 2881 next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 2882 prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' 2883 }, 2884 afterShow: function() 2885 { 2886 2887 }, 2888 helpers: { 2889 overlay: {
2890 locked: false 2891 } 2892 } 2893 }) 2894 }; 2895 }); 2896 2897 $('body').on('submit','form',function(e) 2898 { 2899 $(this).find('.er').remove(); 2900 2901 var error = 0; 2902 $('.required,.r',this).each(function() 2903 { 2904 if($(this).prop("tagName") == 'SPAN') 2905 return; 2906 2907 if($(this).attr('id') == 'agree' && !$(this).is(":checked")) 2908 { 2909 alert(lang['error_confirm_agree']); 2910 error++; 2911 } 2912 if($(this).val().length < 1) 2913 { 2914 var tagname = $(this).context.tagName; 2915 $(this).addClass('invalid'); 2916 if(tagname == 'SELECT') 2917 { 2918 var select_id = $(this).attr('id') + '_chosen'; 2919 $('#' + select_id + '.chosen-container').addClass('invalid'); 2920 } 2921 2922 if(!$(this).hasClass('hidden')) 2923 $('<span style="color: red;text-align:center !important;display: block;font-size: 80%;" class="er">' + lang['error_enter_field'] + '</span>').insertAfter($(this)); 2924 2925 if($(this).attr('name') == 'postal_code') 2926 $('<span style="color: red;text-align:center !important;display: block;font-size: 80%;" class="er">' + lang['error_enter_address_rf'] + '</span>').insertAfter($(this)); 2927 2928 error++; 2929 } 2930 else 2931 { 2932 var tagname = $(this).context.tagName; 2933 $(this).removeClass('invalid'); 2934 if(tagname == 'SELECT') 2935 { 2936 var select_id = $(this).attr('id') + '_chosen'; 2937 $('#' + select_id + '.chosen-container').removeClass('invalid'); 2938 } 2939 } 2940 2941 if($(this).hasClass('nochars')) 2942 { 2943 var check = $(this).checkChars(); 2944 if(!check) 2945 { 2946 $(this).addClass('invalid'); 2947 2948 if(!$(this).hasClass('hidden')) 2949 $('<span style="color: red;text-align:center !important;display: block;font-size: 80%;" class="er">' + lang['error_enter_field'] + '</span>').insertAfter($(this)); 2950 2951 error++; 2952 } 2953 } 2954 2955 if($(this).attr('id') && $.trim($(this).val()).length > 0) 2956 { 2957 var id = $(this).attr('id'); 2958 2959 if(id.indexOf('email') >= 0) 2960 { 2961 var check = $(this).checkChars(true); 2962 if(!check) 2963 { 2964 $(this).addClass('invalid'); 2965 2966 if(!$(this).hasClass('hidden')) 2967 $('<span style="color: red;text-align:center !important;display: block;font-size: 80%;" class="er">' + lang['error_enter_field'] + '</span>').insertAfter($(this)); 2968 2969 error++; 2970 } 2971 } 2972 } 2973 2974 2975 }); 2976 2977 console.log(error); 2978 2979 2980 $('input', this).each(function() 2981 { 2982 if($(this).attr('id')) 2983 { 2984 var id = $(this).attr('id'); 2985 var index = id.indexOf('re_'); 2986 if (index >= 0) { 2987 var relation_id = id.replace('re_',''); 2988 if ($('#'+relation_id).length) { 2989 var value1 = $(this).val(); 2990 var value2 = $('#'+relation_id).val(); 2991 if (value1!=value2) { 2992 error++; 2993 $('#'+relation_id).addClass('invalid'); 2994 $(this).addClass('invalid'); 2995 } 2996 } 2997 } 2998 } 2999 if($(this).hasClass('fio') && $.trim($(this).val()).length) 3000 { 3001 var val = $.trim($(this).val()); 3002 val_array = val.split(' '); 3003 3004 if(val_array.length != 3) 3005 { 3006 error++; 3007 $(this).addClass('invalid'); 3008 if(!$(this).hasClass('hidden')) 3009 $('<span style="color: red;text-align:center !important;display: block;font-size: 80%;" class="er">' + lang['error_enter_field'] + '</span>').insertAfter($(this)); 3010 } 3011 else 3012 $(this).removeClass('invalid'); 3013 } 3014 }); 3015 if 3016 ( 3017 ( 3018 $('#old_password',this).length && 3019 $('#old_password',this).val().length 3020 ) 3021 || 3022 ( 3023 $('#password',this).length && 3024 $('#password',this).val().length 3025 ) 3026 || 3027 ( 3028 $('#re_password',this).length && 3029 $('#re_password',this).val().length 3030 ) 3031 ) 3032 { 3033 $('input[type="password"]',this).each(function(){ 3034 if ($(this).val().length == 0) { 3035 $(this).addClass('invalid'); 3036 error++; 3037 } 3038 }); 3039 } 3040 3041 console.log(error); 3042 3043 if(error > 0) 3044 { 3045 e.preventDefault(); 3046 } 3047 else 3048 $(this).find('[name="submit"]').addClass('disabled'); 3049 }); 3050 $('.save_article').click(function(e) 3051 { 3052 e.preventDefault(); 3053 }); 3054 $('.comtext').find('a').click(function(e) 3055 { 3056 e.preventDefault(); 3057 3058 var href = $(this).attr('href'); 3059 if(!$(this).hasClass('more') && !$(this).hasClass('playvideo')) 3060 window.open(href, '_blank'); 3061 }); 3062 3063 $('.ar .more').click(function(e) 3064 { 3065 e.preventDefault(); 3066 3067 3068 $('body').find('.sources_block').removeClass('hidden'); 3069 3070 var html = ''; 3071 3072 //$(this).parent().next().find('#yandex_ad963').next().remove(); 3073 $(this).parent().next().find('#yandex_ad963').remove(); 3074 3075 console.log($(this).parent().next().find('#yandex_ad963').length); 3076 3077 $(this).parent().next().show(); 3078 3079 $(this).parent().next().find('#yandex_ad963').remove(); 3080 3081 $(this).parent().remove(); 3082 3083 //Ya.Direct.insertInto(185875, "yandex_ad963", 3084 //{ 3085 // ad_format: "direct", 3086 // type: "adaptive", 3087 // limit: 1, 3088 // links_underline: true, 3089 // site_bg_color: "FFFFFF", 3090 // bg_color: "FFFFFF", 3091 // title_color: "26A69A", 3092 // url_color: "26A69A", 3093 // text_color: "212121", 3094 // hover_color: "26A69A", 3095 // sitelinks_color: "78909C", 3096 // no_sitelinks: false 3097 //}); 3098 }); 3099 3100 var loading_users = false;
3101 $('.forum .popular-authors ul.news_list').scroll(function() 3102 { 3103 var t = $(this); 3104 //var def = $('.forum .coll.coll-2 .comments-list > ul').height() - $('.forum .coll.coll-2 .comments-list').scrollTop() - 1000; 3105 var start = t.find('> li').length - 1; 3106 var url = baseurl + 'articles'; 3107 var option = 'getFavoritesList'; 3108 3109 var def = $('.forum .popular-authors .news_list > ul').find('li:last').position().top - $('.forum .popular-authors .news_list').height(); 3110 3111 //console.log(def); 3112 3113 if(def < 200 && !t.hasClass('loading') && !loading_users) 3114 { 3115 var last_url = t.find('li:last > a.img').attr('href'); 3116 loading_users = true; 3117 t.addClass('loading'); 3118 t.append('<p class="align-center preloader"><img src="' + baseurl + 'images/ajax-loader.gif"></p>'); 3119 3120 $.ajax({ 3121 method: "POST", 3122 type: "POST", 3123 cache: false, 3124 url: url, 3125 data: 3126 { 3127 ajax: true, 3128 start: start, 3129 option: option 3130 } 3131 }) 3132 .done(function( result ) 3133 { 3134 t.find('.preloader').remove(); 3135 3136 result = $.parseJSON(result); 3137 3138 var html = ''; 3139 for (var i = 0; i < result.length; i++) 3140 { 3141 var item = result[i]; 3142 if(auth_user && auth_user == item.id) 3143 continue; 3144 3145 if(last_url == item.link) 3146 continue; 3147 3148 html+= '<li>'; 3149 html+= ' <a class="img" href="' + item.link + '">'; 3150 html+= ' <img src="' + item.avatar + '" alt="' + item.name + '" title="' + item.name + '">'; 3151 html+= ' </a>'; 3152 html+= ' <div class="desc overflow">'; 3153 html+= ' <p class="info-top">'; 3154 html+= ' <span><img style="margin-top: -1px;" src="' + baseurl + 'images/star3.png' + '">' + item.place + ' (' + item.points + ')</span>'; 3155 html+= ' <span class="dislikes" title="' + document.persent_likes + '"><img style="margin-top: 0px;" src="' + baseurl + 'images/likes_persent.png">' + item.persent_likes + '%</span>'; 3156 html+= ' <span class="dislikes" title="' + document.mind_persent + '" style="margin-left: 0px;"><img style="margin-top: 0px;" src="' + baseurl + 'images/mind_persent.png">' + item.mind_persent + '</span>'; 3157 html+= ' </p>'; 3158 html+= ' <h5 class="username"><a href="' + item.link + '">' + item.name + '</a></h5>'; 3159 html+= ' <p class="info-bottom">'; 3160 html+= ' <span class="comments" title="' + document.count_comments + '"><img src="' + baseurl + 'images/comment.png' + '">' + (item.count_comments) + '</span>'; 3161 //html+= ' <span class="answers" title="ÐолÑÑено оÑвеÑов"><img style="margin-top: -1px; width: 15px;" src="' + baseurl + 'images/comments3.png' + '">' + item.count_answers + '</span>'; 3162 html+= ' <span class="likes" title="' + document.likes + '"><img style="margin-top: -2px;" src="' + baseurl + 'images/tu.png' + '">' + item.likes + '</span>'; 3163 html+= ' <span class="dislikes" title="' + document.dislikes + '"><img style="margin-top: 0px;" src="' + baseurl + 'images/td.png' + '">' + item.dislikes + '</span>'; 3164 html+= ' <span class="nothings" title="' + document.nothings + '"><img style="margin-top: -1px;" src="' + baseurl + 'images/trash2.png' + '">' + item.nothings + '</span>'; 3165 3166 //html+= ' <span class="redirects" title="ÐеÑеадÑеÑаÑиÑ"><img style="margin-top: -1px;" src="' + baseurl + 'images/links.png' + '">' + item.persent_redirects + '<span style="font-family: arial, sans-serif;">%</span></span>'; 3167 html+= ' </p>'; 3168 html+= ' </div>'; 3169 html+= '</li>'; 3170 } 3171 3172 if(html.length < 1) 3173 return; 3174 3175 //console.log(t.find('ul.news_list').length); 3176 3177 t.append(html); 3178 t.removeClass('loading'); 3179 loading_users = false; 3180 }); 3181 } 3182 }); 3183 3184 if (typeof dotdotdot !== 'undefined' && $.isFunction(dotdotdot)) 3185 $('.dotdotdot').dotdotdot({ellipsis: "...",wrap: "word"}); 3186 3187 //if ($(window).width() > 780) 3188 $('.forum .coll.coll-2 .comments-list + .pagination').remove(); 3189 3190 var loading_comments = false; 3191 $('.forum .coll.coll-2 .comments-list').scroll(function() 3192 { 3193 var t = $(this); 3194 //var def = $('.forum .coll.coll-2 .comments-list > ul').height() - $('.forum .coll.coll-2 .comments-list').scrollTop() - 1000; 3195 var start = $('.forum .coll.coll-2 .comments-list').find('li.comment').length; 3196 var url = baseurl + 'articles'; 3197 var option = 'getCommentsList'; 3198 3199 var def = $('.forum .coll.coll-2 .comments-list > ul').find('li:last').position().top - $('.forum .coll.coll-2 .comments-list').height(); 3200 3201 console.log(def); 3202 3203 if(def < 200 && !t.hasClass('loading') && !loading_comments) 3204 { 3205 loading_comments = true; 3206 t.addClass('loading'); 3207 t.append('<p class="align-center preloader"><img src="' + baseurl + 'images/ajax-loader.gif"></p>'); 3208 $.ajax({ 3209 method: "POST", 3210 type: "POST", 3211 cache: false, 3212 url: url, 3213 data: 3214 { 3215 date_start: getParameterByName('date_start_comments'), 3216 date_end: getParameterByName('date_end_comments'), 3217 author_name: getParameterByName('author_name'), 3218 ajax: true, 3219 count: 25, 3220 start: start, 3221 order: getParameterByName('order_comments'), 3222 option: option 3223 } 3224 }) 3225 .done(function( result ) 3226 { 3227 t.find('.preloader').remove(); 3228 3229 result = $.parseJSON(result); 3230 3231 var html = ''; 3232 for (var i = 0; i < result.length; i++) 3233 { 3234 var item = result[i]; 3235 3236 console.log(renderComment(item,user_group_id)); 3237 3238 html += '<li class="comment">'; 3239 html += ' <a href="' + item.user_info.link + '" class="img">'; 3240 html += ' <img src="' + item.user_info.avatar + '">'; 3241 html += ' </a>'; 3242 html += ' <div class="desc" id="c-' + item.id + '">'; 3243 html += ' <span class="hidden dname">' + item.user_info.surname + ' ' + item.user_info.name + '</span>'; 3244 html += ' <span class="hidden ddate">' + item.date + '</span>'; 3245 html += ' <p class="name"><a href="' + item.user_info.link + '">' + item.user_info.surname + ' ' + item.user_info.name + '</a> <span class="rubric"><a>' + item.user_info.group_name + '</a></span></p>'; 3246 html += ' <p class="comdate">' + item.date + ' <a href="#" rel="' + item.id + '" class="flag"></a><a href="' + item.link + '" title="' + lang['link'] + '" class="cel"></a>'; 3247 html += ' <p>'; 3248 html += ' <p class="actions">'; 3249 if(item.rm) 3250 html += ' <a class="comdelete" title="' + lang['remove'] + '" href="#" rel="' + item.id + '"></a>'; 3251 if(item.ed) 3252 html += ' <a class="comedit" title="' + lang['edit'] + '" href="#" rel="' + item.id + '"></a>'; 3253 //if(item.complaine) 3254 // html += ' <a class="complain" title="ÐожаловаÑÑÑÑ" href="#" rel="' + item.id + '"></a>'; 3255 html += ' </p>'; 3256 3257 html += ' <div class="comtext">'; 3258 html += ' <p>' + nl2br(item.text) + '</p>'; 3259 html += ' </div>';
3260 html += ' <p class="likes_line">'; 3261 if(item.lk) 3262 { 3263 alt_class = 'like'; 3264 if(item.like_it) 3265 alt_class+= ' active'; 3266 html += ' <a href="#" class="' + alt_class + '">' + item.likes + '</a>'; 3267 3268 alt_class = 'dislike'; 3269 if(item.dislike_it) 3270 alt_class+= ' active'; 3271 html += ' <a href="#" class="' + alt_class + '">' + item.dislikes + '</a>'; 3272 } 3273 else 3274 { 3275 html += ' <span class="like">' + item.likes + '</span>'; 3276 html += ' <span class="dislike">' + item.dislikes + '</span>'; 3277 } 3278 html += ' </p>'; 3279 html += ' <p>'; 3280 html += '<a href="' + item.link + '">' + lang['link_comment'] + '</a>'; 3281 html += '</p>'; 3282 html += '</div>'; 3283 html += '</li>'; 3284 } 3285 3286 3287 3288 console.log(html.length); 3289 3290 if(html.length < 1) 3291 return; 3292 3293 t.find('ul').append(html); 3294 t.removeClass('loading'); 3295 loading_comments = false; 3296 }); 3297 } 3298 }); 3299 3300 if ($(window).width() > 780) 3301 $('.forum .coll.coll-2 .list-topics + .pagination').remove(); 3302 3303 var loading = false; 3304 $('.forum .coll.coll-2 .list-topics').scroll(function() 3305 { 3306 var t = $(this); 3307 //var def = $('.forum .coll.coll-2 .list-topics table').height() - $('.forum .coll.coll-2 .list-topics').scrollTop(); 3308 var start = $('.forum .coll.coll-2 .list-topics').find('tr').length; 3309 var url = baseurl + 'articles'; 3310 var option = 'getArticles'; 3311 3312 var def = $('.forum .coll.coll-2 .list-topics table').find('tr:last').position().top - $('.forum .coll.coll-2 .list-topics').height(); 3313 3314 //if(t.hasClass('scroll-content')) 3315 //{ 3316 // var element = t.parent().find('.scroll-y .scroll-bar'); 3317 // def = $('.forum .coll.coll-2 .list-topics table').height() - (element.position().top + element.height()); 3318 // //console.log(def); 3319 //} 3320 3321 if(def < 100 && !t.hasClass('loading') && !loading) 3322 { 3323 loading = true; 3324 t.append('<p class="align-center preloader"><img src="' + baseurl + 'images/ajax-loader.gif"></p>'); 3325 t.addClass('loading'); 3326 $.ajax({ 3327 method: "POST", 3328 type: "POST", 3329 cache: false, 3330 url: url, 3331 data: 3332 { 3333 start: start, 3334 rid: rid, 3335 keywords_title: getParameterByName('keywords'), 3336 tag: tag, 3337 important: important, 3338 is_news: is_news, 3339 order: order, 3340 type: type, 3341 uid: author, 3342 ajax: true, 3343 limit: 20, 3344 date_start: getParameterByName('date_end'), 3345 date_end: getParameterByName('date_start'), 3346 option: option 3347 } 3348 }) 3349 .done(function( result ) 3350 { 3351 t.find('.preloader').remove(); 3352 //console.log(result); 3353 if(result < 1) 3354 return; 3355 3356 result = $.parseJSON(result); 3357 3358 var html = ''; 3359 for (var i = 0; i < result.length; i++) 3360 { 3361 var item = result[i]; 3362 3363 html+= '<tr>'; 3364 html+= ' <td>'; 3365 html+= ' <a href="' + baseurl + 'forum/topic/' + item.id + '-' + item.alias + '">' + item.title + '</a>'; 3366 html+= ' </td>'; 3367 html+= ' <td>'; 3368 html+= ' <span class="comments_count">' + item.comments_count + '</span><br/>'; 3369 html+= ' <span class="hits">' + item.hits + '</span>'; 3370 html+= ' </td>'; 3371 html+= ' <td>'; 3372 if(item.author.link) 3373 html+= ' <p class="author"><a href="' + item.author.link + '">' + item.author.name + '</a></p>'; 3374 3375 html+= ' <p class="date">' + item.date + '</p>'; 3376 html+= ' </td>'; 3377 html+= '</tr>'; 3378 }; 3379 3380 console.log(result); 3381 3382 t.find('table').append(html); 3383 t.removeClass('loading'); 3384 loading = false; 3385 }); 3386 } 3387 }); 3388}); 3389 3390$(window).load(function () 3391{ 3392 if($('.latest_article .canvas .intro:not(.is-truncated)').length) 3393 $('.latest_article .canvas .intro:not(.is-truncated)').dotdotdot(); 3394 3395 if(window.location.hash) 3396 { 3397 var block = window.location.hash; 3398 3399 if($(block).length) 3400 { 3401 setTimeout(function() 3402 { 3403 $('html,body').animate( 3404 { 3405 scrollTop: $(block).offset().top - 20 3406 }, 500); 3407 }, 2500); 3408 } 3409 } 3410 3411 if($('.gallery-block').length) 3412 { 3413 $.getScript(baseurl + 'scripts/owl.carousel.min.js', function() 3414 { 3415 $('head').append('<link rel="stylesheet" href="' + baseurl + 'styles/owl.carousel.min.css" type="text/css" />'); 3416 3417 $('.gallery-block').owlCarousel( 3418 { 3419 nav: true, 3420 dots: true, 3421 autoplay: true, 3422 items: 1, 3423 loop: true 3424 }); 3425 3426 console.log('owl.carousel is loaded'); 3427 }); 3428 } 3429 3430 if($('#videos-tabs').length) 3431 { 3432 $.getScript(baseurl + 'scripts/jquery.scrolltabs.js', function() 3433 { 3434 $('head').append('<link rel="stylesheet" href="' + baseurl + 'styles/scrolltabs.css" type="text/css" />'); 3435 3436 if($('.videos-block').length) 3437 $('head').append('<link rel="stylesheet" href="' + baseurl + 'styles/owl.carousel.min.css" type="text/css" />'); 3438 3439 $('#videos-tabs .tabs').scrollTabs( 3440 { 3441 click_callback: function(e) 3442 { 3443 var href = $(this).find('a').attr('href'); 3444 3445 if(href.charAt(0) == '#') 3446 { 3447 e.preventDefault(); 3448 //window.history.pushState('', '', href.replace('#','?')); 3449 window.history.pushState('', '', href); 3450 console.log(href); 3451 3452 3453 var block_class = $(this).parent().parent().attr('rel'); 3454 $(this).find('a').parent().parent().find('li.active').removeClass('active'); 3455 $(this).find('a').parent().addClass('active'); 3456 3457 $('.' + block_class + ' > .tab').hide(); 3458 $('.' + block_class + ' ' + href).show(); 3459 3460 if($('.' + block_class + ' ' + href + ' .videos-block').length) 3461 { 3462 $.getScript(baseurl + 'scripts/owl.carousel.min.js', function() 3463 { 3464 $('.' + block_class + ' ' + href + ' .videos-block').owlCarousel( 3465 { 3466 nav: true, 3467 dots: true, 3468 autoplay: false, 3469 items: 4, 3470 loop: false, 3471 responsive:{ 3472 0:{ 3473 items:1 3474 }, 3475 600:{ 3476 items:2 3477 }, 3478 1000:{ 3479 items:4 3480 } 3481 } 3482 }); 3483 }); 3484 3485 } 3486 } 3487 } 3488 }); 3489 3490 3491 3492 $('#videos-tabs .tabs li:first a').trigger('click'); 3493 3494 // $('#videos-tabs .videos-block-tabs').show(); 3495 3496 console.log('scrollTabs is loaded'); 3497 }); 3498 } 3499 3500 $('body').on('click','.closePopup',function(e) 3501 { 3502 e.preventDefault(); 3503 3504 $(this).closest('.banner_popup').remove(); 3505 }); 3506 3507 3508 3509 // $('.news_list.list2colls .img.scale').each(function() 3510 // { 3511 // var width = $(this).width(); 3512 3513 // if(width > 100) 3514 // { 3515 // var height = width * 0.56; 3516 // $(this).height(height); 3517 // $(this).find('img').css('margin-top','-24px'); 3518 // } 3519 3520 // console.log(width); 3521 // }); 3522});
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.