Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mossa

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mossa - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "mossa",
"version": "1.0.0",
"version": "1.0.1",
"author": "Evandro Eisinger <evandroeisinger@gmail.com>",

@@ -5,0 +5,0 @@ "repository": {

@@ -23,3 +23,10 @@ ## mossa.js [![npm version](https://badge.fury.io/js/mossa.svg)](http://badge.fury.io/js/mossa)

```javascript
new Mossa(document.getElementsByTagName('figure')[0]);
new Mossa(document.getElementsByTagName('figure')[0], {
onStartMoving: function(element, thumbnail) {
console.log('onStartMoving: ', element, thumbnail);
},
onDrop: function(element) {
console.log('onDrop: ', element);
}
});
```

@@ -29,6 +36,9 @@ ---

```javascript
new Mossa(DOMElement);
new Mossa(DOMElement, options);
```
###### parameters
- **DOMElement**: the element that will be used for Mossa.js instantiation.
- **DOMElement**: the element that will be used for Mossa.js instantiation
- **options**
- *onStartMoving(element, thumbnail)*: callback called when the element start moving
- *onDrop(element)*: callback called when the element has been dropped

@@ -35,0 +45,0 @@ ---

@@ -13,3 +13,3 @@ (function (global, Mossa) {

function Mossa(element) {
function Mossa(element, options) {
var self = this;

@@ -21,2 +21,3 @@

element.draggable = false;
self.options = options || {};
self.element = element;

@@ -30,4 +31,5 @@ self.dropArea = self.createDropArea();

e.preventDefault();
var parent = self.element.parentElement,
child;
parent = self.element.parentElement;
self.thumbnail = self.createThumbnail(self.element, e);

@@ -41,4 +43,5 @@ self.elementSiblings = element.parentElement.children;

for (var i = self.elementSiblings.length - 1; i >= 0; i--) {
self.elementSiblings[i].addEventListener('mouseover', self.addDropArea);
self.elementSiblings[i].addEventListener('mouseup', self.drop);
child = self.elementSiblings[i];
child.addEventListener('mouseover', self.addDropArea);
child.addEventListener('mouseup', self.drop);
}

@@ -48,2 +51,5 @@

document.addEventListener('mousemove', self.move);
if (self.options.onStartMoving)
self.options.onStartMoving(self.element, self.thumbnail);
}

@@ -61,2 +67,4 @@

self.insertElement(self.element, self.dropArea);
if (self.options.onDrop)
self.options.onDrop(self.element);
}

@@ -63,0 +71,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc