1"use strict"; 2 3var ArrowHidden = false; 4 5$(document).ready(function () { 6 $(".cookieClose").on("click", () => { 7 $.cookie("cookie_message_show", "1", { expires: 14, path: "/" }); 8 }); 9 10 $(".emergencyClose").on("click", () => { 11 if ($(".emergencyClose").data("branch") == 0) { 12 let id = $(".emergencyClose").data("id"); 13 14 $.cookie("emmain", id, { expires: 7, path: "/" }); 15 } else { 16 let branch = $(".emergencyClose").data("branch"), 17 id = $(".emergencyClose").data("id"); 18 19 $.cookie("embranch_" + branch, id, { expires: 7, path: "/" }); 20 } 21 }); 22 23 $(".searchButton").on("click", () => { 24 let search = $(".main-search__input").val(); 25 window.location.href = `/search?key=${encodeURIComponent(search)}`; 26 // console.log(encodeURIComponent(search)); 27 }); 28 29 $(".main-search__input").bind("enterKey", function (e) { 30 let search = $(".main-search__input").val(); 31 window.location.href = `/search?key=${encodeURIComponent(search)}`; 32 // console.log(encodeURIComponent(search)); 33 }); 34 35 $(".main-search__input").keyup(function (e) { 36 if (e.keyCode == 13) { 37 $(this).trigger("enterKey"); 38 } 39 }); 40 41 if ($mainSearch.hasClass("hide")) { 42 } 43 44 $(".excursionsMobileNav").on("change", () => { 45 let id = $(".excursionsMobileNav").val(); 46 document.location.href = "/excursions/" + id; 47 }); 48 $("#eventSearchForm").on("submit", function (e) { 49 e.preventDefault(); 50 51 let form = $("#eventSearchForm"); 52 53 let type = $(".eventTypes").val(), 54 branch = $(".eventBranches").val(), 55 date_s = $(".eventDateS").val(), 56 date_e = $(".eventDateE").val(), 57 theme = $(".eventThemes").val(), 58 visitor = $(".eventVisitors").val(); 59 60 if (date_s == "") { 61 date_s = 0; 62 } 63 64 if (date_e == "") { 65 date_e = 0; 66 } 67 68 window.location.href = `/events-search?type=${type}&branch=${branch}&date_s=${date_s}&date_e=${date_e}&theme=${theme}&visitor=${visitor}`; 69 }); 70 71 $("#articlesSearchForm").on("submit", function (e) { 72 e.preventDefault(); 73 74 let form = $("#articlesSearchForm"); 75 76 let 77 theme = $(".articleThemes").val(), 78 author = $(".articleAuthors").val() 79 80 81 window.location.href = `/articles-search?theme=${theme}&author=${author}`; 82 }); 83 84 if (window.location.pathname == "/articles-search") { 85 let off = 2, 86 isReady = 1, 87 theme = $(".events-search-form").data("theme"), 88 author = $(".events-search-form").data("author") 89 90 $(".loader").hide(); 91 92 $(window).scroll(function () { 93 if ($(window).scrollTop() >= $(document).height() - 2400) { 94 if (isReady == 1) { 95 // console.log('load'); 96 $(".loader").show(); 97 isReady = 0; 98 $.ajax({ 99 url: "/api/journal/loadsearch", 100 type: "POST", 101 data: { 102 page: off, 103 theme: theme, 104 author: author 105 }, 106 success: function (data) { 107 if (!data) { 108 $(".loader").hide(); 109 return; 110 } 111 112 var $items = $(data); 113 $(".articles-grid").append($items).masonry("appended", $items); 114 115 $(".articles-grid").masonry("reloadItems"); 116 $(".articles-grid").masonry(); 117 118 off += 1; 119 $(".loader").hide(); 120 isReady = 1; 121 }, 122 }); 123 } 124 } 125 }); 126 } 127 128 if (window.location.pathname.indexOf("/journal/heading") >= 0) { 129 let off = 2, 130 isReady = 1, 131 headingId = $("#headingid").data("headingid"); 132 133 $(".loader").hide(); 134 135 $(window).scroll(function () { 136 if ($(window).scrollTop() >= $(document).height() - 2400) { 137 if (isReady == 1) { 138 // console.log('load'); 139 $(".loader").show(); 140 isReady = 0; 141 $.ajax({ 142 url: "/api/journal/loadheadings", 143 type: "POST", 144 data: { 145 page: off, 146 heading: headingId 147 }, 148 success: function (data) { 149 if (!data) { 150 $(".loader").hide(); 151 return; 152 } 153 154 var $items = $(data); 155 $(".articles-grid").append($items).masonry("appended", $items); 156 157 $(".articles-grid").masonry("reloadItems"); 158 $(".articles-grid").masonry(); 159 160 off += 1; 161 $(".loader").hide(); 162 isReady = 1; 163 }, 164 }); 165 } 166 } 167 }); 168 } 169 170 if (window.location.pathname == "/journal") { 171 let off = 2, 172 isReady = 1; 173 174 $(".loader").hide(); 175 176 $(window).scroll(function () { 177 if ($(window).scrollTop() >= $(document).height() - 2400) { 178 if (isReady == 1) { 179 $(".loader").show(); 180 isReady = 0; 181 $.ajax({ 182 url: "/api/journal/load", 183 type: "POST", 184 data: { 185 page: off, 186 }, 187 success: function (data) { 188 if (!data) { 189 $(".loader").hide(); 190 return; 191 } 192 193 var $items = $(data); 194 $(".articles-grid").append($items).masonry("appended", $items); 195 196 $(".articles-grid").masonry("reloadItems"); 197 $(".articles-grid").masonry(); 198 199 off += 1; 200 $(".loader").hide(); 201 isReady = 1; 202 }, 203 }); 204 } 205 } 206 }); 207 } 208 209 if (window.location.pathname == "/news") { 210 let off = 2, 211 isReady = 1; 212 213 // console.log('123'); 214 $(".loader").hide(); 215 216 $(window).scroll(function () { 217 if ($(window).scrollTop() >= $(document).height() - 2400) { 218 if (isReady == 1) { 219 // console.log('load'); 220 $(".loader").show(); 221 isReady = 0; 222 $.ajax({ 223 url: "/api/news/load", 224 type: "POST", 225 data: { 226 page: off, 227 }, 228 success: function (data) { 229 if (!data) { 230 $(".loader").hide(); 231 return; 232 } 233 $(".news-grid").append(data); 234 off += 1; 235 $(".loader").hide(); 236 isReady = 1; 237 }, 238 }); 239 } 240 } 241 }); 242 } 243 244 $("#educationSearchForm").on("submit", function (e) { 245 e.preventDefault(); 246 247 let form = $("#educationSearchForm"); 248 249 let type = $(".educationCategory").val(), 250 place = $(".educationPlace").val(), 251 tags = $(".educationTags").val(), 252 visitor = $(".educationVisitors").val(); 253 254 window.location.href = `/education-search?type=${type}&place=${place}&tags=${tags}&visitor=${visitor}`; 255 }); 256 257 if (window.location.pathname == "/education-search") { 258 let off = 2, 259 isReady = 1, 260 type = $(".events-search-form").data("type"), 261 tag = $(".events-search-form").data("tag"), 262 visitor = $(".events-search-form").data("visitor"), 263 branch = $(".events-search-form").data("branch"); 264 265 $(".loader").hide(); 266 267 $(window).scroll(function () { 268 if ($(window).scrollTop() >= $(document).height() - 2400) { 269 if (isReady == 1) { 270 // console.log('load'); 271 $(".loader").show(); 272 isReady = 0; 273 $.ajax({ 274 url: "/api/education/loadsearch", 275 type: "POST", 276 data: { 277 page: off, 278 type: type, 279 tag: tag, 280 visitor: visitor, 281 branch: branch, 282 }, 283 success: function (data) { 284 if (!data) { 285 $(".loader").hide(); 286 return; 287 } 288 289 $(".education-grid").append(data); 290 291 off += 1; 292 $(".loader").hide(); 293 isReady = 1; 294 }, 295 }); 296 } 297 } 298 }); 299 } 300 301 // console.log(window.location.pathname); 302 303 if (window.location.pathname == "/search") { 304 let key = getUrlParametr("key"), 305 filter = getUrlParametr("filter"), 306 off = 2, 307 isReady = 1; 308 309 $(".loader").hide(); 310 311 $(window).scroll(function () { 312 if ($(window).scrollTop() >= $(document).height() - 2400) { 313 if (isReady == 1) { 314 // console.log('load'); 315 $(".loader").show(); 316 isReady = 0; 317 $.ajax({ 318 url: "/api/search/download", 319 type: "POST", 320 data: { 321 key: key, 322 page: off, 323 filter: filter, 324 }, 325 success: function (data) { 326 if (!data) { 327 $(".loader").hide(); 328 return; 329 } 330 331 $(".searchResults").append(data); 332 333 off += 1; 334 $(".loader").hide(); 335 isReady = 1; 336 }, 337 }); 338 } 339 } 340 }); 341 } 342 343 if ( 344 window.location.pathname.includes("/collection/") || 345 window.location.pathname.includes("/collections/album/") 346 ) { 347 let type = $(".collectionId").data("type"), 348 id = $(".collectionId").data("id"), 349 off = 2, 350 isReady = 1; 351 352 $(".loader").hide(); 353 354 $(window).scroll(function () { 355 if ($(window).scrollTop() >= $(document).height() - 2400) { 356 if (isReady == 1) { 357 // console.log('load'); 358 $(".loader").show(); 359 isReady = 0; 360 $.ajax({ 361 url: "/api/exhibit/load", 362 type: "POST", 363 data: { 364 id: id, 365 page: off, 366 type: type, 367 }, 368 success: function (data) { 369 if (!data) { 370 $(".loader").hide(); 371 return; 372 } 373 374 let $items = $(data); 375 376 $(".exhibits-grid").append($items).masonry("appended", $items); 377 378 $(".exhibits-grid").masonry("reloadItems"); 379 $(".exhibits-grid").foundation(); 380 381 $(".exhibits-grid").masonry(); 382 383 off += 1; 384 $(".loader").hide(); 385 isReady = 1; 386 }, 387 }); 388 } 389 } 390 }); 391 } 392 393 if ( 394 window.location.pathname == "/education" || 395 window.location.pathname == "/education/online" 396 ) { 397 let type = $(".education-type").data("type"), 398 off = 2, 399 isReady = 1; 400 401 $(".loader").hide(); 402 403 $(window).scroll(function () { 404 if ($(window).scrollTop() >= $(document).height() - 2400) { 405 if (isReady == 1) { 406 // console.log('load'); 407 $(".loader").show(); 408 isReady = 0; 409 $.ajax({ 410 url: "/api/education/load", 411 type: "POST", 412 data: { 413 page: off, 414 type: type, 415 }, 416 success: function (data) { 417 if (!data) { 418 $(".loader").hide(); 419 return; 420 } 421 $(".education-grid").append(data); 422 off += 1; 423 $(".loader").hide(); 424 isReady = 1; 425 }, 426 }); 427 } 428 } 429 }); 430 } 431 432 if ( 433 window.location.pathname == "/education" || 434 window.location.pathname == "/education/online" 435 ) { 436 let type = $(".education-type").data("type"), 437 off = 2, 438 isReady = 1; 439 440 $(".loader").hide(); 441 442 $(window).scroll(function () { 443 if ($(window).scrollTop() >= $(document).height() - 2400) { 444 if (isReady == 1) { 445 // console.log('load'); 446 $(".loader").show(); 447 isReady = 0; 448 $.ajax({ 449 url: "/api/education/load", 450 type: "POST", 451 data: { 452 page: off, 453 type: type, 454 }, 455 success: function (data) { 456 if (!data) { 457 $(".loader").hide(); 458 return; 459 } 460 $(".education-grid").append(data); 461 off += 1; 462 $(".loader").hide(); 463 isReady = 1; 464 }, 465 }); 466 } 467 } 468 }); 469 } 470 471 if ( 472 window.location.pathname == "/projects" || 473 window.location.pathname == "/projects/archive" || 474 window.location.pathname == "/education/projects" 475 ) { 476 let type = $(".project-type").data("type"), 477 off = 2, 478 isReady = 1; 479 480 $(".loader").hide(); 481 482 $(window).scroll(function () { 483 if ($(window).scrollTop() >= $(document).height() - 2400) { 484 if (isReady == 1) { 485 // console.log('load'); 486 $(".loader").show(); 487 isReady = 0; 488 $.ajax({ 489 url: "/api/projects/load", 490 type: "POST", 491 data: { 492 page: off, 493 type: type, 494 }, 495 success: function (data) { 496 if (!data) { 497 $(".loader").hide(); 498 return; 499 } 500 $(".project-grid").append(data); 501 off += 1; 502 $(".loader").hide(); 503 isReady = 1; 504 }, 505 }); 506 } 507 } 508 }); 509 } 510 511 if ( 512 window.location.pathname == "/exhibitions" || 513 window.location.pathname == "/exhibitions/archive" || 514 window.location.pathname == "/exhibitions/future" || 515 window.location.pathname == "/events" || 516 window.location.pathname == "/events/future" || 517 window.location.pathname == "/events/archive" 518 ) { 519 let off = 2, 520 isReady = 1, 521 type = $("#events-page-header").data("type"), 522 vtype = $("#events-page-header").data("vtype"); 523 524 // console.log(type); 525 $(".loader").hide(); 526 // console.log(vtype) 527 528 $(window).scroll(function () { 529 if ($(window).scrollTop() >= $(document).height() - 2400) { 530 if (isReady == 1) { 531 // console.log('load'); 532 $(".loader").show(); 533 isReady = 0; 534 $.ajax({ 535 url: "/api/events/load", 536 type: "POST", 537 data: { 538 page: off, 539 type: type,
540 type_v: vtype, 541 }, 542 success: function (data) { 543 if (!data) { 544 $(".loader").hide(); 545 return; 546 } 547 548 var $items = $(data); 549 $(".events-grid").append($items).masonry("appended", $items); 550 551 $(".events-grid").masonry("reloadItems"); 552 $(".events-grid").masonry(); 553 554 off += 1; 555 $(".loader").hide(); 556 isReady = 1; 557 }, 558 }); 559 } 560 } 561 }); 562 } 563 564 if (window.location.pathname == "/events-search") { 565 let off = 2, 566 isReady = 1, 567 type = $(".events-search-form").data("type"), 568 dates = $(".events-search-form").data("dates"), 569 datee = $(".events-search-form").data("datee"), 570 theme = $(".events-search-form").data("theme"), 571 visitor = $(".events-search-form").data("visitor"), 572 branch = $(".events-search-form").data("branch"); 573 574 $(".loader").hide(); 575 576 $(window).scroll(function () { 577 if ($(window).scrollTop() >= $(document).height() - 2400) { 578 if (isReady == 1) { 579 // console.log('load'); 580 $(".loader").show(); 581 isReady = 0; 582 $.ajax({ 583 url: "/api/events/loadsearch", 584 type: "POST", 585 data: { 586 page: off, 587 type: type, 588 dates: dates, 589 datee: datee, 590 theme: theme, 591 visitor: visitor, 592 branch: branch, 593 }, 594 success: function (data) { 595 if (!data) { 596 $(".loader").hide(); 597 return; 598 } 599 600 var $items = $(data); 601 $(".events-grid").append($items).masonry("appended", $items); 602 603 $(".events-grid").masonry("reloadItems"); 604 $(".events-grid").masonry(); 605 606 off += 1; 607 $(".loader").hide(); 608 isReady = 1; 609 }, 610 }); 611 } 612 } 613 }); 614 } 615 616 setInterval(function () { 617 $(".module-horizontal").each(function () { 618 if ( 619 $(this).hasClass("narrow") && 620 $(this).find(".arrow-left-yel").is(":visible") && 621 $(this).find(".arrow-left-dis").is(":visible") && 622 $(this).find(".arrow-right-yel").is(":visible") && 623 $(this).find(".arrow-right-dis").is(":visible") 624 ) { 625 $(this).find(".arrow-left-yel").hide(); 626 $(this).find(".arrow-left-dis").hide(); 627 $(this).find(".arrow-right-yel").hide(); 628 $(this).find(".arrow-right-dis").hide(); 629 } 630 }); 631 632 $(".module-horizontal:not(.narrow)").each(function () { 633 if ( 634 $(this).find(".item, .link_short, .h3_short").first().is(":visible") 635 ) { 636 $(this).find(".arrow-left-yel").hide(); 637 $(this).find(".arrow-left-dis").show(); 638 } else { 639 $(this).find(".arrow-left-yel").show(); 640 $(this).find(".arrow-left-dis").hide(); 641 } 642 643 if ($(this).find(".item, .link_short, .h3_short").last().is(":visible")) { 644 $(this).find(".arrow-right-yel").hide(); 645 $(this).find(".arrow-right-dis").show(); 646 } else { 647 $(this).find(".arrow-right-yel").show(); 648 $(this).find(".arrow-right-dis").hide(); 649 } 650 }); 651 }, 1000); 652 653 $(document).keydown(function (e) { 654 if (event.shiftKey && event.ctrlKey && e.which == 69) { 655 var article_id = $(".article").data("id"); 656 657 var valid = 0; 658 659 if ($.cookie("editcode") !== undefined) { 660 $.ajax({ 661 url: "/api/articles/codevalid", 662 type: "POST", 663 async: false, 664 data: { 665 id: article_id, 666 code: $.cookie("editcode"), 667 }, 668 success: function (data) { 669 if (data !== "1") { 670 $.removeCookie("editcode"); 671 location.reload(); 672 } else { 673 valid = true; 674 } 675 }, 676 }); 677 } 678 679 if (!valid) { 680 var code = prompt("ÐведиÑе код:"); 681 682 $.ajax({ 683 url: "/api/articles/codevalid", 684 type: "POST", 685 data: { 686 id: article_id, 687 code: code, 688 }, 689 success: function (data) { 690 if (data !== "1") { 691 alert("ÐепÑавилÑнÑй код"); 692 } else { 693 $.cookie("editcode", code, { path: "/" }); 694 $.cookie("edittable", "articles", { path: "/" }); 695 location.reload(); 696 } 697 }, 698 }); 699 } 700 } 701 }); 702 703 if ($.cookie("lang") == "RU") { 704 $(".lang__switcher").html("EN"); 705 } else { 706 $(".lang__switcher").html("RU"); 707 } 708 709 if ($("html")[0].lang == "en") { 710 $.ajax("/public/i18n/en.json").done(function (text) { 711 i18n.translator.add(text); 712 }); 713 } 714}); 715 716function setLang() { 717 if ($.cookie("lang") == undefined) { 718 $.cookie("lang", "EN"); 719 location.reload(); 720 } else if ($.cookie("lang") == "RU") { 721 $.cookie("lang", "EN"); 722 location.reload(); 723 } else if ($.cookie("lang") == "EN") { 724 $.cookie("lang", "RU"); 725 location.reload(); 726 } 727} 728 729function isEndOfPage() { 730 if ( 731 $(window).scrollTop() + $(window).height() >= 732 $(document).height() - 100 733 ) { 734 return true; 735 } else { 736 return false;
737 } 738} 739 740function getUrlParametr(param) { 741 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 742 sURLVariables = sPageURL.split("&"), 743 sParameterName, 744 i; 745 746 for (i = 0; i < sURLVariables.length; i++) { 747 sParameterName = sURLVariables[i].split("="); 748 749 if (sParameterName[0] === param) { 750 return sParameterName[1] === undefined ? true : sParameterName[1]; 751 } 752 } 753} 754 755function isEditable() { 756 if ($(".content-editable-header").length === 0) return false; 757 return true; 758} 759 760function htmlspecialchars_decode(str) { 761 if (typeof str == "string") { 762 str = str.replace(/>/gi, ">"); 763 str = str.replace(/</gi, "<"); 764 str = str.replace(/'/g, "'"); 765 str = str.replace(/"/gi, '"'); 766 str = str.replace(/&/gi, "&"); /* must do & last */ 767 } 768 return str; 769} 770 771jQuery.fn.hasOneOfClasses = function (classes) { 772 var findClass = false; 773 classes.forEach((element) => { 774 if (this.hasClass(element)) { 775 findClass = true; 776 } 777 }); 778 return findClass; 779}; 780 781jQuery.fn.hasOneOfClasses = function (classes) { 782 var findClass = false; 783 classes.forEach((element) => { 784 if (this.hasClass(element)) { 785 findClass = true; 786 } 787 }); 788 return findClass; 789};
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.