draggable-helper
Advanced tools
Comparing version 1.0.4 to 1.0.5
/*! | ||
* draggable-helper v1.0.4 | ||
* draggable-helper v1.0.5 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -114,3 +114,8 @@ * Released under the MIT License. | ||
body = _document.body; | ||
var bodyOldStyle = body.getAttribute('style') || ''; | ||
var bodyOldStyle = (body.getAttribute('style') || '').trim(); | ||
if (bodyOldStyle.length && !bodyOldStyle.endsWith(';')) { | ||
bodyOldStyle += ';'; | ||
} | ||
helperJs.backupAttr(body, 'style'); | ||
@@ -117,0 +122,0 @@ body.style = bodyOldStyle + 'cursor: move;'; |
/*! | ||
* draggable-helper v1.0.4 | ||
* draggable-helper v1.0.5 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -112,3 +112,8 @@ * Released under the MIT License. | ||
body = _document.body; | ||
var bodyOldStyle = body.getAttribute('style') || ''; | ||
var bodyOldStyle = (body.getAttribute('style') || '').trim(); | ||
if (bodyOldStyle.length && !bodyOldStyle.endsWith(';')) { | ||
bodyOldStyle += ';'; | ||
} | ||
backupAttr(body, 'style'); | ||
@@ -115,0 +120,0 @@ body.style = bodyOldStyle + 'cursor: move;'; |
/*! | ||
* draggable-helper v1.0.4 | ||
* draggable-helper v1.0.5 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -565,3 +565,8 @@ * Released under the MIT License. | ||
body = _document.body; | ||
var bodyOldStyle = body.getAttribute('style') || ''; | ||
var bodyOldStyle = (body.getAttribute('style') || '').trim(); | ||
if (bodyOldStyle.length && !bodyOldStyle.endsWith(';')) { | ||
bodyOldStyle += ';'; | ||
} | ||
backupAttr(body, 'style'); | ||
@@ -568,0 +573,0 @@ body.style = bodyOldStyle + 'cursor: move;'; |
/*! | ||
* draggable-helper v1.0.4 | ||
* draggable-helper v1.0.5 | ||
* (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";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 a(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 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&&(a(document.body,"selectstart",m),l.mouse={x:e.pageX,y:e.pageY},l.initialMouse=Object.assign({},l.mouse),a(document,"mousemove",d),a(window,"mouseup",f))}function c(o){var a=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}}(),u=a.el,c=a.offset;if(l.el=u,l.initialOffset=Object.assign({},c),!1===(r.drag&&r.drag(o,r,l)))return s(document.body,"selectstart",m),!1;var d=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}(u),f=Object.assign({width:"".concat(d.width,"px"),height:"".concat(d.height,"px"),zIndex:9999,opacity:.6,position:"fixed",left:c.x+"px",top:c.y+"px"},r.style||r.getStyle&&r.getStyle(r)||{});for(var g in n(u,"style"),f)u.style[g]=f[g];n(u,"class"),i(u,r.draggingClass);var v=document.body,p=v.getAttribute("style")||"";n(v,"style"),v.style=p+"cursor: move;"}function d(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 f(e){if(s(document,"mousemove",d),s(window,"mouseup",f),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"),s(document.body,"selectstart",m),r.drop&&r.drop(e,r,l)}l={movedCount:0}}function m(e){e.preventDefault()}e._draggbleEventHandler&&s(e,"mousedown",e._draggbleEventHandler),e._draggbleEventHandler=u,a(e,"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 a(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 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&&(a(document.body,"selectstart",m),l.mouse={x:e.pageX,y:e.pageY},l.initialMouse=Object.assign({},l.mouse),a(document,"mousemove",d),a(window,"mouseup",f))}function c(o){var a=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}}(),u=a.el,c=a.offset;if(l.el=u,l.initialOffset=Object.assign({},c),!1===(r.drag&&r.drag(o,r,l)))return s(document.body,"selectstart",m),!1;var d=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}(u),f=Object.assign({width:"".concat(d.width,"px"),height:"".concat(d.height,"px"),zIndex:9999,opacity:.6,position:"fixed",left:c.x+"px",top:c.y+"px"},r.style||r.getStyle&&r.getStyle(r)||{});for(var g in n(u,"style"),f)u.style[g]=f[g];n(u,"class"),i(u,r.draggingClass);var v=document.body,p=(v.getAttribute("style")||"").trim();p.length&&!p.endsWith(";")&&(p+=";"),n(v,"style"),v.style=p+"cursor: move;"}function d(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 f(e){if(s(document,"mousemove",d),s(window,"mouseup",f),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"),s(document.body,"selectstart",m),r.drop&&r.drop(e,r,l)}l={movedCount:0}}function m(e){e.preventDefault()}e._draggbleEventHandler&&s(e,"mousedown",e._draggbleEventHandler),e._draggbleEventHandler=u,a(e,"mousedown",u)}}); | ||
//# sourceMappingURL=draggable-helper.min.js.map |
{ | ||
"name": "draggable-helper", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/draggable-helper.cjs.js", |
@@ -90,3 +90,6 @@ import { onDOM, offDOM, getElSize, backupAttr, restoreAttr, getOffset, addClass } from 'helper-js' | ||
const {body} = document | ||
const bodyOldStyle = body.getAttribute('style') || '' | ||
let bodyOldStyle = (body.getAttribute('style') || '').trim() | ||
if (bodyOldStyle.length && !bodyOldStyle.endsWith(';')) { | ||
bodyOldStyle += ';' | ||
} | ||
backupAttr(body, 'style') | ||
@@ -93,0 +96,0 @@ body.style = bodyOldStyle + 'cursor: move;' |
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
87940
1134