Comparing version 2.12.1 to 2.13.0
@@ -1,1 +0,1 @@ | ||
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.DragDrop=n()}}(function(){return function n(e,r,t){function o(u,a){if(!r[u]){if(!e[u]){var f="function"==typeof require&&require;if(!a&&f)return f(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[u]={exports:{}};e[u][0].call(l.exports,function(n){var r=e[u][1][n];return o(r?r:n)},l,l.exports,n,e,r,t)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<t.length;u++)o(t[u]);return o}({1:[function(n,e,r){e.exports=function(n,e){function r(n,t){return n.reduce(function(n,o){return Array.isArray(o)&&t<e?n.concat(r(o,t+1)):n.concat(o)},[])}return e="number"==typeof e?e:1/0,e?r(n,1):Array.isArray(n)?n.map(function(n){return n}):n}},{}],2:[function(n,e,r){function t(n){return c===setTimeout?setTimeout(n,0):c.call(null,n,0)}function o(n){l===clearTimeout?clearTimeout(n):l.call(null,n)}function i(){v&&d&&(v=!1,d.length?p=d.concat(p):g=-1,p.length&&u())}function u(){if(!v){var n=t(i);v=!0;for(var e=p.length;e;){for(d=p,p=[];++g<e;)d&&d[g].run();g=-1,e=p.length}d=null,v=!1,o(n)}}function a(n,e){this.fun=n,this.array=e}function f(){}var c,l,s=e.exports={};!function(){try{c=setTimeout}catch(n){c=function(){throw new Error("setTimeout is not defined")}}try{l=clearTimeout}catch(n){l=function(){throw new Error("clearTimeout is not defined")}}}();var d,p=[],v=!1,g=-1;s.nextTick=function(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];p.push(new a(n,e)),1!==p.length||v||t(u)},a.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=f,s.addListener=f,s.once=f,s.off=f,s.removeListener=f,s.removeAllListeners=f,s.emit=f,s.binding=function(n){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(n){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],3:[function(n,e,r){(function(n){e.exports=function(e,r){function t(e){function t(){r&&r(e,i),r=null}f?n.nextTick(t):t()}function o(n,e,r){i[n]=r,(0===--u||e)&&t(e)}var i,u,a,f=!0;Array.isArray(e)?(i=[],u=e.length):(a=Object.keys(e),i={},u=a.length),u?a?a.forEach(function(n){e[n](function(e,r){o(n,e,r)})}):e.forEach(function(n,e){n(function(n,r){o(e,n,r)})}):t(null),f=!1}}).call(this,n("_process"))},{_process:2}],"/":[function(n,e,r){function t(n,e){function r(r){if(r.stopPropagation(),r.preventDefault(),r.dataTransfer.items){var t=u(r.dataTransfer.items),o=t.filter(function(n){return"file"===n.kind}),i=t.filter(function(n){return"string"===n.kind});if(0===o.length&&!e.onDropText)return;if(0===i.length&&!e.onDrop)return;if(0===o.length&&0===i.length)return}return n.classList.add("drag"),clearTimeout(s),e.onDragOver&&e.onDragOver(r),r.dataTransfer.dropEffect="copy",!1}function t(n){return n.stopPropagation(),n.preventDefault(),e.onDragLeave&&e.onDragLeave(n),clearTimeout(s),s=setTimeout(l,50),!1}function c(n){n.stopPropagation(),n.preventDefault(),e.onDragLeave&&e.onDragLeave(n),clearTimeout(s),l();var r={x:n.clientX,y:n.clientY},t=n.dataTransfer.getData("text");if(t&&e.onDropText&&e.onDropText(t,r),n.dataTransfer.items){var o=u(n.dataTransfer.items).filter(function(n){return"file"===n.kind});if(0===o.length)return;f(o.map(function(n){return function(e){i(n.webkitGetAsEntry(),e)}}),function(n,t){if(n)throw n;e.onDrop&&e.onDrop(a(t),r)})}else{var c=u(n.dataTransfer.files);if(0===c.length)return;c.forEach(function(n){n.fullPath="/"+n.name}),e.onDrop&&e.onDrop(c,r)}return!1}function l(){n.classList.remove("drag")}"string"==typeof n&&(n=window.document.querySelector(n)),"function"==typeof e&&(e={onDrop:e});var s;return n.addEventListener("dragenter",o,!1),n.addEventListener("dragover",r,!1),n.addEventListener("dragleave",t,!1),n.addEventListener("drop",c,!1),function(){l(),n.removeEventListener("dragenter",o,!1),n.removeEventListener("dragover",r,!1),n.removeEventListener("dragleave",t,!1),n.removeEventListener("drop",c,!1)}}function o(n){return n.stopPropagation(),n.preventDefault(),!1}function i(n,e){function r(){a.readEntries(function(n){n.length>0?(o=o.concat(u(n)),r()):t()})}function t(){f(o.map(function(n){return function(e){i(n,e)}}),e)}var o=[];if(n.isFile)n.file(function(r){r.fullPath=n.fullPath,e(null,r)},function(n){e(n)});else if(n.isDirectory){var a=n.createReader();r()}}function u(n){return Array.prototype.slice.call(n||[],0)}e.exports=t;var a=n("flatten"),f=n("run-parallel")},{flatten:1,"run-parallel":3}]},{},[])("/")}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.DragDrop=e()}}(function(){return function e(n,t,r){function o(u,a){if(!t[u]){if(!n[u]){var f="function"==typeof require&&require;if(!a&&f)return f(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var l=t[u]={exports:{}};n[u][0].call(l.exports,function(e){var t=n[u][1][e];return o(t?t:e)},l,l.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,n,t){n.exports=function(e,n){function t(e,r){return e.reduce(function(e,o){return Array.isArray(o)&&r<n?e.concat(t(o,r+1)):e.concat(o)},[])}return n="number"==typeof n?n:1/0,n?t(e,1):Array.isArray(e)?e.map(function(e){return e}):e}},{}],2:[function(e,n,t){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(n){try{return s.call(null,e,0)}catch(n){return s.call(this,e,0)}}}function u(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(n){try{return p.call(null,e)}catch(n){return p.call(this,e)}}}function a(){g&&v&&(g=!1,v.length?h=v.concat(h):m=-1,h.length&&f())}function f(){if(!g){var e=i(a);g=!0;for(var n=h.length;n;){for(v=h,h=[];++m<n;)v&&v[m].run();m=-1,n=h.length}v=null,g=!1,u(e)}}function c(e,n){this.fun=e,this.array=n}function l(){}var s,p,d=n.exports={};!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(e){s=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(e){p=o}}();var v,h=[],g=!1,m=-1;d.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];h.push(new c(e,n)),1!==h.length||g||i(f)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],3:[function(e,n,t){(function(e){n.exports=function(n,t){function r(n){function r(){t&&t(n,i),t=null}f?e.nextTick(r):r()}function o(e,n,t){i[e]=t,(0===--u||n)&&r(n)}var i,u,a,f=!0;Array.isArray(n)?(i=[],u=n.length):(a=Object.keys(n),i={},u=a.length),u?a?a.forEach(function(e){n[e](function(n,t){o(e,n,t)})}):n.forEach(function(e,n){e(function(e,t){o(n,e,t)})}):r(null),f=!1}}).call(this,e("_process"))},{_process:2}],"/":[function(e,n,t){function r(e,n){function t(e){return n.onDragEnter&&n.onDragEnter(e),e.stopPropagation(),e.preventDefault(),!1}function r(t){if(t.stopPropagation(),t.preventDefault(),t.dataTransfer.items){var r=i(t.dataTransfer.items),o=r.filter(function(e){return"file"===e.kind}),u=r.filter(function(e){return"string"===e.kind});if(0===o.length&&!n.onDropText)return;if(0===u.length&&!n.onDrop)return;if(0===o.length&&0===u.length)return}return e.classList.add("drag"),clearTimeout(s),n.onDragOver&&n.onDragOver(t),t.dataTransfer.dropEffect="copy",!1}function f(e){return e.stopPropagation(),e.preventDefault(),n.onDragLeave&&n.onDragLeave(e),clearTimeout(s),s=setTimeout(l,50),!1}function c(e){e.stopPropagation(),e.preventDefault(),n.onDragLeave&&n.onDragLeave(e),clearTimeout(s),l();var t={x:e.clientX,y:e.clientY},r=e.dataTransfer.getData("text");if(r&&n.onDropText&&n.onDropText(r,t),e.dataTransfer.items){var f=i(e.dataTransfer.items).filter(function(e){return"file"===e.kind});if(0===f.length)return;a(f.map(function(e){return function(n){o(e.webkitGetAsEntry(),n)}}),function(e,r){if(e)throw e;n.onDrop&&n.onDrop(u(r),t)})}else{var c=i(e.dataTransfer.files);if(0===c.length)return;c.forEach(function(e){e.fullPath="/"+e.name}),n.onDrop&&n.onDrop(c,t)}return!1}function l(){e.classList.remove("drag")}"string"==typeof e&&(e=window.document.querySelector(e)),"function"==typeof n&&(n={onDrop:n});var s;return e.addEventListener("dragenter",t,!1),e.addEventListener("dragover",r,!1),e.addEventListener("dragleave",f,!1),e.addEventListener("drop",c,!1),function(){l(),e.removeEventListener("dragenter",t,!1),e.removeEventListener("dragover",r,!1),e.removeEventListener("dragleave",f,!1),e.removeEventListener("drop",c,!1)}}function o(e,n){function t(){f.readEntries(function(e){e.length>0?(u=u.concat(i(e)),t()):r()})}function r(){a(u.map(function(e){return function(n){o(e,n)}}),n)}var u=[];if(e.isFile)e.file(function(t){t.fullPath=e.fullPath,n(null,t)},function(e){n(e)});else if(e.isDirectory){var f=e.createReader();t()}}function i(e){return Array.prototype.slice.call(e||[],0)}n.exports=r;var u=e("flatten"),a=e("run-parallel")},{flatten:1,"run-parallel":3}]},{},[])("/")}); |
21
index.js
@@ -17,3 +17,3 @@ module.exports = dragDrop | ||
elem.addEventListener('dragenter', stopEvent, false) | ||
elem.addEventListener('dragenter', onDragEnter, false) | ||
elem.addEventListener('dragover', onDragOver, false) | ||
@@ -26,3 +26,3 @@ elem.addEventListener('dragleave', onDragLeave, false) | ||
removeDragClass() | ||
elem.removeEventListener('dragenter', stopEvent, false) | ||
elem.removeEventListener('dragenter', onDragEnter, false) | ||
elem.removeEventListener('dragover', onDragOver, false) | ||
@@ -33,2 +33,13 @@ elem.removeEventListener('dragleave', onDragLeave, false) | ||
function onDragEnter (e) { | ||
if (listeners.onDragEnter) { | ||
listeners.onDragEnter(e) | ||
} | ||
// Prevent event | ||
e.stopPropagation() | ||
e.preventDefault() | ||
return false | ||
} | ||
function onDragOver (e) { | ||
@@ -139,8 +150,2 @@ e.stopPropagation() | ||
function stopEvent (e) { | ||
e.stopPropagation() | ||
e.preventDefault() | ||
return false | ||
} | ||
function processEntry (entry, cb) { | ||
@@ -147,0 +152,0 @@ var entries = [] |
{ | ||
"name": "drag-drop", | ||
"description": "HTML5 drag & drop for humans", | ||
"version": "2.12.1", | ||
"version": "2.13.0", | ||
"author": "Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)", | ||
@@ -16,5 +16,5 @@ "bugs": { | ||
"browserify": "^13.0.0", | ||
"ecstatic": "^1.4.1", | ||
"ecstatic": "^2.1.0", | ||
"html-inline": "^1.2.0", | ||
"standard": "^7.0.0", | ||
"standard": "*", | ||
"tape": "^4.0.0", | ||
@@ -21,0 +21,0 @@ "uglify-js": "^2.4.15" |
@@ -121,3 +121,3 @@ # drag-drop [![travis](https://img.shields.io/travis/feross/drag-drop/master.svg)](https://travis-ci.org/feross/drag-drop) [![npm](https://img.shields.io/npm/v/drag-drop.svg)](https://npmjs.org/package/drag-drop) [![downloads](https://img.shields.io/npm/dm/drag-drop.svg)](https://npmjs.org/package/drag-drop) | ||
### detect `dragover` and `dragleave` events | ||
### detect `dragenter`, `dragover` and `dragleave` events | ||
@@ -135,2 +135,3 @@ Instead of passing just an `ondrop` function as the second argument, instead pass an | ||
}, | ||
onDragEnter: function () {}, | ||
onDragOver: function () {}, | ||
@@ -137,0 +138,0 @@ onDragLeave: function () {} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18831
202
167