PageSourceSearch

https://rostec.ru/local/templates/rostec2/assets/js/libs/paralex/paralex.js?172048013610014

js rostec.ru collected 2026-10-01 08:27:40 UTC 10,014 bytes, 195 lines download raw bytes

1function paralexMobileCheck() {
2  var check = false;
3  (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
4  return check;
5}
6function paralexDeprecatedBrowser() {
7  if ((navigator.userAgent.toLowerCase().indexOf("msie") !== -1) || (navigator.userAgent.toLowerCase().indexOf("wow64") !== -1)) {
8    return true;
9  }
10  return false;
11}
12// paralex javascript
13// variables to hold each section's settings based on section style
14var paralexPercentDisplayHeight = [];
15var paralexBackgroundPercentAdjust = [];
16var paralexBackgroundSpeed = [];
17var paralexBackgroundWidth = [];
18var paralexBackgroundHeight = [];
19var paralexBackgroundProportion = [];
20var paralexBackgroundResized = [];
21var paralexIsMobile = paralexMobileCheck();
22var paralexDeprecated = paralexDeprecatedBrowser();
23var paralexResizeEvent = false;
24// paralexMove
25// calculates the background image height and top position based on section's styles
26function paralexMove(){
27  var $ = jQuery;
28  $(".paralex .foreground").each(function(i){
29    var top_of_element = $(this).offset().top;
30    var top_of_screen = $(window).scrollTop();
31    var height_of_viewport = paralexIsMobile ? screen.height : window.innerHeight;
32    var min_height_of_element = height_of_viewport * paralexPercentDisplayHeight[i];
33    $(this).css("min-height", min_height_of_element + "px");
34    $(this).parent(".paralex").css("min-height", min_height_of_element + "px");
35    var height_of_element = $(this).outerHeight();
36    var width_of_element = $(this).outerWidth();
37    var height_of_background = height_of_element * paralexBackgroundPercentAdjust[i];
38    var bottom_of_element = top_of_element + height_of_element;
39    var bottom_of_screen = top_of_screen + height_of_viewport;
40    var bg_size = "";
41    var fixed_background_height = 0;
42    var backgroundPercentTopAdjust = 0;
43    var backgroundMinHeight = 0;
44    var effect_scroll_distance = 0;
45    var onScreen = ((bottom_of_screen > top_of_element) && (top_of_screen < bottom_of_element));
46    var resetTriggered = paralexBackgroundResized.includes(-1);
47    if (onScreen || resetTriggered) {
48      var paralexFixed = false;
49      if( $(this).parent(".paralex").hasClass("reverse") ) {
50        if( $(this).parent(".paralex").hasClass("full") ) {
51          effect_scroll_distance = height_of_background;
52          backgroundMinHeight = height_of_element;
53        } else
54        {
55          effect_scroll_distance = height_of_viewport - height_of_element;
56          backgroundMinHeight = height_of_background;
57        }
58        backgroundPercentTopAdjust = ((top_of_screen - top_of_element) / effect_scroll_distance) * (height_of_background - height_of_element);
59        fixed_background_height = height_of_background;
60      } else
61      if( $(this).parent(".paralex").hasClass("fixed") ) {
62        backgroundPercentTopAdjust = top_of_screen - top_of_element;
63        backgroundMinHeight = height_of_viewport;
64        fixed_background_height = height_of_viewport;
65        paralexFixed = true;
66      } else
67      {
68        backgroundPercentTopAdjust = -1 * (height_of_element) * (paralexPercentDisplayHeight[i] * (bottom_of_screen - top_of_element) / ((bottom_of_screen - top_of_element) + (bottom_of_element - top_of_screen)) * paralexBackgroun
68dSpeed[i]);
69        backgroundMinHeight = height_of_background;
70        fixed_background_height = height_of_background;
71      }
72      if( !paralexBackgroundResized.includes(i) || resetTriggered ) {
73        if( paralexBackgroundProportion[i] > (width_of_element / fixed_background_height)) {
74          bg_size = "auto " + fixed_background_height + "px";
75        } else {
76          bg_size = width_of_element + "px auto";
77        }
78        $(this).siblings(".background")
79          .css("min-height", backgroundMinHeight + "px")
80          .css("background-size", bg_size);
81        paralexBackgroundResized.push(i);
82      }
83      if( !paralexFixed && onScreen) {
84        $(this).siblings(".background").css("top", backgroundPercentTopAdjust + "px");
85      }
86    } else {
87      if( paralexBackgroundResized.includes(i) ) {
88        paralexBackgroundResized.splice(paralexBackgroundResized.indexOf(i), 1);
89      }
90    }
91  });
92  if( paralexBackgroundResized.includes(-1) ) {
93    paralexBackgroundResized.splice(paralexBackgroundResized.indexOf(-1), 1);
94  }
95}
96
97// paralexHeight
98// sets paralex variables for each background image
99function paralexHeight() {
100  var urlRegex = /url\(['"]*(.*?)['"]*\)/g;
101  jQuery(".paralex .foreground").each(function(i) {
102    if (jQuery(this).parent(".paralex").hasClass("full")) {
103      paralexPercentDisplayHeight[i] = 1;
104      if (jQuery(this).parent(".paralex").hasClass("slow")) {
105        paralexBackgroundSpeed[i] = 0.2;
106        paralexBackgroundPercentAdjust[i] = 1.2;
107      } else
108      if (jQuery(this).parent(".paralex").hasClass("fast")) {
109        paralexBackgroundSpeed[i] = 0.5;
110        paralexBackgroundPercentAdjust[i] = 1.5;
111      } else { // default medium speed
112        paralexBackgroundSpeed[i] = 0.3;
113        paralexBackgroundPercentAdjust[i] = 1.3;
114      }
115      jQuery(this).siblings(".background").css("background-size", "auto 100%");
116    } else
117    if (jQuery(this).parent(".paralex").hasClass("half")) {
118      paralexPercentDisplayHeight[i] = 0.5;
119      if (jQuery(this).parent(".paralex").hasClass("slow")) {
120        paralexBackgroundSpeed[i] = 0.5;
121        paralexBackgroundPercentAdjust[i] = 1.25;
122      } else
123      if (jQuery(this).parent(".paralex").hasClass("fast")) {
124        paralexBackgroundSpeed[i] = 1;
125        paralexBackgroundPercentAdjust[i] = 1.5;
126      } else { // default medium speed
127        paralexBackgroundSpeed[i] = 0.7;
128        paralexBackgroundPercentAdjust[i] = 1.35;
129      }
130    } else {  // default: 1/3 screen size
131      paralexPercentDisplayHeight[i] = 0.3;
132      if (jQuery(this).parent(".paralex").hasClass("slow")) {
133        paralexBackgroundSpeed[i] = 0.6;
134        paralexBackgroundPercentAdjust[i] = 1.2;
135      } else
136      if (jQuery(this).parent(".paralex").hasClass("fast")) {
137        paralexBackgroundSpeed[i] = 2;
138        paralexBackgroundPercentAdjust[i] = 1.6;
139      } else { // default medium speed
140        paralexBackgroundSpeed[i] = 1;
141        paralexBackgroundPercentAdjust[i] = 1.3;
142      }
143    }
144    if( jQuery(this).parent(".paralex").hasClass("fixed") && paralexDeprecated) {
145      jQuery(this).parent(".paralex").removeClass("fixed");
146    }
147    // This will resize an image onload to avoid jumps and tiling.
148    var backgroundObject = jQuery(this).siblings(".background");
149    var img = new Image();
150    img.src = backgroundObject.css("background-image").replace(urlRegex, "$1");
151    var backgroundImage = backgroundObject.css("background-image");
152    var backgroundOpacity = backgroundObject.css("opacity");
153    backgroundObject.css("background-color", "transparent").css("background-image", "linear-gradient(145deg, #0098db, #0098db, #0098db, #0098db, #0098db, #ffa02f, #fcd900, #00c7b2, #007b69)").css("opacity", "0.3");
154    img.onload  = function () {
155      backgroundObject.css("background-image", backgroundImage).css("opacity", backgroundOpacity).fadeIn();
156      paralexBackgroundWidth[i] = this.width;
157      paralexBackgroundHeight[i] = this.height;
158      paralexBackgroundProportion[i] = this.width / this.height;
159      paralexBackgroundResized = [];
160      paralexMove();
161      img = null;
162    };
163  });
164}
165
166paralexHeight();
167paralexMove();
168
169function paralexReset() {
170  paralexBackgroundResized = [];
171  paralexMove();
172}
173jQuery(window).scroll(function() {
174  paralexMove();
175});
176jQuery(window).resize(function() {
177  if( !paralexIsMobile ) {
178    paralexReset();
179  } else {
180    paralexMove();
181  }
182  paralexResizeEvent = true;
183});
184jQuery(window).on( "orientationchange", function () {
185  paralexReset();
186  paralexResizeEvent = true;
187});
188// resizes all background images away from the scroll and resize events to increase performance.
189jQuery(window).on( "mouseover" , function () {
190  if(paralexResizeEvent) {
191    paralexResizeEvent = false;
192    paralexBackgroundResized = [-1];
193    paralexMove();
194  }
195});

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.