Viewing File: /usr/share/javascript/jquery-ui/ui/position.min.js
!function(factory){"function"==typeof define&&define.amd?define(["jquery","./version"],factory):factory(jQuery)}(function($){function getOffsets(offsets,width,height){return[parseFloat(offsets[0])*(rpercent.test(offsets[0])?width/100:1),parseFloat(offsets[1])*(rpercent.test(offsets[1])?height/100:1)]}function parseCss(element,property){return parseInt($.css(element,property),10)||0}var cachedScrollbarWidth,max,abs,rhorizontal,rvertical,roffset,rposition,rpercent,_position;return max=Math.max,abs=Math.abs,rhorizontal=/left|center|right/,rvertical=/top|center|bottom/,roffset=/[\+\-]\d+(\.[\d]+)?%?/,rposition=/^\w+/,rpercent=/%$/,_position=$.fn.position,$.position={scrollbarWidth:function(){if(void 0!==cachedScrollbarWidth)return cachedScrollbarWidth;var w1,div=$("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),w2=div.children()[0];return $("body").append(div),w1=w2.offsetWidth,div.css("overflow","scroll"),w1===(w2=w2.offsetWidth)&&(w2=div[0].clientWidth),div.remove(),cachedScrollbarWidth=w1-w2},getScrollInfo:function(within){var hasOverflowX=within.isWindow||within.isDocument?"":within.element.css("overflow-x"),overflowY=within.isWindow||within.isDocument?"":within.element.css("overflow-y"),hasOverflowX="scroll"===hasOverflowX||"auto"===hasOverflowX&&within.width<within.element[0].scrollWidth;return{width:"scroll"===overflowY||"auto"===overflowY&&within.height<within.element[0].scrollHeight?$.position.scrollbarWidth():0,height:hasOverflowX?$.position.scrollbarWidth():0}},getWithinInfo:function(element){var withinElement=$(element||window),isWindow=$.isWindow(withinElement[0]),isDocument=!!withinElement[0]&&9===withinElement[0].nodeType;return{element:withinElement,isWindow:isWindow,isDocument:isDocument,offset:!isWindow&&!isDocument?$(element).offset():{left:0,top:0},scrollLeft:withinElement.scrollLeft(),scrollTop:withinElement.scrollTop(),width:withinElement.outerWidth(),height:withinElement.outerHeight()}}},$.fn.position=function(options){if(!options||!options.of)return _position.apply(this,arguments);var atOffset,targetWidth,targetHeight,targetOffset,basePosition,raw,target="string"==typeof(options=$.extend({},options)).of?$(document).find(options.of):$(options.of),within=$.position.getWithinInfo(options.within),scrollInfo=$.position.getScrollInfo(within),collision=(options.collision||"flip").split(" "),offsets={},dimensions=9===(raw=(dimensions=target)[0]).nodeType?{width:dimensions.width(),height:dimensions.height(),offset:{top:0,left:0}}:$.isWindow(raw)?{width:dimensions.width(),height:dimensions.height(),offset:{top:dimensions.scrollTop(),left:dimensions.scrollLeft()}}:raw.preventDefault?{width:0,height:0,offset:{top:raw.pageY,left:raw.pageX}}:{width:dimensions.outerWidth(),height:dimensions.outerHeight(),offset:dimensions.offset()};return target[0].preventDefault&&(options.at="left top"),targetWidth=dimensions.width,targetHeight=dimensions.height,targetOffset=dimensions.offset,basePosition=$.extend({},targetOffset),$.each(["my","at"],function(){var horizontalOffset,verticalOffset,pos=(options[this]||"").split(" ");(pos=1===pos.length?rhorizontal.test(pos[0])?pos.concat(["center"]):rvertical.test(pos[0])?["center"].concat(pos):["center","center"]:pos)[0]=rhorizontal.test(pos[0])?pos[0]:"center",pos[1]=rvertical.test(pos[1])?pos[1]:"center",horizontalOffset=roffset.exec(pos[0]),verticalOffset=roffset.exec(pos[1]),offsets[this]=[horizontalOffset?horizontalOffset[0]:0,verticalOffset?verticalOffset[0]:0],options[this]=[rposition.exec(pos[0])[0],rposition.exec(pos[1])[0]]}),1===collision.length&&(collision[1]=collision[0]),"right"===options.at[0]?basePosition.left+=targetWidth:"center"===options.at[0]&&(basePosition.left+=targetWidth/2),"bottom"===options.at[1]?basePosition.top+=targetHeight:"center"===options.at[1]&&(basePosition.top+=targetHeight/2),atOffset=getOffsets(offsets.at,targetWidth,targetHeight),basePosition.left+=atOffset[0],basePosition.top+=atOffset[1],this.each(function(){var collisionPosition,using,elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),marginLeft=parseCss(this,"marginLeft"),marginTop=parseCss(this,"marginTop"),collisionWidth=elemWidth+marginLeft+parseCss(this,"marginRight")+scrollInfo.width,collisionHeight=elemHeight+marginTop+parseCss(this,"marginBottom")+scrollInfo.height,position=$.extend({},basePosition),myOffset=getOffsets(offsets.my,elem.outerWidth(),elem.outerHeight());"right"===options.my[0]?position.left-=elemWidth:"center"===options.my[0]&&(position.left-=elemWidth/2),"bottom"===options.my[1]?position.top-=elemHeight:"center"===options.my[1]&&(position.top-=elemHeight/2),position.left+=myOffset[0],position.top+=myOffset[1],collisionPosition={marginLeft:marginLeft,marginTop:marginTop},$.each(["left","top"],function(i,dir){$.ui.position[collision[i]]&&$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,collisionPosition:collisionPosition,collisionWidth:collisionWidth,collisionHeight:collisionHeight,offset:[atOffset[0]+myOffset[0],atOffset[1]+myOffset[1]],my:options.my,at:options.at,within:within,elem:elem})}),options.using&&(using=function(props){var left=targetOffset.left-position.left,right=left+targetWidth-elemWidth,top=targetOffset.top-position.top,bottom=top+targetHeight-elemHeight,feedback={target:{element:target,left:targetOffset.left,top:targetOffset.top,width:targetWidth,height:targetHeight},element:{element:elem,left:position.left,top:position.top,width:elemWidth,height:elemHeight},horizontal:right<0?"left":0<left?"right":"center",vertical:bottom<0?"top":0<top?"bottom":"middle"};targetWidth<elemWidth&&abs(left+right)<targetWidth&&(feedback.horizontal="center"),targetHeight<elemHeight&&abs(top+bottom)<targetHeight&&(feedback.vertical="middle"),max(abs(left),abs(right))>max(abs(top),abs(bottom))?feedback.important="horizontal":feedback.important="vertical",options.using.call(this,props,feedback)}),elem.offset($.extend(position,{using:using}))})},$.ui.position={fit:{left:function(position,data){var newOverRight=data.within,withinOffset=newOverRight.isWindow?newOverRight.scrollLeft:newOverRight.offset.left,outerWidth=newOverRight.width,collisionPosLeft=position.left-data.collisionPosition.marginLeft,overLeft=withinOffset-collisionPosLeft,overRight=collisionPosLeft+data.collisionWidth-outerWidth-withinOffset;data.collisionWidth>outerWidth?0<overLeft&&overRight<=0?(newOverRight=position.left+overLeft+data.collisionWidth-outerWidth-withinOffset,position.left+=overLeft-newOverRight):position.left=!(0<overRight&&overLeft<=0)&&overRight<overLeft?withinOffset+outerWidth-data.collisionWidth:withinOffset:0<overLeft?position.left+=overLeft:0<overRight?position.left-=overRight:position.left=max(position.left-collisionPosLeft,position.left)},top:function(position,data){var newOverBottom=data.within,withinOffset=newOverBottom.isWindow?newOverBottom.scrollTop:newOverBottom.offset.top,outerHeight=data.within.height,collisionPosTop=position.top-data.collisionPosition.marginTop,overTop=withinOffset-collisionPosTop,overBottom=collisionPosTop+data.collisionHeight-outerHeight-withinOffset;data.collisionHeight>outerHeight?0<overTop&&overBottom<=0?(newOverBottom=position.top+overTop+data.collisionHeight-outerHeight-withinOffset,position.top+=overTop-newOverBottom):position.top=!(0<overBottom&&overTop<=0)&&overBottom<overTop?withinOffset+outerHeight-data.collisionHeight:withinOffset:0<overTop?position.top+=overTop:0<overBottom?position.top-=overBottom:position.top=max(position.top-collisionPosTop,position.top)}},flip:{left:function(position,data){var atOffset=data.within,newOverRight=atOffset.offset.left+atOffset.scrollLeft,outerWidth=atOffset.width,newOverLeft=atOffset.isWindow?atOffset.scrollLeft:atOffset.offset.left,offset=position.left-data.collisionPosition.marginLeft,overLeft=offset-newOverLeft,overRight=offset+data.collisionWidth-outerWidth-newOverLeft,myOffset="left"===data.my[0]?-data.elemWidth:"right"===data.my[0]?data.elemWidth:0,atOffset="left"===data.at[0]?data.targetWidth:"right"===data.at[0]?-data.targetWidth:0,offset=-2*data.offset[0];overLeft<0?((newOverRight=position.left+myOffset+atOffset+offset+data.collisionWidth-outerWidth-newOverRight)<0||newOverRight<abs(overLeft))&&(position.left+=myOffset+atOffset+offset):0<overRight&&(0<(newOverLeft=position.left-data.collisionPosition.marginLeft+myOffset+atOffset+offset-newOverLeft)||abs(newOverLeft)<overRight)&&(position.left+=myOffset+atOffset+offset)},top:function(position,data){var atOffset=data.within,newOverBottom=atOffset.offset.top+atOffset.scrollTop,outerHeight=atOffset.height,newOverTop=atOffset.isWindow?atOffset.scrollTop:atOffset.offset.top,offset=position.top-data.collisionPosition.marginTop,overTop=offset-newOverTop,overBottom=offset+data.collisionHeight-outerHeight-newOverTop,myOffset="top"===data.my[1]?-data.elemHeight:"bottom"===data.my[1]?data.elemHeight:0,atOffset="top"===data.at[1]?data.targetHeight:"bottom"===data.at[1]?-data.targetHeight:0,offset=-2*data.offset[1];overTop<0?((newOverBottom=position.top+myOffset+atOffset+offset+data.collisionHeight-outerHeight-newOverBottom)<0||newOverBottom<abs(overTop))&&(position.top+=myOffset+atOffset+offset):0<overBottom&&(0<(newOverTop=position.top-data.collisionPosition.marginTop+myOffset+atOffset+offset-newOverTop)||abs(newOverTop)<overBottom)&&(position.top+=myOffset+atOffset+offset)}},flipfit:{left:function(){$.ui.position.flip.left.apply(this,arguments),$.ui.position.fit.left.apply(this,arguments)},top:function(){$.ui.position.flip.top.apply(this,arguments),$.ui.position.fit.top.apply(this,arguments)}}},$.ui.position});
Back to Directory
File Manager