Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
floatingpreviewimg
Advanced tools
Readme
Show a floating image for small image preview
Just load FloatingPreviewImg.js by script tag and the FloatingPreviewImg
is the class object.
npm i floatingpreviewimg
Then in your javascript code
import FloatingPreviewImg from 'floatingpreviewimg'
//all parameters are optional
new FloatingPreviewImg({
id:'12345', //id of the preview image
targetSize:500, //a size for preview to fit in
maxSize:500, //images larger than this size will be ignored
minScale:1, //when targetSize divides source image's size is lower than this value, will use this scale
marign:20, //margin of the floating image to the viewport
/**
*Function for providing image info,
*if a function set, the preview image will get image info from this function instead of the source image
*this function should return an object of {width,height,src,highResSrc},props that are not defined here will filled by defaults
* @param {HTMLImageElement} sourceImg
* @returns {{width,height,src,highResSrc}}
*/
sourceInfoFunc(ele){
return {
width:ele.width,
height:ele.height,
src:ele.src,
highResSrc:highResolutionImageUSrc||undefined,
};
},
/**
*The function for resolving an image for showing preview, if returns falsy, nothing will happen.
*This function is called when mousemove event emits, and the event target element will be passed in.
*The default behaviour is to check if the element is an image and has attribute "showPreview".
*
* @param {HTMLElement} el the event target element from mousemove event
* @returns {HTMLElement|undefined} return the image element for showing preview
*/
shouldShow(target){
let target=e.target;
if(target.localName==='img'
&& target.hasAttribute('showPreview')){
return el;
}
return;
},
});
FAQs
show a floating image for small image preview
The npm package floatingpreviewimg receives a total of 0 weekly downloads. As such, floatingpreviewimg popularity was classified as not popular.
We found that floatingpreviewimg demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.