1'use strict'; 2const SCRIPT_UTILITY = { 3 $window: $(window), 4 $document: $(document), 5 $html: $('html'), 6 $body: $('body'), 7 8 vh: window.innerHeight, 9 svh: window.innerHeight, 10 lvh: window.outerHeight, 11 vw: window.innerWidth, 12 documentRoot: document.documentElement, 13 mq: { 14 hov: () => { 15 return matchMedia('(hover: hover) and (pointer: fine)').matches; 16 }, 17 land: () => { 18 return matchMedia('(orientation: landscape)').matches; 19 }, 20 pc: function () { 21 let breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 961; 22 return matchMedia('(min-width:'.concat(breakpoint, 'px)')).matches; 23 }, 24 }, 25 zeroPadding(num) { 26 let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; 27 return String(num).padStart(length, '0'); 28 }, 29 getParameterByName(name) { 30 let url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.search; 31 const searchParams = new URLSearchParams(url); 32 return searchParams.get(name); 33 }, 34 userAgent: { 35 setup() { 36 var _navigator; 37 const ua = (_navigator = navigator) === null || _navigator === void 0 || (_navigator = _navigator.userAgent) === null || _navigator === void 0 ? void 0 : _navigator.toLowerCase(); 38 if (ua.indexOf('iphone') > 0 || (ua.indexOf('android') > 0 && ua.indexOf('mobile') > 0)) { 39 this.ua = 'sp'; 40 if (ua.indexOf('iphone') > 0) { 41 this.os = 'iOS'; 42 } 43 if (ua.indexOf('android') > 0) { 44 this.os = 'android'; 45 } 46 } else if (ua.indexOf('ipad') > 0 || ua.indexOf('android') > 0) { 47 this.ua = 'sp'; 48 if (ua.indexOf('ipad') > 0) { 49 this.os = 'iOS'; 50 } 51 if (ua.indexOf('android') > 0) { 52 this.os = 'android'; 53 } 54 } else { 55 this.ua = 'pc'; 56 this.os = 'pc'; 57 } 58 if (ua.indexOf('windows nt') !== -1) { 59 this.os = 'win'; 60 } else if (this.ua === 'pc' && ua.indexOf('mac os x') !== -1) { 61 this.os = 'mac'; 62 } 63 64 if (ua.indexOf('msie') !== -1 || ua.indexOf('trident') !== -1) { 65 this.browser = 'ie'; 66 } else if (ua.indexOf('edge') !== -1) { 67 this.browser = 'html_edge'; 68 } else if (ua.indexOf('edg') !== -1) { 69 this.browser = 'edge'; 70 } else if (ua.indexOf('chrome') !== -1) { 71 this.browser = 'chrome'; 72 } else if (ua.indexOf('safari') !== -1) { 73 this.browser = 'safari'; 74 } else if (ua.indexOf('firefox') !== -1) { 75 this.browser = 'firefox'; 76 } else { 77 this.browser = 'other'; 78 } 79 80 SCRIPT_UTILITY.$html.attr('data-ua', this.ua); 81 SCRIPT_UTILITY.$html.attr('data-os', this.os); 82 SCRIPT_UTILITY.$html.attr('data-browser', this.browser); 83 }, 84 }, 85 setHeight() { 86 let forced = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 87 if (forced || SCRIPT_UTILITY.userAgent.ua === 'pc' || SCRIPT_UTILITY.vw !== window.innerWidth) { 88 SCRIPT_UTILITY.svh = window.innerHeight; 89 } 90 SCRIPT_UTILITY.vh = window.innerHeight; 91 SCRIPT_UTILITY.vw = window.innerWidth; 92 SCRIPT_UTILITY.lvh = window.outerHeight; 93 // SCRIPT_UTILITY.documentRoot.style.setProperty('--vw', `${SCRIPT_UTILITY.vw}px`); 94 SCRIPT_UTILITY.documentRoot.style.setProperty('--vh', ''.concat(SCRIPT_UTILITY.vh, 'px')); 95 SCRIPT_UTILITY.documentRoot.style.setProperty('--svh', ''.concat(SCRIPT_UTILITY.svh, 'px')); 96 // SCRIPT_UTILITY.documentRoot.style.setProperty('--lvh', `${SCRIPT_UTILITY.lvh}px`); 97 }, 98 delay: function () { 99 let time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; 100 return new Promise((resolve) => setTimeout(async () => resolve(), time)); 101 }, 102 init() { 103 this.userAgent.setup(); 104 this.setHeight(); 105 window.addEventListener('load', () => { 106 this.setHeight(); 107 }); 108 window.addEventListener('resize', () => { 109 this.setHeight(); 110 }); 111 window.addEventListener('orientationchange', () => { 112 this.setHeight(true); 113 }); 114 }, 115};
116SCRIPT_UTILITY.init();
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.