
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
jquery-detect-environment
Advanced tools
A lightweight jQuery plugin that dynamically adds CSS classes to the html tag
A lightweight jQuery plugin that dynamically adds CSS classes to the <html>
tag based on the device type, operating system, screen size, orientation, browser, internet connection, time of day, color scheme preference, and pixel density. This helps create responsive and adaptive designs easily.
The plugin automatically detects and adds classes for:
device-mobile
or device-desktop
os-windows
, os-macos
, os-linux
, os-android
, os-ios
width-xs
, width-sm
, width-md
, width-lg
, width-xl
orientation-portrait
or orientation-landscape
browser-chrome
, browser-firefox
, browser-safari
, browser-edge
status-online
or status-offline
time-morning
, time-afternoon
, time-evening
, time-night
prefers-dark-mode
or prefers-light-mode
pixel-ratio-1x
, pixel-ratio-2x
, or pixel-ratio-3x
Include jQuery in your project (if not already included):
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
Include the plugin script (choose between the full or minified version):
<script src="path/to/jquery.detect-environment.js"></script>
<script src="path/to/jquery.detect-environment.min.js"></script>
The plugin initializes automatically when the document is ready and dynamically adds classes to the <html>
tag. It also listens for window resize, orientation change, and network connection events to update classes in real-time.
$(document).ready(function() {
$('html').detectEnvironment();
});
The classes added to <html>
will update automatically, so you can use them directly in your CSS for responsive and adaptive design.
With this plugin, the <html>
tag might look like:
<html class="device-desktop os-windows width-lg orientation-landscape browser-chrome status-online time-afternoon prefers-light-mode pixel-ratio-2x">...</html>
Here are some sample classes and what they represent:
The plugin listens for the following events to update classes dynamically:
This project is licensed under the MIT License.
This portion of the README.md
file provides examples and explanations of the classes generated by the plugin, describes the events it listens for, and includes a brief note on the license. It’s designed to help users understand how to work with the classes generated by the plugin for responsive design.
FAQs
A lightweight jQuery plugin that dynamically adds CSS classes to the html tag
We found that jquery-detect-environment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.