Version zu Ende April 2023
This commit is contained in:
170
static/plugins/jquery.resizable.js
Normal file
170
static/plugins/jquery.resizable.js
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* jQuery EasyUI 1.5.1
|
||||
*
|
||||
* Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved.
|
||||
*
|
||||
* Licensed under the commercial license: http://www.jeasyui.com/license_commercial.php
|
||||
* To use it on other terms please contact us: info@jeasyui.com
|
||||
*
|
||||
*/
|
||||
(function($){
|
||||
$.fn.resizable=function(_1,_2){
|
||||
if(typeof _1=="string"){
|
||||
return $.fn.resizable.methods[_1](this,_2);
|
||||
}
|
||||
function _3(e){
|
||||
var _4=e.data;
|
||||
var _5=$.data(_4.target,"resizable").options;
|
||||
if(_4.dir.indexOf("e")!=-1){
|
||||
var _6=_4.startWidth+e.pageX-_4.startX;
|
||||
_6=Math.min(Math.max(_6,_5.minWidth),_5.maxWidth);
|
||||
_4.width=_6;
|
||||
}
|
||||
if(_4.dir.indexOf("s")!=-1){
|
||||
var _7=_4.startHeight+e.pageY-_4.startY;
|
||||
_7=Math.min(Math.max(_7,_5.minHeight),_5.maxHeight);
|
||||
_4.height=_7;
|
||||
}
|
||||
if(_4.dir.indexOf("w")!=-1){
|
||||
var _6=_4.startWidth-e.pageX+_4.startX;
|
||||
_6=Math.min(Math.max(_6,_5.minWidth),_5.maxWidth);
|
||||
_4.width=_6;
|
||||
_4.left=_4.startLeft+_4.startWidth-_4.width;
|
||||
}
|
||||
if(_4.dir.indexOf("n")!=-1){
|
||||
var _7=_4.startHeight-e.pageY+_4.startY;
|
||||
_7=Math.min(Math.max(_7,_5.minHeight),_5.maxHeight);
|
||||
_4.height=_7;
|
||||
_4.top=_4.startTop+_4.startHeight-_4.height;
|
||||
}
|
||||
};
|
||||
function _8(e){
|
||||
var _9=e.data;
|
||||
var t=$(_9.target);
|
||||
t.css({left:_9.left,top:_9.top});
|
||||
if(t.outerWidth()!=_9.width){
|
||||
t._outerWidth(_9.width);
|
||||
}
|
||||
if(t.outerHeight()!=_9.height){
|
||||
t._outerHeight(_9.height);
|
||||
}
|
||||
};
|
||||
function _a(e){
|
||||
$.fn.resizable.isResizing=true;
|
||||
$.data(e.data.target,"resizable").options.onStartResize.call(e.data.target,e);
|
||||
return false;
|
||||
};
|
||||
function _b(e){
|
||||
_3(e);
|
||||
if($.data(e.data.target,"resizable").options.onResize.call(e.data.target,e)!=false){
|
||||
_8(e);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
function _c(e){
|
||||
$.fn.resizable.isResizing=false;
|
||||
_3(e,true);
|
||||
_8(e);
|
||||
$.data(e.data.target,"resizable").options.onStopResize.call(e.data.target,e);
|
||||
$(document).unbind(".resizable");
|
||||
$("body").css("cursor","");
|
||||
return false;
|
||||
};
|
||||
return this.each(function(){
|
||||
var _d=null;
|
||||
var _e=$.data(this,"resizable");
|
||||
if(_e){
|
||||
$(this).unbind(".resizable");
|
||||
_d=$.extend(_e.options,_1||{});
|
||||
}else{
|
||||
_d=$.extend({},$.fn.resizable.defaults,$.fn.resizable.parseOptions(this),_1||{});
|
||||
$.data(this,"resizable",{options:_d});
|
||||
}
|
||||
if(_d.disabled==true){
|
||||
return;
|
||||
}
|
||||
$(this).bind("mousemove.resizable",{target:this},function(e){
|
||||
if($.fn.resizable.isResizing){
|
||||
return;
|
||||
}
|
||||
var _f=_10(e);
|
||||
if(_f==""){
|
||||
$(e.data.target).css("cursor","");
|
||||
}else{
|
||||
$(e.data.target).css("cursor",_f+"-resize");
|
||||
}
|
||||
}).bind("mouseleave.resizable",{target:this},function(e){
|
||||
$(e.data.target).css("cursor","");
|
||||
}).bind("mousedown.resizable",{target:this},function(e){
|
||||
var dir=_10(e);
|
||||
if(dir==""){
|
||||
return;
|
||||
}
|
||||
function _11(css){
|
||||
var val=parseInt($(e.data.target).css(css));
|
||||
if(isNaN(val)){
|
||||
return 0;
|
||||
}else{
|
||||
return val;
|
||||
}
|
||||
};
|
||||
var _12={target:e.data.target,dir:dir,startLeft:_11("left"),startTop:_11("top"),left:_11("left"),top:_11("top"),startX:e.pageX,startY:e.pageY,startWidth:$(e.data.target).outerWidth(),startHeight:$(e.data.target).outerHeight(),width:$(e.data.target).outerWidth(),height:$(e.data.target).outerHeight(),deltaWidth:$(e.data.target).outerWidth()-$(e.data.target).width(),deltaHeight:$(e.data.target).outerHeight()-$(e.data.target).height()};
|
||||
$(document).bind("mousedown.resizable",_12,_a);
|
||||
$(document).bind("mousemove.resizable",_12,_b);
|
||||
$(document).bind("mouseup.resizable",_12,_c);
|
||||
$("body").css("cursor",dir+"-resize");
|
||||
});
|
||||
function _10(e){
|
||||
var tt=$(e.data.target);
|
||||
var dir="";
|
||||
var _13=tt.offset();
|
||||
var _14=tt.outerWidth();
|
||||
var _15=tt.outerHeight();
|
||||
var _16=_d.edge;
|
||||
if(e.pageY>_13.top&&e.pageY<_13.top+_16){
|
||||
dir+="n";
|
||||
}else{
|
||||
if(e.pageY<_13.top+_15&&e.pageY>_13.top+_15-_16){
|
||||
dir+="s";
|
||||
}
|
||||
}
|
||||
if(e.pageX>_13.left&&e.pageX<_13.left+_16){
|
||||
dir+="w";
|
||||
}else{
|
||||
if(e.pageX<_13.left+_14&&e.pageX>_13.left+_14-_16){
|
||||
dir+="e";
|
||||
}
|
||||
}
|
||||
var _17=_d.handles.split(",");
|
||||
for(var i=0;i<_17.length;i++){
|
||||
var _18=_17[i].replace(/(^\s*)|(\s*$)/g,"");
|
||||
if(_18=="all"||_18==dir){
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
});
|
||||
};
|
||||
$.fn.resizable.methods={options:function(jq){
|
||||
return $.data(jq[0],"resizable").options;
|
||||
},enable:function(jq){
|
||||
return jq.each(function(){
|
||||
$(this).resizable({disabled:false});
|
||||
});
|
||||
},disable:function(jq){
|
||||
return jq.each(function(){
|
||||
$(this).resizable({disabled:true});
|
||||
});
|
||||
}};
|
||||
$.fn.resizable.parseOptions=function(_19){
|
||||
var t=$(_19);
|
||||
return $.extend({},$.parser.parseOptions(_19,["handles",{minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number",edge:"number"}]),{disabled:(t.attr("disabled")?true:undefined)});
|
||||
};
|
||||
$.fn.resizable.defaults={disabled:false,handles:"n, e, s, w, ne, se, sw, nw, all",minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000,edge:5,onStartResize:function(e){
|
||||
},onResize:function(e){
|
||||
},onStopResize:function(e){
|
||||
}};
|
||||
$.fn.resizable.isResizing=false;
|
||||
})(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user