{"size": 7107, "ext": "js", "max_stars_repo_path": "dolly.min.js", "max_stars_repo_name": "LunarLogic/dolly.js", "max_stars_repo_stars_event_min_datetime": "2016-05-20T08:15:51.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-19T00:36:22.000Z", "max_issues_repo_path": "dolly.min.js", "max_issues_repo_name": "LunarLogic/dolly.js", "max_issues_repo_issues_event_min_datetime": "2015-04-19T03:15:23.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-10T09:02:37.000Z", "max_forks_repo_path": "dolly.min.js", "max_forks_repo_name": "LunarLogic/dolly.js", "max_forks_repo_forks_event_min_datetime": "2015-03-18T13:59:43.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-31T21:53:30.000Z"}
{"max_stars_count": 6, "max_issues_count": 3, "max_forks_count": 7, "avg_line_length": 473.8, "max_line_length": 533, "alphanum_fraction": 0.7782467989}
(function(d){var e={setHandlersDisplay:function(a){return d(".dolly-handler").css({display:a})}};d.widget("llp.dolly",{options:{rowSelector:"tr",cellSelector:"td",allowDiagonalSelection:!1,boxStyle:{border:"2px dotted black"},handleStyle:{width:"8px",height:"8px","background-color":"black",cursor:"crosshair"}},_boxStyle:{position:"absolute",width:"100%",height:"100%","z-index":"1000",visibility:"hidden"},_handleStyle:{position:"absolute",visibility:"hidden"},_wrapperStyle:{position:"relative",height:"100%",
width:"100%",display:"inline-block"},_create:function(){this._createElements();this._boxBorder=this._getCssAsNumber("border-width",this.elements.box);this._bindEvents()},_createElements:function(){this.elements={};this.elements.box=d("<div/>",{"class":"dolly-box"});this.elements.handle=d("<div/>",{"class":"dolly-handler"});this.elements.wrapper=d("<div/>",{"class":"dolly-wrapper"});this.elements.box.css(this._processBoxStyle());this.elements.handle.css(this._processHandleStyle());this.elements.wrapper.css(this._wrapperStyle);
this.element.wrapInner(this.elements.wrapper);this.elements.wrapper=this.element.find(".dolly-wrapper");this.elements.wrapper.append(this.elements.box);this.elements.wrapper.append(this.elements.handle)},_processHandleStyle:function(){return d.extend(this.options.handleStyle,this._handleStyle,{right:-1*this._getCssAsNumber("padding-right")+"px",bottom:-1*this._getCssAsNumber("padding-bottom")+"px"})},_processBoxStyle:function(){return d.extend(this.options.boxStyle,this._boxStyle)},_bindEvents:function(){var a=
this;this.element.hover(function(){a.elements.handle.css({visibility:"visible"})},function(){a.elements.handle.css({visibility:"hidden"})});this.elements.handle.on("mousedown",function(b){a._initialX=b.pageX;a._initialY=b.pageY;a._cloneX=0;a._cloneY=0;a.elements.box.css({visibility:"visible"});e.setHandlersDisplay("none");a._resetBoxSize();a._setTopLeftBoxPosition();d(window).disableSelection();var c=function(b){a._handleDrag(b)},f=function(){a.elements.box.css({visibility:"hidden"});e.setHandlersDisplay("");
d(window).enableSelection();d(window).off("mousemove",c);d(window).off("mouseup",f);a._trigger("cloned",null,{cloneX:a._cloneX,cloneY:a._cloneY,originX:a._getOriginX(),originY:a._getOriginY()})};d(window).on("mousemove",c);d(window).on("mouseup",f)})},_handleDrag:function(a){this._resetBoxSize();var b=this._cloneX,c=this._cloneY;this._cloneY=this._cloneX=0;this.options.allowDiagonalSelection?this._getCells(a.pageX,a.pageY):Math.abs(a.pageX-this._initialX)>Math.abs(a.pageY-this._initialY)?this._getCellsHorizontally(a.pageX):
this._getCellsVertically(a.pageY);b===this._cloneX&&c===this._cloneY||this._trigger("selected",null,{cloneX:this._cloneX,cloneY:this._cloneY,originX:this._getOriginX(),originY:this._getOriginY()})},_getCells:function(a,b){a<this._initialX&&b<this._initialY?(this._setBottomRightBoxPosition(),this._getCellsLeft(this.element,a),this._getCellsUp(this.element,b)):a>this._initialX&&b<this._initialY?(this._setBottomLeftBoxPosition(),this._getCellsRight(this.element,a),this._getCellsUp(this.element,b)):a>
this._initialX&&b>this._initialY?(this._setTopLeftBoxPosition(),this._getCellsRight(this.element,a),this._getCellsDown(this.element,b)):a<this._initialX&&b>this._initialY&&(this._setTopRightBoxPosition(),this._getCellsLeft(this.element,a),this._getCellsDown(this.element,b))},_getCellsHorizontally:function(a){a<this._initialX?(this._setBottomRightBoxPosition(),this._getCellsLeft(this.element,a)):(this._setTopLeftBoxPosition(),this._getCellsRight(this.element,a))},_getCellsVertically:function(a){a<
this._initialY?(this._setBottomRightBoxPosition(),this._getCellsUp(this.element,a)):(this._setTopLeftBoxPosition(),this._getCellsDown(this.element,a))},_getCellsUp:function(a,b){var c=a.closest(this.options.rowSelector).find(this.options.cellSelector).index(this.element),c=d(a.closest(this.options.rowSelector).prev(this.options.rowSelector).find(this.options.cellSelector).get(c));0===c.length||b>this._getCellEdges(c).bottom-10||(this._cloneY-=1,this.elements.box.height(this.elements.box.offset().top+
this.elements.box.height()-this._getCellEdges(c).top+this._boxBorder),this._getCellsUp(c,b))},_getCellsLeft:function(a,b){var c=a.prev(this.options.cellSelector);0===c.length||b>this._getCellEdges(c).right-10||(this._cloneX-=1,this.elements.box.width(this.elements.box.offset().left+this.elements.box.width()-this._getCellEdges(c).left+this._boxBorder),this._getCellsLeft(c,b))},_getCellsRight:function(a,b){var c=a.next(this.options.cellSelector);0===c.length||b<c.offset().left+10||(this._cloneX+=1,
this.elements.box.width(this._getCellEdges(c).right-this.elements.box.offset().left-this._boxBorder),this._getCellsRight(c,b))},_getCellsDown:function(a,b){var c=a.closest(this.options.rowSelector).find(this.options.cellSelector).index(this.element),c=d(a.closest(this.options.rowSelector).next(this.options.rowSelector).find(this.options.cellSelector).get(c));0===c.length||b<c.offset().top+10||(this._cloneY+=1,this.elements.box.height(this._getCellEdges(c).bottom-this.elements.box.offset().top-this._boxBorder),
this._getCellsDown(c,b))},_resetBoxSize:function(){this.elements.box.width(this._getCellSize().width);this.elements.box.height(this._getCellSize().height)},_setTopRightBoxPosition:function(){this.elements.box.css({top:-1*this._getCssAsNumber("padding-top")-this._boxBorder+"px",right:-1*this._getCssAsNumber("padding-right")-this._boxBorder+"px",bottom:"",left:""})},_setTopLeftBoxPosition:function(){this.elements.box.css({top:-1*this._getCssAsNumber("padding-top")-this._boxBorder+"px",left:-1*this._getCssAsNumber("padding-left")-
this._boxBorder+"px",bottom:"",right:""})},_setBottomLeftBoxPosition:function(){this.elements.box.css({bottom:-1*this._getCssAsNumber("padding-bottom")-this._boxBorder+"px",left:-1*this._getCssAsNumber("padding-left")-this._boxBorder+"px",top:"",right:""})},_setBottomRightBoxPosition:function(){this.elements.box.css({bottom:-1*this._getCssAsNumber("padding-bottom")-this._boxBorder+"px",right:-1*this._getCssAsNumber("padding-right")-this._boxBorder+"px",top:"",left:""})},_getCellEdges:function(a){var b=
a.find(".dolly-wrapper");return{top:b.offset().top-this._getCssAsNumber("padding-top",a),bottom:b.offset().top+b.height()+this._getCssAsNumber("padding-bottom",a),left:b.offset().left-this._getCssAsNumber("padding-left",a),right:b.offset().left+b.width()+this._getCssAsNumber("padding-right",a)}},_getCellSize:function(a){a=a||this.element;var b=a.find(".dolly-wrapper");return{width:this._getCssAsNumber("padding-left",a)+this._getCssAsNumber("padding-right",a)+b.width(),height:this._getCssAsNumber("padding-top",
a)+this._getCssAsNumber("padding-bottom",a)+b.height()}},_getCssAsNumber:function(a,b){b=b||this.element;return parseInt(b.css(a),10)},_getOriginX:function(){return this.element.closest(this.options.rowSelector).find(this.options.cellSelector).index(this.element)},_getOriginY:function(){var a=this.element.closest(this.options.rowSelector);return a.parent().find(this.options.rowSelector).index(a)}})})(jQuery);
