1// замеÑки 2// /thewelder.ru/public_html/bitrix/components/bitrix/catalog.comments/templates/.default/bitrix/blog.post.comment/adapt/neweditor.php 3// здеÑÑ Ð½Ð°Ð²ÐµÑиваеÑÑÑ scroll на оÑзÑÐ²Ñ 4 5$(document).ready(function () { 6 7 function restoreMainReviewsSimplebar() { 8 var $wrap = $('#keklol'); 9 10 if (!$wrap.length) { 11 return; 12 } 13 14 $wrap.find('.simplebar-vertical').show(); 15 $wrap.find('.simplebar-horizontal').show(); 16 17 $wrap.find('.simplebar-mask').removeClass('kill-overflow'); 18 $wrap.find('.simplebar-content-wrapper').removeClass('kill-overflow'); 19 20 $wrap.find('.kill-simplebar-content').each(function () { 21 $(this).addClass('simplebar-content').removeClass('kill-simplebar-content'); 22 }); 23 24 var el = $wrap.get(0); 25 26 if (window.SimpleBar && SimpleBar.instances && SimpleBar.instances.has(el)) { 27 var instance = SimpleBar.instances.get(el); 28 29 if (instance && typeof instance.recalculate === 'function') { 30 instance.recalculate(); 31 } 32 } else if (window.SimpleBar) { 33 new SimpleBar(el); 34 } 35 } 36 37 function getCurrentSortValue() { 38 return $("select[name='sort']").val() || $("select[name='sort_comments']").val() || 'reviewonly_morekomment'; 39 } 40 41 function resetInlineReviewForm() { 42 var $inline = $('#inline-added-reviews'); 43 44 $inline 45 .stop(true, true) 46 .hide() 47 .removeClass('active opened is-open') 48 .removeData('opened'); 49 50 $('.inline-added-reviews').remove(); 51 52 $('.btn-add-review, .review-add-product').show(); 53 54 $('#sendreview input[name="id"]').val(''); 55 $('#sendreview #id').val(''); 56 $('#sendreview button').attr('id', ''); 57 $('.modal-add-review--button').attr('id', ''); 58 } 59 60 function closeOpenedReviewCard() { 61 $('.catherine-reviews-block--coffee-one.open').removeClass('open'); 62 $('.catherine-reviews-block-add-review--text').removeClass('hide'); 63 $('#reviews-block-list').removeClass('hide'); 64 $('.catherine-reviews-menu--one[data-target=reviews--to-list]').addClass('hide'); 65 66 $('.catherine-reviews-block-filter--one[data-type=tolist]').addClass('hide'); 67 $('.catherine-reviews-block-filter--one[data-type=archive]').removeClass('hide'); 68 $('.catherine-reviews-block-filter--one[data-type=subscribes]').removeClass('hide'); 69 $('.catherine-reviews-block-filter--one[data-type=coffe]').removeClass('hide'); 70 $('.catherine-reviews-block-filter--one[data-type=another]').removeClass('hide'); 71 72 $('select[name="sort_comments"]').attr('name', 'sort'); 73 74 $('.nice-select.sort_products').find("li[data-value='reviewonly_morekomment']").show(); 75 $('.nice-select.sort_products').find("li[data-value='reviewonly']").show(); 76 77 $('.product-v2').show(); 78 $('.product-v2').siblings().show(); 79 80 resetInlineReviewForm(); 81 restoreMainReviewsSimplebar(); 82 } 83 84 function openInlineReview($btn) { 85 var itemId = $btn.attr('item-id') || $btn.data('item-id') || ''; 86 var $target = $('#inline-added-reviews'); 87 88 if (!$target.length) { 89 $target = $('<div id="inline-added-reviews" style="display:none;"></div>'); 90 91 var $place = $('.catherine-reviews-block--add-review').first(); 92 93 if ($place.length) { 94 $place.after($target); 95 } else { 96 $('body').append($target); 97 } 98 } 99 100 if (!$target.html().trim()) { 101 var modalHtml = $('#added-reviews').html(); 102 103 if (!modalHtml) { 104 console.log('Ðе найден HTML ÑоÑÐ¼Ñ #added-reviews'); 105 return false; 106 } 107 108 $target.html('<div class="modal-add-review">' + modalHtml + '</div>'); 109 } 110 111 resetInlineReviewForm(); 112 113 $target = $('#inline-added-reviews'); 114 $target.data('opened', 1); 115 116 if (itemId) { 117 $('#sendreview input[name="id"]').val(itemId); 118 $('#sendreview #id').val(itemId); 119 $('#sendreview button').attr('id', itemId); 120 $('.modal-add-review--button').attr('id', itemId); 121 } 122 123 $.ajax({ 124 url: '/ajax/otzivi/getProperties.php', 125 method: 'get', 126 dataType: 'json', 127 data: { id: itemId }, 128 success: function (data) { 129 if (!data) { 130 return; 131 } 132 133 if (data.success === false) { 134 $target.html(data.message); 135 } else if (data.success === 'empty') { 136 $target.find('.modal-add-review-tags--body').html(data.message); 137 $target.find('#sendreview button').attr('type', 'empty'); 138 } else {
139 $target.find('.modal-add-review-tags--body').html(data.message); 140 $target.find('#sendreview button').attr('type', 'product'); 141 } 142 143 $target 144 .stop(true, true) 145 .slideDown(200) 146 .css({ 147 display: 'block', 148 visibility: 'visible', 149 opacity: 1, 150 height: 'auto' 151 }) 152 .addClass('active opened is-open'); 153 154 $target.find('.modal-add-review') 155 .show() 156 .css({ 157 display: 'block', 158 visibility: 'visible', 159 opacity: 1 160 }) 161 .addClass('active opened is-open'); 162 }, 163 error: function (xhr) { 164 console.log('ÐÑибка загÑÑзки ÑвойÑÑв оÑзÑва'); 165 console.log(xhr.responseText); 166 } 167 }); 168 169 return false; 170 } 171 172 function openProductInlineReview($btn) { 173 var itemId = $btn.attr('item-id') || $btn.data('item-id') || ''; 174 175 if (!itemId) { 176 return false; 177 } 178 179 $.ajax({ 180 url: '/ajax/otzivi/getProperties.php', 181 method: 'get', 182 dataType: 'json', 183 data: { id: itemId }, 184 success: function (data) { 185 if (!data) { 186 return; 187 } 188 189 $('.inline-added-reviews').remove(); 190 191 var template = $('#review-form-template').html(); 192 193 if (!template) { 194 console.log('Ðе найден template #review-form-template'); 195 return; 196 } 197 198 var $holder = $btn 199 .closest('.catherine-reviews-block-coffee-review--block, .catherine-reviews-block--coffee-one, .product-v2') 200 .find('.catherine-reviews-block-coffee-review-block--add-review') 201 .first(); 202 203 if (!$holder.length) { 204 $holder = $('.catherine-reviews-block-coffee-review-block--add-review').first(); 205 } 206 207 if (!$holder.length) { 208 console.log('Ðе найден конÑÐµÐ¹Ð½ÐµÑ Ð´Ð»Ñ ÑоÑÐ¼Ñ Ð¾ÑзÑва'); 209 return; 210 } 211 212 $holder.html(template); 213 214 $('.btn-add-review, .review-add-product').show(); 215 $btn.hide(); 216 217 var $form = $holder.find('#sendreview').first(); 218 219 var title = $('.catherine-reviews-block-coffee-one--title#' + itemId).text(); 220 221 if (!title) { 222 title = $btn 223 .closest('.catherine-reviews-block--coffee-one, .product-v2') 224 .find('.catherine-reviews-block-coffee-one--title') 225 .first() 226 .text(); 227 } 228 229 $form.find('.modal-add-review--title').html('ÐÑзÑв ' + title); 230 $form.find('.modal-add-review-tags--body').html(data.message); 231 $form.find('.modal-add-review--button').attr('id', itemId); 232 $form.find('button').attr('id', itemId); 233 234 if (data.success === 'empty' || data.success === false) { 235 $form.find('button').attr('type', 'empty'); 236 } else { 237 $form.find('button').attr('type', 'product'); 238 } 239 240 setTimeout(function () { 241 var $target = $holder.find('.modal-add-review--button').first(); 242 var $scroll = $holder.closest('.simplebar-content-wrapper'); 243 244 if ($target.length && $scroll.length) { 245 $scroll.stop(true).animate({ 246 scrollTop: $scroll.scrollTop() + $target.position().top - 120 247 }, 400); 248 } else if ($target.length) { 249 $('html, body').stop(true).animate({ 250 scrollTop: $target.offset().top - 120 251 }, 400); 252 } 253 }, 150); 254 }, 255 error: function () { 256 console.log('ÐÑибка загÑÑзки ÑвойÑÑв оÑзÑва'); 257 } 258 }); 259 260 return false; 261 } 262 263 function getParam() { 264 var urlParams = new URLSearchParams(window.location.search); 265 var review_prod_id = urlParams.get('review_prod_id'); 266 var section = urlParams.get('section'); 267 268 if (review_prod_id !== null && review_prod_id !== '') { 269 if (section == 199) { 270 if (!$('.catherine-reviews-block-filter--one[data-type=archive]').hasClass('active')) { 271 $('.catherine-reviews-block-filter--one[data-type=archive]').trigger('click'); 272 } else { 273 $('.open-more[data-id=' + review_prod_id + ']').trigger('click'); 274 } 275 } else if (section == 198) { 276 if (!$('.catherine-reviews-block-filter--one[data-type=subscribes]').hasClass('active')) { 277 $('.catherine-reviews-block-filter--one[data-type=subscribes]').trigger('click'); 278 } else { 279 $('.open-more[data-id=' + review_prod_id + ']').trigger('click'); 280 } 281 } else { 282 $('.open-more[data-id=' + review_prod_id + ']').trigger('click'); 283 } 284 285 review_prod_id = null; 286 } 287 } 288
289 function init() { 290 $('.filter-select select').niceSelect(); 291 $('select[name="quantity"]').niceSelect(); 292 $('select.filter-sort-select').niceSelect(); 293 294 $('body') 295 .off('click.reviewsAnswersMore', '.catherine-reviews-block-coffee-text-bottom-answers--more') 296 .on('click.reviewsAnswersMore', '.catherine-reviews-block-coffee-text-bottom-answers--more', function () { 297 var dataId = $(this).attr('data-id'); 298 $('.' + dataId).show(); 299 $(this).hide(); 300 return false; 301 }); 302 } 303 304 var originalContentModal = $('#added-reviews').html(); 305 306 $('.filter-select select').niceSelect(); 307 $('select.filter-sort-select').niceSelect(); 308 309 $('.catherine-reviews-block--coffee[data-simplebar="init"]').each(function () { 310 const simpleBar = new SimpleBar($(this)[0]); 311 getNewElement(simpleBar); 312 }); 313 314 $('.catherine-reviews-delivery--reviews[data-simplebar="init"]').each(function () { 315 const simpleBar = new SimpleBar($(this)[0]); 316 getNewElement(simpleBar); 317 }); 318 319 function getNewElement(simpleBar) { 320 simpleBar.getScrollElement().addEventListener('scroll', scrollFunc); 321 } 322 323 function scrollFunc() { 324 $('.nice-select.quantup').show(); 325 326 var height = Math.round($(this).scrollTop()); 327 var jj2 = $('.catherine-reviews-block--coffee-wrap').height(); 328 var jj5 = $('.catherine-reviews-block--coffee[data-simplebar="init"]').height(); 329 330 var load = $('.catherine-reviews-block--coffee-wrap').attr('data-load'); 331 var pagescount = $('.catherine-reviews-block--coffee-wrap').attr('data-count'); 332 var count = $('.catherine-reviews-block--coffee-wrap').attr('data-page'); 333 334 var difference = Math.abs(jj2 - (height + jj5)); 335 336 if (difference < 10 && count < pagescount && load == 'Y') { 337 $('.catherine-reviews-block--coffee-wrap').attr('data-load', 'N'); 338 339 var selectedValue = getCurrentSortValue(); 340 var archive = $('.catherine-reviews-block-filter--one[data-type=archive]').hasClass('active') ? 'Y' : 'N'; 341 342 $.get('/otzivi/?PAGEN_1=' + count + '&' + selectedValue + '=Y&archive=' + archive, function (data) { 343 $('#addreviews').append($(data).find('#addreviews').html()); 344 345 count = parseInt(count) + 1; 346 $('.catherine-reviews-block--coffee-wrap').attr('data-page', count); 347 $('.catherine-reviews-block--coffee-wrap').attr('data-load', 'Y'); 348 349 init(); 350 }); 351 } 352 } 353 354 $(document).on('keyup paste', '.modal-add-review--textarea--text textarea', function () { 355 var maxlength = $(this).attr("maxlength"); 356 var currentLength = $(this).val().length; 357 358 if (typeof maxlength == 'undefined' || maxlength === false) { 359 return true; 360 } 361 362 if (currentLength > maxlength) { 363 return false; 364 } 365 366 var parentDiv = $(this).closest('.modal-add-review--textarea'); 367 368 if (parentDiv.length > 0) { 369 var textareaDiv = parentDiv.find('.modal-add-review--textarea--counter span'); 370 371 if (textareaDiv.length > 0) { 372 textareaDiv.eq(0).empty().text(currentLength); 373 } 374 } 375 }); 376 377 $(document).on('mouseover', '#stars li', function () { 378 var onStar = parseInt($(this).data('value'), 10); 379 380 $(this).parent().children('li.catherine-reviews--star').each(function (e) { 381 if (e < onStar) { 382 $(this).addClass('hover'); 383 } else { 384 $(this).removeClass('hover'); 385 } 386 }); 387 }); 388 389 $(document).on('mouseout', '#stars li', function () { 390 $(this).parent().children('li.catherine-reviews--star').each(function () { 391 $(this).removeClass('hover'); 392 }); 393 }); 394 395 $(document) 396 .off('submit.reviewSend', '#sendreview, #sendreviewdelivery') 397 .on('submit.reviewSend', '#sendreview, #sendreviewdelivery', function (e) { 398 e.preventDefault(); 399 e.stopPropagation(); 400 e.stopImmediatePropagation(); 401 402 var $form = $(this); 403 404 if ($form.data('sending')) { 405 return false; 406 } 407 408 $form.data('sending', true); 409 410 var $modalBox = $form.closest('.modal-add-review'); 411 var $submitBtn = $form.find('button').prop('disabled', true); 412 413 var type = $form.find('button').first().attr('type'); 414 var id = ''; 415 var delivid = ''; 416 var text = $form.find('textarea[name="comment"]').val(); 417 var stars = $form.find('#stars .selected:last').data('value'); 418 var happy = $form.find('input[name="happy"]:checked').map(function () { 419 return $(this).val(); 420 }).get(); 421 422 if (type == 'product' || type == 'empty' || type == 'submit') { 423 id = $form.find('button').first().attr('id'); 424 } 425 426 if (!stars) { 427 alert('ÐоÑÑавÑÑе оÑенкÑ.'); 428 $form.data('sending', false); 429 $submitBtn.prop('disabled', false); 430 return false;
431 } 432 433 if (happy.length === 0 && type == 'product') { 434 alert('ÐÑбеÑиÑе болÑÑе 1 вкÑÑового каÑеÑÑва'); 435 $form.data('sending', false); 436 $submitBtn.prop('disabled', false); 437 return false; 438 } 439 440 if (type == 'delivAdd') { 441 delivid = $('#delivAdd').attr('item-id'); 442 } 443 444 $.ajax({ 445 url: '/ajax/otzivi/z9Addcomment.php', 446 method: 'post', 447 dataType: 'html', 448 data: { 449 id: id, 450 text: text, 451 delivid: delivid, 452 stars: stars, 453 happy: happy 454 }, 455 success: function (data) { 456 data = jQuery.parseJSON(data); 457 458 if (data.success == false) { 459 $modalBox.html(data.message); 460 461 $('html, body').animate({ 462 scrollTop: $modalBox.offset().top - 120 463 }, 300); 464 465 return; 466 } 467 468 var html = "<div class='review-success-message' style='color:black;'>СпаÑибо! ÐÐ°Ñ Ð³Ð¾Ð»Ð¾Ñ ÑÑÑÑн.</div>"; 469 470 if (!$.isNumeric(data) && data.message) { 471 html = "<div class='review-success-message'>" + data.message + "</div>"; 472 } 473 474 $modalBox.html(html); 475 476 $('html, body').animate({ 477 scrollTop: $modalBox.offset().top - 120 478 }, 300); 479 }, 480 error: function (xhr) { 481 console.log(xhr.responseText); 482 }, 483 complete: function () { 484 $form.data('sending', false); 485 $submitBtn.prop('disabled', false); 486 } 487 }); 488 489 return false; 490 }); 491 492 $(document).on('click', '#stars li', function () { 493 var onStar = parseInt($(this).data('value'), 10); 494 var stars = $(this).parent().children('li.catherine-reviews--star'); 495 496 for (var i = 0; i < stars.length; i++) { 497 $(stars[i]).removeClass('selected'); 498 } 499 500 for (var j = 0; j < onStar; j++) { 501 $(stars[j]).addClass('selected'); 502 } 503 504 var ratingValue = parseInt($(this).parent().find('li.selected').last().data('value'), 10); 505 var ratingTitle = $(this).parent().find('li.selected').last().attr('title'); 506 var ratingText = $(this).parent().find('li.selected').last().attr('data-text'); 507 508 $(this).closest('form').find('input[name="mark"]').val(ratingValue); 509 $(this).closest('form').find('.modal-add-review--stars .modal-add-review-stars--status').eq(0).empty().html(ratingTitle); 510 $(this).closest('form').find('.modal-add-review--tags .modal-add-review-tags--title').eq(0).empty().html(ratingText); 511 }); 512 513 $('.tabs-change').on('click', function () { 514 var deliveryname = $(this).find("span").attr('deliveryname'); 515 var id = $(this).attr('data-id'); 516 517 $('.catherine-reviews-block-add-review--button').attr('item-id', id); 518 $('.modal-add-review--title').html('ÐÑзÑв ' + deliveryname); 519 $('#delivAdd').html('ÐÑÑавиÑÑ Ð¾ÑзÑв ' + deliveryname); 520 $('.modal-add-review--button').children('button').attr('delivid', id); 521 522 var dataTarget = $(this).attr('data-target'); 523 var dataBody = $(this).attr('data-body'); 524 525 $(this).parent().find('.active').removeClass('active'); 526 $(this).addClass('active'); 527 528 $(dataBody).removeClass('active'); 529 $(dataTarget).addClass('active'); 530 531 return false; 532 }); 533 534 $(document).on('click', '.show-block', function () { 535 $('.filter-select select').niceSelect(); 536 537 var dataTarget = $(this).attr('data-target'); 538 539 $(dataTarget).removeClass('active'); 540 $(this).closest('.catherine-reviews-block--coffee-one').find(dataTarget).toggleClass('active'); 541 542 return false; 543 }); 544 545 $(document).on('reveal:close', '.reveal-modal', function () { 546 document.querySelector('main.main-page').style.position = 'relative'; 547 $('#added-reviews').html(originalContentModal); 548 resetInlineReviewForm(); 549 }); 550 551 $(document) 552 .off('click.inlineReviewOpen', '.js-toggle-inline-review') 553 .on('click.inlineReviewOpen', '.js-toggle-inline-review', function (e) { 554 e.preventDefault(); 555 e.stopPropagation(); 556 e.stopImmediatePropagation(); 557 558 var $btn = $(this); 559 560 if ($btn.data('processing')) { 561 return false; 562 } 563 564 $btn.data('processing', true); 565 566 openInlineReview($btn); 567 568 setTimeout(function () { 569 $btn.removeData('processing'); 570 }, 300); 571 572 return false; 573 }); 574 575 $(document) 576 .off('click.btnAddReviewOpen', '.btn-add-review') 577 .on('click.btnAddReviewOpen', '.btn-add-review', function (e) { 578 e.preventDefault(); 579 e.stopPropagation(); 580 e.stopImmediatePropagation(); 581 582 var $btn = $(this); 583 584 if (!$btn.attr('item-id') && !$btn.data('item-id')) { 585 console.log('У .btn-add-review Ð½ÐµÑ item-id или data-item-id'); 586 return false;
587 } 588 589 var path = window.location.pathname.replace(/\/+$/, ''); 590 591 if (path === '/otzivi') { 592 openInlineReview($btn); 593 594 setTimeout(function () { 595 var $form = $('#inline-added-reviews'); 596 597 if ($form.length) { 598 $('html, body').stop(true).animate({ 599 scrollTop: $form.offset().top - 120 600 }, 400); 601 } 602 }, 250); 603 604 return false; 605 } 606 607 openProductInlineReview($btn); 608 609 return false; 610 }); 611 612 $(document) 613 .off('click.reviewItemData', '[item-id], [data-item-id]') 614 .on('click.reviewItemData', '[item-id], [data-item-id]', function (e) { 615 var $btn = $(this); 616 617 if ($btn.hasClass('js-toggle-inline-review')) { 618 return false; 619 } 620 621 if ($btn.hasClass('btn-add-review')) { 622 return false; 623 } 624 625 e.preventDefault(); 626 627 var itemId = $btn.attr('item-id') || $btn.data('item-id') || ''; 628 var elementId = $btn.attr('id') || ''; 629 630 if (!itemId) { 631 return false; 632 } 633 634 if (elementId === 'delivAdd') { 635 $('#sendreview button').attr('type', 'delivAdd'); 636 637 var deliveryname = $('.catherine-reviews-delivery--one.active span').attr('deliveryname') || ''; 638 $('.modal-add-review--title').html('ÐÑзÑв ' + deliveryname); 639 640 return false; 641 } 642 643 openProductInlineReview($btn); 644 645 return false; 646 }); 647 648 $(document).on('click', '.catherine-reviews--buy', function () { 649 var allowToAdd = $(this).hasClass('show-block'); 650 651 if (allowToAdd == false) { 652 var weight = $('.' + this.id + 'weight-checkbox:checked').val(); 653 var roasting = $('.' + this.id + 'roasting-checkbox:checked').val(); 654 var pomol = $('.visible_type[data-id="' + this.id + '"] option:selected').val(); 655 var hudi_size = $('#filtersize' + this.id + ' option:selected').val(); 656 657 $.post('/ajax/offerId.php', { 658 id: this.id, 659 quantity: $('.quantup[id="' + this.id + '"]').val(), 660 roasting: roasting, 661 weight: weight, 662 pomol: pomol, 663 hudi_size: hudi_size 664 }, function () { 665 window.showAdd(); 666 BX.onCustomEvent('OnBasketChange'); 667 }); 668 } 669 670 return false; 671 }); 672 673 $('.catherine-reviews--menu .catherine-reviews-menu--one').on('click', function () { 674 var dataTarget = $(this).attr('data-target'); 675 var id = $(this).attr('id'); 676 677 if (id == 'reviews-block-list') { 678 closeOpenedReviewCard(); 679 $('#reviews-block-list').toggleClass('hide'); 680 } 681 682 $(this).parent().find('.active').removeClass('active'); 683 $(this).addClass('active'); 684 685 $('.catherine-reviews--default-block').removeClass('active'); 686 $('.' + dataTarget).addClass('active'); 687 688 checkHeightReviews(); 689 690 return false; 691 }); 692 693 $(document).on('change', '[name="sort"]', function () { 694 var selectedValue = $(this).val(); 695 var option = $('.catherine-reviews-block-filter--one[data-type].active').attr('data-type') || 'catalog'; 696 697 $('#loader').removeClass('hide'); 698 699 $.get('/otzivi/?PAGEN_1=1&' + selectedValue + '=Y&option=' + option, function (data) { 700 $('#loader').addClass('hide'); 701 $('#addreviews').html($(data).find('#addreviews').html()); 702 restoreMainReviewsSimplebar(); 703 init(); 704 }); 705 }); 706 707 $(document).on('change', '[name="sort_comments"]', function () { 708 BXEditor = null; 709 710 var selectedValue = $(this).val(); 711 var id = $('.catherine-reviews-block--coffee-one.open').find('.catherine-reviews-block-coffee-one--title').attr('id'); 712 713 const el = document.querySelector('.catherine-reviews-block-coffee-review--block[data-item="' + id + '"]'); 714 715 if (el && window.SimpleBar && SimpleBar.instances && SimpleBar.instances.get(el)) { 716 const instance = SimpleBar.instances.get(el); 717 718 if (instance && typeof instance.unMount === 'function') { 719 instance.unMount(); 720 } 721 } 722 723 $.ajax({ 724 url: '/ajax/otzivi/sorting.php', 725 method: 'get', 726 dataType: 'html', 727 cache: false, 728 data: { id: id, sort: selectedValue }, 729 success: function (data) { 730 var dat = $(data).find('#add' + id).html(); 731 732 $('.catherine-reviews-block-coffee-review--block[data-item="' + id + '"]').html(dat); 733 734 $('.catherine-reviews-block-coffee-review--block[data-item="' + id + '"]').each(function () { 735 const simpleBar = new SimpleBar($(this)[0]); 736 }); 737 738 init(); 739 } 740 }); 741 }); 742 743 $(document).on('click', '.catherine-reviews-block-filter--one[data-type]', function (e) { 744 e.preventDefault(); 745 746 var $clicked = $(this); 747 748 closeOpenedReviewCard(); 749 750 $('.catherine-reviews-block-filter--one[data-type]').not($clicked).removeClass('active archive'); 751 $clicked.addClass('active archive'); 752 753 var selectedValue = getCurrentSortValue(); 754 var option = $clicked.attr('data-type'); 755 756 if (option !== 'tolist' && selectedValue != null) { 757 $('#loader').removeClass('hide'); 758 759 $.get('/otzivi/?PAGEN_1=1&' + selectedValue + '=Y&option=' + option, function (data) { 760 $('#loader').addClass('hide'); 761 762 $('#addreviews').html($(data).find('#addreviews').html()); 763 764 if (option === 'archive') { 765 $('.catherine-reviews--buy').addClass('hide'); 766 } else { 767 $('.catherine-reviews--buy').removeClass('hide'); 768 } 769 770 restoreMainReviewsSimplebar(); 771 init(); 772 getParam(); 773 774 var storedData = localStorage.getItem('globalText'); 775 var globalText = JSON.parse(storedData); 776 777 if (globalText && globalText.dataItem != null && globalText.subscribe == 'y') { 778 $('.open-more[data-id=' + globalText.dataItem + ']').trigger('click'); 779 globalText = null; 780 localStorage.setItem('globalText', JSON.stringify(globalText)); 781 } 782 }); 783 } 784 785 return false;
786 }); 787 788 $(document).on('click', '.catherine-reviews-block-filter--one[data-type=tolist]', function (e) { 789 e.preventDefault(); 790 791 history.replaceState(null, '', '/otzivi/'); 792 closeOpenedReviewCard(); 793 794 $(this).addClass('hide'); 795 796 return false; 797 }); 798 799 $(document).on('click', '#reviews-zakazi', function () {}); 800 801 $(document).on('click', '.open-more', function (e) { 802 e.preventDefault(); 803 804 var $item = $(this).closest('.catherine-reviews-block--coffee-one'); 805 var $product = $(this).closest('.product-v2'); 806 807 resetInlineReviewForm(); 808 809 if ($item.hasClass('open')) { 810 return false; 811 } 812 813 $('#loader').addClass('hide'); 814 815 $('.catherine-reviews-block-filter--one[data-type=tolist]').addClass('hide'); 816 $('.catherine-reviews-block-filter--one[data-type=archive]').addClass('hide'); 817 $('.catherine-reviews-block-filter--one[data-type=subscribes]').addClass('hide'); 818 $('.catherine-reviews-block-filter--one[data-type=coffe]').addClass('hide'); 819 $('.catherine-reviews-block-filter--one[data-type=another]').addClass('hide'); 820 821 $item.addClass('open'); 822 $('.catherine-reviews-block-add-review--text').addClass('hide'); 823 $('#reviews-block-list').addClass('hide'); 824 $('.catherine-reviews-menu--one[data-target=reviews--to-list]').removeClass('hide'); 825 826 $product.siblings().hide(); 827 828 var id = $(this).attr('data-id'); 829 830 $('.catherine-reviews-block--add-review .review-add-product').attr('item-id', id); 831 832 var title = $('.catherine-reviews-block-coffee-one--title#' + id).html(); 833 834 $('.modal-add-review--title').html('ÐÑзÑв ' + title); 835 $('.modal-add-review--button').children('button').attr('id', id); 836 837 originalContentModal = $('#added-reviews').html(); 838 839 var checkSimpleBar = $product.find('#soc_comments_div_' + id); 840 841 if (!checkSimpleBar.length) { 842 var selectedValue = getCurrentSortValue(); 843 844 $.ajax({ 845 url: '/ajax/otzivi/sorting.php', 846 method: 'get', 847 dataType: 'html', 848 cache: false, 849 data: { id: id, sort: selectedValue }, 850 success: function (data) { 851 var dat = $(data).find('#add' + id).html(); 852 853 $('.catherine-reviews-block-coffee-review--block[data-item="' + id + '"]').html(dat); 854 855 $('.filter-select select').niceSelect(); 856 $('select[name="quantity"]').niceSelect(); 857 858 $('.catherine-reviews-block-coffee-review--block[data-item="' + id + '"]').each(function () { 859 const simpleBar = new SimpleBar($(this)[0]); 860 }); 861 862 init(); 863 } 864 }); 865 } 866 867 $('#keklol').find('.simplebar-content-wrapper').eq(0).addClass('kill-overflow'); 868 $('#keklol').find('.simplebar-mask').eq(0).addClass('kill-overflow'); 869 $('#keklol').find('.simplebar-content').eq(0).addClass('kill-simplebar-content').removeClass('simplebar-content'); 870 $('#keklol').find('.simplebar-vertical').hide(); 871 $('#keklol').find('.simplebar-horizontal').hide(); 872 873 $('.nice-select.sort_products').find("li[data-value='reviewonly_morekomment']").hide(); 874 $('.nice-select.sort_products').find("li[data-value='reviewonly']").hide(); 875 876 $('select[name="sort"]').attr('name', 'sort_comments'); 877 878 $product.siblings().hide(); 879 880 checkHeightReviews(); 881 882 return false; 883 }); 884 885 $(window).resize(function () { 886 checkHeightReviews(); 887 }); 888 889 function checkHeightReviews() { 890 var value = $('.catherine-reviews-block--coffee-one.open').length; 891 892 if (value === 1 && $(window).width() <= 860) { 893 var heightHeaderReviews = $('.catherine-reviews-block--coffee-one.open').find('.catherine-reviews-block-coffee--info').height(); 894 $('.catherine-reviews-block--coffee-one.open').find('.catherine-reviews-block-coffee-review--block.more').css('padding-bottom', heightHeaderReviews + 40); 895 } else { 896 $('.catherine-reviews-block--coffee-one.open').find('.catherine-reviews-block-coffee-review--block.more').css('padding-bottom', ''); 897 } 898 } 899 900 window.redirectProduct = function () { 901 var dataItem = $('.review-add-product').attr('item-id'); 902 var globalText = { redirect: 'y', dataItem: dataItem }; 903 904 localStorage.setItem('globalText', JSON.stringify(globalText)); 905 window.location.href = '/sl/'; 906 }; 907 908 window.redirectProductCatalog = function () { 909 var dataItemId = $('.modal-add-review--button').attr('id'); 910 var currentUrl = window.location.origin + window.location.pathname; 911 var globalCatalogLink = { dataItemId: dataItemId, link: currentUrl }; 912 913 localStorage.setItem('globalCatalogLink', JSON.stringify(globalCatalogLink)); 914 window.location.href = '/sl/'; 915 }; 916 917 getParam(); 918}); 919 920$(document).ready(function () { 921 var storedData = localStorage.getItem('globalText'); 922 var globalText = JSON.parse(storedData); 923 924 var storedDataglobalCatalogLink = localStorage.getItem('globalCatalogLink'); 925 var catalogLink = JSON.parse(storedDataglobalCatalogLink); 926 927 if (catalogLink !== null && catalogLink.dataItemId !== null) { 928 scrollToTarget(); 929 930 function scrollToTarget() { 931 var targetElement = $('#' + catalogLink.dataItemId + '.icon-reviews-count--wrap'); 932 var checkBtn = $(".btn-add-review[item-id='" + catalogLink.dataItemId + "']"); 933 934 if (checkBtn.length < 1) { 935 if (targetElement.length) { 936 var targetPosition = targetElement.offset().top - 500; 937 938 $("html, body").animate({ scrollTop: targetPosition }, 700); 939 $('#' + catalogLink.dataItemId + '.icon-reviews-count--wrap').trigger('click'); 940 } else { 941 $("html, body").animate({ scrollTop: $(document).height() }, 700, function () { 942 scrollToTarget(); 943 }); 944 } 945 } 946 } 947 948 localStorage.setItem('globalCatalogLink', null); 949 } 950 951 if (globalText !== null && globalText.dataItem !== null) { 952 if (globalText.subscribe == 'y') { 953 $('.catherine-reviews-block-filter--one[data-type=subscribes]').trigger('click'); 954 } else { 955 $('.open-more[data-id=' + globalText.dataItem + ']').trigger('click'); 956 957 globalText = { dataItem: null }; 958 localStorage.setItem('globalText', JSON.stringify(globalText)); 959 } 960 } 961});
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.