Annotation of loncom/html/adm/split.js/split.min.js, revision 1.1
1.1 ! damieng 1: "use strict";(function(){var t=this,e="querySelector",i="addEventListener",s="removeEventListener",n="getBoundingClientRect",r=t.attachEvent&&!t[i],h=function(){var e,i=["","-webkit-","-moz-","-o-"];for(var s=0;s<i.length;s++){e=t.document.createElement("div");e.style.cssText="width:"+i[s]+"calc(9px)";if(e.style.length){return i[s]+"calc"}}}(),a=function(a,o){var l,u,c,f,g,p,z,d,S=[];o=typeof o!=="undefined"?o:{};if(!o.gutterSize)o.gutterSize=10;if(!o.minSize)o.minSize=100;if(!o.snapOffset)o.snapOffset=30;if(!o.direction)o.direction="horizontal";if(!o.cursor)o.cursor="grabbing";if(o.direction=="horizontal"){l="width";c="clientWidth";f="clientX";g="left";p="gutter gutter-horizontal";z="paddingLeft";d="paddingRight"}else if(o.direction=="vertical"){l="height";c="clientHeight";f="clientY";g="top";p="gutter gutter-vertical";z="paddingTop";d="paddingBottom"}var b=function(e){if(!this.dragging&&o.onDragStart){o.onDragStart()}e.preventDefault();this.dragging=true;this.move=m.bind(this);this.stop=y.bind(this);t[i]("mouseup",this.stop);t[i]("touchend",this.stop);t[i]("touchcancel",this.stop);this.parent[i]("mousemove",this.move);this.parent[i]("touchmove",this.move);this.a[i]("selectstart",w);this.a[i]("dragstart",w);this.b[i]("selectstart",w);this.b[i]("dragstart",w);this.a.style.userSelect="none";this.a.style.webkitUserSelect="none";this.a.style.MozUserSelect="none";this.a.style.pointerEvents="none";this.a.style.cursor=o.cursor;this.b.style.userSelect="none";this.b.style.webkitUserSelect="none";this.b.style.MozUserSelect="none";this.b.style.pointerEvents="none";this.b.style.cursor=o.cursor;this.gutter.style.cursor=o.cursor;v.call(this)},y=function(){if(this.dragging&&o.onDragEnd){o.onDragEnd()}this.dragging=false;t[s]("mouseup",this.stop);t[s]("touchend",this.stop);t[s]("touchcancel",this.stop);this.parent[s]("mousemove",this.move);this.parent[s]("touchmove",this.move);delete this.stop;delete this.move;this.a[s]("selectstart",w);this.a[s]("dragstart",w);this.b[s]("selectstart",w);this.b[s]("dragstart",w);this.a.style.userSelect="";this.a.style.webkitUserSelect="";this.a.style.MozUserSelect="";this.a.style.pointerEvents="";this.a.style.cursor="";this.b.style.userSelect="";this.b.style.webkitUserSelect="";this.b.style.MozUserSelect="";this.b.style.pointerEvents="";this.b.style.cursor="";this.gutter.style.cursor=""},m=function(t){var e;if(!this.dragging)return;if("touches"in t){e=t.touches[0][f]-this.start}else{e=t[f]-this.start}if(e<=this.aMin+o.snapOffset){e=this.aMin}else if(e>=this.size-this.bMin-o.snapOffset){e=this.size-this.bMin}M.call(this,e);if(o.onDrag){o.onDrag()}},v=function(){var e=t.getComputedStyle(this.parent),i=this.parent[c]-parseFloat(e[z])-parseFloat(e[d]);this.size=this.a[n]()[l]+this.b[n]()[l]+this.aGutterSize+this.bGutterSize;this.percentage=Math.min(this.size/i*100,100);this.start=this.a[n]()[g]},M=function(t){this.a.style[l]=h+"("+t/this.size*this.percentage+"% - "+this.aGutterSize+"px)";this.b.style[l]=h+"("+(this.percentage-t/this.size*this.percentage)+"% - "+this.bGutterSize+"px)"},x=function(){if(this.a[n]()[l]<this.aMin){this.a.style[l]=this.aMin-this.aGutterSize+"px";this.b.style[l]=this.size-this.aMin-this.aGutterSize+"px"}else if(this.b[n]()[l]<this.bMin){this.a.style[l]=this.size-this.bMin-this.bGutterSize+"px";this.b.style[l]=this.bMin-this.bGutterSize+"px"}},G=function(){if(this.b[n]()[l]<this.bMin){this.a.style[l]=this.size-this.bMin-this.bGutterSize+"px";this.b.style[l]=this.bMin-this.bGutterSize+"px"}else if(this.a[n]()[l]<this.aMin){this.a.style[l]=this.aMin-this.aGutterSize+"px";this.b.style[l]=this.size-this.aMin-this.aGutterSize+"px"}},E=function(t){for(var e=0;e<t.length;e++){v.call(t[e]);x.call(t[e])}for(e=t.length-1;e>=0;e--){v.call(t[e]);G.call(t[e])}},w=function(){return false},U=t.document[e](a[0]).parentNode;if(!o.sizes){var D=100/a.length;o.sizes=[];for(u=0;u<a.length;u++){o.sizes.push(D)}}if(!Array.isArray(o.minSize)){var k=[];for(u=0;u<a.length;u++){k.push(o.minSize)}o.minSize=k}for(u=0;u<a.length;u++){var L=t.document[e](a[u]),O=u==1,B=u==a.length-1,F,A=o.gutterSize,C;if(u>0){C={a:t.document[e](a[u-1]),b:L,aMin:o.minSize[u-1],bMin:o.minSize[u],dragging:false,parent:U,isFirst:O,isLast:B,direction:o.direction};C.aGutterSize=o.gutterSize;C.bGutterSize=o.gutterSize;if(O){C.aGutterSize=o.gutterSize/2}if(B){C.bGutterSize=o.gutterSize/2}}if(!r){if(u>0){var N=t.document.createElement("div");N.className=p;N.style[l]=o.gutterSize+"px";N[i]("mousedown",b.bind(C));N[i]("touchstart",b.bind(C));U.insertBefore(N,L);C.gutter=N}if(u===0||u==a.length-1){A=o.gutterSize/2}if(typeof o.sizes[u]==="string"||o.sizes[u]instanceof String){F=o.sizes[u]}else{F=h+"("+o.sizes[u]+"% - "+A+"px)"}}else{if(typeof o.sizes[u]==="string"||o.sizes[u]instanceof String){F=o.sizes[u]}else{F=o.sizes[u]+"%"}}L.style[l]=F;if(u>0){S.push(C)}}E(S)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=a}exports.Split=a}else{t.Split=a}}).call(window);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>