1function withoutCyr(input) { 2 var value = input.value; 3 var re = /а|б|в|г|д|е|Ñ|ж|з|и|Ñ|к|л|м|н|о|п|Ñ|Ñ|Ñ|Ñ|Ñ|Ñ |Ñ|Ñ|Ñ|Ñ|Ñ|Ñ|Ñ|Ñ|Ñ|Ñ/gi; 4 if (re.test(value)) { 5 value = value.replace(re, ''); 6 input.value = value; 7 } 8} 9function strstr(haystack, needle, bool) { // Find first occurrence of a string 10 // 11 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 12 13 var pos = 0; 14 15 pos = haystack.indexOf(needle); 16 if (pos == -1) { 17 return false; 18 } else { 19 if (bool) { 20 return haystack.substr(0, pos); 21 } else { 22 return haystack.slice(pos); 23 } 24 } 25} 26 27var can_get_chat = true; 28 29function getChat(user_id) { 30 if (!can_get_chat) return; 31 32 var last_id = parseInt($('#send_message [name=last_id]').val()); 33 34 can_get_chat = false; 35 36 if (!last_id) { 37 $('.current_dialog').html(''); 38 } 39 if (!last_id && user_id) 40 $('.current_dialog').html('<img src="/local/images/preloader.gif" style="display:block;position:relative;top:48%;left:48%;" />'); 41 42 43 $.post('/local/ajax/chat_get_dialog.php', {user_id: user_id, last_id: last_id}, 44 function (data) { 45 46 if (last_id) 47 $('.current_dialog').append(data.html); 48 else if (user_id) { 49 $('.current_dialog').html(data.html); 50 $('#user_dialogs .user_block').removeClass('active'); 51 $('#user_dialogs .user_block[data-user_id="' + user_id + '"]').addClass('active'); 52 } 53 if (data.last_id) 54 $('#send_message [name=last_id]').val(data.last_id); 55 $('#send_message [name=user_id]').val(user_id); 56 57 58 if (data.dialogs) 59 $('#user_dialogs .dialogs').html(data.dialogs); 60 61 if (data.unread) { 62 $('.head-right .num1 sup').html(data.unread); 63 $('.head-right .num1 sup').hide(); 64 if (parseInt(data.unread) > 0) 65 $('.head-right .num1 sup').show(); 66 } 67 else { 68 $('.head-right .num1 sup').html(0); 69 $('.head-right .num1 sup').hide(); 70 } 71 72 73 var objDiv = document.getElementById("current_dialog"); 74 objDiv.scrollTop = objDiv.scrollHeight; 75 76 can_get_chat = true; 77 78 79 if (user_id) { 80 $('#user_dialogs .user_block').removeClass('active'); 81 $('#user_dialogs .user_block[data-user_id="' + user_id + '"]').addClass('active'); 82 } 83 84 85 }, 'json'); 86} 87 88$(document).on('click', '.jSearchMailVch', function(){ 89 var uId = $(this).data('id'); 90 91 getChat(uId); 92 $('.head-right .num1').trigger('click'); 93 94 return false; 95}); 96 97var blog_item_clicked; 98$(document).ready(function () { 99 $('.header_home .soc-block a').click(function () { 100 101 var sn = $(this).data('sn'); 102 $('.header_home .ulogin-button-' + sn).trigger('click'); 103 104 return false; 105 }); 106 107 function phoneInputHandler() { 108 if (!this.value.match(/^[-0-9+()]*$/)) { 109 this.value = this.getAttribute("value"); 110 } else { 111 this.setAttribute("value", this.value); 112 } 113 } 114 115 $('[name=PERSONAL_PHONE]').on("input", phoneInputHandler); 116 $('[name="UF_PHONES[]"]').on("input", phoneInputHandler); 117 118 $('.plus.add_phone').on('click', function () { 119 120 var n = $(this).parents('table').find('tr.additional_phone').length; 121 var html = '' + 122 '<tr class="additional_phone">' + 123 '<td class="label"><label></label></td>' + 124 '<td width="460">' + 125 '<div class="border add_input">' + 126 '<input name="UF_PHONES[]" placeholder="+7 (495) 962-62-62" type="phone">' + 127 '</div>' + 128 '</td>' + 129 '<td>' + 130 '<div class="border">' + 131 '<span class="minus"></span>' + 132 '</div>' + 133 '</td>' + 134 '</tr>' + 135 ''; 136 137 if (n) 138 $(this).parents('table').find('tr.additional_phone').eq(n - 1).after(html); 139 else 140 $(this).parents('tr').after(html); 141 $('[name="UF_PHONES[]"]').on("input", phoneInputHandler); 142 143 });
144 145 $('.plus.add_email').on('click', function () { 146 147 var n = $(this).parents('table').find('tr.additional_email').length; 148 var html = '' + 149 '<tr class="additional_email">' + 150 '<td class="label"><label></label></td>' + 151 '<td width="460">' + 152 '<div class="border add_input">' + 153 '<input name="UF_EMAILS[]" placeholder="[email protected]" type="email">' + 154 '</div>' + 155 '</td>' + 156 '<td>' + 157 '<div class="border">' + 158 '<span class="minus"></span>' + 159 '</div>' + 160 '</td>' + 161 '</tr>' + 162 ''; 163 164 if (n) 165 $(this).parents('table').find('tr.additional_email').eq(n - 1).after(html); 166 else 167 $(this).parents('tr').after(html); 168 169 }); 170 171 $('.form_conent.slugba').submit(function () { 172 173 var go = true; 174 $(this).find('[name="SLUGBA[MILITARY_UNIT][]"]').each(function () { 175 176 if ($(this).val().length < 4 || $(this).val().length > 5) { 177 go = false; 178 } 179 180 }); 181 182 if (!go) { 183 alert('ÐÐ¾Ð¼ÐµÑ Ð²Ð¾Ð¸Ð½Ñкой ÑаÑÑи должен ÑоÑÑоÑÑÑ Ð¸Ð· 4 или 5 ÑиÑÑ'); 184 return false; 185 } 186 187 }); 188 189 $('.plus.add_slugba').on('click', function () { 190 191 var n = $(this).parents('table').find('tr.slugba').length; 192 var html = '' + 193 '<tr>' + 194 '<td class="col1"></td>' + 195 '<td class="col2"><div class="border"><input name="SLUGBA[MILITARY_UNIT][]" placeholder="12345" type="text"></div></td>' + 196 '<td class="col3">Ñ</td>' + 197 '<td class="col4"><div class="border"><input name="SLUGBA[FROM][]" placeholder="2012" type="text"></div></td>' + 198 '<td class="col3">по</td>' + 199 '<td class="col4"><div class="border"><input name="SLUGBA[TO][]" placeholder="2013" type="text"></div></td>' + 200 '<td class="col5">' + 201 '<div class="border">' + 202 '<span class="minus"></span>' + 203 '</div>' + 204 '</td>' + 205 '</tr>' + 206 ''; 207 208 if (n) 209 $(this).parents('table').find('tr:last-child').before(html); 210 else 211 $(this).parents('tr').after(html); 212 $('[name="SLUGBA[FROM][]"]').mask('9999'); 213 $('[name="SLUGBA[TO][]"]').mask('9999'); 214 215 }); 216 217 218 $('body').on('click', '.minus', function () { 219 $(this).parents('tr').remove(); 220 }); 221 222 $('.show_change').click(function () { 223 224 var id = $(this).parents('tr').attr('id'); 225 $(this).parents('tr').hide(); 226 227 $('#' + id + '_change').show(); 228 229 return false; 230 }); 231 232 $('.submit_change').click(function () { 233 234 $(this).parents('form').submit(); 235 236 return false; 237 }); 238 239 $('body').on('click','li.like a',function() { 240 var url = "/local/components/vamba/rating.vote/vote.ajax.php"; 241 242 var action = "plus"; 243 if ($(this).hasClass('liked')) 244 action = "cancel"; 245 246 var s = $(this).data('sessid').split('='); 247 248 var data = { 249 RATING_VOTE: "Y", 250 RATING_VOTE_TYPE_ID: "BLOG_POST", 251 RATING_VOTE_ENTITY_ID: $(this).data('entity_id'), 252 RATING_VOTE_ACTION: action, 253 sessid: s[1] 254 }; 255 256 if ($(this).parents('.obsugden').length) { 257 data.RATING_VOTE_TYPE_ID = 'FORUM_POST'; 258 } 259 if ($(this).parents('.item_obsugd').hasClass('firstm')) { 260 data.RATING_VOTE_TYPE_ID = 'FORUM_TOPIC'; 261 } 262 if ($(this).parents('.feed-log-entry').length) { 263 data.RATING_VOTE_TYPE_ID = 'IBLOCK_SECTION'; 264 } 265 266 var t = $(this); 267 var p = t.parents('.action_block '); 268 var lw = p.find('.like_window'); 269 270 $.ajax({
271 url: url, 272 method: "POST", 273 data: data, 274 dataType: "json", 275 success: function (res) { 276 console.log(t); 277 t.find('b').text(res.items_all); 278 if (action == 'cancel') t.removeClass('liked'); 279 else t.addClass('liked'); 280 281 lw.html(res.html); 282 283 if (res.html) { 284 lw.show(); 285 } 286 287 288 }, 289 error: function (res, textStatus, err) { 290 291 console.log(res); 292 console.log(textStatus); 293 console.log(err); 294 295 } 296 }); 297 298 //return false; 299 }); 300 301 302 $('[name=to_years], [name=from_years]').change(function () { 303 var d = new Date(); 304 var y = d.getFullYear(); 305 306 var to0 = $('[name=to_years]').val(); 307 var from0 = $('[name=from_years]').val(); 308 309 var y1 = y - to0; 310 var y2 = y - from0; 311 312 $('[name=flt_personal_birthday_year]').val(y1 + ',' + y2); 313 314 }); 315 316 317 $('body').on('click', '.delete_post', function () { 318 if (confirm('ÐÑ ÑвеÑенÑ?')) { 319 var id = $(this).data('id'); 320 var t = $(this); 321 $.get('/ajax/delete_post.php?id=' + id, 322 function (data) { 323 if (data) 324 alert(data); 325 else { 326 t.parents('.blog_post').remove(); 327 } 328 }); 329 } 330 331 return false; 332 }); 333 334 $('body').on('click', '.post_approve', function (e) { 335 e.preventDefault(); 336 var t = $(this), 337 id = t.data('id'); 338 $.get('/local/ajax/approve_post.php?id=' + id, 339 function (data) { 340 if (data.status == 'success') { 341 t.remove(); 342 } 343 else { 344 console.log(data); 345 } 346 } 347 ); 348 }); 349 350 $('[name=flt_personal_city]').keyup(function () { 351 var v = $(this).val(); 352 console.log(v.length); 353 $('.city_vars').hide(); 354 if (v.length > 1) { 355 $.get('/ajax/get_cities.php?city=' + v, 356 function (data) { 357 $('.city_vars').html(data); 358 $('.city_vars').show(); 359 }); 360 } 361 else { 362 $('.city_vars').html(''); 363 $('.city_vars').hide(); 364 } 365 }); 366 367 $('body').on('click', '.city_search_result', function (data) { 368 var t = $(this).text(); 369 $(this).parent().parent().find('[type=text]').val(t); 370 $(this).parent().hide(); 371 372 return false; 373 }); 374 375 376 $('[name=PERSONAL_CITY]').keyup(function () { 377 var v = $(this).val(); 378 console.log(v.length); 379 $('.city_vars').hide(); 380 if (v.length > 1) { 381 $.get('/ajax/get_cities.php?city=' + v, 382 function (data) { 383 $('.city_vars').html(data); 384 $('.city_vars').show(); 385 }); 386 } 387 else { 388 $('.city_vars').html(''); 389 $('.city_vars').hide(); 390 } 391 }); 392 393 $('#contacts_form').submit(function () { 394 395 var vk = $(this).find('[name=UF_VK]').val(); 396 if (vk && vk.substring(0, 7) != 'vk.com/') { 397 alert('ÐÑоÑÐ¸Ð»Ñ vk должен наÑинаÑÑÑÑ Ñ vk.com/') 398 return false; 399 } 400 var fb = $(this).find('[name=UF_FB]').val(); 401 if (fb && fb.substring(0, 13) != 'facebook.com/') { 402 alert('ÐÑоÑÐ¸Ð»Ñ facebook должен наÑинаÑÑÑÑ Ñ facebook.com/') 403 return false; 404 } 405 var ok = $(this).find('[name=UF_OK]').val(); 406 if (ok && ok.substring(0, 6) != 'ok.ru/') { 407 alert('ÐÑоÑÐ¸Ð»Ñ ok должен наÑинаÑÑÑÑ Ñ ok.ru/') 408 return false; 409 } 410 411 }); 412 413 if ($('.popular_blog_post').length) { 414 $('.popular_blog_post').each(function () { 415 var p = $(this).find('.dtext'); 416 p.css('height', 'auto'); 417 if (p.height() <= 100) 418 $(this).find('.read_more').hide(); 419 420 p.css('height', '100px'); 421 }); 422 423 $('.popular_blog_post .read_more a').click(function () { 424 var dtext = $(this).parents('.popular_blog_post').find('.dtext'); 425 426 console.log(dtext.css('height')); 427 if (dtext.css('height') != '100px') { 428 dtext.css('height', '100px'); 429 $(this).text('ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ'); 430 } 431 else { 432 dtext.css('height', 'auto'); 433 $(this).text('СвеÑнÑÑÑ'); 434 } 435 436 return false; 437 }); 438 } 439 if ($('.blog_post').length) { 440 $('.blog_post').each(function () { 441 var p = $(this).find('.text_block'); 442 p.css('height', 'auto'); 443 444 if (p.hasClass('repost')) { 445 if (p.height() <= 200) 446 $(this).find('.read_more').hide(); 447 448 p.css('height', '200px'); 449 } 450 else if (p.find('iframe').length || p.find('img').length) { 451 $(this).find('.read_more').hide(); 452 } 453 else { 454 if (p.height() <= 100) 455 $(this).find('.read_more').hide(); 456 ///p.css('height', '95px'); 457 } 458 }); 459 460 $('body').on('click', '.blog_post .read_more a', function () { 461 console.log('test'); 462 //var p = $(this).parents('.blog_post').find('.text_block'); 463 var text_block = $(this).parents('.blog_post').find('.text_block'); 464 /*var text_block_table = text_block.find('table');*/ 465 if (text_block.hasClass('height_max')) { 466 if (text_block.css('height') != '345px') { 467 text_block.css('height', '345px'); 468 $(this).text('ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ'); 469 } 470 else { 471 text_block.css('height', 'auto'); 472 $(this).text('СвеÑнÑÑÑ'); 473 } 474 } 475 else { 476 if (text_block.hasClass('repost')) { 477 if (text_block.css('height') != '200px') { 478 text_block.css('height', '200px'); 479 $(this).text('ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ'); 480 } 481 else { 482 text_block.css('height', 'auto'); 483 $(this).text('СвеÑнÑÑÑ'); 484 } 485 } 486 else { 487 if (text_block.height() == 95) { 488 text_block.css('height', 'auto'); 489 $(this).text('СвеÑнÑÑÑ'); 490 } 491 else { 492 text_block.css('height', '95px'); 493 $(this).text('ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ'); 494 } 495 } 496 } 497 /*if (text_block.css('height') != '100px') { 498 text_block.css('height', '100px'); 499 $(this).text('ЧиÑаÑÑ Ð´Ð°Ð»ÐµÐµ'); 500 } 501 else { 502 text_block.css('height', 'auto'); 503 $(this).text('СвеÑнÑÑÑ'); 504 }*/ 505 506 507 return false; 508 }); 509 } 510 511 $('#up_group_search_form input').keyup(function () { 512 if (!$('.search_group').length) { 513 $('.foto_block_zdem').before('<div class="foto_block_zdem grupp search_group"></div>'); 514 } 515 var v = $(this).val(); 516 517 if (!v) { 518 $('.foto_block_zdem').not('.search_group').show(); 519 $('.search_group').hide(); 520 } 521 else { 522 $('.foto_block_zdem').not('.search_group').hide(); 523 $('.search_group').show(); 524 525 var url = '/local/ajax/ajax_group_search.php?s=' + v; 526 $.get(url, 527 function (data) { 528 $('.search_group').html(data); 529 if (!data) $('.search_group').html('ÐÑÑпп не найдено'); 530 }); 531 } 532 533 534 });
535 536 537 $('.search_chast input').keyup(function () { 538 if (!$('.foto_block_zdem_search').length) { 539 $('.foto_block_zdem').before('<div class="foto_block_zdem foto_block_zdem_search"></div>'); 540 } 541 var v = $(this).val(); 542 543 if (!v) { 544 $('.foto_block_zdem').not('.foto_block_zdem_search').show(); 545 $('.foto_block_zdem_search').hide(); 546 } 547 else { 548 $('.foto_block_zdem').not('.foto_block_zdem_search').hide(); 549 $('.foto_block_zdem_search').show(); 550 551 var url = '/ajax/get_friends.php?s=' + v; 552 if ($(this).parent().hasClass('vch')) { 553 url += '&vch=' + $(this).parent().data('id'); 554 } 555 556 $.get(url, 557 function (data) { 558 $('.foto_block_zdem_search').html(data); 559 if (!data) $('.foto_block_zdem_search').html('ÐикÑо не найден'); 560 }); 561 } 562 563 564 }); 565 566 $('[name=to_years], [name=from_years]').keydown(function (event) { 567 if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || 568 // РазÑеÑаем: Ctrl+A 569 (event.keyCode == 65 && event.ctrlKey === true) || 570 // РазÑеÑаем: home, end, влево, впÑаво 571 (event.keyCode >= 35 && event.keyCode <= 39)) { 572 // ÐиÑего не делаем 573 return; 574 } 575 else { 576 // ÐбеждаемÑÑ, ÑÑо ÑÑо ÑиÑÑа, и оÑÑанавливаем ÑобÑÑие keypress 577 if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )) { 578 event.preventDefault(); 579 } 580 } 581 }); 582 583 $('[name="SLUGBA[FROM][]"]').mask('9999'); 584 $('[name="SLUGBA[TO][]"]').mask('9999'); 585 586 $('.num4, .sub').hover(function () { 587 $('.sub').show(); 588 }, function () { 589 $('.sub').hide(); 590 }); 591 592 593 $('body').magnificPopup({ 594 delegate: '.popup-link', 595 type: 'inline', 596 fixedContentPos: true, 597 fixedBgPos: true, 598 overflowY: 'auto', 599 closeBtnInside: true, 600 preloader: false, 601 midClick: true, 602 removalDelay: 300, 603 mainClass: 'my-mfp-zoom-in', 604 callbacks: { 605 close: function () { 606 var p = $('#group_claim_form').parents('.popup-block'); 607 p.find('.title').show(); 608 p.find('form').show(); 609 p.find('.sent').hide(); 610 } 611 } 612 }); 613 614 615 $('#group_claim_form').submit(function () { 616 617 var a = $(this).serialize(); 618 var p = $(this).parents('.popup-block'); 619 $.post('/local/ajax/submit_claim_form.php', a, 620 function (data) { 621 console.log(data); 622 if (data.result) { 623 p.addClass('one_line_text'); 624 /*p.find('.body').html('СпаÑибо! ÐаÑа заÑвка пÑинÑÑа!'); 625 p.find('.title').html(''); 626 p.find('.header').css('background', '#f8f8f8');*/ 627 p.find('textarea').val(''); 628 p.find('.title').hide(); 629 p.find('form').hide(); 630 p.find('.sent').show(); 631 } 632 else { 633 alert(data.error); 634 } 635 636 }, 'json'); 637 638 return false; 639 }); 640 641 $('.tab-link').click(function () { 642 643 var id = '#' + $(this).data('tab'); 644 $(this).parents('.tabs-block').find('.tab').hide(); 645 $(id).show(); 646 647 return false; 648 }); 649 650 651 $('body').on('click', '#user_friends .user_block', function () { 652 var user_id = $(this).data('user_id').split(','); 653 $('#send_message [name=last_id]').val(''); 654 $('.current_dialog').html(''); 655 var name = $(this).find('.name').text(); 656 var names = $(this).find('.name').text().split(','); 657 links = [];
658 names.forEach(function (item, i, arr) { 659 links.push('<a href="/personal/user/' + user_id[i] + '/">' + item + '</a>'); 660 }); 661 662 $('#soob_window .right_block2 .title span').html(links.join(', ')); 663 664 getChat(user_id); 665 666 return false; 667 }); 668 $('body').on('click', '#user_dialogs .user_block', function () { 669 var user_id = $(this).data('user_id').split(','); 670 $('#send_message [name=last_id]').val(''); 671 $('.current_dialog').html(''); 672 var name = $(this).find('.name').text(); 673 var names = $(this).find('.name').text().split(','); 674 675 links = []; 676 names.forEach(function (item, i, arr) { 677 links.push('<a href="/personal/user/' + user_id[i] + '/">' + item + '</a>'); 678 }); 679 680 $('#soob_window .right_block2 .title span').html(links.join(', ')); 681 //$('#soob_window .right_block2 .title span').text(name); 682 683 getChat(user_id); 684 685 return false; 686 }); 687 $('#inv_button').click(function () { 688 689 if ($('.invite:checked').length) { 690 var user_id = new Array(); 691 var name = new Array(); 692 $('.invite:checked').each(function () { 693 694 user_id.push($(this).val()); 695 var n = $(this).parents('tr').find('.w2 b').text(); 696 name.push(n); 697 698 }); 699 $('#send_message [name=last_id]').val(''); 700 $('.current_dialog').html(''); 701 $('#send_message [name=user_id]').val(user_id); 702 $('#soob_window .right_block2 .title span').text(name); 703 704 getChat(user_id); 705 } 706 else { 707 alert('ÐикÑо не вÑбÑан'); 708 } 709 710 return false; 711 }); 712 713 714 $('#send_message').submit(function () { 715 716 var a = $(this).serialize(); 717 var user_id = $(this).find('[name=user_id]').val(); 718 719 if (!user_id) { 720 alert('Ðе вÑбÑан диалог'); 721 return false; 722 } 723 724 var ttt = $(this); 725 726 $.get('/local/ajax/messages_check_rights.php?user_id=' + user_id, 727 function (data) { 728 if (data == 1) { 729 ttt.find('textarea').val(''); 730 731 $.post('/local/ajax/chat_send_message.php', a, 732 function (data) { 733 734 getChat(user_id); 735 736 /* 737 $('#send_message [name=last_id]').val(data.last_id); 738 739 $('.current_dialog').append(data.html); 740 741 var objDiv = document.getElementById("current_dialog"); 742 objDiv.scrollTop = objDiv.scrollHeight; 743 */ 744 745 }, 'json'); 746 } 747 else if (data == 0) { 748 alert('ÐолÑзоваÑÐµÐ»Ñ Ð¾Ð³ÑаниÑил кол-во лÑдей, коÑоÑÑе могÑÑ ÐµÐ¼Ñ Ð¿Ð¸ÑаÑÑ'); 749 } 750 else 751 alert(data); 752 }); 753 754 755 return false; 756 }); 757 758 var chatInterval = setInterval(function () { 759 760 var user_id = $('#send_message').find('[name=user_id]').val(); 761 var last_id = $('#send_message').find('[name=last_id]').val(); 762 763 764 if (user_id) { 765 766 getChat(user_id); 767 /* 768 $.post('/local/ajax/chat_get_dialog.php',{user_id:user_id,last_id:last_id}, 769 function(data){ 770 771 if(data.last_id) 772 $('#send_message [name=last_id]').val(data.last_id); 773 774 $('.current_dialog').append(data.html); 775 776 var objDiv = document.getElementById("current_dialog"); 777 objDiv.scrollTop = objDiv.scrollHeight; 778 779 },'json'); 780 */ 781 } 782 783 }, 5000); 784 785 786 $('body').on('submit', '.share_form', function () { 787 788 var a = $(this).serialize(); 789 790 var st = $(this).find('[name=share_to]:checked').val(); 791 792 if (st == 'message' && !parseInt($(this).find('.fr_select select').val())) { 793 alert('УкажиÑе дÑÑга Ð´Ð»Ñ Ð¾ÑпÑавки'); 794 return false; 795 } 796 797 $.post('/local/ajax/submit_share_form.php', a, 798 function (data) { 799 if (data.result) { 800 alert('УÑпеÑно!'); 801 location.reload(); 802 } 803 else 804 alert(data.error); 805 }, 'json'); 806 807 return false; 808 });
809 810 if ($('.ajax_paginator').length) { 811 var paginator_top = new Array(); 812 var paginator_flag = new Array(); 813 814 $('.ajax_paginator').each(function () { 815 paginator_top.push($(this).offset().top); 816 paginator_flag.push(true); 817 }); 818 819 $(window).scroll(function () { 820 821 var wh = $(this).height(); 822 var st = $(this).scrollTop(); 823 824 var h = wh + st; 825 826 827 $('.ajax_paginator').each(function (i) { 828 829 var t = $(this); 830 var navnum = $(this).data('navnum'); 831 var page = $(this).data('page'); 832 var max = $(this).data('max'); 833 var u = $(this).data('unique'); 834 835 if (h >= paginator_top[i] && paginator_flag[i]) { 836 paginator_flag[i] = false; 837 page++; 838 var href = location.href.replace(location.hash, ""); 839 var url = ~href.indexOf("?") ? href + "&" : href + "?"; 840 $.ajax({
841 url: url + 'ajax_' + u + '=Y&PAGEN_' + navnum + '=' + page, 842 data: {}, 843 success: function (data) { 844 console.log(data.length); 845 $('#' + u).append(data); 846 if (page < max) { 847 t.data('page', page); 848 paginator_top[i] = t.offset().top; 849 paginator_flag[i] = true; 850 } 851 852 }}); 853 854 } 855 }); 856 857 858 }); 859 860 } 861 //if ($('#fileuploader').length > 0) { 862 var uploadObj = $("#fileuploader").uploadFile({ 863 url: "/local/templates/voenchast/js/jquery-upload-file/php/upload.php", 864 fileName: "myfile", 865 allowedTypes: "jpg,png", 866 acceptFiles: "/*", 867 multiple: true, 868 showPreview: true, 869 dragdropWidth: "100%", 870 previewWidth: "auto", 871 previewHeight: "100%", 872 autoSubmit: false, 873 showDelete: true, 874 showFileSize: false, 875 maxFileCount: 10, 876 autoSubmit: true, 877 uploadStr: 'вÑбеÑиÑе на компÑÑÑеÑе', 878 dragDropStr: '<span>или пеÑеÑаÑиÑе ÑоÑогÑаÑии ÑÑда</span>', 879 maxFileCountErrorStr: 'не загÑÑжен. ÐакÑималÑно допÑÑÑимо к загÑÑзке Ñайлов: ', 880 afterUploadAll: function (obj) { 881 setTimeout(function () { 882 $('.ajax-file-upload-progress').fadeOut(300); 883 884 $('.ajax-file-upload-statusbar').each(function (i) { 885 886 if (!$(this).find('a.delete').length) { 887 $(this).prepend('<a href="#" class="delete" style="position:absolute;top:0;right:0;display:block;width:37px;height:38px;background-image:url(/images/basket_mini_hover.png);"></a>'); 888 } 889 890 var chkd = false; 891 if ($(this).find('.main_photo:checked').length) 892 chkd = true; 893 $(this).find('.main_photo').parent().remove(); 894 895 if (!chkd) 896 $(this).append('<label><input type="radio" name="main_photo" class="main_photo" value="' + i + '" /> ÐÑновное ÑоÑо</label>'); 897 else 898 $(this).append('<label><input type="radio" name="main_photo" class="main_photo" value="' + i + '" checked /> ÐÑновное ÑоÑо</label>'); 899 900 }); 901 902 903 }, 300); 904 905 906 var site = 'http://' + location.host + '/upload/temp_files/'; 907 $.each(obj.responses, function (key, value) { 908 var v = site + value; 909 var name = 'image[]'; 910 911 if (!$('.uimages [value="' + v + '"]').length) 912 $('.uimages').prepend('<input type="hidden" name="' + name + '" value="' + v + '" />'); 913 }); 914 915 916 }, 917 onLoad: function (obj) { 918 919 920 } 921 922 }); 923 // } 924 925 926 $('body').on('click', '.ajax-file-upload-statusbar .delete', function () { 927 928 $(this).parent().find('.ajax-file-upload-red:last-child').click(); 929 930 return false; 931 }); 932 933 /*****инаÑе поÑемÑÑо пеÑеÑÑало оÑпÑавлÑÑÑÑÑ ÑообÑениÑ***/ 934 $('#blogPostForm').attr('novalidate', true); 935 $('#REPLIER').attr('novalidate', true); 936 937 938 $('body').on('change', '[name=share_to]', function () { 939 var p = $(this).parents('.center'); 940 var v = p.find('[name=share_to]:checked').val(); 941 p.find('.fr_select').hide(); 942 // console.log(v); 943 944 if (v == 'message') { 945 p.find('.fr_select').show(); 946 p.find('.fr_select select').styler(); 947 } 948 949 950 }); 951 952 953 $('#mb_search [name=s]').keyup(function () { 954 955 var v = $(this).val(); 956 957 // if(v.length > 3 || 1) 958 // { 959 $.get(location.href + '?s=' + v + '&ajax=Y', 960 function (data) { 961 $('.foto_block_zdem.kniga').html(data); 962 }); 963 964 // } 965 966 967 });
968 969 970 $('.right_block input[type=text]').keyup(function () { 971 972 var v = $(this).val().toLowerCase(); 973 //$('.right_block .ublock').not('.friends').remove(); 974 975 if (!v) { 976 //$('.right_block .ublock.friends').show(); 977 } 978 else { 979 980 $('.right_block .ublock.friends').hide(); 981 $('.right_block table tr.ublock').each(function () { 982 //if(!$(this).hasClass('form_tr') && !$(this).hasClass('need_tr')) 983 $(this).remove(); 984 }); 985 986 $.get('/local/ajax/ajax_user_chat_search.php?q=' + v, 987 function (data) { 988 $('.right_block table tbody tr.form_tr').after(data); 989 990 $('.right_block table tbody input').styler(); 991 }); 992 /* 993 $('.right_block .ublock').each(function() { 994 var n = $(this).find('.w2').text().toLowerCase(); 995 $(this).hide(); 996 if(n.indexOf(v) >= 0) 997 $(this).show(); 998 }); 999 */ 1000 } 1001 1002 }); 1003 $('[name=friends_search]').keyup(function () { 1004 1005 var v = $(this).val().toLowerCase(); 1006 1007 if (!v) { 1008 $('#user_friends .user_block').show(); 1009 } 1010 else { 1011 $('#user_friends .user_block').each(function () { 1012 var n = $(this).find('.name').text().toLowerCase(); 1013 $(this).hide(); 1014 console.log(v); 1015 console.log(n.indexOf(v)); 1016 if (n.indexOf(v) >= 0) 1017 $(this).show(); 1018 }); 1019 } 1020 1021 }); 1022 $('[name=dialogs_search]').keyup(function () { 1023 1024 var v = $(this).val().toLowerCase(); 1025 1026 if (!v) { 1027 $('#user_dialogs .dialogs .user_block').show(); 1028 } 1029 else { 1030 $('#user_dialogs .dialogs .user_block').each(function () { 1031 var n = $(this).find('.name').text().toLowerCase(); 1032 $(this).hide(); 1033 console.log(v); 1034 console.log(n.indexOf(v)); 1035 if (n.indexOf(v) >= 0) 1036 $(this).show(); 1037 }); 1038 } 1039 1040 }); 1041 1042 $("#send_message [name=message]").keyup(function (event) { 1043 if (event.keyCode === 13) { 1044 $("#send_message").submit(); 1045 return false; 1046 } 1047 }); 1048 1049 var clicked_foto; 1050 var last_clicked_foto; 1051 var total_foto = $('.show_foto').length; 1052 1053 1054 $('#albom_wrap2 .block-img img').click(function () { 1055 if (last_clicked_foto.data('entity') !== 'USER_PHOTO') 1056 $('.show_foto').eq(clicked_foto).click(); 1057 return false; 1058 }); 1059 1060 $('body').on('click', '#arr_left', function () { 1061 if (last_clicked_foto.data('entity') !== 'USER_PHOTO') { 1062 if (clicked_foto) 1063 clicked_foto = clicked_foto - 2; 1064 $('.show_foto').eq(clicked_foto).click(); 1065 } 1066 return false; 1067 }); 1068 $('body').on('click', '#arr_right', function () { 1069 if (last_clicked_foto.data('entity') !== 'USER_PHOTO') 1070 $('.show_foto').eq(clicked_foto).click(); 1071 return false; 1072 }); 1073 1074 setTimeout(function () { 1075 $("#albom_wrap2").after('<div id="arr_left"></div><div id="arr_right"></div>'); 1076 }, 800); 1077 1078 $('body').on('click', '.show_foto', function (e) { 1079 e.preventDefault(); 1080 var t = $(this); 1081 $.post( 1082 '/ajax/actions.php', 1083 { 1084 action: 'increaseViews', 1085 id: $(this).data('id') 1086 }, 1087 function(data) { 1088 data = JSON.parse(data); 1089 if (data.views) 1090 t.data('views', data.views); 1091 1092 $('#albom_wrap2 .window_footer #photo_desc').remove(); 1093 $('#albom_wrap2 .action_block ul .edit_photo').remove(); 1094 $('#albom_wrap2 .action_block ul .delete_photo').remove(); 1095 $('#albom_wrap2 .action_block ul .change_foto').remove(); 1096 1097 console.log(t.hasClass('myfoto')); 1098 1099 1100 // $('#albom_wrap2 #foto_comment').hide(); 1101 $('#albom_wrap2 .action_block ul .share.share_foto').hide(); 1102 1103 var num = $('.show_foto').length; 1104 var n = t.index('.show_foto') + 1; 1105 clicked_foto = n; 1106 last_clicked_foto = $(this); 1107 1108 if (!t.hasClass('myfoto') && num > 1) 1109 $('#arr_left, #arr_right').show(); 1110 else 1111 $('#arr_left, #arr_right').hide(); 1112 1113 var id = t.data('id'); 1114 1115 var src = t.data('src'); 1116 var original = t.data('original'); 1117 var name = t.data('name'); 1118 var views = parseInt(t.data('views')); 1119 var date = t.data('date');
1120 var likes = t.data('likes'); 1121 var liked = t.data('liked'); 1122 var author = t.data('user'); 1123 var album = t.data('album'); 1124 var entity = t.data('entity'); 1125 var created_by = t.data('created_by'); 1126 1127 1128 $('#albom_wrap2 .block-img img').attr('src', src); 1129 $('#albom_wrap2 .block-img .count').text(n + ' из ' + num); 1130 $('#albom_wrap2 .block-img .origin').attr('href', original); 1131 // $('#albom_wrap2 .block-img .name span:eq(0)').text(name); 1132 $('#albom_wrap2 .block-img .share').attr('data-id', id); 1133 $('#albom_wrap2 .block-img .like').attr('data-id', id); 1134 $('#albom_wrap2 .block-img .like').text(likes); 1135 $('#albom_wrap2 td.views').text(views); 1136 $('#albom_wrap2 td.date').text(date); 1137 1138 if (author) 1139 $('#albom_wrap2 td.author').html(author); 1140 if (album) 1141 $('#albom_wrap2 td.album').html(album); 1142 1143 if (author && created_by) 1144 $('#albom_wrap2 td.author').html('<a href="/personal/user/' + created_by + '/">' + author + '</a>'); 1145 1146 if (t.hasClass('myfoto') && (!entity || entity == 'IBLOCK_ELEMENT')) { 1147 $('#albom_wrap2 .action_block ul').append('<li class="change_foto"><a href="/personal/user/' + created_by + '/main_edit/" style="background:none;padding-left:10px;">ÑмениÑÑ Ð°Ð²Ð°ÑаÑ</a></li>'); 1148 } 1149 1150 1151 if (entity) 1152 $('#albom_wrap2 .block-img .like').attr('data-entity', entity); 1153 1154 if (liked == 'Y') 1155 $('#albom_wrap2 .block-img .like').addClass('liked'); 1156 else 1157 $('#albom_wrap2 .block-img .like').removeClass('liked'); 1158 1159 $('#foto_comment [name=id]').val(id); 1160 1161 var url = '/local/ajax/photo_get_comments.php?id=' + id; 1162 1163 if (entity) url += '&entity=' + entity; 1164 1165 $.get(url, 1166 function (data) { 1167 $('#albom_wrap2 .left').html(data); 1168 }); 1169 1170 if (!entity || entity == 'IBLOCK_ELEMENT') 1171 $.get('/local/ajax/photo_get_desc.php?id=' + id, 1172 function (data) { 1173 $('#albom_wrap2 .window_footer').prepend('<div style="margin-top:-10px;text-align:left;" id="photo_desc">' + data.desc + '</div>'); 1174 1175 if ((data.mine || data.moder) && (!entity || entity == 'IBLOCK_ELEMENT')) { 1176 $('#albom_wrap2 .action_block ul').append('<li class="edit_photo"><a href="#edit_photo-popup" data-id="' + id + '" style="background:none;padding-left:10px;">ÑедакÑиÑоваÑÑ</a></li>'); 1177 $('#albom_wrap2 .action_block ul').append('<li class="delete_photo"><a data-id="' + id + '" style="background:none;padding-left:10px;">ÑдалиÑÑ</a></li>'); 1178 1179 $('#albom_wrap2 .action_block ul .edit_photo a').magnificPopup({ 1180 type: 'inline', 1181 fixedContentPos: true, 1182 fixedBgPos: true, 1183 overflowY: 'auto', 1184 closeBtnInside: true, 1185 preloader: false, 1186 midClick: true, 1187 removalDelay: 300, 1188 mainClass: 'my-mfp-zoom-in', 1189 closeOnBgClick: false 1190 }); 1191 } 1192 1193 if (data.can_comment) 1194 $('#albom_wrap2 #foto_comment').show(); 1195 if (data.can_share) 1196 $('#albom_wrap2 .action_block ul .share.share_foto').show(); 1197 }, 'json'); 1198 $('#foto_popup').click(); 1199 return false; 1200 } 1201 ); 1202 });
1203 1204 $('body').on('click', '.show_avatar', function (e) { 1205 e.preventDefault(); 1206 var t = $(this); 1207 $.post( 1208 '/ajax/actions.php', 1209 { 1210 action: 'increaseAvatarViews', 1211 user_id: t.data('created_by') 1212 }, 1213 function (data) { 1214 data = JSON.parse(data); 1215 if (data.views) 1216 t.data('views', data.views); 1217 console.log(t.data('views')); 1218 $('#albom_wrap2 .window_footer #photo_desc').remove(); 1219 $('#albom_wrap2 .action_block ul .edit_photo').remove(); 1220 $('#albom_wrap2 .action_block ul .delete_photo').remove(); 1221 $('#albom_wrap2 .action_block ul .change_foto').remove(); 1222 1223 $('#arr_left, #arr_right').hide(); 1224 1225 //$('#albom_wrap2 #foto_comment').hide(); 1226 $('#albom_wrap2 .action_block ul .share.share_foto').hide(); 1227 1228 var id = t.data('id'); 1229 var src = t.data('src'); 1230 var original = t.data('original'); 1231 var views = parseInt(t.data('views')); 1232 var date = t.data('date'); 1233 var likes = t.data('likes'); 1234 var liked = t.data('liked'); 1235 var author = t.data('user'); 1236 var album = t.data('album'); 1237 var entity = t.data('entity'); 1238 var created_by = t.data('created_by'); 1239 1240 $('#albom_wrap2 .block-img img').attr('src', src); 1241 $('#albom_wrap2 .block-img .count').text(''); 1242 $('#albom_wrap2 .block-img .origin').attr('href', original); 1243 $('#albom_wrap2 .block-img .share').attr('data-id', id); 1244 $('#albom_wrap2 .block-img .like').attr('data-id', id); 1245 $('#albom_wrap2 .block-img .like').text(likes); 1246 $('#albom_wrap2 td.views').text(views); 1247 $('#albom_wrap2 td.date').text(date); 1248 1249 if (author) 1250 $('#albom_wrap2 td.author').html(author); 1251 if (album) 1252 $('#albom_wrap2 td.album').html(album); 1253 1254 if (author && created_by) 1255 $('#albom_wrap2 td.author').html('<a href="/personal/user/' + created_by + '/">' + author + '</a>'); 1256 1257 if (t.hasClass('myfoto') && (!entity || entity === 'IBLOCK_ELEMENT')) { 1258 $('#albom_wrap2 .action_block ul').append('<li class="change_foto"><a href="/personal/user/' + created_by + '/main_edit/" style="background:none;padding-left:10px;">ÑмениÑÑ Ð°Ð²Ð°ÑаÑ</a></li>'); 1259 } 1260 1261 1262 if (entity) 1263 $('#albom_wrap2 .block-img .like').attr('data-entity', entity); 1264 1265 if (liked == 'Y') 1266 $('#albom_wrap2 .block-img .like').addClass('liked'); 1267 else 1268 $('#albom_wrap2 .block-img .like').removeClass('liked'); 1269 1270 $('#foto_comment [name=id]').val(id); 1271 1272 var url = '/local/ajax/photo_get_comments.php?id=' + id; 1273 if (entity) 1274 url += '&entity=' + entity; 1275 1276 $.get(url, 1277 function (data) { 1278 $('#albom_wrap2 .left').html(data); 1279 }); 1280 1281 if (!entity || entity === 'IBLOCK_ELEMENT') 1282 $.get('/local/ajax/photo_get_desc.php?id=' + id, 1283 function (data) { 1284 $('#albom_wrap2 .window_footer').prepend('<div style="margin-top:-10px;text-align:left;" id="photo_desc">' + data.desc + '</div>'); 1285 1286 if ((data.mine || data.moder) && (!entity || entity == 'IBLOCK_ELEMENT')) { 1287 $('#albom_wrap2 .action_block ul').append('<li class="edit_photo"><a href="#edit_photo-popup" data-id="' + id + '" style="background:none;padding-left:10px;">ÑедакÑиÑоваÑÑ</a></li>'); 1288 $('#albom_wrap2 .action_block ul').append('<li class="delete_photo"><a data-id="' + id + '" style="background:none;padding-left:10px;">ÑдалиÑÑ</a></li>'); 1289 1290 $('#albom_wrap2 .action_block ul .edit_photo a').magnificPopup({ 1291 type: 'inline', 1292 fixedContentPos: true, 1293 fixedBgPos: true, 1294 overflowY: 'auto', 1295 closeBtnInside: true, 1296 preloader: false, 1297 midClick: true, 1298 removalDelay: 300, 1299 mainClass: 'my-mfp-zoom-in' 1300 }); 1301 } 1302 1303 if (data.can_comment) 1304 $('#albom_wrap2 #foto_comment').show(); 1305 if (data.can_share) 1306 $('#albom_wrap2 .action_block ul .share.share_foto').show(); 1307 }, 'json'); 1308 $('#foto_popup').click(); 1309 return false; 1310 } 1311 ); 1312 });
1313 1314 $('body').on('click', '#albom_wrap2 .action_block ul .edit_photo a', 1315 function () { 1316 $('#photo_edit_form textarea').val($('#photo_desc').text()); 1317 $('#photo_edit_form [name=photo_id]').val($(this).data('id')); 1318 }); 1319 $('body').on('click', '#albom_wrap2 .action_block ul .delete_photo a', 1320 function () { 1321 if (confirm('ÐÑ ÑвеÑенÑ?')) { 1322 $.get('/local/ajax/photo_delete.php?id=' + $(this).data('id'), 1323 function (data) { 1324 location.reload(); 1325 }); 1326 } 1327 }); 1328 1329 $('#photo_edit_form').submit(function () { 1330 var a = $(this).serialize(); 1331 var m = $(this).find('textarea').val(); 1332 $.post('/local/ajax/photo_change_desc.php', a, 1333 function (data) { 1334 $('#edit_photo-popup .mfp-close').click(); 1335 $('#photo_edit_form textarea').val(''); 1336 $('#albom_wrap2 #photo_desc').text(m); 1337 }); 1338 return false; 1339 }); 1340 1341 $('#foto_comment').submit(function () { 1342 var id = $(this).find('[name=id]').val(); 1343 var a = $(this).serialize(); 1344 var t = $(this); 1345 var isGroup = $(this).data('group'); 1346 console.log(isGroup); 1347 $.get('/local/ajax/photo_check_comment_rights.php?id=' + id + '&group=' + isGroup, 1348 function (data) { 1349 if (parseInt(data) == 1) { 1350 var entity = $('#albom_wrap2 .like').data('entity'); 1351 var url = '/local/ajax/photo_comment.php'; 1352 if (entity) url += '?entity=' + entity; 1353 1354 $.post(url, a, 1355 function (data) { 1356 1357 t.find('input[name=message]').val(''); 1358 $('.window_footer .left').html(data); 1359 }); 1360 } 1361 else if (parseInt(data) == 0) { 1362 alert('ÐолÑзоваÑÐµÐ»Ñ Ð¾Ð³ÑаниÑил возможноÑÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½ÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑÐ²Ð¾Ð¸Ñ ÑоÑо'); 1363 } 1364 else 1365 alert(data); 1366 }); 1367 1368 return false; 1369 }); 1370 1371 1372 $('#albom_wrap2 .block-img .like').click(function () { 1373 1374 var id = $(this).data('id'); 1375 var entity = $(this).data('entity'); 1376 var t = $(this); 1377 1378 var url = '/local/ajax/photo_vote.php?id=' + id; 1379 1380 if (entity) url += '&entity=' + entity; 1381 1382 $.get(url, 1383 function (data) { 1384 if (t.hasClass('liked')) 1385 t.removeClass('liked'); 1386 else 1387 t.addClass('liked'); 1388 t.text(data); 1389 1390 }); 1391 1392 return false; 1393 }); 1394 1395 $('#albom_wrap2 .block-img .share').click(function () { 1396 1397 var id = $(this).data('id'); 1398 var entity = $('#albom_wrap2 .like').data('entity'); 1399 var t = $(this); 1400 1401 var url = '/local/ajax/photo_share.php?id=' + id; 1402 1403 if (entity) url += '&entity=' + entity; 1404 1405 $.get(url, 1406 function (data) { 1407 if (data.result) 1408 alert('ФоÑогÑаÑÐ¸Ñ ÑазмеÑена Ñ Ð²Ð°Ñ Ð² ленÑе'); 1409 else 1410 alert(data.error); 1411 }, 'json'); 1412 1413 return false; 1414 }); 1415 1416 1417 $('.create_chat').click(function () { 1418 $('#soob_window .right_block').show(); 1419 $('#soob_window .right_block2').hide(); 1420 }); 1421 1422 $('.text_block_detail .img_block').height($('.text_block_detail table').height()); 1423 1424 1425 $('.settings_form').submit(function () { 1426 $(this).find('[type=file]').attr('required', false); 1427 }); 1428 1429 1430 $('#about_sort_form').submit(function () { 1431 1432 var t = $(this); 1433 1434 $('#sortable li').each(function () { 1435 1436 t.append('<input type="hidden" name="sort[' + $(this).data('id') + ']" value="' + $(this).data('sort') + '" />'); 1437 1438 }); 1439 1440 1441 //return false; 1442 });
1443 1444 1445 $('input.voen_chast').mask('9999?9'); 1446 1447 1448 $('#vch_enter_form').submit(function () { 1449 1450 var a = $(this).serialize(); 1451 1452 $.post('/local/ajax/enter_vch.php', a, 1453 function (data) { 1454 1455 alert(data); 1456 location.reload(); 1457 1458 }); 1459 1460 1461 return false; 1462 }); 1463 1464 1465 $('#albom_wrap2').each(function (i) { 1466 if (i) $(this).remove(); 1467 }); 1468 $('#foto_popup').each(function (i) { 1469 if (i) $(this).remove(); 1470 }); 1471 1472 1473 $('.vch_blog_item.before_click').css('cursor', 'pointer'); 1474 1475 var ccc = true; 1476 1477 1478 $('.vch_blog_item.before_click').click(function (e) { 1479 /* 1480 var id = $(this).data('post_id'); 1481 $('#cb'+id).click(); 1482 */ 1483 if (!$(e.target).is('a')) { 1484 blog_item_clicked = $(this).parent(); 1485 1486 blog_item_clicked.find('.delete_post').hide(); 1487 1488 var t = $(window).scrollTop(); 1489 1490 1491 $(this).removeClass('before_click'); 1492 var p = $(this).parent(); 1493 1494 p.css('position', 'absolute'); 1495 p.animate( 1496 { 1497 left: '50%', 1498 top: (t + 50) + 'px', 1499 marginLeft: '-270px', 1500 zIndex: '1000', 1501 width: '664px', 1502 }, 1503 500 1504 ); 1505 $('#darkbox').fadeIn(500); 1506 1507 1508 return false; 1509 } 1510 1511 }); 1512 1513 $('#darkbox').click(function () { 1514 if (blog_item_clicked) { 1515 blog_item_clicked.css('position', 'relative'); 1516 blog_item_clicked.css('left', ''); 1517 blog_item_clicked.css('top', ''); 1518 blog_item_clicked.css('marginLeft', ''); 1519 blog_item_clicked.css('zIndex', ''); 1520 blog_item_clicked.css('width', ''); 1521 1522 $('#darkbox').fadeOut(500); 1523 blog_item_clicked.find('.delete_post').show(); 1524 } 1525 }); 1526 1527 $('.colorbox').colorbox({ 1528 // iframe:true, 1529 onComplete: function () { 1530 jQuery('.share_window input[type="radio"]').styler(); 1531 }, 1532 }); 1533 1534 1535 $('body').on('click', '#colorbox .feed-com-add-link', function () { 1536 1537 var c = $(this).parents('#colorbox'); 1538 c.find('.feed-add-post').show(); 1539 c.find('.feed-add-post').parents('form').parent().show(); 1540 //$(this).remove(); 1541 1542 //return false; 1543 }); 1544 1545 $('.isearch_like').click(function () { 1546 1547 var liked = $(this).hasClass('liked'); 1548 var id = $(this).data('id'); 1549 var t = $(this); 1550 1551 $.get('/local/ajax/isearch_vote.php?id=' + id, 1552 function (data) { 1553 t.find('span').text(data); 1554 if (liked) 1555 t.removeClass('liked'); 1556 else 1557 t.addClass('liked'); 1558 }); 1559 1560 return false; 1561 }); 1562 1563 $('.isearch_share').click(function () { 1564 1565 var id = $(this).data('id'); 1566 var t = $(this); 1567 1568 var url = '/local/ajax/isearch_share.php?id=' + id + '&entity=ISEARCH'; 1569 1570 $.get(url, 1571 function (data) { 1572 alert('ÐапиÑÑ ÑазмеÑена Ñ Ð²Ð°Ñ Ð² ленÑе'); 1573 }); 1574 1575 return false; 1576 1577 1578 return false; 1579 }); 1580 1581 $('.head-search [name=q]').keyup(function () { 1582 1583 var v = $(this).val(); 1584 if (v.length > 2) { 1585 $.get('/local/ajax/ajax_top_search.php?q=' + v + '&ajax=Y', 1586 function (data) { 1587 $('#ajaxed_search').html(data); 1588 $('#ajaxed_search').show(); 1589 }); 1590 } 1591 else { 1592 $('#ajaxed_search').hide(); 1593 } 1594 1595 1596 }); 1597 1598 1599 $('body').on('click', '.the_notif_answer, .accept-friend', function () { 1600 var t = $(this); 1601 1602 BX.ajax({ 1603 url: '/bitrix/components/bitrix/im.messenger/im.ajax.php?NOTIFY_CONFIRM', 1604 method: 'POST', 1605 dataType: 'json', 1606 timeout: 60, 1607 data: { 1608 'IM_NOTIFY_CONFIRM': 'Y',
1609 'NOTIFY_ID': t.data('id'), 1610 'NOTIFY_VALUE': t.data('value'), 1611 'IM_AJAX_CALL': 'Y', 1612 'sessid': BX.bitrix_sessid() 1613 }, 1614 onsuccess: BX.delegate(function (data) { 1615 if (t.hasClass('page_notif_answer')) { 1616 location.reload(); 1617 } 1618 else { 1619 var notifs_page = 1; 1620 var o = {}; 1621 o['IM_NOTIFY_HISTORY_LOAD_MORE'] = 'Y'; 1622 o['PAGE'] = notifs_page; 1623 o['IM_AJAX_CALL'] = 'Y'; 1624 o['sessid'] = BX.bitrix_sessid(); 1625 1626 $("#settings .inner").html(''); 1627 1628 BX.ajax({ 1629 dataType: 'json', 1630 method: 'POST', 1631 url: '/bitrix/components/bitrix/im.messenger/im.ajax.php?NOTIFY_HISTORY_LOAD_MORE&1111', 1632 data: o, 1633 onsuccess: function (data) { 1634 var arr = Object.values(data.NOTIFY).sort().reverse(); 1635 1636 $.each(arr, function (index, value) { 1637 if (!value.userAvatar) { 1638 value.userAvatar = "/local/images/group_img.png"; 1639 } 1640 var d = new Date(value.date * 1000); 1641 1642 var item = '' + 1643 '<div class="item even">' + 1644 '<div class="right_foto">' + 1645 ''; 1646 if (value.buttons) { 1647 $.each(value.buttons, function (index2, value2) { 1648 item += '<span class="bx-notifier-item-button-wrap"><span data-id="' + value.id + '" data-value="' + value2.VALUE + '" class="the_notif_answer bx-notifier-item-button bx-notifier-item-button-confirm bx-notifier-item-button-' + value2.TYPE + '">' + value2.TITLE + '</span></span>'; 1649 }); 1650 } 1651 1652 item += '' + 1653 '</div>' + 1654 '<div class="left_foto">' + 1655 '<img src="' + value.userAvatar + '">' + 1656 '<a href="' + value.userLink + '"><span class="ramka"></span></a>' + 1657 '</div>' + 1658 '<div class="center_info">' + 1659 '<p><a href="'+value.userLink+'">' + value.userName + '</a> ' + value.text + ' <br>' + 1660 '<span class="time">' + d.toLocaleString() + '</span>' + 1661 '</p>' + 1662 '</div>' + 1663 '</div>'; 1664 1665 1666 $('#settings .inner').append(item); 1667 }); 1668 } 1669 }); 1670 } 1671 if (t.hasClass('accept-friend')) { 1672 t.attr('href', '/personal/user/'+t.data('user')+'/friends/delete/'); 1673 t.attr('title', 'УбÑаÑÑ Ð¸Ð· дÑÑзей'); 1674 t.text('У Ð²Ð°Ñ Ð² дÑÑзÑÑÑ '); 1675 t.removeClass('accept-friend'); 1676 } 1677 }, this) 1678 }); 1679 1680 }); 1681 1682 $('#user_blog_edit .feed-add-post-micro').click(function () { 1683 1684 //$('#blog-title').show(); 1685 LHEPostForm.getHandler('idPostFormLHE_blogPostForm').showPanelEditor(); 1686 $('[name=UF_BLOG_POST_IMPRTNT]').val('1'); 1687 }); 1688 1689 /* 1690 $('#blog-submit-button-cancel').click(function() { 1691 1692 $('#blog-title').hide(); 1693 }); 1694 */ 1695 1696 $('#user_blog_edit #blogPostForm').submit(function () { 1697 /* 1698 if(!$('#blog-title').val()) 1699 return false; 1700 */ 1701 });
1702 1703 1704 $('.post_claim').click(function () { 1705 var id = $(this).data('id'), 1706 user = $(this).data('user'); 1707 $('#claim-popup [name=post_id]').val(id); 1708 $('#claim-popup [name=user_id]').val(user); 1709 1710 }); 1711 $('.photo_claim').click(function () { 1712 var id = $(this).parents('#albom_wrap2').find('.block-img img').attr('src'); 1713 $('#claim-popup [name=photo_id]').val(id); 1714 }); 1715 1716 $('[name=PERSONAL_COUNTRY0]').keyup(function () { 1717 1718 var v = $(this).val(); 1719 var l = v.length; 1720 if (l) { 1721 $('.country_vars').show(); 1722 1723 $('.country_vars a').each(function () { 1724 var t = $(this).text(); 1725 if (t.substr(0, l) == v) { 1726 $(this).show(); 1727 } 1728 else 1729 $(this).hide(); 1730 1731 1732 }); 1733 } 1734 else { 1735 $('.country_vars').hide(); 1736 $('.country_vars a').hide(); 1737 } 1738 1739 console.log(v + '/' + l); 1740 1741 }); 1742 $('.country_vars a').click(function () { 1743 1744 $('.country_vars').hide(); 1745 $('.country_vars a').hide(); 1746 $('[name=PERSONAL_COUNTRY]').val($(this).data('v')); 1747 $('[name=PERSONAL_COUNTRY0]').val($(this).text()); 1748 }); 1749 1750 $('.detail_action a').click(function () { 1751 1752 $('body').append('<div style="position:fixed;width:100%;height:100%;background:rgba(0,0,0,0.6);left:0;top:0;z-index:10;"><img src="/local/images/preloader.gif" style="width:24px;height:24px;position:absolute;top:50%;left:50%;" /></div>'); 1753 1754 }); 1755 1756 1757 $('.fm_delete').click(function () { 1758 1759 if (confirm('ÐÑ ÑвеÑенÑ, ÑÑо Ñ Ð¾ÑиÑе ÑдалиÑÑ ÑообÑение без возможноÑÑи воÑÑÑановлениÑ?')) { 1760 var id = $(this).data('id'); 1761 1762 $.get('/local/ajax/forum_message_delete.php?id=' + id, 1763 function (data) { 1764 if (data == 1) { 1765 location.reload(); 1766 } 1767 else { 1768 alert(data); 1769 } 1770 }); 1771 } 1772 1773 1774 return false; 1775 }); 1776 1777 1778 $('#clear_blog_header').click(function () { 1779 $('#POST_TITLE').val(''); 1780 }); 1781 $('.all_not').click(function () { 1782 $('.uved_block .item').show(); 1783 return false; 1784 }); 1785 $('.friend_not').click(function () { 1786 $('.uved_block .item').hide(); 1787 $('._friend_not').show(); 1788 return false; 1789 }); 1790 $('.groups_not').click(function () { 1791 $('.uved_block .item').hide(); 1792 $('._groups_not').show(); 1793 return false; 1794 }); 1795 $('.comm_not').click(function () { 1796 $('.uved_block .item').hide(); 1797 $('._comm_not').show(); 1798 return false; 1799 }); 1800 1801}); 1802
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.