1'use strict'; 2/*----------------------------------------------- 3| Utilities 4-----------------------------------------------*/ 5 6var Utils = { 7 $window: $(window), 8 $document: $(document), 9 $html: $('html'), 10 $body: $('body'), 11 $main: $('main'), 12 isRTL: function isRTL() { 13 return this.$html.attr('dir') === 'rtl'; 14 }, 15 location: window.location, 16 nua: navigator.userAgent, 17 breakpoints: { 18 xs: 0, 19 sm: 576, 20 md: 768, 21 lg: 992, 22 xl: 1200 23 }, 24 offset: function offset(element) { 25 var rect = element.getBoundingClientRect(); 26 var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft; 27 var scrollTop = window.pageYOffset || document.documentElement.scrollTop; 28 return { 29 top: rect.top + scrollTop, 30 left: rect.left + scrollLeft 31 }; 32 }, 33 isScrolledIntoViewJS: function isScrolledIntoViewJS(element) { 34 var windowHeight = window.innerHeight; 35 var elemTop = this.offset(element).top; 36 var elemHeight = element.offsetHeight; 37 var windowScrollTop = window.scrollY; 38 return elemTop <= windowScrollTop + windowHeight && windowScrollTop <= elemTop + elemHeight; 39 }, 40 isScrolledIntoView: function isScrolledIntoView(el) { 41 var $el = $(el); 42 var windowHeight = this.$window.height(); 43 var elemTop = $el.offset().top; 44 var elemHeight = $el.height(); 45 var windowScrollTop = this.$window.scrollTop(); 46 return elemTop <= windowScrollTop + windowHeight && windowScrollTop <= elemTop + elemHeight; 47 }, 48 getCurrentScreanBreakpoint: function getCurrentScreanBreakpoint() { 49 var _this = this; 50 51 var currentScrean = ''; 52 var windowWidth = this.$window.width(); 53 $.each(this.breakpoints, function (index, value) { 54 if (windowWidth >= value) { 55 currentScrean = index; 56 } else if (windowWidth >= _this.breakpoints.xl) { 57 currentScrean = 'xl'; 58 } 59 }); 60 return { 61 currentScrean: currentScrean, 62 currentBreakpoint: this.breakpoints[currentScrean] 63 }; 64 } 65};
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.