New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pluginjs/lightbox

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pluginjs/lightbox - npm Package Compare versions

Comparing version 0.2.10 to 0.2.12

12

package.json

@@ -5,9 +5,9 @@ {

"dependencies": {
"@pluginjs/component": "^0.2.14",
"@pluginjs/dom": "^0.0.5",
"@pluginjs/pluginjs": "^0.2.15",
"@pluginjs/template": "^0.2.11",
"@pluginjs/video": "^0.2.10"
"@pluginjs/component": "^0.2.16",
"@pluginjs/dom": "^0.0.7",
"@pluginjs/pluginjs": "^0.2.19",
"@pluginjs/template": "^0.2.13",
"@pluginjs/video": "^0.2.12"
},
"version": "0.2.10",
"version": "0.2.12",
"description": "A flexible modern lightbox js plugin.",

@@ -14,0 +14,0 @@ "author": "Creation Studio Limited",

@@ -9,3 +9,3 @@ import templateEngine from '@pluginjs/template'

class Arrow {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -19,3 +19,3 @@ this.options = instance.options

init () {
init() {
this.arrowRight = parseHTML(

@@ -40,3 +40,3 @@ templateEngine.render(this.options.templates.arrow.call(this), {

bind () {
bind() {
bindEvent(

@@ -63,3 +63,3 @@ {

in () {
in() {
this.reflow()

@@ -70,3 +70,3 @@ addClass(this.classes.SLIDERIGHT, this.arrowRight)

reflow () {
reflow() {
const reflow = this.arrowRight.offsetHeight

@@ -76,3 +76,3 @@ return this.arrowLeft.offsetHeight

out () {
out() {
removeClass(this.classes.SLIDERIGHT, this.arrowRight)

@@ -79,0 +79,0 @@ removeClass(this.classes.SLIDELEFT, this.arrowLeft)

@@ -8,3 +8,3 @@ import { addClass, removeClass } from '@pluginjs/dom/classes'

class footer {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -16,3 +16,3 @@ this.options = instance.options

init () {
init() {
this.footer = this.instance.getElement('footer')

@@ -31,3 +31,3 @@ append(this.footer, this.instance.wrap)

goTo (index) {
goTo(index) {
// this.updateTitle()

@@ -37,3 +37,3 @@ this.thumbs.goTo(index)

in () {
in() {
// this.updateTitle()

@@ -46,7 +46,7 @@ this.reflow()

reflow () {
reflow() {
return this.footer.offsetHeight
}
out () {
out() {
removeClass(this.classes.SLIDEBOTTOM, this.footer)

@@ -53,0 +53,0 @@ }

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Thumbnails {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -17,3 +17,3 @@ this.options = instance.options

init () {
init() {
this.thumbs = this.instance.getElement('thumbnails')

@@ -39,3 +39,3 @@ this.inner = this.thumbs.children[0]

bind () {
bind() {
bindEvent(

@@ -59,7 +59,7 @@ {

resizeHandle () {
resizeHandle() {
this.straightGoTo(this.instance.activeIndex)
}
goTo (index) {
goTo(index) {
if (!hasClass(this.classes.THUMBSTRANSITION, this.inner)) {

@@ -73,3 +73,3 @@ addClass(this.classes.THUMBSTRANSITION, this.inner)

straightGoTo (index) {
straightGoTo(index) {
if (hasClass(this.classes.THUMBSTRANSITION, this.inner)) {

@@ -83,3 +83,3 @@ removeClass(this.classes.THUMBSTRANSITION, this.inner)

setTransform (index) {
setTransform(index) {
const halfPosition = this.getHalfPosition()

@@ -91,3 +91,3 @@ const baseSpace = 100 * (index - 1)

addActiveClass (index) {
addActiveClass(index) {
removeClass(this.classes.THUMBACTIVE, this.elements[this.index])

@@ -98,3 +98,3 @@ this.index = index

getHalfPosition () {
getHalfPosition() {
const p = Pj.windowWidth / 2 - 50

@@ -104,3 +104,3 @@ return Math.floor(p)

appendTo (element) {
appendTo(element) {
append(this.thumbs, element)

@@ -107,0 +107,0 @@ }

@@ -7,3 +7,3 @@ import { addClass, removeClass } from '@pluginjs/dom/classes'

class overlay {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -15,3 +15,3 @@ this.options = instance.options

init () {
init() {
this.overlay = this.instance.getElement('overlay')

@@ -24,3 +24,3 @@

setStyle () {
setStyle() {
setStyle(

@@ -41,3 +41,3 @@ {

bind () {
bind() {
bindEvent(

@@ -56,11 +56,11 @@ {

appendToBody () {
appendToBody() {
append(this.overlay, document.body)
}
hide () {
hide() {
this.overlay.style.display = 'none'
}
show () {
show() {
this.overlay.style.display = ''

@@ -71,3 +71,3 @@

fadeIn () {
fadeIn() {
this.reflow()

@@ -77,7 +77,7 @@ addClass(this.classes.READY, this.overlay)

reflow () {
reflow() {
return this.overlay.offsetHeight
}
fadeOut () {
fadeOut() {
removeClass(this.classes.READY, this.overlay)

@@ -84,0 +84,0 @@ }

@@ -11,3 +11,3 @@ import { addClass, removeClass } from '@pluginjs/dom/classes'

class ItemContainer {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -21,3 +21,3 @@ this.options = instance.options

init () {
init() {
this.item = this.instance.getElement('item')

@@ -81,7 +81,7 @@ this.inner = query(`.${this.classes.ITEMINNER}`, this.item)

appendTo (el) {
appendTo(el) {
append(this.item, el)
}
left (size) {
left(size) {
const left = size * Pj.windowWidth

@@ -91,3 +91,3 @@ setStyle({ left }, this.item)

getImage () {
getImage() {
if (['image'].includes(this.type)) {

@@ -98,3 +98,3 @@ return this[this.type].image

update (index) {
update(index) {
const type = this.items[index].type

@@ -131,3 +131,3 @@ if (this.index !== index) {

updateImage () {
updateImage() {
if (this.image === undefined) {

@@ -149,3 +149,3 @@ this.image = new Image(this.instance)

updateVideo () {
updateVideo() {
if (this.video === undefined) {

@@ -167,3 +167,3 @@ this.video = new Video(this.instance)

updateMap () {
updateMap() {
if (this.map === undefined) {

@@ -181,3 +181,3 @@ this.map = new Map(this.instance)

updateIframe () {
updateIframe() {
if (this.iframe === undefined) {

@@ -195,3 +195,3 @@ this.iframe = new Iframe(this.instance)

updateInline () {
updateInline() {
if (this.inline === undefined) {

@@ -198,0 +198,0 @@ this.inline = new Inline(this.instance)

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Ajax extends Base {
constructor (instance) {
constructor(instance) {
super(instance)

@@ -15,7 +15,7 @@

init () {
init() {
this.ajax = this.instance.getElement('ajax')
}
update (index) {
update(index) {
const data = this.items[index]

@@ -52,3 +52,3 @@

updateStatus (status) {
updateStatus(status) {
if (status === 'error') {

@@ -70,3 +70,3 @@ removeClass(this.classes.LOADED, this.content)

appendTo (el) {
appendTo(el) {
append(this.ajax, el)

@@ -76,3 +76,3 @@ this.loader = query(`.${this.classes.LOADER}`, el)

remove () {
remove() {
addClass(this.classes.HIDE, this.content)

@@ -79,0 +79,0 @@ this.ajax.remove()

@@ -7,3 +7,3 @@ import { addClass, removeClass } from '@pluginjs/dom/classes'

class Base {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -31,3 +31,3 @@ this.options = instance.options

setTitle (title) {
setTitle(title) {
if (this.options.title) {

@@ -38,3 +38,3 @@ this.title.innerHTML = title

appendTo (el) {
appendTo(el) {
append(this.content, el)

@@ -45,3 +45,3 @@ this.inner = el

remove () {
remove() {
this.content.remove()

@@ -48,0 +48,0 @@ }

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Iframe extends Base {
constructor (instance) {
constructor(instance) {
super(instance)

@@ -15,3 +15,3 @@

init () {
init() {
this.iframe = this.instance.getElement('iframe')

@@ -30,3 +30,3 @@

bind () {
bind() {
bindEvent(

@@ -42,3 +42,3 @@ {

addScr (index) {
addScr(index) {
const data = this.items[index]

@@ -52,3 +52,3 @@

updateStatus (status) {
updateStatus(status) {
if (status === 'error') {

@@ -70,3 +70,3 @@ removeClass(this.classes.LOADED, this.content)

appendTo (el) {
appendTo(el) {
super.appendTo(el)

@@ -78,3 +78,3 @@ setTimeout(() => {

remove () {
remove() {
this.iframe.src = '//about:blank'

@@ -86,3 +86,3 @@ this.append = false

resetSrc () {
resetSrc() {
this.iframe.src = '//about:blank'

@@ -89,0 +89,0 @@ }

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Image extends Base {
constructor (instance) {
constructor(instance) {
super(instance)

@@ -15,3 +15,3 @@

init () {
init() {
this.image = this.instance.getElement('image')

@@ -24,3 +24,3 @@

update (index) {
update(index) {
const itemData = this.items[index]

@@ -56,3 +56,3 @@

loadImage (index, loadCallback, errorCallback) {
loadImage(index, loadCallback, errorCallback) {
const itemData = this.items[index]

@@ -91,3 +91,3 @@ if (itemData.loaded || itemData.loadError) {

updateStatus (status) {
updateStatus(status) {
if (status === 'error') {

@@ -94,0 +94,0 @@ this.content.removeClass(this.classes.LOADED, this.content)

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Inline extends Base {
constructor (instance) {
constructor(instance) {
super(instance)

@@ -15,3 +15,3 @@

init () {
init() {
this.inline = this.instance.getElement('inline')

@@ -21,3 +21,3 @@ prepend(this.inline, this.content)

update (index) {
update(index) {
const data = this.items[index]

@@ -51,3 +51,3 @@ this.inline.innerHTML = ''

updateStatus (status) {
updateStatus(status) {
if (status === 'error') {

@@ -64,3 +64,3 @@ removeClass(this.classes.LOADED, this.content)

remove () {
remove() {
addClass(this.classes.HIDE, this.htmlPop)

@@ -67,0 +67,0 @@ super.remove()

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Map extends Base {
constructor (instance) {
constructor(instance) {
super(instance)

@@ -15,3 +15,3 @@

init () {
init() {
this.map = this.instance.getElement('map')

@@ -29,3 +29,3 @@ prepend(this.map, this.content)

bind () {
bind() {
bindEvent(

@@ -41,3 +41,3 @@ {

unbind () {
unbind() {
removeEvent('load', this.map)

@@ -47,3 +47,3 @@ // this.map.off('load', this.loadHandler)

addScr (index) {
addScr(index) {
const data = this.items[index]

@@ -59,3 +59,3 @@

updateStatus (status) {
updateStatus(status) {
if (status === 'error') {

@@ -77,3 +77,3 @@ removeClass(this.classes.LOADED, this.content)

appendTo (el) {
appendTo(el) {
super.appendTo(el)

@@ -85,7 +85,7 @@ setTimeout(() => {

resetSrc () {
resetSrc() {
this.map.src = '//about:blank'
}
remove () {
remove() {
this.map.src = '//about:blank'

@@ -92,0 +92,0 @@ this.append = false

@@ -8,3 +8,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Video extends Base {
constructor (instance) {
constructor(instance) {
super(instance)

@@ -15,3 +15,3 @@

init () {
init() {
this.videoContainer = this.instance.getElement('video')

@@ -23,3 +23,3 @@ prepend(this.videoContainer, this.content)

bind () {
bind() {
bindEvent(

@@ -47,3 +47,3 @@ {

createVideo () {
createVideo() {
this.instance.video = Pj.video(this.videoContainer, {

@@ -68,3 +68,3 @@ type: this.sourse,

update (index) {
update(index) {
const data = this.items[index]

@@ -102,3 +102,3 @@ this.href = data.href

loadImage (index, loadCallback, errorCallback) {
loadImage(index, loadCallback, errorCallback) {
const data = this.items[index]

@@ -136,3 +136,3 @@

updateBg () {
updateBg() {
setStyle(

@@ -148,3 +148,3 @@ {

updateStatus (status) {
updateStatus(status) {
if (status === 'error') {

@@ -151,0 +151,0 @@ removeClass(this.classes.LOADED, this.content)

@@ -17,3 +17,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class Slide {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -26,3 +26,3 @@ this.options = instance.options

init () {
init() {
this.slide = this.instance.getElement('slide')

@@ -38,3 +38,3 @@ this.translate = 0

createItem () {
createItem() {
this.plugins = []

@@ -52,3 +52,3 @@

resetPosition () {
resetPosition() {
this.translate = 0

@@ -62,3 +62,3 @@ setStyle({ transform: 'translate3d(0px, 0px, 0px)' }, this.slide)

updateItem () {
updateItem() {
this.updateCurrPlugin()

@@ -69,3 +69,3 @@ this.updateLeftPlugin()

updateCurrPlugin () {
updateCurrPlugin() {
this.plugins[this.activePlugin].update(this.instance.activeIndex)

@@ -75,3 +75,3 @@ this.plugins[this.activePlugin].left(this.translate)

updateLeftPlugin () {
updateLeftPlugin() {
const left = this.loop(0, 2, this.activePlugin - 1)

@@ -87,3 +87,3 @@ const index = this.loop(

updateRightPlugin () {
updateRightPlugin() {
const right = this.loop(0, 2, this.activePlugin + 1)

@@ -99,3 +99,3 @@ const index = this.loop(

loop (min, max, value) {
loop(min, max, value) {
if (value > max) {

@@ -109,3 +109,3 @@ return min

next () {
next() {
this.translate++

@@ -124,3 +124,3 @@ this.activePlugin = this.loop(0, 2, this.activePlugin + 1)

pre () {
pre() {
this.translate--

@@ -139,3 +139,3 @@ this.activePlugin = this.loop(0, 2, this.activePlugin - 1)

changeSlidePosition (size, callback) {
changeSlidePosition(size, callback) {
this.instance.leave('enable')

@@ -153,3 +153,3 @@ setTimeout(() => {

closeVideo () {
closeVideo() {
if (this.instance.video) {

@@ -161,3 +161,3 @@ this.instance.video('destroy')

bind () {
bind() {
bindEvent(

@@ -236,3 +236,3 @@ {

resizeHandle () {
resizeHandle() {
this.plugins[this.activePlugin].left(this.translate)

@@ -251,7 +251,7 @@ const left = this.loop(0, 2, this.activePlugin - 1)

getCurrentImage () {
getCurrentImage() {
return this.plugins[this.activePlugin].getImage()
}
hide () {
hide() {
this.slide.style.display = 'none'

@@ -264,3 +264,3 @@ this.closeVideo()

show () {
show() {
this.resetPosition()

@@ -273,3 +273,3 @@ this.updateItem()

fadeIn () {
fadeIn() {
this.reflow()

@@ -279,7 +279,7 @@ addClass(this.classes.READY, this.slide)

reflow () {
reflow() {
return this.slide.offsetHeight
}
fadeOut () {
fadeOut() {
removeClass(this.classes.READY, this.slide)

@@ -286,0 +286,0 @@ }

@@ -13,3 +13,3 @@ import { addClass, removeClass, hasClass } from '@pluginjs/dom/classes'

class TopBar {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -21,3 +21,3 @@ this.options = instance.options

init () {
init() {
this.topBar = this.instance.getElement('topBar')

@@ -30,18 +30,18 @@ append(this.topBar, this.instance.wrap)

this.actions = {
close () {
close() {
this.instance.close()
},
play () {
play() {
// this.play()
console.log('play')
},
download () {
download() {
// this.download()
console.log('download')
},
fullScreen () {
fullScreen() {
// this.fullScreen()
console.log('fullScreen')
},
share () {
share() {
// this.share()

@@ -53,3 +53,3 @@ console.log('share')

updateCount () {
updateCount() {
const length = this.instance.length

@@ -61,3 +61,3 @@ const count = this.instance.activeIndex

bind () {
bind() {
bindEvent(

@@ -79,3 +79,3 @@ {

in () {
in() {
addClass(this.classes.SLIDETOP, this.topBar)

@@ -85,3 +85,3 @@ this.updateCount()

out () {
out() {
removeClass(this.classes.SLIDETOP, this.topBar)

@@ -88,0 +88,0 @@ }

@@ -86,16 +86,16 @@ export const namespace = 'lightbox'

templates: {
close () {
close() {
return '<button type="button" class="{classes.CLOSE}" aria-label="Close"></button>'
},
overlay () {
overlay() {
return '<div class="{classes.OVERLAY}"></div>'
},
wrap () {
wrap() {
return '<div class="{classes.WRAP}"></div>'
},
// // footer
footer () {
footer() {
return '<div class="{classes.FOOTER}"></div>'
},
thumbnails () {
thumbnails() {
return (

@@ -108,3 +108,3 @@ '<div class="{classes.THUMBNAILS}">' +

},
thumb () {
thumb() {
return (

@@ -118,6 +118,6 @@ '<div class="{classes.THUMB}">' +

// // slide
slide () {
slide() {
return '<div class="{classes.SLIDE}"></div>'
},
item () {
item() {
return (

@@ -131,28 +131,28 @@ '<div class="{classes.ITEM}">' +

},
title () {
title() {
return '<div class="{classes.TITLE}"></div>'
},
content () {
content() {
return '<div class="{classes.CONTENT} {classes.VERTICALCENTER}"></div>'
},
image () {
image() {
return '<img class="{classes.IMAGE} {classes.VERTICALCENTER}">'
},
video () {
video() {
return '<div class="{classes.VIDEO} {classes.VERTICALCENTER}">'
},
map () {
map() {
return '<iframe class="{classes.MAP} {classes.VERTICALCENTER}" src="//about:blank" frameborder="0" allowfullscreen></iframe>'
},
iframe () {
iframe() {
return '<iframe class="{classes.IFRAME} {classes.VERTICALCENTER}" src="//about:blank" frameborder="0" allowfullscreen></iframe>'
},
inline () {
inline() {
return '<div class="{classes.INLINE} {classes.VERTICALCENTER}">'
},
inline () {
inline() {
return '<div class="{classes.AJAX} {classes.VERTICALCENTER}">'
},
// arrow
arrow () {
arrow() {
return (

@@ -165,3 +165,3 @@ '<div title="{title}" class="{classes.ARROW} {classes.NAMESPACE}-arrow-{dir}">' +

// topBar
topBar () {
topBar() {
return (

@@ -168,0 +168,0 @@ '<div class="{classes.TOPBAR}">' +

@@ -49,3 +49,3 @@ import Component from '@pluginjs/component'

class Lightbox extends Component {
constructor (element, options = {}) {
constructor(element, options = {}) {
super(NAMESPACE, element)

@@ -62,3 +62,3 @@

initialize () {
initialize() {
const eventHandler = event => {

@@ -103,7 +103,7 @@ this.openClick(event)

bind () {}
bind() {}
unbind () {}
unbind() {}
openClick (event) {
openClick(event) {
if (event.type) {

@@ -134,3 +134,3 @@ event.preventDefault()

open () {
open() {
if (this.is('init')) {

@@ -165,3 +165,3 @@ this.show()

show () {
show() {
if (this.is('show')) {

@@ -188,3 +188,3 @@ return

close () {
close() {
if (!this.is('show')) {

@@ -214,3 +214,3 @@ return

next () {
next() {
if (!this.is('enable')) {

@@ -233,3 +233,3 @@ return

pre () {
pre() {
if (!this.is('enable')) {

@@ -252,3 +252,3 @@ return

goTo (index) {
goTo(index) {
if (index > this.activeIndex) {

@@ -279,3 +279,3 @@ if (!this.is('enable')) {

parseItems () {
parseItems() {
const items = {}

@@ -305,3 +305,3 @@ let count = 1

hideScrollbar () {
hideScrollbar() {
const windowStyles = {}

@@ -320,3 +320,3 @@

reserveScrollbar () {
reserveScrollbar() {
const windowStyles = {}

@@ -333,3 +333,3 @@ if (UTILS.hasScrollBar(Pj.windowHeight)) {

getElement (type) {
getElement(type) {
const template = this.options.templates[type]

@@ -345,3 +345,3 @@ let html = ''

enable () {
enable() {
if (this.is('disabled')) {

@@ -354,3 +354,3 @@ removeClass(this.classes.DISABLED, this.element)

disable () {
disable() {
if (!this.is('disabled')) {

@@ -364,3 +364,3 @@ addClass(this.classes.DISABLED, this.element)

destroy () {
destroy() {
if (this.is('initialized')) {

@@ -367,0 +367,0 @@ this.unbind()

import Pj from '@pluginjs/pluginjs'
const Utils = {
hasScrollBar (winHeight) {
hasScrollBar(winHeight) {
return document.body.scrollHeight > (winHeight || Pj.windowHeight)
},
getScrollbarSize () {
getScrollbarSize() {
let scrollbarSize = 0

@@ -9,0 +9,0 @@ if (scrollbarSize === undefined) {

@@ -8,3 +8,3 @@ import { transitionProperty } from '@pluginjs/feature'

class zoomEngine {
constructor (instance) {
constructor(instance) {
this.instance = instance

@@ -23,3 +23,3 @@ this.options = {

init () {
init() {
bindEvent(

@@ -47,3 +47,3 @@ {

loaded (event) {
loaded(event) {
const item = event.detail.data[0]

@@ -59,3 +59,3 @@ if (

zoomIn () {
zoomIn() {
this.currentItem = this.getItemToZoom()

@@ -92,3 +92,3 @@ if (!this.currentItem.loaded || this.currentItem.type !== 'image') {

zoomOut () {
zoomOut() {
this.currentItem = this.getItemToZoom()

@@ -128,3 +128,3 @@ if (!this.currentItem.loaded || this.currentItem.type !== 'image') {

getOffset (el) {
getOffset(el) {
const offsetValue = offset(el)

@@ -147,15 +147,15 @@ const paddingTop = parseInt(

showMainContent () {
showMainContent() {
this.instance.slide.fadeIn()
}
getItemToZoom () {
getItemToZoom() {
return this.instance.items[this.instance.activeIndex]
}
scrollTop () {
scrollTop() {
return window.pageYOffset || document.documentElement.scrollTop
}
getElToAnimate (image) {
getElToAnimate(image) {
const cssObj = {

@@ -180,3 +180,3 @@ position: 'fixed',

static init (instance) {
static init(instance) {
return new this(instance)

@@ -183,0 +183,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc