PageSourceSearch

https://www.jejupass.com/assets/navigation.7963c72b.js

js jejupass.com collected 2026-09-24 10:54:54 UTC 5,836 bytes, 195 lines download raw bytes

1import { d as createElementIfNotDefined } from "./swiper-slide.e1f071d5.js";
2function Navigation({
3  swiper,
4  extendParams,
5  on,
6  emit
7}) {
8  extendParams({
9    navigation: {
10      nextEl: null,
11      prevEl: null,
12      hideOnClick: false,
13      disabledClass: "swiper-button-disabled",
14      hiddenClass: "swiper-button-hidden",
15      lockClass: "swiper-button-lock",
16      navigationDisabledClass: "swiper-navigation-disabled"
17    }
18  });
19  swiper.navigation = {
20    nextEl: null,
21    prevEl: null
22  };
23  const makeElementsArray = (el) => {
24    if (!Array.isArray(el))
25      el = [el].filter((e) => !!e);
26    return el;
27  };
28  function getEl(el) {
29    let res;
30    if (el && typeof el === "string" && swiper.isElement) {
31      res = swiper.el.shadowRoot.querySelector(el);
32      if (res)
33        return res;
34    }
35    if (el) {
36      if (typeof el === "string")
37        res = [...document.querySelectorAll(el)];
38      if (swiper.params.uniqueNavElements && typeof el === "string" && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
39        res = swiper.el.querySelector(el);
40      }
41    }
42    if (el && !res)
43      return el;
44    return res;
45  }
46  function toggleEl(el, disabled) {
47    const params = swiper.params.navigation;
48    el = makeElementsArray(el);
49    el.forEach((subEl) => {
50      if (subEl) {
51        subEl.classList[disabled ? "add" : "remove"](...params.disabledClass.split(" "));
52        if (subEl.tagName === "BUTTON")
53          subEl.disabled = disabled;
54        if (swiper.params.watchOverflow && swiper.enabled) {
55          subEl.classList[swiper.isLocked ? "add" : "remove"](params.lockClass);
56        }
57      }
58    });
59  }
60  function update() {
61    const {
62      nextEl,
63      prevEl
64    } = swiper.navigation;
65    if (swiper.params.loop) {
66      toggleEl(prevEl, false);
67      toggleEl(nextEl, false);
68      return;
69    }
70    toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
71    toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
72  }
73  function onPrevClick(e) {
74    e.preventDefault();
75    if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind)
76      return;
77    swiper.slidePrev();
78    emit("navigationPrev");
79  }
80  function onNextClick(e) {
81    e.preventDefault();
82    if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind)
83      return;
84    swiper.slideNext();
85    emit("navigationNext");
86  }
87  function init() {
88    const params = swiper.params.navigation;
89    swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
90      nextEl: "swiper-button-next",
91      prevEl: "swiper-button-prev"
92    });
93    if (!(params.nextEl || params.prevEl))
94      return;
95    let nextEl = getEl(params.nextEl);
96    let prevEl = getEl(params.prevEl);
97    Object.assign(swiper.navigation, {
98      nextEl,
99      prevEl
100    });
101    nextEl = makeElementsArray(nextEl);
102    prevEl = makeElementsArray(prevEl);
103    const initButton = (el, dir) => {
104      if (el) {
105        el.addEventListener("click", dir === "next" ? onNextClick : onPrevClick);
106      }
107      if (!swiper.enabled && el) {
108        el.classList.add(...params.lockClass.split(" "));
109      }
110    };
111    nextEl.forEach((el) => initButton(el, "next"));
112    prevEl.forEach((el) => initButton(el, "prev"));
113  }
114  function destroy() {
115    let {
116      nextEl,
117      prevEl
118    } = swiper.navigation;
119    nextEl = makeElementsArray(nextEl);
120    prevEl = makeElementsArray(prevEl);
121    const destroyButton = (el, dir) => {
122      el.removeEventListener("click", dir === "next" ? onNextClick : onPrevClick);
123      el.classList.remove(...swiper.params.navigation.disabledClass.split(" "));
124    };
125    nextEl.forEach((el) => destroyButton(el, "next"));
126    prevEl.forEach((el) => destroyButton(el, "prev"));
127  }
128  on("init", () => {
129    if (swiper.params.navigation.enabled === false) {
130      disable();
131    } else {
132      init();
133      update();
134    }
135  });
136  on("toEdge fromEdge lock unlock", () => {
137    update();
138  });
139  on("destroy", () => {
140    destroy();
141  });
142  on("enable disable", () => {
143    let {
144      nextEl,
145      prevEl
146    } = swiper.navigation;
147    nextEl = makeElementsArray(nextEl);
148    prevEl = makeElementsArray(prevEl);
149    [...nextEl, ...prevEl].filter((el) => !!el).forEach((el) => el.classList[swiper.enabled ? "remove" : "add"](swiper.params.navigation.lockClass));
150  });
151  on("click", (_s, e) => {
152    let {
153      nextEl,
154      prevEl
155    } = swiper.navigation;
156    nextEl = makeElementsArray(nextEl);
157    prevEl = makeElementsArray(prevEl);
158    const targetEl = e.target;
159    if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {
160      if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl)))
161        return;
162      let isHidden;
163      if (nextEl.length) {
164        isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
165      } else if (prevEl.length) {
166        isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
167      }
168      if (isHidden === true) {
169        emit("navigationShow");
170      } else {
171        emit("navigationHide");
172      }
173      [...nextEl, ...prevEl].filter((el) => !!el).forEach((el) => el.classList.toggle(swiper.params.navigation.hiddenClass));
174    }
175  });
176  const enable = () => {
177    swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(" "));
178    init();
179    update();
180  };
181  const disable = () => {
182    swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(" "));
183    destroy();
184  };
185  Object.assign(swiper.navigation, {
186    enable,
187    disable,
188    update,
189    init,
190    destroy
191  });
192}
193export {
194  Navigation as N
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.