You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
32 KiB
JavaScript
60 lines
32 KiB
JavaScript
/*! jQuery UI - v1.12.1 - 2017-11-15
|
|
* http://jqueryui.com
|
|
* Includes: widget.js, data.js, disable-selection.js, scroll-parent.js, widgets/draggable.js, widgets/mouse.js
|
|
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
|
(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(e){e.ui=e.ui||{};var i=e.ui.version="1.12.1";
|
|
/*!
|
|
* jQuery UI Widget 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
var d=0;var j=Array.prototype.slice;e.cleanData=(function(p){return function(q){var s,t,r;for(r=0;(t=q[r])!=null;r++){try{s=e._data(t,"events");if(s&&s.remove){e(t).triggerHandler("remove")}}catch(u){}}p(q)}})(e.cleanData);e.widget=function(p,q,x){var v,s,w;var r={};var u=p.split(".")[0];p=p.split(".")[1];var t=u+"-"+p;if(!x){x=q;q=e.Widget}if(e.isArray(x)){x=e.extend.apply(null,[{}].concat(x))}e.expr[":"][t.toLowerCase()]=function(y){return !!e.data(y,t)};e[u]=e[u]||{};v=e[u][p];s=e[u][p]=function(y,z){if(!this._createWidget){return new s(y,z)}if(arguments.length){this._createWidget(y,z)}};e.extend(s,v,{version:x.version,_proto:e.extend({},x),_childConstructors:[]});w=new q();w.options=e.widget.extend({},w.options);e.each(x,function(z,y){if(!e.isFunction(y)){r[z]=y;return}r[z]=(function(){function A(){return q.prototype[z].apply(this,arguments)}function B(C){return q.prototype[z].apply(this,C)}return function(){var E=this._super;var C=this._superApply;var D;this._super=A;this._superApply=B;D=y.apply(this,arguments);this._super=E;this._superApply=C;return D}})()});s.prototype=e.widget.extend(w,{widgetEventPrefix:v?(w.widgetEventPrefix||p):p},r,{constructor:s,namespace:u,widgetName:p,widgetFullName:t});if(v){e.each(v._childConstructors,function(z,A){var y=A.prototype;e.widget(y.namespace+"."+y.widgetName,s,A._proto)});delete v._childConstructors}else{q._childConstructors.push(s)}e.widget.bridge(p,s);return s};e.widget.extend=function(u){var q=j.call(arguments,1);var t=0;var p=q.length;var r;var s;for(;t<p;t++){for(r in q[t]){s=q[t][r];if(q[t].hasOwnProperty(r)&&s!==undefined){if(e.isPlainObject(s)){u[r]=e.isPlainObject(u[r])?e.widget.extend({},u[r],s):e.widget.extend({},s)}else{u[r]=s}}}}return u};e.widget.bridge=function(q,p){var r=p.prototype.widgetFullName||q;e.fn[q]=function(u){var s=typeof u==="string";var t=j.call(arguments,1);var v=this;if(s){if(!this.length&&u==="instance"){v=undefined}else{this.each(function(){var x;var w=e.data(this,r);if(u==="instance"){v=w;return false}if(!w){return e.error("cannot call methods on "+q+" prior to initialization; attempted to call method '"+u+"'")}if(!e.isFunction(w[u])||u.charAt(0)==="_"){return e.error("no such method '"+u+"' for "+q+" widget instance")}x=w[u].apply(w,t);if(x!==w&&x!==undefined){v=x&&x.jquery?v.pushStack(x.get()):x;return false}})}}else{if(t.length){u=e.widget.extend.apply(null,[u].concat(t))}this.each(function(){var w=e.data(this,r);if(w){w.option(u||{});if(w._init){w._init()}}else{e.data(this,r,new p(u,this))}})}return v}};e.Widget=function(){};e.Widget._childConstructors=[];e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:false,create:null},_createWidget:function(p,q){q=e(q||this.defaultElement||this)[0];this.element=e(q);this.uuid=d++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=e();this.hoverable=e();this.focusable=e();this.classesElementLookup={};if(q!==this){e.data(q,this.widgetFullName,this);this._on(true,this.element,{remove:function(r){if(r.target===q){this.destroy()}}});this.document=e(q.style?q.ownerDocument:q.document||q);this.window=e(this.document[0].defaultView||this.document[0].parentWindow)}this.options=e.widget.extend({},this.options,this._getCreateOptions(),p);this._create();if(this.options.disabled){this._setOptionDisabled(this.options.disabled)}this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){var p=this;this._destroy();e.each(this.classesElementLookup,function(q,r){p._removeClass(r,q)});this.element.off(this.eventNamespace).removeData(this.widgetFullName);this.widget().off(this.eventNamespace).removeAttr("aria-disabled");this.bindings.off(this.eventNamespace)},_destroy:e.noop,widget:function(){return this.element},option:function(s,t){var p=s;var u;var r;var q;if(arguments.length===0){return e.widget.extend({},this.options)}if(typeof s==="string"){p={};u=s.split(".");s=u.shift();if(u.length){r=p[s]=e.widget.extend({},this.options[s]);for(q=0;q<u.length-1;q++){r[u[q]]=r[u[q]]||{};r=r[u[q]]}s=u.pop();if(arguments.length===1){return r[s]===undefined?null:r[s]}r[s]=t}else{if(arguments.length===1){return this.options[s]===undefined?null:this.options[s]}p[s]=t}}this._setOptions(p);return this},_setOptions:function(p){var q;for(q in p){this._setOption(q,p[q])}return this},_setOption:function(p,q){if(p==="classes"){this._setOptionClasses(q)}this.options[p]=q;if(p==="disabled"){this._setOptionDisabled(q)}return this},_setOptionClasses:function(s){var p,r,q;for(p in s){q=this.classesElementLookup[p];if(s[p]===this.options.classes[p]||!q||!q.length){continue}r=e(q.get());this._removeClass(q,p);r.addClass(this._classes({element:r,keys:p,classes:s,add:true}))}},_setOptionDisabled:function(p){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!p);if(p){this._removeClass(this.hoverable,null,"ui-state-hover");this._removeClass(this.focusable,null,"ui-state-focus")}},enable:function(){return this._setOptions({disabled:false})},disable:function(){return this._setOptions({disabled:true})},_classes:function(p){var q=[];var r=this;p=e.extend({element:this.element,classes:this.options.classes||{}},p);function s(u,w){var v,t;for(t=0;t<u.length;t++){v=r.classesElementLookup[u[t]]||e();if(p.add){v=e(e.unique(v.get().concat(p.element.get())))}else{v=e(v.not(p.element).get())}r.classesElementLookup[u[t]]=v;q.push(u[t]);if(w&&p.classes[u[t]]){q.push(p.classes[u[t]])}}}this._on(p.element,{remove:"_untrackClassesElement"});if(p.keys){s(p.keys.match(/\S+/g)||[],true)}if(p.extra){s(p.extra.match(/\S+/g)||[])}return q.join(" ")},_untrackClassesElement:function(q){var p=this;e.each(p.classesElementLookup,function(r,s){if(e.inArray(q.target,s)!==-1){p.classesElementLookup[r]=e(s.not(q.target).get())}})},_removeClass:function(q,r,p){return this._toggleClass(q,r,p,false)},_addClass:function(q,r,p){return this._toggleClass(q,r,p,true)},_toggleClass:function(s,t,p,u){u=(typeof u==="boolean")?u:p;var q=(typeof s==="string"||s===null),r={extra:q?t:p,keys:q?s:t,element:q?this.element:s,add:u};r.element.toggleClass(this._classes(r),u);return this},_on:function(s,r,q){var t;var p=this;if(typeof s!=="boolean"){q=r;r=s;s=false}if(!q){q=r;r=this.element;t=this.widget()}else{r=t=e(r);this.bindings=this.bindings.add(r)}e.each(q,function(z,y){function w(){if(!s&&(p.options.disabled===true||e(this).hasClass("ui-state-disabled"))){return}return(typeof y==="string"?p[y]:y).apply(p,arguments)}if(typeof y!=="string"){w.guid=y.guid=y.guid||w.guid||e.guid++}var x=z.match(/^([\w:-]*)\s*(.*)$/);var v=x[1]+p.eventNamespace;var u=x[2];if(u){t.on(v,u,w)}else{r.on(v,w)}})},_off:function(q,p){p=(p||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;q.off(p).off(p);this.bindings=e(this.bindings.not(q).get());this.focusable=e(this.focusable.not(q).get());this.hoverable=e(this.hoverable.not(q).get())},_delay:function(s,r){function q(){return(typeof s==="string"?p[s]:s).apply(p,arguments)}var p=this;return setTimeout(q,r||0)},_hoverable:function(p){this.hoverable=this.hoverable.add(p);this._on(p,{mouseenter:function(q){this._addClass(e(q.currentTarget),null,"ui-state-hover")},mouseleave:function(q){this._removeClass(e(q.currentTarget),null,"ui-state-hover")}})},_focusable:function(p){this.focusable=this.focusable.add(p);this._on(p,{focusin:function(q){this._addClass(e(q.currentTarget),null,"ui-state-focus")},focusout:function(q){this._removeClass(e(q.currentTarget),null,"ui-state-focus")}})},_trigger:function(p,q,r){var u,t;var s=this.options[p];r=r||{};q=e.Event(q);q.type=(p===this.widgetEventPrefix?p:this.widgetEventPrefix+p).toLowerCase();q.target=this.element[0];t=q.originalEvent;if(t){for(u in t){if(!(u in q)){q[u]=t[u]}}}this.element.trigger(q,r);return !(e.isFunction(s)&&s.apply(this.element[0],[q].concat(r))===false||q.isDefaultPrevented())}};e.each({show:"fadeIn",hide:"fadeOut"},function(q,p){e.Widget.prototype["_"+q]=function(t,s,v){if(typeof s==="string"){s={effect:s}}var u;var r=!s?q:s===true||typeof s==="number"?p:s.effect||p;s=s||{};if(typeof s==="number"){s={duration:s}}u=!e.isEmptyObject(s);s.complete=v;if(s.delay){t.delay(s.delay)}if(u&&e.effects&&e.effects.effect[r]){t[q](s)}else{if(r!==q&&t[r]){t[r](s.duration,s.easing,v)}else{t.queue(function(w){e(this)[q]();if(v){v.call(t[0])}w()})}}}});var g=e.widget;
|
|
/*!
|
|
* jQuery UI :data 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
var f=e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(p){return function(q){return !!e.data(q,p)}}):function(r,q,p){return !!e.data(r,p[3])}});
|
|
/*!
|
|
* jQuery UI Disable Selection 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
var b=e.fn.extend({disableSelection:(function(){var p="onselectstart" in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(p+".ui-disableSelection",function(q){q.preventDefault()})}})(),enableSelection:function(){return this.off(".ui-disableSelection")}});
|
|
/*!
|
|
* jQuery UI Scroll Parent 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
var l=e.fn.scrollParent=function(r){var q=this.css("position"),p=q==="absolute",s=r?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var u=e(this);if(p&&u.css("position")==="static"){return false}return s.test(u.css("overflow")+u.css("overflow-y")+u.css("overflow-x"))}).eq(0);return q==="fixed"||!t.length?e(this[0].ownerDocument||document):t};var a=e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
|
|
/*!
|
|
* jQuery UI Mouse 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
var c=false;e(document).on("mouseup",function(){c=false});var k=e.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var p=this;this.element.on("mousedown."+this.widgetName,function(q){return p._mouseDown(q)}).on("click."+this.widgetName,function(q){if(true===e.data(q.target,p.widgetName+".preventClickEvent")){e.removeData(q.target,p.widgetName+".preventClickEvent");q.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.off("."+this.widgetName);if(this._mouseMoveDelegate){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)}},_mouseDown:function(r){if(c){return}this._mouseMoved=false;(this._mouseStarted&&this._mouseUp(r));this._mouseDownEvent=r;var q=this,s=(r.which===1),p=(typeof this.options.cancel==="string"&&r.target.nodeName?e(r.target).closest(this.options.cancel).length:false);if(!s||p||!this._mouseCapture(r)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){q.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(r)&&this._mouseDelayMet(r)){this._mouseStarted=(this._mouseStart(r)!==false);if(!this._mouseStarted){r.preventDefault();return true}}if(true===e.data(r.target,this.widgetName+".preventClickEvent")){e.removeData(r.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(t){return q._mouseMove(t)};this._mouseUpDelegate=function(t){return q._mouseUp(t)};this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate);r.preventDefault();c=true;return true},_mouseMove:function(p){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||document.documentMode<9)&&!p.button){return this._mouseUp(p)}else{if(!p.which){if(p.originalEvent.altKey||p.originalEvent.ctrlKey||p.originalEvent.metaKey||p.originalEvent.shiftKey){this.ignoreMissingWhich=true}else{if(!this.ignoreMissingWhich){return this._mouseUp(p)}}}}}if(p.which||p.button){this._mouseMoved=true}if(this._mouseStarted){this._mouseDrag(p);return p.preventDefault()}if(this._mouseDistanceMet(p)&&this._mouseDelayMet(p)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,p)!==false);(this._mouseStarted?this._mouseDrag(p):this._mouseUp(p))}return !this._mouseStarted},_mouseUp:function(p){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(p.target===this._mouseDownEvent.target){e.data(p.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(p)}if(this._mouseDelayTimer){clearTimeout(this._mouseDelayTimer);delete this._mouseDelayTimer}this.ignoreMissingWhich=false;c=false;p.preventDefault()},_mouseDistanceMet:function(p){return(Math.max(Math.abs(this._mouseDownEvent.pageX-p.pageX),Math.abs(this._mouseDownEvent.pageY-p.pageY))>=this.options.distance)},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}});var h=e.ui.plugin={add:function(q,r,t){var p,s=e.ui[q].prototype;for(p in t){s.plugins[p]=s.plugins[p]||[];s.plugins[p].push([r,t[p]])}},call:function(p,s,r,q){var t,u=p.plugins[s];if(!u){return}if(!q&&(!p.element[0].parentNode||p.element[0].parentNode.nodeType===11)){return}for(t=0;t<u.length;t++){if(p.options[u[t][0]]){u[t][1].apply(p.element,r)}}}};var m=e.ui.safeActiveElement=function(p){var r;try{r=p.activeElement}catch(q){r=p.body}if(!r){r=p.body}if(!r.nodeName){r=p.body}return r};var o=e.ui.safeBlur=function(p){if(p&&p.nodeName.toLowerCase()!=="body"){e(p).trigger("blur")}};
|
|
/*!
|
|
* jQuery UI Draggable 1.12.1
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*/
|
|
e.widget("ui.draggable",e.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false,drag:null,start:null,stop:null},_create:function(){if(this.options.helper==="original"){this._setPositionRelative()}if(this.options.addClasses){this._addClass("ui-draggable")}this._setHandleClassName();this._mouseInit()},_setOption:function(p,q){this._super(p,q);if(p==="handle"){this._removeHandleClassName();this._setHandleClassName()}},_destroy:function(){if((this.helper||this.element).is(".ui-draggable-dragging")){this.destroyOnClear=true;return}this._removeHandleClassName();this._mouseDestroy()},_mouseCapture:function(p){var q=this.options;if(this.helper||q.disabled||e(p.target).closest(".ui-resizable-handle").length>0){return false}this.handle=this._getHandle(p);if(!this.handle){return false}this._blurActiveElement(p);this._blockFrames(q.iframeFix===true?"iframe":q.iframeFix);return true},_blockFrames:function(p){this.iframeBlocks=this.document.find(p).map(function(){var q=e(this);return e("<div>").css("position","absolute").appendTo(q.parent()).outerWidth(q.outerWidth()).outerHeight(q.outerHeight()).offset(q.offset())[0]})},_unblockFrames:function(){if(this.iframeBlocks){this.iframeBlocks.remove();delete this.iframeBlocks}},_blurActiveElement:function(q){var p=e.ui.safeActiveElement(this.document[0]),r=e(q.target);if(r.closest(p).length){return}e.ui.safeBlur(p)},_mouseStart:function(p){var q=this.options;this.helper=this._createHelper(p);this._addClass(this.helper,"ui-draggable-dragging");this._cacheHelperProportions();if(e.ui.ddmanager){e.ui.ddmanager.current=this}this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent(true);this.offsetParent=this.helper.offsetParent();this.hasFixedAncestor=this.helper.parents().filter(function(){return e(this).css("position")==="fixed"}).length>0;this.positionAbs=this.element.offset();this._refreshOffsets(p);this.originalPosition=this.position=this._generatePosition(p,false);this.originalPageX=p.pageX;this.originalPageY=p.pageY;(q.cursorAt&&this._adjustOffsetFromHelper(q.cursorAt));this._setContainment();if(this._trigger("start",p)===false){this._clear();return false}this._cacheHelperProportions();if(e.ui.ddmanager&&!q.dropBehaviour){e.ui.ddmanager.prepareOffsets(this,p)}this._mouseDrag(p,true);if(e.ui.ddmanager){e.ui.ddmanager.dragStart(this,p)}return true},_refreshOffsets:function(p){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:false,parent:this._getParentOffset(),relative:this._getRelativeOffset()};this.offset.click={left:p.pageX-this.offset.left,top:p.pageY-this.offset.top}},_mouseDrag:function(p,r){if(this.hasFixedAncestor){this.offset.parent=this._getParentOffset()}this.position=this._generatePosition(p,true);this.positionAbs=this._convertPositionTo("absolute");if(!r){var q=this._uiHash();if(this._trigger("drag",p,q)===false){this._mouseUp(new e.Event("mouseup",p));return false}this.position=q.position}this.helper[0].style.left=this.position.left+"px";this.helper[0].style.top=this.position.top+"px";if(e.ui.ddmanager){e.ui.ddmanager.drag(this,p)}return false},_mouseStop:function(q){var p=this,r=false;if(e.ui.ddmanager&&!this.options.dropBehaviour){r=e.ui.ddmanager.drop(this,q)}if(this.dropped){r=this.dropped;this.dropped=false}if((this.options.revert==="invalid"&&!r)||(this.options.revert==="valid"&&r)||this.options.revert===true||(e.isFunction(this.options.revert)&&this.options.revert.call(this.element,r))){e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(p._trigger("stop",q)!==false){p._clear()}})}else{if(this._trigger("stop",q)!==false){this._clear()}}return false},_mouseUp:function(p){this._unblockFrames();if(e.ui.ddmanager){e.ui.ddmanager.dragStop(this,p)}if(this.handleElement.is(p.target)){this.element.trigger("focus")}return e.ui.mouse.prototype._mouseUp.call(this,p)},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp(new e.Event("mouseup",{target:this.element[0]}))}else{this._clear()}return this},_getHandle:function(p){return this.options.handle?!!e(p.target).closest(this.element.find(this.options.handle)).length:true},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element;this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(q){var s=this.options,r=e.isFunction(s.helper),p=r?e(s.helper.apply(this.element[0],[q])):(s.helper==="clone"?this.element.clone().removeAttr("id"):this.element);if(!p.parents("body").length){p.appendTo((s.appendTo==="parent"?this.element[0].parentNode:s.appendTo))}if(r&&p[0]===this.element[0]){this._setPositionRelative()}if(p[0]!==this.element[0]&&!(/(fixed|absolute)/).test(p.css("position"))){p.css("position","absolute")}return p},_setPositionRelative:function(){if(!(/^(?:r|a|f)/).test(this.element.css("position"))){this.element[0].style.position="relative"}},_adjustOffsetFromHelper:function(p){if(typeof p==="string"){p=p.split(" ")}if(e.isArray(p)){p={left:+p[0],top:+p[1]||0}}if("left" in p){this.offset.click.left=p.left+this.margins.left}if("right" in p){this.offset.click.left=this.helperProportions.width-p.right+this.margins.left}if("top" in p){this.offset.click.top=p.top+this.margins.top}if("bottom" in p){this.offset.click.top=this.helperProportions.height-p.bottom+this.margins.top}},_isRootNode:function(p){return(/(html|body)/i).test(p.tagName)||p===this.document[0]},_getParentOffset:function(){var q=this.offsetParent.offset(),p=this.document[0];if(this.cssPosition==="absolute"&&this.scrollParent[0]!==p&&e.contains(this.scrollParent[0],this.offsetParent[0])){q.left+=this.scrollParent.scrollLeft();q.top+=this.scrollParent.scrollTop()}if(this._isRootNode(this.offsetParent[0])){q={top:0,left:0}}return{top:q.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:q.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition!=="relative"){return{top:0,left:0}}var q=this.element.position(),r=this._isRootNode(this.scrollParent[0]);return{top:q.top-(parseInt(this.helper.css("top"),10)||0)+(!r?this.scrollParent.scrollTop():0),left:q.left-(parseInt(this.helper.css("left"),10)||0)+(!r?this.scrollParent.scrollLeft():0)}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0),right:(parseInt(this.element.css("marginRight"),10)||0),bottom:(parseInt(this.element.css("marginBottom"),10)||0)}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var q,t,r,s=this.options,p=this.document[0];this.relativeContainer=null;if(!s.containment){this.containment=null;return}if(s.containment==="window"){this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||p.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(s.containment==="document"){this.containment=[0,0,e(p).width()-this.helperProportions.width-this.margins.left,(e(p).height()||p.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];return}if(s.containment.constructor===Array){this.containment=s.containment;return}if(s.containment==="parent"){s.containment=this.helper[0].parentNode}t=e(s.containment);r=t[0];if(!r){return}q=/(scroll|auto)/.test(t.css("overflow"));this.containment=[(parseInt(t.css("borderLeftWidth"),10)||0)+(parseInt(t.css("paddingLeft"),10)||0),(parseInt(t.css("borderTopWidth"),10)||0)+(parseInt(t.css("paddingTop"),10)||0),(q?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(t.css("borderRightWidth"),10)||0)-(parseInt(t.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(q?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(t.css("borderBottomWidth"),10)||0)-(parseInt(t.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relativeContainer=t},_convertPositionTo:function(q,s){if(!s){s=this.position}var p=q==="absolute"?1:-1,r=this._isRootNode(this.scrollParent[0]);return{top:(s.top+this.offset.relative.top*p+this.offset.parent.top*p-((this.cssPosition==="fixed"?-this.offset.scroll.top:(r?0:this.offset.scroll.top))*p)),left:(s.left+this.offset.relative.left*p+this.offset.parent.left*p-((this.cssPosition==="fixed"?-this.offset.scroll.left:(r?0:this.offset.scroll.left))*p))}},_generatePosition:function(q,w){var p,x,y,s,r=this.options,v=this._isRootNode(this.scrollParent[0]),u=q.pageX,t=q.pageY;if(!v||!this.offset.scroll){this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}}if(w){if(this.containment){if(this.relativeContainer){x=this.relativeContainer.offset();p=[this.containment[0]+x.left,this.containment[1]+x.top,this.containment[2]+x.left,this.containment[3]+x.top]}else{p=this.containment}if(q.pageX-this.offset.click.left<p[0]){u=p[0]+this.offset.click.left}if(q.pageY-this.offset.click.top<p[1]){t=p[1]+this.offset.click.top}if(q.pageX-this.offset.click.left>p[2]){u=p[2]+this.offset.click.left}if(q.pageY-this.offset.click.top>p[3]){t=p[3]+this.offset.click.top}}if(r.grid){y=r.grid[1]?this.originalPageY+Math.round((t-this.originalPageY)/r.grid[1])*r.grid[1]:this.originalPageY;t=p?((y-this.offset.click.top>=p[1]||y-this.offset.click.top>p[3])?y:((y-this.offset.click.top>=p[1])?y-r.grid[1]:y+r.grid[1])):y;s=r.grid[0]?this.originalPageX+Math.round((u-this.originalPageX)/r.grid[0])*r.grid[0]:this.originalPageX;u=p?((s-this.offset.click.left>=p[0]||s-this.offset.click.left>p[2])?s:((s-this.offset.click.left>=p[0])?s-r.grid[0]:s+r.grid[0])):s}if(r.axis==="y"){u=this.originalPageX}if(r.axis==="x"){t=this.originalPageY}}return{top:(t-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition==="fixed"?-this.offset.scroll.top:(v?0:this.offset.scroll.top))),left:(u-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition==="fixed"?-this.offset.scroll.left:(v?0:this.offset.scroll.left)))}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging");if(this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval){this.helper.remove()}this.helper=null;this.cancelHelperRemoval=false;if(this.destroyOnClear){this.destroy()}},_trigger:function(p,q,r){r=r||this._uiHash();e.ui.plugin.call(this,p,[q,r,this],true);if(/^(drag|start|stop)/.test(p)){this.positionAbs=this._convertPositionTo("absolute");r.offset=this.positionAbs}return e.Widget.prototype._trigger.call(this,p,q,r)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});e.ui.plugin.add("draggable","connectToSortable",{start:function(r,s,p){var q=e.extend({},s,{item:p.element});p.sortables=[];e(p.options.connectToSortable).each(function(){var t=e(this).sortable("instance");if(t&&!t.options.disabled){p.sortables.push(t);t.refreshPositions();t._trigger("activate",r,q)}})},stop:function(r,s,p){var q=e.extend({},s,{item:p.element});p.cancelHelperRemoval=false;e.each(p.sortables,function(){var t=this;if(t.isOver){t.isOver=0;p.cancelHelperRemoval=true;t.cancelHelperRemoval=false;t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")};t._mouseStop(r);t.options.helper=t.options._helper}else{t.cancelHelperRemoval=true;t._trigger("deactivate",r,q)}})},drag:function(q,r,p){e.each(p.sortables,function(){var s=false,t=this;t.positionAbs=p.positionAbs;t.helperProportions=p.helperProportions;t.offset.click=p.offset.click;if(t._intersectsWith(t.containerCache)){s=true;e.each(p.sortables,function(){this.positionAbs=p.positionAbs;this.helperProportions=p.helperProportions;this.offset.click=p.offset.click;if(this!==t&&this._intersectsWith(this.containerCache)&&e.contains(t.element[0],this.element[0])){s=false}return s})}if(s){if(!t.isOver){t.isOver=1;p._parent=r.helper.parent();t.currentItem=r.helper.appendTo(t.element).data("ui-sortable-item",true);t.options._helper=t.options.helper;t.options.helper=function(){return r.helper[0]};q.target=t.currentItem[0];t._mouseCapture(q,true);t._mouseStart(q,true,true);t.offset.click.top=p.offset.click.top;t.offset.click.left=p.offset.click.left;t.offset.parent.left-=p.offset.parent.left-t.offset.parent.left;t.offset.parent.top-=p.offset.parent.top-t.offset.parent.top;p._trigger("toSortable",q);p.dropped=t.element;e.each(p.sortables,function(){this.refreshPositions()});p.currentItem=p.element;t.fromOutside=p}if(t.currentItem){t._mouseDrag(q);r.position=t.position}}else{if(t.isOver){t.isOver=0;t.cancelHelperRemoval=true;t.options._revert=t.options.revert;t.options.revert=false;t._trigger("out",q,t._uiHash(t));t._mouseStop(q,true);t.options.revert=t.options._revert;t.options.helper=t.options._helper;if(t.placeholder){t.placeholder.remove()}r.helper.appendTo(p._parent);p._refreshOffsets(q);r.position=p._generatePosition(q,true);p._trigger("fromSortable",q);p.dropped=false;e.each(p.sortables,function(){this.refreshPositions()})}}})}});e.ui.plugin.add("draggable","cursor",{start:function(r,s,p){var q=e("body"),u=p.options;if(q.css("cursor")){u._cursor=q.css("cursor")}q.css("cursor",u.cursor)},stop:function(q,r,p){var s=p.options;if(s._cursor){e("body").css("cursor",s._cursor)}}});e.ui.plugin.add("draggable","opacity",{start:function(r,s,p){var q=e(s.helper),u=p.options;if(q.css("opacity")){u._opacity=q.css("opacity")}q.css("opacity",u.opacity)},stop:function(q,r,p){var s=p.options;if(s._opacity){e(r.helper).css("opacity",s._opacity)}}});e.ui.plugin.add("draggable","scroll",{start:function(q,r,p){if(!p.scrollParentNotHidden){p.scrollParentNotHidden=p.helper.scrollParent(false)}if(p.scrollParentNotHidden[0]!==p.document[0]&&p.scrollParentNotHidden[0].tagName!=="HTML"){p.overflowOffset=p.scrollParentNotHidden.offset()}},drag:function(s,t,r){var u=r.options,q=false,v=r.scrollParentNotHidden[0],p=r.document[0];if(v!==p&&v.tagName!=="HTML"){if(!u.axis||u.axis!=="x"){if((r.overflowOffset.top+v.offsetHeight)-s.pageY<u.scrollSensitivity){v.scrollTop=q=v.scrollTop+u.scrollSpeed}else{if(s.pageY-r.overflowOffset.top<u.scrollSensitivity){v.scrollTop=q=v.scrollTop-u.scrollSpeed}}}if(!u.axis||u.axis!=="y"){if((r.overflowOffset.left+v.offsetWidth)-s.pageX<u.scrollSensitivity){v.scrollLeft=q=v.scrollLeft+u.scrollSpeed}else{if(s.pageX-r.overflowOffset.left<u.scrollSensitivity){v.scrollLeft=q=v.scrollLeft-u.scrollSpeed}}}}else{if(!u.axis||u.axis!=="x"){if(s.pageY-e(p).scrollTop()<u.scrollSensitivity){q=e(p).scrollTop(e(p).scrollTop()-u.scrollSpeed)
|
|
}else{if(e(window).height()-(s.pageY-e(p).scrollTop())<u.scrollSensitivity){q=e(p).scrollTop(e(p).scrollTop()+u.scrollSpeed)}}}if(!u.axis||u.axis!=="y"){if(s.pageX-e(p).scrollLeft()<u.scrollSensitivity){q=e(p).scrollLeft(e(p).scrollLeft()-u.scrollSpeed)}else{if(e(window).width()-(s.pageX-e(p).scrollLeft())<u.scrollSensitivity){q=e(p).scrollLeft(e(p).scrollLeft()+u.scrollSpeed)}}}}if(q!==false&&e.ui.ddmanager&&!u.dropBehaviour){e.ui.ddmanager.prepareOffsets(r,s)}}});e.ui.plugin.add("draggable","snap",{start:function(q,r,p){var s=p.options;p.snapElements=[];e(s.snap.constructor!==String?(s.snap.items||":data(ui-draggable)"):s.snap).each(function(){var u=e(this),t=u.offset();if(this!==p.element[0]){p.snapElements.push({item:this,width:u.outerWidth(),height:u.outerHeight(),top:t.top,left:t.left})}})},drag:function(D,A,u){var p,I,w,x,C,z,y,J,E,v,B=u.options,H=B.snapTolerance,G=A.offset.left,F=G+u.helperProportions.width,s=A.offset.top,q=s+u.helperProportions.height;for(E=u.snapElements.length-1;E>=0;E--){C=u.snapElements[E].left-u.margins.left;z=C+u.snapElements[E].width;y=u.snapElements[E].top-u.margins.top;J=y+u.snapElements[E].height;if(F<C-H||G>z+H||q<y-H||s>J+H||!e.contains(u.snapElements[E].item.ownerDocument,u.snapElements[E].item)){if(u.snapElements[E].snapping){(u.options.snap.release&&u.options.snap.release.call(u.element,D,e.extend(u._uiHash(),{snapItem:u.snapElements[E].item})))}u.snapElements[E].snapping=false;continue}if(B.snapMode!=="inner"){p=Math.abs(y-q)<=H;I=Math.abs(J-s)<=H;w=Math.abs(C-F)<=H;x=Math.abs(z-G)<=H;if(p){A.position.top=u._convertPositionTo("relative",{top:y-u.helperProportions.height,left:0}).top}if(I){A.position.top=u._convertPositionTo("relative",{top:J,left:0}).top}if(w){A.position.left=u._convertPositionTo("relative",{top:0,left:C-u.helperProportions.width}).left}if(x){A.position.left=u._convertPositionTo("relative",{top:0,left:z}).left}}v=(p||I||w||x);if(B.snapMode!=="outer"){p=Math.abs(y-s)<=H;I=Math.abs(J-q)<=H;w=Math.abs(C-G)<=H;x=Math.abs(z-F)<=H;if(p){A.position.top=u._convertPositionTo("relative",{top:y,left:0}).top}if(I){A.position.top=u._convertPositionTo("relative",{top:J-u.helperProportions.height,left:0}).top}if(w){A.position.left=u._convertPositionTo("relative",{top:0,left:C}).left}if(x){A.position.left=u._convertPositionTo("relative",{top:0,left:z-u.helperProportions.width}).left}}if(!u.snapElements[E].snapping&&(p||I||w||x||v)){(u.options.snap.snap&&u.options.snap.snap.call(u.element,D,e.extend(u._uiHash(),{snapItem:u.snapElements[E].item})))}u.snapElements[E].snapping=(p||I||w||x||v)}}});e.ui.plugin.add("draggable","stack",{start:function(r,s,p){var q,u=p.options,t=e.makeArray(e(u.stack)).sort(function(w,v){return(parseInt(e(w).css("zIndex"),10)||0)-(parseInt(e(v).css("zIndex"),10)||0)});if(!t.length){return}q=parseInt(e(t[0]).css("zIndex"),10)||0;e(t).each(function(v){e(this).css("zIndex",q+v)});this.css("zIndex",(q+t.length))}});e.ui.plugin.add("draggable","zIndex",{start:function(r,s,p){var q=e(s.helper),u=p.options;if(q.css("zIndex")){u._zIndex=q.css("zIndex")}q.css("zIndex",u.zIndex)},stop:function(q,r,p){var s=p.options;if(s._zIndex){e(r.helper).css("zIndex",s._zIndex)}}});var n=e.ui.draggable})); |