Changeset 10019
- Timestamp:
- 12/03/2008 08:40:06 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/postbox.js
r10017 r10019 55 55 distance: 2, 56 56 tolerance: 'pointer', 57 toleranceMove: 'tolerance', 57 58 sort: function(e,ui) { 58 59 if ( $(document).width() - e.clientX < 300 ) { -
trunk/wp-includes/js/jquery/ui.sortable.js
r8601 r10019 1 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(b(B){b A(E,D){9 C=B.2Y.3Z&&B.2Y.3Y<3X;5(E.2X&&!C){d E.2X(D)}5(E.2W){d!!(E.2W(D)&16)}1T(D=D.1d){5(D==E){d V}}d w}B.3W("j.p",B.2j({},B.j.3V,{3U:b(){9 C=4.8;4.Q={};4.g.2a("j-p");4.2P();4.14=4.c.z?(/6|28/).1e(4.c[0].t.f("3T")):w;5(!(/(2V|1m|3S)/).1e(4.g.f("O"))){4.g.f("O","2V")}4.a=4.g.a();4.3R()},3Q:{},j:b(C){d{l:(C||4)["l"],r:(C||4)["r"]||B([]),O:(C||4)["O"],3P:(C||4)["18"],8:4.8,g:4.g,t:(C||4)["i"],3O:C?C.g:P}},v:b(F,E,C,D){B.j.1b.Y(4,F,[E,4.j(C)]);5(!D){4.g.2t(F=="1a"?F:"1a"+F,[E,4.j(C)],4.8[F])}},2i:b(E){9 C=(B.1N(4.8.c)?4.8.c.Y(4.g):B(4.8.c,4.g)).21(".j-p-l");9 D=[];E=E||{};C.1x(b(){9 F=(B(4).2S(E.3N||"2R")||"").3M(E.2T||(/(.+)[-=3L](.+)/));5(F){D.1y((E.2U||F[1])+"[]="+(E.2U&&E.2T?F[1]:F[2]))}});d D.3K("&")},2h:b(C){9 D=(B.1N(4.8.c)?4.8.c.Y(4.g):B(4.8.c,4.g)).21(".j-p-l");9 E=[];D.1x(b(){E.1y(B(4).2S(C||"2R"))});d E},2J:b(J){9 E=4.18.6,D=E+4.s.n,I=4.18.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1r=="2Q"||4.8.3J||(4.8.1r=="1X"&&4.s[4.14?"n":"o"]>J[4.14?"n":"o"])){d(I+4.a.q.7>K&&I+4.a.q.7<G&&E+4.a.q.6>F&&E+4.a.q.6<C)}X{d(F<E+(4.s.n/2)&&D-(4.s.n/2)<C&&K<I+(4.s.o/2)&&H-(4.s.o/2)<G)}},2w:b(J){9 E=4.18.6,D=E+4.s.n,I=4.18.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1r=="2Q"||(4.8.1r=="1X"&&4.s[4.14?"n":"o"]>J[4.14?"n":"o"])){5(!(I+4.a.q.7>K&&I+4.a.q.7<G&&E+4.a.q.6>F&&E+4.a.q.6<C)){d w}5(4.14){5(E+4.a.q.6>F&&E+4.a.q.6<F+J.n/2){d 2}5(E+4.a.q.6>F+J.n/2&&E+4.a.q.6<C){d 1}}X{5(I+4.a.q.7>K&&I+4.a.q.7<K+J.o/2){d 2}5(I+4.a.q.7>K+J.o/2&&I+4.a.q.7<G){d 1}}}X{5(!(F<E+(4.s.n/2)&&D-(4.s.n/2)<C&&K<I+(4.s.o/2)&&H-(4.s.o/2)<G)){d w}5(4.14){5(D>F&&E<F){d 2}5(E<C&&D>C){d 1}}X{5(H>K&&I<K){d 1}5(I<G&&H>G){d 2}}}d w},2P:b(){4.2b();4.1G()},2b:b(){4.c=[];4.e=[4];9 D=4.c;9 C=4;9 F=[[B.1N(4.8.c)?4.8.c.Y(4.g,P,{8:4.8,t:4.i}):B(4.8.c,4.g),4]];5(4.8.2e){R(9 G=4.8.2e.z-1;G>=0;G--){9 I=B(4.8.2e[G]);R(9 E=I.z-1;E>=0;E--){9 H=B.19(I[E],"p");5(H&&!H.8.2c){F.1y([B.1N(H.8.c)?H.8.c.Y(H.g):B(H.8.c,H.g),H]);4.e.1y(H)}}}}R(9 G=F.z-1;G>=0;G--){F[G][0].1x(b(){B.19(4,"p-t",F[G][1]);D.1y({t:B(4),2O:F[G][1],n:0,o:0,6:0,7:0})})}},1G:b(D){5(4.u){9 C=4.u.a();4.a.m={7:C.7+4.1v.7,6:C.6+4.1v.6}}R(9 F=4.c.z-1;F>=0;F--){5(4.c[F].2O!=4.1w&&4.1w&&4.c[F].t[0]!=4.i[0]){1I}9 E=4.8.2N?B(4.8.2N,4.c[F].t):4.c[F].t;5(!D){4.c[F].n=E[0].1Q;4.c[F].o=E[0].1S}9 G=E.a();4.c[F].6=G.6;4.c[F].7=G.7}5(4.8.2d&&4.8.2d.2M){4.8.2d.2M.Y(4)}X{R(9 F=4.e.z-1;F>=0;F--){9 G=4.e[F].g.a();4.e[F].Q.6=G.6;4.e[F].Q.7=G.7;4.e[F].Q.n=4.e[F].g.1L();4.e[F].Q.o=4.e[F].g.1K()}}},3I:b(){4.g.3H("j-p j-p-2c").2L("p").3G(".p");4.3F();R(9 C=4.c.z-1;C>=0;C--){4.c[C].t.2L("p-t")}},29:b(E){9 C=E||4,F=C.8;5(F.r.3E==3D){9 D=F.r;F.r={g:b(){d B("<2K></2K>").2a(D)[0]},1s:b(G,H){H.f(G.a()).f({n:G.1L(),o:G.1K()})}}}C.r=B(F.r.g.Y(C.g,C.i)).1D("U").f({O:"1m"});F.r.1s.Y(C.g,C.i,C.r)},2u:b(F){R(9 D=4.e.z-1;D>=0;D--){5(4.2J(4.e[D].Q)){5(!4.e[D].Q.1h){5(4.1w!=4.e[D]){9 I=3C;9 H=P;9 E=4.18[4.e[D].14?"6":"7"];R(9 C=4.c.z-1;C>=0;C--){5(!A(4.e[D].g[0],4.c[C].t[0])){1I}9 G=4.c[C][4.e[D].14?"6":"7"];5(1n.2I(G-E)<I){I=1n.2I(G-E);H=4.c[C]}}5(!H&&!4.8.2g){1I}5(4.r){4.r.1E()}5(4.e[D].8.r){4.e[D].29(4)}X{4.r=P}4.1w=4.e[D];H?4.1H(F,H,P,V):4.1H(F,P,4.e[D].g,V);4.v("23",F);4.e[D].v("23",F,4)}4.e[D].v("1h",F,4);4.e[D].Q.1h=1}}X{5(4.e[D].Q.1h){4.e[D].v("2m",F,4);4.e[D].Q.1h=0}}}},3B:b(G,F){5(4.8.2c||4.8.2v=="3A"){d w}4.2b();9 E=P,D=4,C=B(G.1M).2G().1x(b(){5(B.19(4,"p-t")==D){E=B(4);d w}});5(B.19(G.1M,"p-t")==D){E=B(G.1M)}5(!E){d w}5(4.8.2H&&!F){9 H=w;B(4.8.2H,E).3z("*").3y().1x(b(){5(4==G.1M){H=V}});5(!H){d w}}4.i=E;d V},3x:b(H,F,C){9 J=4.8;4.1w=4;4.1G();4.l=3w J.l=="b"?B(J.l.3v(4.g[0],[H,4.i])):4.i.1Y();5(!4.l.2G("U").z){B(J.1D!="m"?J.1D:4.i[0].1d)[0].2s(4.l[0])}4.l.f({O:"1m",1F:"3u"}).2a("j-p-l");4.W={6:(L(4.i.f("3t"),10)||0),7:(L(4.i.f("3s"),10)||0)};4.a=4.i.a();4.a={7:4.a.7-4.W.7,6:4.a.6-4.W.6};4.a.q={6:H.1i-4.a.6,7:H.1j-4.a.7};4.u=4.l.u();9 D=4.u.a();4.1v={7:(L(4.u.f("26"),10)||0),6:(L(4.u.f("27"),10)||0)};4.a.m={7:D.7+4.1v.7,6:D.6+4.1v.6};4.15=4.25(H);4.1Z={1t:4.i.1t()[0],m:4.i.m()[0]};4.s={n:4.l.1L(),o:4.l.1K()};5(J.r){4.29()}4.v("1p",H);4.s={n:4.l.1L(),o:4.l.1K()};5(J.13){5(J.13.6!=1J){4.a.q.6=J.13.6}5(J.13.28!=1J){4.a.q.6=4.s.n-J.13.28}5(J.13.7!=1J){4.a.q.7=J.13.7}5(J.13.2F!=1J){4.a.q.7=4.s.o-J.13.2F}}5(J.k){5(J.k=="m"){J.k=4.l[0].1d}5(J.k=="h"||J.k=="1c"){4.k=[0-4.a.m.6,0-4.a.m.7,B(J.k=="h"?h:1c).n()-4.a.m.6-4.s.n-4.W.6-(L(4.g.f("2E"),10)||0),(B(J.k=="h"?h:1c).o()||h.U.1d.2C)-4.a.m.7-4.s.o-4.W.7-(L(4.g.f("2B"),10)||0)]}5(!(/^(h|1c|m)$/).1e(J.k)){9 G=B(J.k)[0];9 I=B(J.k).a();4.k=[I.6+(L(B(G).f("27"),10)||0)-4.a.m.6,I.7+(L(B(G).f("26"),10)||0)-4.a.m.7,I.6+1n.2D(G.3r,G.1Q)-(L(B(G).f("27"),10)||0)-4.a.m.6-4.s.n-4.W.6-(L(4.i.f("2E"),10)||0),I.7+1n.2D(G.2C,G.1S)-(L(B(G).f("26"),10)||0)-4.a.m.7-4.s.o-4.W.7-(L(4.i.f("2B"),10)||0)]}}5(4.8.r!="1Y"){4.i.f("2k","3q")}5(!C){R(9 E=4.e.z-1;E>=0;E--){4.e[E].v("3p",H,4)}}5(B.j.17){B.j.17.3o=4}5(B.j.17&&!J.2p){B.j.17.3n(4,H)}4.2l=V;4.2z(H);d V},24:b(D,E){5(!E){E=4.O}9 C=D=="1m"?1:-1;d{7:(E.7+4.a.m.7*C-(4.u[0]==h.U?0:4.u[0].N)*C+4.W.7*C),6:(E.6+4.a.m.6*C-(4.u[0]==h.U?0:4.u[0].M)*C+4.W.6*C)}},25:b(F){9 G=4.8;9 C={7:(F.1j-4.a.q.7-4.a.m.7+(4.u[0]==h.U?0:4.u[0].N)),6:(F.1i-4.a.q.6-4.a.m.6+(4.u[0]==h.U?0:4.u[0].M))};5(!4.15){d C}5(4.k){5(C.6<4.k[0]){C.6=4.k[0]}5(C.7<4.k[1]){C.7=4.k[1]}5(C.6>4.k[2]){C.6=4.k[2]}5(C.7>4.k[3]){C.7=4.k[3]}}5(G.12){9 E=4.15.7+1n.2A((C.7-4.15.7)/G.12[1])*G.12[1];C.7=4.k?(!(E<4.k[1]||E>4.k[3])?E:(!(E<4.k[1])?E-G.12[1]:E+G.12[1])):E;9 D=4.15.6+1n.2A((C.6-4.15.6)/G.12[0])*G.12[0];C.6=4.k?(!(D<4.k[0]||D>4.k[2])?D:(!(D<4.k[0])?D-G.12[0]:D+G.12[0])):D}d C},2z:b(D){4.O=4.25(D);4.18=4.24("1m");B.j.1b.Y(4,"1a",[D,4.j()]);4.18=4.24("1m");4.l[0].2y.6=4.O.6+"2x";4.l[0].2y.7=4.O.7+"2x";R(9 C=4.c.z-1;C>=0;C--){9 E=4.2w(4.c[C]);5(!E){1I}5(4.c[C].t[0]!=4.i[0]&&4.i[E==1?"3m":"1t"]()[0]!=4.c[C].t[0]&&!A(4.i[0],4.c[C].t[0])&&(4.8.2v=="3l-3k"?!A(4.g[0],4.c[C].t[0]):V)){4.2r=E==1?"2q":"3j";4.1H(D,4.c[C]);4.v("23",D);3i}}4.2u(D);5(B.j.17){B.j.17.3h(4,D)}4.g.2t("1a",[D,4.j()],4.8["1a"]);d w},1H:b(H,G,D,F){D?D[0].2s(4.i[0]):G.t[0].1d.3g(4.i[0],(4.2r=="2q"?G.t[0]:G.t[0].3f));4.1u=4.1u?++4.1u:1;9 E=4,C=4.1u;1c.3e(b(){5(C==E.1u){E.1G(!F)}},0);5(4.8.r){4.8.r.1s.Y(4.g,4.i,4.r)}},3d:b(E,D){5(B.j.17&&!4.8.2p){B.j.17.3c(4,E)}5(4.8.22){9 C=4;9 F=C.i.a();5(C.r){C.r.2o({1f:"3b"},(L(4.8.22,10)||2n)-3a)}B(4.l).2o({6:F.6-4.a.m.6-C.W.6+(4.u[0]==h.U?0:4.u[0].M),7:F.7-4.a.m.7-C.W.7+(4.u[0]==h.U?0:4.u[0].N)},L(4.8.22,10)||2n,b(){C.1F(E)})}X{4.1F(E,D)}d w},1F:b(E,D){5(4.1Z.1t!=4.i.1t().21(".j-p-l")[0]||4.1Z.m!=4.i.m()[0]){4.v("1s",E,P,D)}5(!A(4.g[0],4.i[0])){4.v("1E",E,P,D);R(9 C=4.e.z-1;C>=0;C--){5(A(4.e[C].g[0],4.i[0])){4.e[C].v("1s",E,4,D);4.e[C].v("39",E,4,D)}}}R(9 C=4.e.z-1;C>=0;C--){4.e[C].v("38",E,4,D);5(4.e[C].Q.1h){4.e[C].v("2m",E,4);4.e[C].Q.1h=0}}4.2l=w;5(4.37){4.v("1q",E,P,D);d w}B(4.i).f("2k","");5(4.r){4.r.1E()}4.l.1E();4.l=P;4.v("1q",E,P,D);d V}}));B.2j(B.j.p,{36:"2i 2h",35:{l:"1Y",1r:"1X",34:1,33:0,1k:V,11:20,Z:20,32:":31",c:"> *",1g:30,2g:V,1D:"m"}});B.j.1b.1o("p","1l",{1p:b(E,D){9 C=B("U");5(C.f("1l")){D.8.1W=C.f("1l")}C.f("1l",D.8.1l)},1q:b(D,C){5(C.8.1W){B("U").f("1l",C.8.1W)}}});B.j.1b.1o("p","1g",{1p:b(E,D){9 C=D.l;5(C.f("1g")){D.8.1V=C.f("1g")}C.f("1g",D.8.1g)},1q:b(D,C){5(C.8.1V){B(C.l).f("1g",C.8.1V)}}});B.j.1b.1o("p","1f",{1p:b(E,D){9 C=D.l;5(C.f("1f")){D.8.1U=C.f("1f")}C.f("1f",D.8.1f)},1q:b(D,C){5(C.8.1U){B(C.l).f("1f",C.8.1U)}}});B.j.1b.1o("p","1k",{1p:b(E,D){9 F=D.8;9 C=B(4).19("p");C.T=b(G){2f{5(/1C|1k/.1e(G.f("1B"))||(/1C|1k/).1e(G.f("1B-y"))){d G}G=G.m()}1T(G[0].1d);d B(h)}(C.i);C.S=b(G){2f{5(/1C|1k/.1e(G.f("1B"))||(/1C|1k/).1e(G.f("1B-x"))){d G}G=G.m()}1T(G[0].1d);d B(h)}(C.i);5(C.T[0]!=h&&C.T[0].1A!="1z"){C.1R=C.T.a()}5(C.S[0]!=h&&C.S[0].1A!="1z"){C.1P=C.S.a()}},1a:b(E,D){9 F=D.8;9 C=B(4).19("p");5(C.T[0]!=h&&C.T[0].1A!="1z"){5((C.1R.7+C.T[0].1S)-E.1j<F.11){C.T[0].N=C.T[0].N+F.Z}5(E.1j-C.1R.7<F.11){C.T[0].N=C.T[0].N-F.Z}}X{5(E.1j-B(h).N()<F.11){B(h).N(B(h).N()-F.Z)}5(B(1c).o()-(E.1j-B(h).N())<F.11){B(h).N(B(h).N()+F.Z)}}5(C.S[0]!=h&&C.S[0].1A!="1z"){5((C.1P.6+C.S[0].1Q)-E.1i<F.11){C.S[0].M=C.S[0].M+F.Z}5(E.1i-C.1P.6<F.11){C.S[0].M=C.S[0].M-F.Z}}X{5(E.1i-B(h).M()<F.11){B(h).M(B(h).M()-F.Z)}5(B(1c).n()-(E.1i-B(h).M())<F.11){B(h).M(B(h).M()+F.Z)}}}});B.j.1b.1o("p","1O",{1a:b(E,D){9 C=B(4).19("p");5(D.8.1O=="y"){C.O.6=C.15.6}5(D.8.1O=="x"){C.O.7=C.15.7}}})})(2Z)',62,248,'||||this|if|left|top|options|var|offset|function|items|return|containers|css|element|document|currentItem|ui|containment|helper|parent|width|height|sortable|click|placeholder|helperProportions|item|offsetParent|propagate|false|||length||||||||||||parseInt|scrollLeft|scrollTop|position|null|containerCache|for|overflowX|overflowY|body|true|margins|else|call|scrollSpeed||scrollSensitivity|grid|cursorAt|floating|originalPosition||ddmanager|positionAbs|data|sort|plugin|window|parentNode|test|opacity|zIndex|over|pageX|pageY|scroll|cursor|absolute|Math|add|start|stop|tolerance|update|prev|counter|offsetParentBorders|currentContainer|each|push|HTML|tagName|overflow|auto|appendTo|remove|clear|refreshPositions|rearrange|continue|undefined|outerHeight|outerWidth|target|isFunction|axis|overflowXOffset|offsetWidth|overflowYOffset|offsetHeight|while|_opacity|_zIndex|_cursor|guess|clone|domPosition||not|revert|change|convertPositionTo|generatePosition|borderTopWidth|borderLeftWidth|right|createPlaceholder|addClass|refreshItems|disabled|custom|connectWith|do|dropOnEmpty|toArray|serialize|extend|visibility|dragging|out|500|animate|dropBehaviour|down|direction|appendChild|triggerHandler|contactContainers|type|intersectsWithEdge|px|style|mouseDrag|round|marginBottom|scrollHeight|max|marginRight|bottom|parents|handle|abs|intersectsWith|div|removeData|refreshContainers|toleranceElement|instance|refresh|pointer|id|attr|expression|key|relative|compareDocumentPosition|contains|browser|jQuery|1000|input|cancel|delay|distance|defaults|getter|cancelHelperRemoval|deactivate|receive|50|hide|drop|mouseStop|setTimeout|nextSibling|insertBefore|drag|break|up|dynamic|semi|next|prepareOffsets|current|activate|hidden|scrollWidth|marginTop|marginLeft|both|apply|typeof|mouseStart|andSelf|find|static|mouseCapture|10000|String|constructor|mouseDestroy|unbind|removeClass|destroy|forcePointerForContainers|join|_|match|attribute|sender|absolutePosition|plugins|mouseInit|fixed|float|init|mouse|widget|522|version|safari'.split('|'),0,{})) 2 1 /* 2 * jQuery UI Sortable 3 * 4 * Copyright (c) 2008 Paul Bakaus 5 * Dual licensed under the MIT (MIT-LICENSE.txt) 6 * and GPL (GPL-LICENSE.txt) licenses. 7 * 8 * http://docs.jquery.com/UI/Sortables 9 * 10 * Depends: 11 * ui.core.js 12 */ 13 (function($) { 14 15 function contains(a, b) { 16 var safari2 = $.browser.safari && $.browser.version < 522; 17 if (a.contains && !safari2) { 18 return a.contains(b); 19 } 20 if (a.compareDocumentPosition) 21 return !!(a.compareDocumentPosition(b) & 16); 22 while (b = b.parentNode) 23 if (b == a) return true; 24 return false; 25 }; 26 27 $.widget("ui.sortable", $.extend({}, $.ui.mouse, { 28 init: function() { 29 30 var o = this.options; 31 this.containerCache = {}; 32 this.element.addClass("ui-sortable"); 33 34 //Get the items 35 this.refresh(); 36 37 //Let's determine if the items are floating 38 this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false; 39 40 //Let's determine the parent's offset 41 if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative'); 42 this.offset = this.element.offset(); 43 44 //Initialize mouse events for interaction 45 this.mouseInit(); 46 47 }, 48 plugins: {}, 49 ui: function(inst) { 50 return { 51 helper: (inst || this)["helper"], 52 placeholder: (inst || this)["placeholder"] || $([]), 53 position: (inst || this)["position"], 54 absolutePosition: (inst || this)["positionAbs"], 55 options: this.options, 56 element: this.element, 57 item: (inst || this)["currentItem"], 58 sender: inst ? inst.element : null 59 }; 60 }, 61 propagate: function(n,e,inst, noPropagation) { 62 $.ui.plugin.call(this, n, [e, this.ui(inst)]); 63 if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]); 64 }, 65 serialize: function(o) { 66 67 var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself 68 var str = []; o = o || {}; 69 70 items.each(function() { 71 var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); 72 if(res) str.push((o.key || res[1])+'[]='+(o.key && o.expression ? res[1] : res[2])); 73 }); 74 75 return str.join('&'); 76 77 }, 78 toArray: function(attr) { 79 80 var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself 81 var ret = []; 82 83 items.each(function() { ret.push($(this).attr(attr || 'id')); }); 84 return ret; 85 86 }, 87 /* Be careful with the following core functions */ 88 intersectsWith: function(item) { 89 90 var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, 91 y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height; 92 var l = item.left, r = l + item.width, 93 t = item.top, b = t + item.height; 94 95 if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { 96 return (y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r); 97 } else { 98 99 return (l < x1 + (this.helperProportions.width / 2) // Right Half 100 && x2 - (this.helperProportions.width / 2) < r // Left Half 101 && t < y1 + (this.helperProportions.height / 2) // Bottom Half 102 && y2 - (this.helperProportions.height / 2) < b ); // Top Half 103 104 } 105 106 }, 107 intersectsWithEdge: function(item) { 108 var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, 109 y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height; 110 var l = item.left, r = l + item.width, 111 t = item.top, b = t + item.height; 112 113 if(this.options.toleranceMove == "pointer" || (this.options.toleranceMove == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) { 114 115 if(!(y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r)) return false; 116 117 if(this.floating) { 118 if(x1 + this.offset.click.left > l && x1 + this.offset.click.left < l + item.width/2) return 2; 119 if(x1 + this.offset.click.left > l+item.width/2 && x1 + this.offset.click.left < r) return 1; 120 } else { 121 if(y1 + this.offset.click.top > t && y1 + this.offset.click.top < t + item.height/2) return 2; 122 if(y1 + this.offset.click.top > t+item.height/2 && y1 + this.offset.click.top < b) return 1; 123 } 124 125 } else { 126 127 if (!(l < x1 + (this.helperProportions.width / 2) // Right Half 128 && x2 - (this.helperProportions.width / 2) < r // Left Half 129 && t < y1 + (this.helperProportions.height / 2) // Bottom Half 130 && y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half 131 132 if(this.floating) { 133 if(x2 > l && x1 < l) return 2; //Crosses left edge 134 if(x1 < r && x2 > r) return 1; //Crosses right edge 135 } else { 136 if(y2 > t && y1 < t) return 1; //Crosses top edge 137 if(y1 < b && y2 > b) return 2; //Crosses bottom edge 138 } 139 140 } 141 142 return false; 143 144 }, 145 refresh: function() { 146 this.refreshItems(); 147 this.refreshPositions(); 148 }, 149 refreshItems: function() { 150 151 this.items = []; 152 this.containers = [this]; 153 var items = this.items; 154 var self = this; 155 var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]]; 156 157 if(this.options.connectWith) { 158 for (var i = this.options.connectWith.length - 1; i >= 0; i--){ 159 var cur = $(this.options.connectWith[i]); 160 for (var j = cur.length - 1; j >= 0; j--){ 161 var inst = $.data(cur[j], 'sortable'); 162 if(inst && !inst.options.disabled) { 163 queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element), inst]); 164 this.containers.push(inst); 165 } 166 }; 167 }; 168 } 169 170 for (var i = queries.length - 1; i >= 0; i--){ 171 queries[i][0].each(function() { 172 $.data(this, 'sortable-item', queries[i][1]); // Data for target checking (mouse manager) 173 items.push({ 174 item: $(this), 175 instance: queries[i][1], 176 width: 0, height: 0, 177 left: 0, top: 0 178 }); 179 }); 180 }; 181 182 }, 183 refreshPositions: function(fast) { 184 185 //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change 186 if(this.offsetParent) { 187 var po = this.offsetParent.offset(); 188 this.offset.parent = { top: po.top + this.offsetParentBorders.top, left: po.left + this.offsetParentBorders.left }; 189 } 190 191 for (var i = this.items.length - 1; i >= 0; i--){ 192 193 //We ignore calculating positions of all connected containers when we're not over them 194 if(this.items[i].instance != this.currentContainer && this.currentContainer && this.items[i].item[0] != this.currentItem[0]) 195 continue; 196 197 var t = this.options.toleranceElement ? $(this.options.toleranceElement, this.items[i].item) : this.items[i].item; 198 199 if(!fast) { 200 this.items[i].width = t[0].offsetWidth; 201 this.items[i].height = t[0].offsetHeight; 202 } 203 204 var p = t.offset(); 205 this.items[i].left = p.left; 206 this.items[i].top = p.top; 207 208 }; 209 210 if(this.options.custom && this.options.custom.refreshContainers) { 211 this.options.custom.refreshContainers.call(this); 212 } else { 213 for (var i = this.containers.length - 1; i >= 0; i--){ 214 var p =this.containers[i].element.offset(); 215 this.containers[i].containerCache.left = p.left; 216 this.containers[i].containerCache.top = p.top; 217 this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); 218 this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); 219 }; 220 } 221 222 }, 223 destroy: function() { 224 this.element 225 .removeClass("ui-sortable ui-sortable-disabled") 226 .removeData("sortable") 227 .unbind(".sortable"); 228 this.mouseDestroy(); 229 230 for ( var i = this.items.length - 1; i >= 0; i-- ) 231 this.items[i].item.removeData("sortable-item"); 232 }, 233 createPlaceholder: function(that) { 234 235 var self = that || this, o = self.options; 236 237 if(o.placeholder.constructor == String) { 238 var className = o.placeholder; 239 o.placeholder = { 240 element: function() { 241 return $('<div></div>').addClass(className)[0]; 242 }, 243 update: function(i, p) { 244 p.css(i.offset()).css({ width: i.outerWidth(), height: i.outerHeight() }); 245 } 246 }; 247 } 248 249 self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)).appendTo('body').css({ position: 'absolute' }); 250 o.placeholder.update.call(self.element, self.currentItem, self.placeholder); 251 }, 252 contactContainers: function(e) { 253 for (var i = this.containers.length - 1; i >= 0; i--){ 254 255 if(this.intersectsWith(this.containers[i].containerCache)) { 256 if(!this.containers[i].containerCache.over) { 257 258 259 if(this.currentContainer != this.containers[i]) { 260 261 //When entering a new container, we will find the item with the least distance and append our item near it 262 var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top']; 263 for (var j = this.items.length - 1; j >= 0; j--) { 264 if(!contains(this.containers[i].element[0], this.items[j].item[0])) continue; 265 var cur = this.items[j][this.containers[i].floating ? 'left' : 'top']; 266 if(Math.abs(cur - base) < dist) { 267 dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; 268 } 269 } 270 271 if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled 272 continue; 273 274 //We also need to exchange the placeholder 275 if(this.placeholder) this.placeholder.remove(); 276 if(this.containers[i].options.placeholder) { 277 this.containers[i].createPlaceholder(this); 278 } else { 279 this.placeholder = null;; 280 } 281 282 this.currentContainer = this.containers[i]; 283 itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance, null, true) : this.rearrange(e, null, this.containers[i].element, true); 284 this.propagate("change", e); //Call plugins and callbacks 285 this.containers[i].propagate("change", e, this); //Call plugins and callbacks 286 287 } 288 289 this.containers[i].propagate("over", e, this); 290 this.containers[i].containerCache.over = 1; 291 } 292 } else { 293 if(this.containers[i].containerCache.over) { 294 this.containers[i].propagate("out", e, this); 295 this.containers[i].containerCache.over = 0; 296 } 297 } 298 299 }; 300 }, 301 mouseCapture: function(e, overrideHandle) { 302 303 if(this.options.disabled || this.options.type == 'static') return false; 304 305 //We have to refresh the items data once first 306 this.refreshItems(); 307 308 //Find out if the clicked node (or one of its parents) is a actual item in this.items 309 var currentItem = null, self = this, nodes = $(e.target).parents().each(function() { 310 if($.data(this, 'sortable-item') == self) { 311 currentItem = $(this); 312 return false; 313 } 314 }); 315 if($.data(e.target, 'sortable-item') == self) currentItem = $(e.target); 316 317 if(!currentItem) return false; 318 if(this.options.handle && !overrideHandle) { 319 var validHandle = false; 320 321 $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == e.target) validHandle = true; }); 322 if(!validHandle) return false; 323 } 324 325 this.currentItem = currentItem; 326 return true; 327 328 }, 329 mouseStart: function(e, overrideHandle, noActivation) { 330 331 var o = this.options; 332 this.currentContainer = this; 333 334 //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture 335 this.refreshPositions(); 336 337 //Create and append the visible helper 338 this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone(); 339 if (!this.helper.parents('body').length) $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(this.helper[0]); //Add the helper to the DOM if that didn't happen already 340 this.helper.css({ position: 'absolute', clear: 'both' }).addClass('ui-sortable-helper'); //Position it absolutely and add a helper class 341 342 /* 343 * - Position generation - 344 * This block generates everything position related - it's the core of draggables. 345 */ 346 347 this.margins = { //Cache the margins 348 left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), 349 top: (parseInt(this.currentItem.css("marginTop"),10) || 0) 350 }; 351 352 this.offset = this.currentItem.offset(); //The element's absolute position on the page 353 this.offset = { //Substract the margins from the element's absolute offset 354 top: this.offset.top - this.margins.top, 355 left: this.offset.left - this.margins.left 356 }; 357 358 this.offset.click = { //Where the click happened, relative to the element 359 left: e.pageX - this.offset.left, 360 top: e.pageY - this.offset.top 361 }; 362 363 this.offsetParent = this.helper.offsetParent(); //Get the offsetParent and cache its position 364 var po = this.offsetParent.offset(); 365 366 this.offsetParentBorders = { 367 top: (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), 368 left: (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) 369 }; 370 this.offset.parent = { //Store its position plus border 371 top: po.top + this.offsetParentBorders.top, 372 left: po.left + this.offsetParentBorders.left 373 }; 374 375 this.originalPosition = this.generatePosition(e); //Generate the original position 376 this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //Cache the former DOM position 377 378 //If o.placeholder is used, create a new element at the given position with the class 379 this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size 380 if(o.placeholder) this.createPlaceholder(); 381 382 //Call plugins and callbacks 383 this.propagate("start", e); 384 this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size 385 386 if(o.cursorAt) { 387 if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left; 388 if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right; 389 if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top; 390 if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom; 391 } 392 393 /* 394 * - Position constraining - 395 * Here we prepare position constraining like grid and containment. 396 */ 397 398 if(o.containment) { 399 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; 400 if(o.containment == 'document' || o.containment == 'window') this.containment = [ 401 0 - this.offset.parent.left, 402 0 - this.offset.parent.top, 403 $(o.containment == 'document' ? document : window).width() - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0), 404 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0) 405 ]; 406 407 if(!(/^(document|window|parent)$/).test(o.containment)) { 408 var ce = $(o.containment)[0]; 409 var co = $(o.containment).offset(); 410 411 this.containment = [ 412 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left, 413 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top, 414 co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.currentItem.css("marginRight"),10) || 0), 415 co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.currentItem.css("marginBottom"),10) || 0) 416 ]; 417 } 418 } 419 420 //Set the original element visibility to hidden to still fill out the white space 421 if(this.options.placeholder != 'clone') 422 this.currentItem.css('visibility', 'hidden'); 423 424 //Post 'activate' events to possible containers 425 if(!noActivation) { 426 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); } 427 } 428 429 //Prepare possible droppables 430 if($.ui.ddmanager) $.ui.ddmanager.current = this; 431 if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e); 432 433 this.dragging = true; 434 435 this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position 436 return true; 437 438 439 }, 440 convertPositionTo: function(d, pos) { 441 if(!pos) pos = this.position; 442 var mod = d == "absolute" ? 1 : -1; 443 return { 444 top: ( 445 pos.top // the calculated relative position 446 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) 447 - (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position 448 + this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods) 449 ), 450 left: ( 451 pos.left // the calculated relative position 452 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) 453 - (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position 454 + this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods) 455 ) 456 }; 457 }, 458 generatePosition: function(e) { 459 460 var o = this.options; 461 var position = { 462 top: ( 463 e.pageY // The absolute mouse position 464 - this.offset.click.top // Click offset (relative to the element) 465 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) 466 + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed 467 ), 468 left: ( 469 e.pageX // The absolute mouse position 470 - this.offset.click.left // Click offset (relative to the element) 471 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) 472 + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed 473 ) 474 }; 475 476 if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options 477 478 /* 479 * - Position constraining - 480 * Constrain the position to a mix of grid, containment. 481 */ 482 if(this.containment) { 483 if(position.left < this.containment[0]) position.left = this.containment[0]; 484 if(position.top < this.containment[1]) position.top = this.containment[1]; 485 if(position.left > this.containment[2]) position.left = this.containment[2]; 486 if(position.top > this.containment[3]) position.top = this.containment[3]; 487 } 488 489 if(o.grid) { 490 var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1]; 491 position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; 492 493 var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0]; 494 position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; 495 } 496 497 return position; 498 }, 499 mouseDrag: function(e) { 500 501 //Compute the helpers position 502 this.position = this.generatePosition(e); 503 this.positionAbs = this.convertPositionTo("absolute"); 504 505 //Call the internal plugins 506 $.ui.plugin.call(this, "sort", [e, this.ui()]); 507 508 //Regenerate the absolute position used for position checks 509 this.positionAbs = this.convertPositionTo("absolute"); 510 511 //Set the helper's position 512 this.helper[0].style.left = this.position.left+'px'; 513 this.helper[0].style.top = this.position.top+'px'; 514 515 //Rearrange 516 for (var i = this.items.length - 1; i >= 0; i--) { 517 var intersection = this.intersectsWithEdge(this.items[i]); 518 if(!intersection) continue; 519 520 if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself 521 && this.currentItem[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before 522 && !contains(this.currentItem[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked 523 && (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true) 524 ) { 525 526 this.direction = intersection == 1 ? "down" : "up"; 527 this.rearrange(e, this.items[i]); 528 this.propagate("change", e); //Call plugins and callbacks 529 break; 530 } 531 } 532 533 //Post events to containers 534 this.contactContainers(e); 535 536 //Interconnect with droppables 537 if($.ui.ddmanager) $.ui.ddmanager.drag(this, e); 538 539 //Call callbacks 540 this.element.triggerHandler("sort", [e, this.ui()], this.options["sort"]); 541 542 return false; 543 544 }, 545 rearrange: function(e, i, a, hardRefresh) { 546 a ? a[0].appendChild(this.currentItem[0]) : i.item[0].parentNode.insertBefore(this.currentItem[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); 547 548 //Various things done here to improve the performance: 549 // 1. we create a setTimeout, that calls refreshPositions 550 // 2. on the instance, we have a counter variable, that get's higher after every append 551 // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same 552 // 4. this lets only the last addition to the timeout stack through 553 this.counter = this.counter ? ++this.counter : 1; 554 var self = this, counter = this.counter; 555 556 window.setTimeout(function() { 557 if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove 558 },0); 559 560 if(this.options.placeholder) 561 this.options.placeholder.update.call(this.element, this.currentItem, this.placeholder); 562 }, 563 mouseStop: function(e, noPropagation) { 564 565 //If we are using droppables, inform the manager about the drop 566 if ($.ui.ddmanager && !this.options.dropBehaviour) 567 $.ui.ddmanager.drop(this, e); 568 569 if(this.options.revert) { 570 var self = this; 571 var cur = self.currentItem.offset(); 572 573 //Also animate the placeholder if we have one 574 if(self.placeholder) self.placeholder.animate({ opacity: 'hide' }, (parseInt(this.options.revert, 10) || 500)-50); 575 576 $(this.helper).animate({ 577 left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), 578 top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) 579 }, parseInt(this.options.revert, 10) || 500, function() { 580 self.clear(e); 581 }); 582 } else { 583 this.clear(e, noPropagation); 584 } 585 586 return false; 587 588 }, 589 clear: function(e, noPropagation) { 590 591 if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this.propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed 592 if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element 593 this.propagate("remove", e, null, noPropagation); 594 for (var i = this.containers.length - 1; i >= 0; i--){ 595 if(contains(this.containers[i].element[0], this.currentItem[0])) { 596 this.containers[i].propagate("update", e, this, noPropagation); 597 this.containers[i].propagate("receive", e, this, noPropagation); 598 } 599 }; 600 }; 601 602 //Post events to containers 603 for (var i = this.containers.length - 1; i >= 0; i--){ 604 this.containers[i].propagate("deactivate", e, this, noPropagation); 605 if(this.containers[i].containerCache.over) { 606 this.containers[i].propagate("out", e, this); 607 this.containers[i].containerCache.over = 0; 608 } 609 } 610 611 this.dragging = false; 612 if(this.cancelHelperRemoval) { 613 this.propagate("stop", e, null, noPropagation); 614 return false; 615 } 616 617 $(this.currentItem).css('visibility', ''); 618 if(this.placeholder) this.placeholder.remove(); 619 this.helper.remove(); this.helper = null; 620 this.propagate("stop", e, null, noPropagation); 621 622 return true; 623 624 } 625 })); 626 627 $.extend($.ui.sortable, { 628 getter: "serialize toArray", 629 defaults: { 630 helper: "clone", 631 tolerance: "guess", 632 toleranceMove: "guess", 633 distance: 1, 634 delay: 0, 635 scroll: true, 636 scrollSensitivity: 20, 637 scrollSpeed: 20, 638 cancel: ":input", 639 items: '> *', 640 zIndex: 1000, 641 dropOnEmpty: true, 642 appendTo: "parent" 643 } 644 }); 645 646 /* 647 * Sortable Extensions 648 */ 649 650 $.ui.plugin.add("sortable", "cursor", { 651 start: function(e, ui) { 652 var t = $('body'); 653 if (t.css("cursor")) ui.options._cursor = t.css("cursor"); 654 t.css("cursor", ui.options.cursor); 655 }, 656 stop: function(e, ui) { 657 if (ui.options._cursor) $('body').css("cursor", ui.options._cursor); 658 } 659 }); 660 661 $.ui.plugin.add("sortable", "zIndex", { 662 start: function(e, ui) { 663 var t = ui.helper; 664 if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex"); 665 t.css('zIndex', ui.options.zIndex); 666 }, 667 stop: function(e, ui) { 668 if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex); 669 } 670 }); 671 672 $.ui.plugin.add("sortable", "opacity", { 673 start: function(e, ui) { 674 var t = ui.helper; 675 if(t.css("opacity")) ui.options._opacity = t.css("opacity"); 676 t.css('opacity', ui.options.opacity); 677 }, 678 stop: function(e, ui) { 679 if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity); 680 } 681 }); 682 683 $.ui.plugin.add("sortable", "scroll", { 684 start: function(e, ui) { 685 var o = ui.options; 686 var i = $(this).data("sortable"); 687 688 i.overflowY = function(el) { 689 do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode); 690 return $(document); 691 }(i.currentItem); 692 i.overflowX = function(el) { 693 do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode); 694 return $(document); 695 }(i.currentItem); 696 697 if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset(); 698 if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset(); 699 700 }, 701 sort: function(e, ui) { 702 703 var o = ui.options; 704 var i = $(this).data("sortable"); 705 706 if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') { 707 if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity) 708 i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed; 709 if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity) 710 i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed; 711 } else { 712 if(e.pageY - $(document).scrollTop() < o.scrollSensitivity) 713 $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); 714 if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) 715 $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); 716 } 717 718 if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') { 719 if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity) 720 i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed; 721 if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity) 722 i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed; 723 } else { 724 if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity) 725 $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); 726 if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) 727 $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); 728 } 729 730 } 731 }); 732 733 $.ui.plugin.add("sortable", "axis", { 734 sort: function(e, ui) { 735 736 var i = $(this).data("sortable"); 737 738 if(ui.options.axis == "y") i.position.left = i.originalPosition.left; 739 if(ui.options.axis == "x") i.position.top = i.originalPosition.top; 740 741 } 742 }); 743 744 })(jQuery); -
trunk/wp-includes/script-loader.php
r10017 r10019 133 133 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.2' ); 134 134 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.2' ); 135 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2 ' );135 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.2b' ); 136 136 $scripts->add( 'jquery-ui-draggable', '/wp-includes/js/jquery/ui.draggable.js', array('jquery-ui-core'), '1.5.2' ); 137 137 $scripts->add( 'jquery-ui-resizable', '/wp-includes/js/jquery/ui.resizable.js', array('jquery-ui-core'), '1.5.2' ); … … 164 164 $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20081117' ); 165 165 $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); 166 $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '2008120 2' );166 $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081203' ); 167 167 $scripts->localize( 'postbox', 'postboxL10n', array( 168 168 'requestFile' => admin_url('admin-ajax.php')
Note: See TracChangeset
for help on using the changeset viewer.