PageSourceSearch

https://xn--80aacozicjl1agbl4lraw.xn--p1ai/local/templates/mediapasport_new/script.js

js xn--80aacozicjl1agbl4lraw.xn--p1ai collected 2026-10-02 17:37:15 UTC 5,173 bytes, 189 lines download raw bytes

1$(function($){
2
3    // размеры окна
4    var ww = window.innerWidth;
5    var wh = window.innerHeight;
6
7    var scrolled = window.pageYOffset || document.documentElement.scrollTop;
8    var header = document.querySelector(".page-header");
9
10    if(header){
11        if(scrolled > 50){
12            header.classList.add("page-header--scroll");
13        }else{
14            header.classList.remove("page-header--scroll");
15        }
16    }
17
18    window.onscroll = function(){
19        if(header){
20            scrolled = window.pageYOffset || document.documentElement.scrollTop;
21            if(scrolled > 50){
22                header.classList.add("page-header--scroll");
23            }else{
24                header.classList.remove("page-header--scroll");
25            }
26        }
27    }
28
29
30    // пропорции
31    var aspect = function(){
32        $("[data-aspect]").each(function(){
33            $(this).css("height", parseInt($(this).css("width")) / $(this).data("aspect"));
34        });
35    }
36    aspect();
37
38    // ресайз окна
39    $(window).on("resize", function(){
40        ww = window.innerWidth;
41        wh = window.innerHeight;
42        aspect();
43    });
44
45    var st = $(window).scrollTop();
46
47    // основное меню
48    function openMenu(e){
49        // e.preventDefault();
50        st = $(window).scrollTop();
51        $("body").addClass("menu-open");
52        $(".page-content").hide();
53    }
54
55    function closeMenu(e){
56        e.preventDefault();
57        $("body").removeClass("menu-open");
58        $(".page-content").show();
59        if(st > 0) $(window).scrollTop(st);
60    }
61
62    // левое меню
63    function openLeftMenu(e){
64        e.preventDefault();
65        $("#main-body").addClass("left-menu-open");
66        e.stopPropagation();
67    }
68
69    function closeLeftMenu(e){
70        $("body").removeClass("left-menu-open");
71    }
72
73    $(document).keyup(function(e){
74        if(e.keyCode === 27){
75            if($("body").hasClass("menu-open")){
76                closeMenu(e);
77            }else if($("body").hasClass("left-menu-open")){
78                closeLeftMenu(e);
79            }
80        }
81    });
82
83    // открытие основного меню
84    $(".logo").on("click", function(e){
85        openMenu(e);
86    });
87
88    $(".nav-global__close").on("click", function(e){
89        closeMenu(e);
90    });
91
92
93    // открытие левого меню
94    $(".burger").on("click", function(e){
95        openLeftMenu(e);
96    });
97    // открытие левого меню
98    $(".section-menu").on("click", function(e){
99        openLeftMenu(e);
100    });
101
102    // закрытие левого меню
103    $(document).on("click", function(e){
104        if($("#main-body").hasClass("left-menu-open")){
105            if($(e.target).closest(".nav-left").length) return;
106            closeLeftMenu(e);
107            e.stopPropagation();
108        }
109    });
110
111    $(".nav-left__close").on("click", function(e){
112        closeLeftMenu(e);
113    });
114
115    // открытие подразделов меню
116    $(".main-nav__item").on("click", function(e){
117        if(!($(this).hasClass("main-nav__item--current")) && !($("#nav-global").hasClass("nav-global--section"))){
118            e.preventDefault();
119            $(".main-nav__item--current").removeClass("main-nav__item--current");
120            $(this).addClass("main-nav__item--current");
121            $(".main-nav").addClass("main-nav--selected");
122        }
123    });
124
125
126    $(".main-nav__back").on("click", function(){
127        $(".main-nav__item").removeClass("main-nav__item--current");
128        $(".main-nav").removeClass("main-nav--selected");
129    });
130
131
132    // видео
133    $(".video-container span span").on("click", function(ev){
134        if($(this).parent().parent().hasClass("map-container")){
135            $(this).parent().hide();
136        }else{
137            $(this).parent().prev()[0].src += "&autoplay=1";
138            $(this).parent().hide();
139        }
140    });
141
142
143    if($("#fp").width() > 0){
144        var nih = $(window).height() - 260 - 80;
145        $(".main-nav__sub-list").css("max-height", nih);
146        $(".main-nav__sub-list").mCustomScrollbar({
147            scrollInertia: 0
148        });
149    }
150
151
152    var showBy = 8;
153    var activeFrom = 0;
154    var activeTo = 0;
155    $(".foto__item--last").on("click", function(){
156        var current = $(this).data("current");
157        var max = $(this).data("max");
158        current++;
159        $(this).data("current", current);
160
161        activeTo = current * showBy - 2;
162        if(current != 1){
163            activeFrom = (current - 1) * showBy - 1;
164        }else{
165            activeFrom = 0;
166        }
167
168        $(".foto .row div").each(function(index){
169            if(index >= activeFrom && index <= activeTo){
170                $(this).addClass("active");
171            }
172            if(index === (activeTo + 1)){
173                $(".foto__item--last img").attr("src", $(this).find(".foto__item img").attr("src"));
174            }
175        });
176
177        if(current === max){
178            $(this).data("current", max);
179            $(this).hide();
180            $(".foto__item--last").hide();
181        }
182
183        aspect();
184    });
185
186    $(".foto__item--last").trigger("click");
187
188
189});

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.