PageSourceSearch

https://www.yuikobayashi-yousti.jp/assets/js/util.js

js yuikobayashi-yousti.jp collected 2026-10-05 18:06:25 UTC 4,757 bytes, 137 lines download raw bytes

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

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.