
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
A jQuery plugin to fit an object to its container according to a fit parameter that behaves similarly to the CSS background-size
keyword syntax.
npm install fitobject
For simple cover fitting of an object to a container:
<div class="container">
<img class="object" src="http://placehold.it/400x300" />
</div>
<script>
$('.object').fitObject();
</script>
You can size and position the object to be totally contained inside the container, as with the CSS property background-size: contain
:
$('.object').fitObject({
'fit': 'contain'
});
Specify a safeArea
parameter to define a region of the object to avoid cropping into when the object fit method is set to 'cover'
.
$('.object').fitObject({
'safeArea': {
'top': 25, // 25% of the vertical dimension from the top
'right': 0, // 0% of the horizontal dimension from the right
'bottom': 0, // 0% of the vertical dimension from the bottom
'left': 50 // 50% of the horizontal dimension from the left
}
});
By default, fitObject
will fit your object to its immediate parent, but can fit to ancestors further up the DOM tree by setting the container
parameter:
<div class="container-wrapper">
<div class="container">
<img class="object" src="http://placehold.it/400x300" />
</div>
</div>
<script>
$('.object').fitObject({
'container': '.container-wrapper'
});
</script>
Each of the fitObject
parameters can be set via HTML data attributes on the object to fit:
<div class="container">
<img class="object" src="http://placehold.it/400x300"
data-object-fit="cover"
data-fit-container=".container"
data-safe-area="{'top':0,'right':21.23,'bottom':0,'left':19.33}"
/>
</div>
<script>
$('.object').fitObject();
</script>
Object data attributes will supersede parameters passed into the fitObject
method.
Parameter | Data Attribute | Type | Default | Description |
---|---|---|---|---|
container | fit-container | String, DOM Node, jQuery DOM element | First parent not classed .fit-object-wrapper | The container to fit the object to |
fit | object-fit | String | 'cover' | The fit method – either 'cover' or 'contain' |
safeArea | safe-area | Object | { 'top': 0, 'right': 0, 'bottom': 0, 'left': 0 } | An area of the object to avoid cropping into. Specify a percentage of the X or Y dimension for each side. |
FAQs
A jQuery plugin to fit an object to its container.
The npm package fitobject receives a total of 0 weekly downloads. As such, fitobject popularity was classified as not popular.
We found that fitobject 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
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.