draggable-helper
Advanced tools
Comparing version 1.0.0 to 1.0.1
/*! | ||
* draggable-helper v1.0.0 | ||
* (c) 2017-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* draggable-helper v1.0.1 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* draggable-helper v1.0.0 | ||
* (c) 2017-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* draggable-helper v1.0.1 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
@@ -5,0 +5,0 @@ */ |
/*! | ||
* draggable-helper v1.0.0 | ||
* (c) 2017-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* draggable-helper v1.0.1 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
@@ -13,3 +13,3 @@ */ | ||
/*! | ||
* helper-js v1.0.45 | ||
* helper-js v1.0.46 | ||
* (c) 2017-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -117,2 +117,11 @@ * Released under the MIT License. | ||
} | ||
// resolve global | ||
var glb; | ||
try { | ||
glb = global; | ||
} catch (e) { | ||
glb = window; | ||
} // local store | ||
function getOffsetWithoutScroll(el) { | ||
@@ -287,4 +296,4 @@ var elOffset = { | ||
} | ||
var localStorage2 = makeStorageHelper(global.localStorage); | ||
var sessionStorage2 = makeStorageHelper(global.sessionStorage); // 事件处理 | ||
var localStorage2 = makeStorageHelper(glb.localStorage); | ||
var sessionStorage2 = makeStorageHelper(glb.sessionStorage); // 事件处理 | ||
@@ -442,3 +451,3 @@ var EventProcessor = | ||
global.localStorage.setItem(this.storageName, JSON.stringify({ | ||
glb.localStorage.setItem(this.storageName, JSON.stringify({ | ||
name: name, | ||
@@ -445,0 +454,0 @@ args: args, |
/*! | ||
* draggable-helper v1.0.0 | ||
* (c) 2017-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* draggable-helper v1.0.1 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.draggableHelper=t()}(this,function(){"use strict";function e(e){for(var t=function e(t){var n=t.offsetLeft,o=t.offsetTop,i={x:0,y:0};return null!=t.offsetParent&&(i=e(t.offsetParent)),{x:n+i.x,y:o+i.y}}(e),n=e,o=document.body;n&&n!==o;)t.x-=n.scrollLeft,t.y-=n.scrollTop,n=n.parentElement;return t}function t(e,t){e["original_".concat(t)]=e.getAttribute(t)}function n(e,t){var n="original_".concat(t);e.setAttribute(t,e[n])}function o(e,t){(function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)})(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}function i(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on".concat(t),n)}function s(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent&&e.detachEvent("on".concat(t),n)}function a(e){return{storage:e,set:function(e,t,n){null==t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify({value:t,expired_at:n&&(new Date).getTime()/1e3+60*n}))},get:function(e){var t=this.storage.getItem(e);if(t){if(!(t=JSON.parse(t)).expired_at||t.expired_at>(new Date).getTime())return t.value;this.storage.removeItem(e)}return null},clear:function(){this.storage.clear()}}}a(global.localStorage),a(global.sessionStorage);return function(a){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==r.minTranslate&&(r.minTranslate=10);var l={movedCount:0};function u(e){1===e.which&&(l.mouse={x:e.pageX,y:e.pageY},l.initialMouse=Object.assign({},l.mouse),i(document,"mousemove",f),i(window,"mouseup",d))}function c(n){var i=function(){var t=r.getEl?r.getEl(a,r):a,n=t;return r.clone&&(l.triggerEl=t,n=t.cloneNode(!0),t.parentElement.appendChild(n)),{offset:e(t),el:n}}(),s=i.el,u=i.offset;if(l.el=s,l.initialOffset=Object.assign({},u),!1===(r.drag&&r.drag(n,r,l)))return!1;var c=function(e){var t=e.style.display;e.style.display="block";var n={width:e.offsetWidth,height:e.offsetHeight};return e.style.display=t,n}(s),f=Object.assign({width:"".concat(c.width,"px"),height:"".concat(c.height,"px"),zIndex:9999,opacity:.6,position:"fixed",left:u.x+"px",top:u.y+"px"},r.style||r.getStyle&&r.getStyle(r)||{});for(var d in t(s,"style"),f)s.style[d]=f[d];t(s,"class"),o(s,"dragging");var g=document.body;t(g,"style");var m=g.getAttribute("style")||"";m&&";"!==m.substr(-1)&&(m+=";"),g.setAttribute("style",m+"-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;")}function f(e){l.mouse={x:e.pageX,y:e.pageY};var t=l.move={x:l.mouse.x-l.initialMouse.x,y:l.mouse.y-l.initialMouse.y};if(0===l.movedCount&&r.minTranslate){var n=Math.pow(l.move.x,2),o=Math.pow(l.move.y,2);if(Math.pow(n+o,.5)<r.minTranslate)return}var i=!0;if(0===l.movedCount&&!1===c(e)&&(i=!1),i&&r.moving&&!1===r.moving(e,r,l)&&(i=!1),i){if(!l||!l.el)return;Object.assign(l.el.style,{left:l.initialOffset.x+t.x+"px",top:l.initialOffset.y+t.y+"px"}),l.movedCount++}}function d(e){if(s(document,"mousemove",f),s(window,"mouseup",d),l.movedCount>0){l.movedCount=0;var t=l.el;r.clone?t.parentElement.removeChild(t):(n(t,"style"),n(t,"class")),n(document.body,"style"),r.drop&&r.drop(e,r,l)}l={movedCount:0}}a._draggbleEventHandler&&s(a,"mousedown",a._draggbleEventHandler),a._draggbleEventHandler=u,i(a,"mousedown",u)}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.draggableHelper=t()}(this,function(){"use strict";var e;try{e=global}catch(t){e=window}function t(e){for(var t=function e(t){var n=t.offsetLeft,o=t.offsetTop,i={x:0,y:0};return null!=t.offsetParent&&(i=e(t.offsetParent)),{x:n+i.x,y:o+i.y}}(e),n=e,o=document.body;n&&n!==o;)t.x-=n.scrollLeft,t.y-=n.scrollTop,n=n.parentElement;return t}function n(e,t){e["original_".concat(t)]=e.getAttribute(t)}function o(e,t){var n="original_".concat(t);e.setAttribute(t,e[n])}function i(e,t){(function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)})(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}function s(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on".concat(t),n)}function a(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent&&e.detachEvent("on".concat(t),n)}function r(e){return{storage:e,set:function(e,t,n){null==t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify({value:t,expired_at:n&&(new Date).getTime()/1e3+60*n}))},get:function(e){var t=this.storage.getItem(e);if(t){if(!(t=JSON.parse(t)).expired_at||t.expired_at>(new Date).getTime())return t.value;this.storage.removeItem(e)}return null},clear:function(){this.storage.clear()}}}r(e.localStorage),r(e.sessionStorage);return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==r.minTranslate&&(r.minTranslate=10);var l={movedCount:0};function u(e){1===e.which&&(l.mouse={x:e.pageX,y:e.pageY},l.initialMouse=Object.assign({},l.mouse),s(document,"mousemove",f),s(window,"mouseup",d))}function c(o){var s=function(){var n=r.getEl?r.getEl(e,r):e,o=n;return r.clone&&(l.triggerEl=n,o=n.cloneNode(!0),n.parentElement.appendChild(o)),{offset:t(n),el:o}}(),a=s.el,u=s.offset;if(l.el=a,l.initialOffset=Object.assign({},u),!1===(r.drag&&r.drag(o,r,l)))return!1;var c=function(e){var t=e.style.display;e.style.display="block";var n={width:e.offsetWidth,height:e.offsetHeight};return e.style.display=t,n}(a),f=Object.assign({width:"".concat(c.width,"px"),height:"".concat(c.height,"px"),zIndex:9999,opacity:.6,position:"fixed",left:u.x+"px",top:u.y+"px"},r.style||r.getStyle&&r.getStyle(r)||{});for(var d in n(a,"style"),f)a.style[d]=f[d];n(a,"class"),i(a,"dragging");var m=document.body;n(m,"style");var g=m.getAttribute("style")||"";g&&";"!==g.substr(-1)&&(g+=";"),m.setAttribute("style",g+"-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;")}function f(e){l.mouse={x:e.pageX,y:e.pageY};var t=l.move={x:l.mouse.x-l.initialMouse.x,y:l.mouse.y-l.initialMouse.y};if(0===l.movedCount&&r.minTranslate){var n=Math.pow(l.move.x,2),o=Math.pow(l.move.y,2);if(Math.pow(n+o,.5)<r.minTranslate)return}var i=!0;if(0===l.movedCount&&!1===c(e)&&(i=!1),i&&r.moving&&!1===r.moving(e,r,l)&&(i=!1),i){if(!l||!l.el)return;Object.assign(l.el.style,{left:l.initialOffset.x+t.x+"px",top:l.initialOffset.y+t.y+"px"}),l.movedCount++}}function d(e){if(a(document,"mousemove",f),a(window,"mouseup",d),l.movedCount>0){l.movedCount=0;var t=l.el;r.clone?t.parentElement.removeChild(t):(o(t,"style"),o(t,"class")),o(document.body,"style"),r.drop&&r.drop(e,r,l)}l={movedCount:0}}e._draggbleEventHandler&&a(e,"mousedown",e._draggbleEventHandler),e._draggbleEventHandler=u,s(e,"mousedown",u)}}); | ||
//# sourceMappingURL=draggable-helper.min.js.map |
{ | ||
"name": "draggable-helper", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -24,5 +24,5 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"helper-js": "^1.0.45" | ||
"helper-js": "^1.0.46" | ||
}, | ||
"license": "MIT" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
252187
4890
Updatedhelper-js@^1.0.46