Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ele.addEventListener('click', e => {
let href
const target =
attr('data-target', e.target) ||
query(
(href = attr('href', e.target)) && href.replace(/.*(?=#[^\s]+$)/, '')
)
const wizard = getData(NAMESPACE, target)
if (!wizard) {
return
}
const method = data(NAMESPACE, e.target)
if (/^(back|next|first|finish|reset)$/.test(method)) {
wizard[method]()
}
e.preventDefault()
})
})
setLoaderFromData() {
const loader = getData('loader', this.pane)
if (loader) {
if (isFunction(window[loader])) {
this.loader = window[loader]
}
} else {
const url = getData('loader-url', this.pane)
if (url) {
this.loader = {
url,
settings: data('settings', this.pane) || {}
}
}
}
}
index = this.current === 0 ? length - 1 : this.current - 1
pos = `${offset - 100}%`
this.cards[i].inactive()
break
default:
index = this.current
pos = `${offset}%`
this.cards[i].active()
break
}
const card = this.cards[i].element
const content = query(`.${this.classes.CONTENT}`, card)
if (content) {
const oldIndex = parseInt(data('index', content), 10)
if (index !== oldIndex) {
const module = this.modules[oldIndex]
if (module.type === 'video' && module.isload) {
this.modules[oldIndex].video.destroy()
}
this.cards[i].createModule(this.data[index], index)
this.cards[i].module.setData({ index }).replace(content)
}
} else {
this.cards[i].createModule(this.data[index], index)
this.cards[i].module.setData({ index }).appendTo(card)
}
setValidatorFromData() {
const validator = data('validator', this.pane)
if (validator && isFunction(window[validator])) {
this.validator = window[validator]
}
}
children(this.element).forEach(element => {
switch (element.tagName.toLowerCase()) {
case 'img':
dataArr.push({
type: 'image',
src: attr('src', element)
})
break
case 'video':
dataArr.push({
type: 'video',
videoType: data('videoType', element),
src: data('src', element),
href: attr('href', element),
id: data('id', element)
})
break
default:
if (data('type', element) === 'inline') {
dataArr.push({
type: 'inline',
html: element.innerHTML
})
} else {
dataArr.push({
type: data('type', element),
src: data('src', element)
})
}
}
})
query('.api', root).addEventListener('click', event => {
const el = event.target
if (!el.matches('[data-api]')) {
return
}
instance[data('api', el)]()
})
this.eventName('click'),
`.${this.classes.BUTTON}`,
({ target }) => {
this.do(
hasClass(this.classes.BUTTON, target)
? data('action', target)
: compose(
data('action'),
closest(`.${this.classes.BUTTON}`)
)(target)
)
return false
},
$tip
)
data({ buttonEventsBinded: true }, $tip)
}
event => {
if (
!event.target.classList.contains(this.classes.BUTTON) ||
!data('action', event.target)
) {
return false
}
const action = data('action', event.target)
for (let i = 0; i < this.options.buttons.length; i++) {
if (action === this.options.buttons[i].action) {
const button = this.options.buttons[i]
if (isFunction(button.fn)) {
button.fn(this.close.bind(this))
} else {
this.close()
}
}
}
return false
},
this.$buttons