Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
stimulus-photoswipe
Advanced tools
A Stimulus controller for PhotoSwipe.
npm i stimulus-photoswipe
yarn add stimulus-photoswipe
Add this in your JavaScript file:
// Installing Stimulus in Your Application
import { Application } from '@hotwired/stimulus'
const application = Application.start()
// Registering Controllers Manually
import { PhotoSwipeController } from 'stimulus-photoswipe'
application.register('lightbox', PhotoSwipeController)
And add this in your CSS file:
@import 'stimulus-photoswipe/dist/style.css';
<div data-controller="lightbox">
<a
href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/2/img-2500.jpg"
data-pswp-width="1669"
data-pswp-height="2500"
target="_blank"
>
<img
src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/2/img-200.jpg"
/>
</a>
</div>
data-[identifier]-pswp-options-value
<div
data-controller="lightbox"
data-lightbox-pswp-options-value='{"children":".lightbox-item","showHideAnimationType":"zoom"}'
>
<a
class="lightbox-item"
href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/7/img-2500.jpg"
data-pswp-width="1875"
data-pswp-height="2500"
data-cropped="true"
target="_blank"
>
<img
src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/7/img-200.jpg"
/>
Cropped
</a>
</div>
data-action="click->[identifier]#loadAndOpen"
<div
data-controller="lightbox"
data-lightbox-pswp-options-value='{"children":".lightbox-item"}'
>
<a
class="lightbox-item hidden"
href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/4/img-2500.jpg"
data-pswp-width="1875"
data-pswp-height="2500"
></a>
<a
class="btn"
data-action="click->lightbox#loadAndOpen"
data-pswp-slide-index="0"
>loadAndOpen</a
>
</div>
import { Controller } from '@hotwired/stimulus'
import { usePhotoSwipe } from 'stimulus-photoswipe'
class CustomPhotoSwipeController extends Controller {
connect() {
this.lightbox = usePhotoSwipe(this, {
// https://photoswipe.com/options/
photoswipe: {
showHideAnimationType: 'fade'
},
// https://photoswipe.com/events/
handlers: {
beforeOpen: [this.beforeOpenHandler]
},
// https://photoswipe.com/filters/
filters: {
numItems: [this.numItemsFilter]
}
}).lightbox
}
beforeOpenHandler() {
console.log('beforeOpen')
}
numItemsFilter(numItems, dataSource) {
console.log('numItems')
return numItems
}
}
FAQs
A Stimulus controller for PhotoSwipe.
We found that stimulus-photoswipe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.