
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
dragselect
Advanced tools
__ _____ __ __
____/ /________ _____ _/ ___/___ / /__ _____/ /_
/ __ / ___/ __ `/ __ `/\__ \/ _ \/ / _ \/ ___/ __/
/ /_/ / / / /_/ / /_/ /___/ / __/ / __/ /__/ /_
\__,_/_/ \__,_/\__, //____/\___/_/\___/\___/\__/
/____/
easily add a selection algorythm to your application/website.
https://thibaultjanbeyer.github.io/dragSelect/
Because aparently there is nothing that does not require jquery out there yet.
Just download the file (minified) and add it to your document:
npm install --save-dev npm-dragselect
bower install --save-dev dragselect
That's it, you're ready to rock! Of course you can also just include the function within your code to save a request.
Now in your JavaScript you can simply pass elements to the function like so:
The rectangle has to have a position: fixed
attribute. The other ones have purely visual reasons.
<div id="rectangle"
style="position: fixed;
background-color: blue;
border: 1px solid blue;
display:none;"></div>
dragSelect({
selectables: document.getElementsByClassName('selectable-node')
});
var ds = dragSelect({
selector: document.getElementById('rectangle'), // draggable element '#rectangle is default but can be set to anything'
selectables: [ document.getElementById('selectable1') ], // nodes that can be selected as array
onElementSelect: function(element) {}, // this is optional, it is fired every time an element is selected. (element) = just selected node
onElementUnselect: function(element) {}, // this is optional, it is fired every time an element is de-selected. (element) = just de-selected node.
callback: function(elements) {} // this is optional is fired once the user releases the mouse. (elements) = array of selected nodes.
});
// if you add the function to a variable like we did, you have access to all its functions
// and can now use start() and stop() like so:
ds.getSelection(); // returns all currently selected nodes
ds.stop(); // will teardown/stop the whole functionality
ds.start(); // reset the functionality after a teardown
property | type | usage |
---|---|---|
selector | single DOM element (node) | the square that will draw the selection. Default = #rectangle |
selectables | array of DOM elements (nodes) | the elements that can be selected |
onElementSelect | function | this is optional, it is fired every time an element is selected. This callback gets a property which is the just selected node |
onElementUnselect | function | this is optional, it is fired every time an element is de-selected. This callback gets a property which is the just de-selected node. |
callback | function | callback function that gets fired when the element is dropped. This callback gets a property which is an array that holds all selected nodes |
name | trigger |
---|---|
.ds-selected | on elements that are selected |
FAQs
Easy JavaScript library for selecting and moving elements. With no dependencies. Drag-Select & Drag-And-Drop.
We found that dragselect 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
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.