Changeset 8064
- Timestamp:
- 06/09/2008 07:37:55 PM (16 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/jquery/ui.core.js
r8032 r8064 1 /* 2 * jQuery UI @VERSION 3 * 4 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com) 5 * Dual licensed under the MIT (MIT-LICENSE.txt) 6 * and GPL (GPL-LICENSE.txt) licenses. 7 * 8 * http://docs.jquery.com/UI 9 * 10 * $Id: ui.core.js 5587 2008-05-13 19:56:42Z scott.gonzalez $ 11 */ 12 ;(function($) { 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}('(3(C){C.8={2t:{1o:3(E,F,H){6 G=C.8[E].m;1v(6 D 2s H){G.u[D]=G.u[D]||[];G.u[D].2r([F,H[D]])}},1n:3(D,F,E){6 H=D.u[F];5(!H){4}1v(6 G=0;G<H.2q;G++){5(D.a[H[G][0]]){H[G][1].r(D.c,E)}}}},n:{},f:3(D){5(C.8.n[D]){4 C.8.n[D]}6 E=C(\'<2p 2o="8-2n-2m">\').1i(D).f({2l:"2k",11:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.n[D]=!!((!(/2f|2e/).h(E.f("2d"))||(/^[1-9]/).h(E.f("2c"))||(/^[1-9]/).h(E.f("2b"))||!(/1r/).h(E.f("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.f("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.n[D]},23:3(D){D.j="1g";D.1q=3(){4 7};5(D.t){D.t.1p="1r"}},22:3(D){D.j="21";D.1q=3(){4 d};5(D.t){D.t.1p=""}},20:3(G,E){6 D=/11/.h(E||"11")?"1Z":"1Y",F=7;5(G[D]>0){4 d}G[D]=1;F=G[D]>0?d:7;G[D]=0;4 F}};6 B=C.Z.q;C.Z.q=3(){C("*",2).1o(2).1X("q");4 B.r(2,1m)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(U D=="T"?D.10(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.X=3(E,D){6 F=E.10(".")[0];E=E.10(".")[1];C.Z[E]=3(J){6 H=(U J=="T"),I=1U.m.1T.1n(1m,1);5(H&&A(F,E,J)){6 G=C.Y(2[0],E);4(G?G[J].r(G,I):1S)}4 2.1R(3(){6 K=C.Y(2,E);5(H&&K&&C.1Q(K[J])){K[J].r(K,I)}1P{5(!H){C.Y(2,E,1O C[F][E](2,J))}}})};C[F][E]=3(I,H){6 G=2;2.e=E;2.1h=F+"-"+E;2.a=C.1l({k:7},C[F][E].13,H);2.c=C(I).g("l."+E,3(L,J,K){4 G.l(J,K)}).g("W."+E,3(K,J){4 G.W(J)}).g("q",3(){4 G.1j()});2.1k()};C[F][E].m=C.1l({},C.X.m,D)};C.X.m={1k:3(){},1j:3(){2.c.1N(2.e)},W:3(D){4 2.a[D]},l:3(D,E){2.a[D]=E;5(D=="k"){2.c[E?"1i":"1M"](2.1h+"-k")}},1L:3(){2.l("k",7)},1K:3(){2.l("k",d)}};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1e(E)});5(C.S.R){2.1f=2.c.V("j");2.c.V("j","1g")}2.1H=7},1G:3(){2.c.P("."+2.e);(C.S.R&&2.c.V("j",2.1f))},1e:3(F){(2.b&&2.i(F));2.p=F;6 E=2,G=(F.1F==1),D=(U 2.a.w=="T"?C(F.1E).1D(2.a.w):7);5(!G||D||!2.15(F)){4 d}2.o=!2.a.v;5(!2.o){2.1C=1B(3(){E.o=d},2.a.v)}5(2.N(F)&&2.z(F)){2.b=(2.y(F)!==7);5(!2.b){F.1A();4 d}}2.Q=3(H){4 E.1d(H)};2.O=3(H){4 E.i(H)};C(1c).g("1b."+2.e,2.Q).g("1a."+2.e,2.O);4 7},1d:3(D){5(C.S.R&&!D.1z){4 2.i(D)}5(2.b){2.x(D);4 7}5(2.N(D)&&2.z(D)){2.b=(2.y(2.p,D)!==7);(2.b?2.x(D):2.i(D))}4!2.b},i:3(D){C(1c).P("1b."+2.e,2.Q).P("1a."+2.e,2.O);5(2.b){2.b=7;2.16(D)}4 7},N:3(D){4(M.1y(M.18(2.p.19-D.19),M.18(2.p.17-D.17))>=2.a.12)},z:3(D){4 2.o},y:3(D){},x:3(D){},16:3(D){},15:3(D){4 d}};C.8.14.13={w:1x,12:1,v:0}})(1w)',62,154,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|true|widgetName|css|bind|test|mouseUp|unselectable|disabled|setData|prototype|cssCache|_mouseDelayMet|_mouseDownEvent|remove|apply||style|plugins|delay|cancel|mouseDrag|mouseStart|mouseDelayMet|||||||||||||Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|string|typeof|attr|getData|widget|data|fn|split|top|distance|defaults|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|add|MozUserSelect|onselectstart|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|is|target|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|trigger|scrollLeft|scrollTop|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|left|absolute|position|gen|resizable|class|div|length|push|in|plugin'.split('|'),0,{})) 13 2 14 $.ui = {15 plugin: {16 add: function(module, option, set) {17 var proto = $.ui[module].prototype;18 for(var i in set) {19 proto.plugins[i] = proto.plugins[i] || [];20 proto.plugins[i].push([option, set[i]]);21 }22 },23 call: function(instance, name, args) {24 var set = instance.plugins[name];25 if(!set) { return; }26 27 for (var i = 0; i < set.length; i++) {28 if (instance.options[set[i][0]]) {29 set[i][1].apply(instance.element, args);30 }31 }32 }33 },34 cssCache: {},35 css: function(name) {36 if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }37 var tmp = $('<div class="ui-resizable-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');38 39 //if (!$.browser.safari)40 //tmp.appendTo('body');41 42 //Opera and Safari set width and height to 0px instead of auto43 //Safari returns rgba(0,0,0,0) when bgcolor is not set44 $.ui.cssCache[name] = !!(45 (!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||46 !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))47 );48 try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}49 return $.ui.cssCache[name];50 },51 disableSelection: function(e) {52 e.unselectable = "on";53 e.onselectstart = function() { return false; };54 if (e.style) { e.style.MozUserSelect = "none"; }55 },56 enableSelection: function(e) {57 e.unselectable = "off";58 e.onselectstart = function() { return true; };59 if (e.style) { e.style.MozUserSelect = ""; }60 },61 hasScroll: function(e, a) {62 var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;63 if (e[scroll] > 0) return true; e[scroll] = 1;64 has = e[scroll] > 0 ? true : false; e[scroll] = 0;65 return has;66 }67 };68 69 70 /** jQuery core modifications and additions **/71 72 var _remove = $.fn.remove;73 $.fn.remove = function() {74 $("*", this).add(this).trigger("remove");75 return _remove.apply(this, arguments );76 };77 78 // $.widget is a factory to create jQuery plugins79 // taking some boilerplate code out of the plugin code80 // created by Scott González and Jörn Zaefferer81 function getter(namespace, plugin, method) {82 var methods = $[namespace][plugin].getter || [];83 methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);84 return ($.inArray(method, methods) != -1);85 }86 87 var widgetPrototype = {88 init: function() {},89 destroy: function() {90 this.element.removeData(this.widgetName);91 },92 93 getData: function(key) {94 return this.options[key];95 },96 setData: function(key, value) {97 this.options[key] = value;98 },99 100 enable: function() {101 this.setData('disabled', false);102 },103 disable: function() {104 this.setData('disabled', true);105 }106 };107 108 $.widget = function(name, prototype) {109 var namespace = name.split(".")[0];110 name = name.split(".")[1];111 // create plugin method112 $.fn[name] = function(options) {113 var isMethodCall = (typeof options == 'string'),114 args = Array.prototype.slice.call(arguments, 1);115 116 if (isMethodCall && getter(namespace, name, options)) {117 var instance = $.data(this[0], name);118 return (instance ? instance[options].apply(instance, args)119 : undefined);120 }121 122 return this.each(function() {123 var instance = $.data(this, name);124 if (!instance) {125 $.data(this, name, new $[namespace][name](this, options));126 } else if (isMethodCall) {127 instance[options].apply(instance, args);128 }129 });130 };131 132 // create widget constructor133 $[namespace][name] = function(element, options) {134 var self = this;135 136 this.widgetName = name;137 138 this.options = $.extend({}, $[namespace][name].defaults, options);139 this.element = $(element)140 .bind('setData.' + name, function(e, key, value) {141 return self.setData(key, value);142 })143 .bind('getData.' + name, function(e, key) {144 return self.getData(key);145 })146 .bind('remove', function() {147 return self.destroy();148 });149 this.init();150 };151 152 // add widget prototype153 $[namespace][name].prototype = $.extend({}, widgetPrototype, prototype);154 };155 156 157 /** Mouse Interaction Plugin **/158 159 $.ui.mouse = {160 mouseInit: function() {161 var self = this;162 163 this.element.bind('mousedown.'+this.widgetName, function(e) {164 return self.mouseDown(e);165 });166 167 // Prevent text selection in IE168 if ($.browser.msie) {169 this._mouseUnselectable = this.element.attr('unselectable');170 this.element.attr('unselectable', 'on');171 }172 173 this.started = false;174 },175 176 // TODO: make sure destroying one instance of mouse doesn't mess with177 // other instances of mouse178 mouseDestroy: function() {179 this.element.unbind('.'+this.widgetName);180 181 // Restore text selection in IE182 ($.browser.msie183 && this.element.attr('unselectable', this._mouseUnselectable));184 },185 186 mouseDown: function(e) {187 // we may have missed mouseup (out of window)188 (this._mouseStarted && this.mouseUp(e));189 190 this._mouseDownEvent = e;191 192 var self = this,193 btnIsLeft = (e.which == 1),194 elIsCancel = ($(e.target).is(this.options.cancel));195 if (!btnIsLeft || elIsCancel) {196 return true;197 }198 199 this._mouseDelayMet = !this.options.delay;200 if (!this._mouseDelayMet) {201 this._mouseDelayTimer = setTimeout(function() {202 self._mouseDelayMet = true;203 }, this.options.delay);204 }205 206 // these delegates are required to keep context207 this._mouseMoveDelegate = function(e) {208 return self.mouseMove(e);209 };210 this._mouseUpDelegate = function(e) {211 return self.mouseUp(e);212 };213 $(document)214 .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)215 .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);216 217 return false;218 },219 220 mouseMove: function(e) {221 // IE mouseup check - mouseup happened when mouse was out of window222 if ($.browser.msie && !e.button) {223 return this.mouseUp(e);224 }225 226 if (this._mouseStarted) {227 this.mouseDrag(e);228 return false;229 }230 231 if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {232 this._mouseStarted =233 (this.mouseStart(this._mouseDownEvent, e) !== false);234 (this._mouseStarted || this.mouseUp(e));235 }236 237 return !this._mouseStarted;238 },239 240 mouseUp: function(e) {241 $(document)242 .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)243 .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);244 245 if (this._mouseStarted) {246 this._mouseStarted = false;247 this.mouseStop(e);248 }249 250 return false;251 },252 253 mouseDistanceMet: function(e) {254 return (Math.max(255 Math.abs(this._mouseDownEvent.pageX - e.pageX),256 Math.abs(this._mouseDownEvent.pageY - e.pageY)257 ) >= this.options.distance258 );259 },260 261 mouseDelayMet: function(e) {262 return this._mouseDelayMet;263 },264 265 // These are placeholder methods, to be overriden by extending plugin266 mouseStart: function(e) {},267 mouseDrag: function(e) {},268 mouseStop: function(e) {}269 };270 271 $.ui.mouse.defaults = {272 cancel: null,273 distance: 0,274 delay: 0275 };276 277 })(jQuery); -
trunk/wp-includes/js/jquery/ui.sortable.js
r8032 r8064 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 * Revision: $Id: ui.sortable.js 5433 2008-05-04 20:07:17Z joern.zaefferer $ 14 */ 15 ;(function($) { 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.2Q.3T&&B.2Q.3S<3R;5(E.2P&&!C){c E.2P(D)}5(E.2O){c!!(E.2O(D)&16)}1O(D=D.1g){5(D==E){c W}}c w}B.3Q("k.o",B.2f(B.k.3P,{3O:b(){9 C=4.6;4.O={};4.g.24("k-o");4.25();4.13=4.f.z?(/7|23/).17(4.f[0].v.e("3N")):w;5(!(/(2N|1s|3M)/).17(4.g.e("Y"))){4.g.e("Y","2N")}4.a=4.g.a();4.3L()},3K:{},k:b(C){c{l:(C||4)["l"],q:(C||4)["q"]||B([]),Y:(C||4)["Y"],3J:(C||4)["1b"],6:4.6,g:4.g,v:(C||4)["j"],3I:C?C.g:X}},t:b(F,E,C,D){B.k.1o.14(4,F,[E,4.k(C)]);5(!D){4.g.3H(F=="1z"?F:"1z"+F,[E,4.k(C)],4.6[F])}},2e:b(E){9 C=(B.1L(4.6.f)?4.6.f.14(4.g):B(4.6.f,4.g)).1F(".k-o-l");9 D=[];E=E||{};C.1v(b(){9 F=(B(4).2L(E.3G||"2K")||"").3F(E.3E||(/(.+)[-=3D](.+)/));5(F){D.1w((E.2M||F[1])+"[]="+(E.2M?F[1]:F[2]))}});c D.3C("&")},2d:b(C){9 D=(B.1L(4.6.f)?4.6.f.14(4.g):B(4.6.f,4.g)).1F(".k-o-l");9 E=[];D.1v(b(){E.1w(B(4).2L(C||"2K"))});c E},2F:b(J){9 E=4.1b.7,D=E+4.r.m,I=4.1b.8,H=I+4.r.n;9 F=J.7,C=F+J.m,K=J.8,G=K+J.n;5(4.6.1r=="2J"||(4.6.1r=="1S"&&4.r[4.13?"m":"n"]>J[4.13?"m":"n"])){c(I+4.a.p.8>K&&I+4.a.p.8<G&&E+4.a.p.7>F&&E+4.a.p.7<C)}Z{c(F<E+(4.r.m/2)&&D-(4.r.m/2)<C&&K<I+(4.r.n/2)&&H-(4.r.n/2)<G)}},2s:b(J){9 E=4.1b.7,D=E+4.r.m,I=4.1b.8,H=I+4.r.n;9 F=J.7,C=F+J.m,K=J.8,G=K+J.n;5(4.6.1r=="2J"||(4.6.1r=="1S"&&4.r[4.13?"m":"n"]>J[4.13?"m":"n"])){5(!(I+4.a.p.8>K&&I+4.a.p.8<G&&E+4.a.p.7>F&&E+4.a.p.7<C)){c w}5(4.13){5(E+4.a.p.7>F&&E+4.a.p.7<F+J.m/2){c 2}5(E+4.a.p.7>F+J.m/2&&E+4.a.p.7<C){c 1}}Z{5(I+4.a.p.8>K&&I+4.a.p.8<K+J.n/2){c 2}5(I+4.a.p.8>K+J.n/2&&I+4.a.p.8<G){c 1}}}Z{5(!(F<E+(4.r.m/2)&&D-(4.r.m/2)<C&&K<I+(4.r.n/2)&&H-(4.r.n/2)<G)){c w}5(4.13){5(D>F&&E<F){c 2}5(E<C&&D>C){c 1}}Z{5(H>K&&I<K){c 1}5(I<G&&H>G){c 2}}}c w},25:b(){4.2I();4.1T()},2I:b(){4.f=[];4.d=[4];9 C=4.f;9 E=[B.1L(4.6.f)?4.6.f.14(4.g):B(4.6.f,4.g)];5(4.6.28){P(9 F=4.6.28.z-1;F>=0;F--){9 H=B(4.6.28[F]);P(9 D=H.z-1;D>=0;D--){9 G=B.1f(H[D],"o");5(G&&!G.6.27){E.1w(B.1L(G.6.f)?G.6.f.14(G.g):B(G.6.f,G.g));4.d.1w(G)}}}}P(9 F=E.z-1;F>=0;F--){E[F].1v(b(){B.1f(4,"o-v",W);C.1w({v:B(4),m:0,n:0,7:0,8:0})})}},1T:b(C){P(9 E=4.f.z-1;E>=0;E--){9 D=4.f[E].v;5(!C){4.f[E].m=(4.6.1l?B(4.6.1l,D):D).1u()}5(!C){4.f[E].n=(4.6.1l?B(4.6.1l,D):D).1t()}9 F=(4.6.1l?B(4.6.1l,D):D).a();4.f[E].7=F.7;4.f[E].8=F.8}P(9 E=4.d.z-1;E>=0;E--){9 F=4.d[E].g.a();4.d[E].O.7=F.7;4.d[E].O.8=F.8;4.d[E].O.m=4.d[E].g.1u();4.d[E].O.n=4.d[E].g.1t()}},3B:b(){4.g.3A("k-o k-o-27").2H("o").3z(".o");4.3y();P(9 C=4.f.z-1;C>=0;C--){4.f[C].v.2H("o-v")}},1Z:b(E){9 C=E||4,F=C.6;5(F.q.3x==3w){9 D=F.q;F.q={g:b(){c B("<2G></2G>").24(D)[0]},1i:b(G,H){H.e(G.a()).e({m:G.1u(),n:G.1t()})}}}C.q=B(F.q.g.14(C.g,C.j)).1q("S").e({Y:"1s"});F.q.1i.14(C.g,C.j,C.q)},2q:b(F){P(9 D=4.d.z-1;D>=0;D--){5(4.2F(4.d[D].O)){5(!4.d[D].O.1a){5(4.26!=4.d[D]){9 I=3v;9 H=X;9 E=4.1b[4.d[D].13?"7":"8"];P(9 C=4.f.z-1;C>=0;C--){5(!A(4.d[D].g[0],4.f[C].v[0])){1X}9 G=4.f[C][4.d[D].13?"7":"8"];5(1k.2E(G-E)<I){I=1k.2E(G-E);H=4.f[C]}}5(!H&&!4.6.2c){1X}5(4.q){4.q.1E()}5(4.d[D].6.q){4.d[D].1Z(4)}Z{4.q=X}H?4.1D(F,H):4.1D(F,X,4.d[D].g);4.t("1W",F);4.d[D].t("1W",F,4);4.26=4.d[D]}4.d[D].t("1a",F,4);4.d[D].O.1a=1}}Z{5(4.d[D].O.1a){4.d[D].t("2k",F,4);4.d[D].O.1a=0}}}},3u:b(F,E){5(4.6.27||4.6.2r=="3t"){c w}9 D=X,C=B(F.1K).2C().1v(b(){5(B.1f(4,"o-v")){D=B(4);c w}});5(B.1f(F.1K,"o-v")){D=B(F.1K)}5(!D){c w}5(4.6.2D&&!E){9 G=w;B(4.6.2D,D).3s("*").3r().1v(b(){5(4==F.1K){G=W}});5(!G){c w}}4.j=D;c W},3q:b(H,F,C){9 J=4.6;4.26=4;4.25();4.l=3p J.l=="b"?B(J.l.3o(4.g[0],[H,4.j])):4.j.2w();5(!4.l.2C("S").z){4.l.1q((J.1q!="s"?J.1q:4.j[0].1g))}4.l.e({Y:"1s",1H:"3n"}).24("k-o-l");4.T={7:(L(4.j.e("3m"),10)||0),8:(L(4.j.e("3l"),10)||0)};4.a=4.j.a();4.a={8:4.a.8-4.T.8,7:4.a.7-4.T.7};4.a.p={7:H.1c-4.a.7,8:H.1e-4.a.8};4.u=4.l.u();9 D=4.u.a();4.a.s={8:D.8+(L(4.u.e("21"),10)||0),7:D.7+(L(4.u.e("22"),10)||0)};4.1j=4.1Y(H);4.r={m:4.l.1u(),n:4.l.1t()};5(J.12){5(J.12.7!=1J){4.a.p.7=J.12.7}5(J.12.23!=1J){4.a.p.7=4.r.m-J.12.23}5(J.12.8!=1J){4.a.p.8=J.12.8}5(J.12.2B!=1J){4.a.p.8=4.r.n-J.12.2B}}4.1U=4.j.1G()[0];5(J.i){5(J.i=="s"){J.i=4.l[0].1g}5(J.i=="h"||J.i=="1d"){4.i=[0-4.a.s.7,0-4.a.s.8,B(J.i=="h"?h:1d).m()-4.a.s.7-4.r.m-4.T.7-(L(4.g.e("2A"),10)||0),(B(J.i=="h"?h:1d).n()||h.S.1g.2y)-4.a.s.8-4.r.n-4.T.8-(L(4.g.e("2x"),10)||0)]}5(!(/^(h|1d|s)$/).17(J.i)){9 G=B(J.i)[0];9 I=B(J.i).a();4.i=[I.7+(L(B(G).e("22"),10)||0)-4.a.s.7,I.8+(L(B(G).e("21"),10)||0)-4.a.s.8,I.7+1k.2z(G.3k,G.29)-(L(B(G).e("22"),10)||0)-4.a.s.7-4.r.m-4.T.7-(L(4.j.e("2A"),10)||0),I.8+1k.2z(G.2y,G.2a)-(L(B(G).e("21"),10)||0)-4.a.s.8-4.r.n-4.T.8-(L(4.j.e("2x"),10)||0)]}}5(J.q){4.1Z()}4.t("1n",H);4.r={m:4.l.1u(),n:4.l.1t()};5(4.6.q!="2w"){4.j.e("2i","3j")}5(!C){P(9 E=4.d.z-1;E>=0;E--){4.d[E].t("3i",H,4)}}5(B.k.15){B.k.15.3h=4}5(B.k.15&&!J.2n){B.k.15.3g(4,H)}4.2j=W;4.2u(H);c W},2t:b(D,E){5(!E){E=4.Y}9 C=D=="1s"?1:-1;c{8:(E.8+4.a.s.8*C-(4.u[0]==h.S?0:4.u[0].N)*C+4.T.8*C),7:(E.7+4.a.s.7*C-(4.u[0]==h.S?0:4.u[0].M)*C+4.T.7*C)}},1Y:b(F){9 G=4.6;9 C={8:(F.1e-4.a.p.8-4.a.s.8+(4.u[0]==h.S?0:4.u[0].N)),7:(F.1c-4.a.p.7-4.a.s.7+(4.u[0]==h.S?0:4.u[0].M))};5(!4.1j){c C}5(4.i){5(C.7<4.i[0]){C.7=4.i[0]}5(C.8<4.i[1]){C.8=4.i[1]}5(C.7>4.i[2]){C.7=4.i[2]}5(C.8>4.i[3]){C.8=4.i[3]}}5(G.11){9 E=4.1j.8+1k.2v((C.8-4.1j.8)/G.11[1])*G.11[1];C.8=4.i?(!(E<4.i[1]||E>4.i[3])?E:(!(E<4.i[1])?E-G.11[1]:E+G.11[1])):E;9 D=4.1j.7+1k.2v((C.7-4.1j.7)/G.11[0])*G.11[0];C.7=4.i?(!(D<4.i[0]||D>4.i[2])?D:(!(D<4.i[0])?D-G.11[0]:D+G.11[0])):D}c C},2u:b(D){4.Y=4.1Y(D);4.1b=4.2t("1s");P(9 C=4.f.z-1;C>=0;C--){9 E=4.2s(4.f[C]);5(!E){1X}5(4.f[C].v[0]!=4.j[0]&&4.j[E==1?"3f":"1G"]()[0]!=4.f[C].v[0]&&!A(4.j[0],4.f[C].v[0])&&(4.6.2r=="3e-3d"?!A(4.g[0],4.f[C].v[0]):W)){4.2h=E==1?"2g":"3c";4.1D(D,4.f[C]);4.t("1W",D);3b}}4.2q(D);4.t("1z",D);5(!4.6.1I||4.6.1I=="x"){4.l[0].2p.7=4.Y.7+"2o"}5(!4.6.1I||4.6.1I=="y"){4.l[0].2p.8=4.Y.8+"2o"}5(B.k.15){B.k.15.3a(4,D)}c w},39:b(E,D){5(B.k.15&&!4.6.2n){B.k.15.38(4,E)}5(4.6.1V){9 C=4;9 F=C.j.a();5(C.q){C.q.2m({18:"37"},(L(4.6.1V,10)||2l)-36)}B(4.l).2m({7:F.7-4.a.s.7-C.T.7+(4.u[0]==h.S?0:4.u[0].M),8:F.8-4.a.s.8-C.T.8+(4.u[0]==h.S?0:4.u[0].N)},L(4.6.1V,10)||2l,b(){C.t("1p",E,X,D);C.1H(E)})}Z{4.t("1p",E,X,D);4.1H(E,D)}c w},1H:b(E,D){5(4.1U!=4.j.1G().1F(".k-o-l")[0]){4.t("1i",E,X,D)}5(!A(4.g[0],4.j[0])){5(4.1U==4.j.1G().1F(".k-o-l")[0]){4.t("1i",E,X,D)}4.t("1E",E,X,D);P(9 C=4.d.z-1;C>=0;C--){5(A(4.d[C].g[0],4.j[0])){4.d[C].t("1i",E,4,D);4.d[C].t("35",E,4,D)}}}P(9 C=4.d.z-1;C>=0;C--){4.d[C].t("34",E,4,D);5(4.d[C].O.1a){4.d[C].t("2k",E,4);4.d[C].O.1a=0}}4.2j=w;5(4.33){c w}B(4.j).e("2i","");5(4.q){4.q.1E()}4.l.1E();c W},1D:b(E,D,C){C?C.32(4.j):D.v[4.2h=="2g"?"31":"30"](4.j);4.1T(W);5(4.6.q){4.6.q.1i.14(4.g,4.j,4.q)}}}));B.2f(B.k.o,{2Z:"2e 2d",2Y:{1r:"1S",2X:0,2W:0,2V:":2U,2T",f:"> *",19:2S,2c:W,1q:"s"}});B.k.1o.1C("o","1h",{1n:b(E,D){9 C=B("S");5(C.e("1h")){D.6.1R=C.e("1h")}C.e("1h",D.6.1h)},1p:b(D,C){5(C.6.1R){B("S").e("1h",C.6.1R)}}});B.k.1o.1C("o","19",{1n:b(E,D){9 C=D.l;5(C.e("19")){D.6.1Q=C.e("19")}C.e("19",D.6.19)},1p:b(D,C){5(C.6.1Q){B(C.l).e("19",C.6.1Q)}}});B.k.1o.1C("o","18",{1n:b(E,D){9 C=D.l;5(C.e("18")){D.6.1P=C.e("18")}C.e("18",D.6.18)},1p:b(D,C){5(C.6.1P){B(C.l).e("18",C.6.1P)}}});B.k.1o.1C("o","1m",{1n:b(E,D){9 F=D.6;9 C=B(4).1f("o");F.V=F.V||20;F.U=F.U||20;C.R=b(G){2b{5(/1B|1m/.17(G.e("1A"))||(/1B|1m/).17(G.e("1A-y"))){c G}G=G.s()}1O(G[0].1g);c B(h)}(C.j);C.Q=b(G){2b{5(/1B|1m/.17(G.e("1A"))||(/1B|1m/).17(G.e("1A-x"))){c G}G=G.s()}1O(G[0].1g);c B(h)}(C.j);5(C.R[0]!=h&&C.R[0].1y!="1x"){C.1N=C.R.a()}5(C.Q[0]!=h&&C.Q[0].1y!="1x"){C.1M=C.Q.a()}},1z:b(E,D){9 F=D.6;9 C=B(4).1f("o");5(C.R[0]!=h&&C.R[0].1y!="1x"){5((C.1N.8+C.R[0].2a)-E.1e<F.V){C.R[0].N=C.R[0].N+F.U}5(E.1e-C.1N.8<F.V){C.R[0].N=C.R[0].N-F.U}}Z{5(E.1e-B(h).N()<F.V){B(h).N(B(h).N()-F.U)}5(B(1d).n()-(E.1e-B(h).N())<F.V){B(h).N(B(h).N()+F.U)}}5(C.Q[0]!=h&&C.Q[0].1y!="1x"){5((C.1M.7+C.Q[0].29)-E.1c<F.V){C.Q[0].M=C.Q[0].M+F.U}5(E.1c-C.1M.7<F.V){C.Q[0].M=C.Q[0].M-F.U}}Z{5(E.1c-B(h).M()<F.V){B(h).M(B(h).M()-F.U)}5(B(1d).m()-(E.1c-B(h).M())<F.V){B(h).M(B(h).M()+F.U)}}}})})(2R)',62,242,'||||this|if|options|left|top|var|offset|function|return|containers|css|items|element|document|containment|currentItem|ui|helper|width|height|sortable|click|placeholder|helperProportions|parent|propagate|offsetParent|item|false|||length||||||||||||parseInt|scrollLeft|scrollTop|containerCache|for|overflowX|overflowY|body|margins|scrollSpeed|scrollSensitivity|true|null|position|else||grid|cursorAt|floating|call|ddmanager||test|opacity|zIndex|over|positionAbs|pageX|window|pageY|data|parentNode|cursor|update|originalPosition|Math|toleranceElement|scroll|start|plugin|stop|appendTo|tolerance|absolute|outerHeight|outerWidth|each|push|HTML|tagName|sort|overflow|auto|add|rearrange|remove|not|prev|clear|axis|undefined|target|isFunction|overflowXOffset|overflowYOffset|while|_opacity|_zIndex|_cursor|guess|refreshPositions|domPosition|revert|change|continue|generatePosition|createPlaceholder||borderTopWidth|borderLeftWidth|right|addClass|refresh|currentContainer|disabled|connectWith|offsetWidth|offsetHeight|do|dropOnEmpty|toArray|serialize|extend|down|direction|visibility|dragging|out|500|animate|dropBehaviour|px|style|contactContainers|type|intersectsWithEdge|convertPositionTo|mouseDrag|round|clone|marginBottom|scrollHeight|max|marginRight|bottom|parents|handle|abs|intersectsWith|div|removeData|refreshItems|pointer|id|attr|key|relative|compareDocumentPosition|contains|browser|jQuery|1000|button|input|cancel|delay|distance|defaults|getter|after|before|append|cancelHelperRemoval|deactivate|receive|50|hide|drop|mouseStop|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|join|_|expression|match|attribute|triggerHandler|sender|absolutePosition|plugins|mouseInit|fixed|float|init|mouse|widget|522|version|safari'.split('|'),0,{})) 16 2 17 function contains(a, b) {18 var safari2 = $.browser.safari && $.browser.version < 522;19 if (a.contains && !safari2) {20 return a.contains(b);21 }22 if (a.compareDocumentPosition)23 return !!(a.compareDocumentPosition(b) & 16);24 while (b = b.parentNode)25 if (b == a) return true;26 return false;27 };28 29 $.widget("ui.sortable", $.extend($.ui.mouse, {30 init: function() {31 32 var o = this.options;33 this.containerCache = {};34 this.element.addClass("ui-sortable");35 36 //Get the items37 this.refresh();38 39 //Let's determine if the items are floating40 this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;41 42 //Let's determine the parent's offset43 if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');44 this.offset = this.element.offset();45 46 //Initialize mouse events for interaction47 this.mouseInit();48 49 },50 plugins: {},51 ui: function(inst) {52 return {53 helper: (inst || this)["helper"],54 placeholder: (inst || this)["placeholder"] || $([]),55 position: (inst || this)["position"],56 absolutePosition: (inst || this)["positionAbs"],57 options: this.options,58 element: this.element,59 item: (inst || this)["currentItem"],60 sender: inst ? inst.element : null61 };62 },63 propagate: function(n,e,inst, noPropagation) {64 $.ui.plugin.call(this, n, [e, this.ui(inst)]);65 if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);66 },67 serialize: function(o) {68 69 70 71 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 itself72 var str = []; o = o || {};73 74 items.each(function() {75 var res = ($(this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));76 if(res) str.push((o.key || res[1])+'[]='+(o.key ? res[1] : res[2]));77 });78 79 return str.join('&');80 81 },82 toArray: function(attr) {83 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 itself84 var ret = [];85 86 items.each(function() { ret.push($(this).attr(attr || 'id')); });87 return ret;88 },89 enable: function() {90 this.element.removeClass("ui-sortable-disabled");91 this.options.disabled = false;92 },93 disable: function() {94 this.element.addClass("ui-sortable-disabled");95 this.options.disabled = true;96 },97 /* Be careful with the following core functions */98 intersectsWith: function(item) {99 100 var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,101 y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;102 var l = item.left, r = l + item.width,103 t = item.top, b = t + item.height;104 105 if(this.options.tolerance == "pointer") {106 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);107 } else {108 109 return (l < x1 + (this.helperProportions.width / 2) // Right Half110 && x2 - (this.helperProportions.width / 2) < r // Left Half111 && t < y1 + (this.helperProportions.height / 2) // Bottom Half112 && y2 - (this.helperProportions.height / 2) < b ); // Top Half113 114 }115 116 },117 intersectsWithEdge: function(item) {118 var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,119 y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;120 var l = item.left, r = l + item.width,121 t = item.top, b = t + item.height;122 123 if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.currentItem[0]['offset'+(this.floating ? 'Width' : 'Height')] > item.item[0]['offset'+(this.floating ? 'Width' : 'Height')])) {124 125 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;126 127 if(this.floating) {128 if(x1 + this.offset.click.left > l && x1 + this.offset.click.left < l + item.width/2) return 2;129 if(x1 + this.offset.click.left > l+item.width/2 && x1 + this.offset.click.left < r) return 1;130 } else {131 if(y1 + this.offset.click.top > t && y1 + this.offset.click.top < t + item.height/2) return 2;132 if(y1 + this.offset.click.top > t+item.height/2 && y1 + this.offset.click.top < b) return 1;133 }134 135 } else {136 137 if (!(l < x1 + (this.helperProportions.width / 2) // Right Half138 && x2 - (this.helperProportions.width / 2) < r // Left Half139 && t < y1 + (this.helperProportions.height / 2) // Bottom Half140 && y2 - (this.helperProportions.height / 2) < b )) return false; // Top Half141 142 if(this.floating) {143 if(x2 > l && x1 < l) return 2; //Crosses left edge144 if(x1 < r && x2 > r) return 1; //Crosses right edge145 } else {146 if(y2 > t && y1 < t) return 1; //Crosses top edge147 if(y1 < b && y2 > b) return 2; //Crosses bottom edge148 }149 150 }151 152 return false;153 154 },155 refresh: function() {156 this.refreshItems();157 this.refreshPositions();158 },159 refreshItems: function() {160 161 this.items = [];162 this.containers = [this];163 var items = this.items;164 var queries = [$.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)];165 166 if(this.options.connectWith) {167 for (var i = this.options.connectWith.length - 1; i >= 0; i--){168 var cur = $(this.options.connectWith[i]);169 for (var j = cur.length - 1; j >= 0; j--){170 var inst = $.data(cur[j], 'sortable');171 if(inst && !inst.options.disabled) {172 queries.push($.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element));173 this.containers.push(inst);174 }175 };176 };177 }178 179 for (var i = queries.length - 1; i >= 0; i--){180 queries[i].each(function() {181 $.data(this, 'sortable-item', true); // Data for target checking (mouse manager)182 items.push({183 item: $(this),184 width: 0, height: 0,185 left: 0, top: 0186 });187 });188 };189 190 },191 refreshPositions: function(fast) {192 for (var i = this.items.length - 1; i >= 0; i--){193 var t = this.items[i].item;194 if(!fast) this.items[i].width = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).outerWidth();195 if(!fast) this.items[i].height = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).outerHeight();196 var p = (this.options.toleranceElement ? $(this.options.toleranceElement, t) : t).offset();197 this.items[i].left = p.left;198 this.items[i].top = p.top;199 };200 for (var i = this.containers.length - 1; i >= 0; i--){201 var p =this.containers[i].element.offset();202 this.containers[i].containerCache.left = p.left;203 this.containers[i].containerCache.top = p.top;204 this.containers[i].containerCache.width = this.containers[i].element.outerWidth();205 this.containers[i].containerCache.height = this.containers[i].element.outerHeight();206 };207 },208 destroy: function() {209 this.element210 .removeClass("ui-sortable ui-sortable-disabled")211 .removeData("sortable")212 .unbind(".sortable");213 this.mouseDestroy();214 215 for ( var i = this.items.length - 1; i >= 0; i-- )216 this.items[i].item.removeData("sortable-item");217 },218 createPlaceholder: function(that) {219 220 var self = that || this, o = self.options;221 222 if(o.placeholder.constructor == String) {223 var className = o.placeholder;224 o.placeholder = {225 element: function() {226 return $('<div></div>').addClass(className)[0];227 },228 update: function(i, p) {229 p.css(i.offset()).css({ width: i.outerWidth(), height: i.outerHeight() });230 }231 };232 }233 234 self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)).appendTo('body').css({ position: 'absolute' });235 o.placeholder.update.call(self.element, self.currentItem, self.placeholder);236 },237 contactContainers: function(e) {238 for (var i = this.containers.length - 1; i >= 0; i--){239 240 if(this.intersectsWith(this.containers[i].containerCache)) {241 if(!this.containers[i].containerCache.over) {242 243 244 if(this.currentContainer != this.containers[i]) {245 246 //When entering a new container, we will find the item with the least distance and append our item near it247 var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];248 for (var j = this.items.length - 1; j >= 0; j--) {249 if(!contains(this.containers[i].element[0], this.items[j].item[0])) continue;250 var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];251 if(Math.abs(cur - base) < dist) {252 dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];253 }254 }255 256 if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled257 continue;258 259 //We also need to exchange the placeholder260 if(this.placeholder) this.placeholder.remove();261 if(this.containers[i].options.placeholder) {262 this.containers[i].createPlaceholder(this);263 } else {264 this.placeholder = null;;265 }266 267 268 itemWithLeastDistance ? this.rearrange(e, itemWithLeastDistance) : this.rearrange(e, null, this.containers[i].element);269 this.propagate("change", e); //Call plugins and callbacks270 this.containers[i].propagate("change", e, this); //Call plugins and callbacks271 this.currentContainer = this.containers[i];272 273 }274 275 this.containers[i].propagate("over", e, this);276 this.containers[i].containerCache.over = 1;277 }278 } else {279 if(this.containers[i].containerCache.over) {280 this.containers[i].propagate("out", e, this);281 this.containers[i].containerCache.over = 0;282 }283 }284 285 };286 },287 mouseStart: function(e, overrideHandle, noActivation) {288 289 var o = this.options;290 this.currentContainer = this;291 292 if(this.options.disabled || this.options.type == 'static') return false;293 294 //Find out if the clicked node (or one of its parents) is a actual item in this.items295 var currentItem = null, nodes = $(e.target).parents().each(function() {296 if($.data(this, 'sortable-item')) {297 currentItem = $(this);298 return false;299 }300 });301 if($.data(e.target, 'sortable-item')) currentItem = $(e.target);302 303 if(!currentItem) return false;304 if(this.options.handle && !overrideHandle) {305 var validHandle = false;306 $(this.options.handle, currentItem).each(function() { if(this == e.target) validHandle = true; });307 if(!validHandle) return false;308 }309 310 this.currentItem = currentItem;311 312 this.refresh();313 314 //Create and append the visible helper315 this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone();316 if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)); //Add the helper to the DOM if that didn't happen already317 this.helper.css({ position: 'absolute', clear: 'both' }).addClass('ui-sortable-helper'); //Position it absolutely and add a helper class318 319 /*320 * - Position generation -321 * This block generates everything position related - it's the core of draggables.322 */323 324 this.margins = { //Cache the margins325 left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),326 top: (parseInt(this.currentItem.css("marginTop"),10) || 0)327 };328 329 this.offset = this.currentItem.offset(); //The element's absolute position on the page330 this.offset = { //Substract the margins from the element's absolute offset331 top: this.offset.top - this.margins.top,332 left: this.offset.left - this.margins.left333 };334 335 this.offset.click = { //Where the click happened, relative to the element336 left: e.pageX - this.offset.left,337 top: e.pageY - this.offset.top338 };339 340 this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); //Get the offsetParent and cache its position341 342 this.offset.parent = { //Store its position plus border343 top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),344 left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)345 };346 347 this.originalPosition = this.generatePosition(e); //Generate the original position348 this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Cache the helper size349 350 if(o.cursorAt) {351 if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left;352 if(o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right;353 if(o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top;354 if(o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom;355 }356 357 this.domPosition = this.currentItem.prev()[0]; //Cache the former DOM position358 359 /*360 * - Position constraining -361 * Here we prepare position constraining like grid and containment.362 */363 364 if(o.containment) {365 if(o.containment == 'parent') o.containment = this.helper[0].parentNode;366 if(o.containment == 'document') this.containment = [0,0,$(document).width(), ($(document).height() || document.body.parentNode.scrollHeight)];367 if(!(/^(document|window|parent)$/).test(o.containment)) {368 var ce = $(o.containment)[0];369 var co = $(o.containment).offset();370 371 this.containment = [372 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.parent.left,373 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.parent.top,374 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),375 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)376 ];377 }378 }379 380 //If o.placeholder is used, create a new element at the given position with the class381 if(o.placeholder) this.createPlaceholder();382 383 //Call plugins and callbacks384 this.propagate("start", e);385 this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size386 387 if(this.options.placeholder != 'clone') this.currentItem.css('visibility', 'hidden'); //Set the original element visibility to hidden to still fill out the white space388 389 if(!noActivation) {390 for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); } //Post 'activate' events to possible containers391 }392 393 //Prepare possible droppables394 if($.ui.ddmanager) $.ui.ddmanager.current = this;395 if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);396 397 this.dragging = true;398 399 this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position400 return true;401 402 403 },404 convertPositionTo: function(d, pos) {405 if(!pos) pos = this.position;406 var mod = d == "absolute" ? 1 : -1;407 return {408 top: (409 pos.top // the calculated relative position410 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)411 - (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) * mod // The offsetParent's scroll position412 + this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods)413 ),414 left: (415 pos.left // the calculated relative position416 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)417 - (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) * mod // The offsetParent's scroll position418 + this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods)419 )420 };421 },422 generatePosition: function(e) {423 424 var o = this.options;425 var position = {426 top: (427 e.pageY // The absolute mouse position428 - this.offset.click.top // Click offset (relative to the element)429 - this.offset.parent.top // The offsetParent's offset without borders (offset + border)430 + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) // The offsetParent's scroll position, not if the element is fixed431 ),432 left: (433 e.pageX // The absolute mouse position434 - this.offset.click.left // Click offset (relative to the element)435 - this.offset.parent.left // The offsetParent's offset without borders (offset + border)436 + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft) // The offsetParent's scroll position, not if the element is fixed437 )438 };439 440 if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options441 442 /*443 * - Position constraining -444 * Constrain the position to a mix of grid, containment.445 */446 if(this.containment) {447 if(position.left < this.containment[0]) position.left = this.containment[0];448 if(position.top < this.containment[1]) position.top = this.containment[1];449 if(position.left > this.containment[2]) position.left = this.containment[2];450 if(position.top > this.containment[3]) position.top = this.containment[3];451 }452 453 if(o.grid) {454 var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];455 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;456 457 var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];458 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;459 }460 461 return position;462 },463 mouseDrag: function(e) {464 465 466 //Compute the helpers position467 this.position = this.generatePosition(e);468 this.positionAbs = this.convertPositionTo("absolute");469 470 //Rearrange471 for (var i = this.items.length - 1; i >= 0; i--) {472 var intersection = this.intersectsWithEdge(this.items[i]);473 if(!intersection) continue;474 475 if(this.items[i].item[0] != this.currentItem[0] //cannot intersect with itself476 && this.currentItem[intersection == 1 ? "next" : "prev"]()[0] != this.items[i].item[0] //no useless actions that have been done before477 && !contains(this.currentItem[0], this.items[i].item[0]) //no action if the item moved is the parent of the item checked478 && (this.options.type == 'semi-dynamic' ? !contains(this.element[0], this.items[i].item[0]) : true)479 ) {480 481 this.direction = intersection == 1 ? "down" : "up";482 this.rearrange(e, this.items[i]);483 this.propagate("change", e); //Call plugins and callbacks484 break;485 }486 }487 488 //Post events to containers489 this.contactContainers(e);490 491 //Call plugins and callbacks492 this.propagate("sort", e);493 494 if(!this.options.axis || this.options.axis == "x") this.helper[0].style.left = this.position.left+'px';495 if(!this.options.axis || this.options.axis == "y") this.helper[0].style.top = this.position.top+'px';496 497 //Interconnect with droppables498 if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);499 500 return false;501 502 },503 mouseStop: function(e, noPropagation) {504 505 //If we are using droppables, inform the manager about the drop506 if ($.ui.ddmanager && !this.options.dropBehaviour)507 $.ui.ddmanager.drop(this, e);508 509 if(this.options.revert) {510 var self = this;511 var cur = self.currentItem.offset();512 513 //Also animate the placeholder if we have one514 if(self.placeholder) self.placeholder.animate({ opacity: 'hide' }, (parseInt(this.options.revert, 10) || 500)-50);515 516 $(this.helper).animate({517 left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),518 top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)519 }, parseInt(this.options.revert, 10) || 500, function() {520 self.propagate("stop", e, null, noPropagation);521 self.clear(e);522 });523 } else {524 this.propagate("stop", e, null, noPropagation);525 this.clear(e, noPropagation);526 }527 528 return false;529 530 },531 clear: function(e, noPropagation) {532 533 if(this.domPosition != this.currentItem.prev()[0]) this.propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed534 if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element535 this.propagate("remove", e, null, noPropagation);536 for (var i = this.containers.length - 1; i >= 0; i--){537 if(contains(this.containers[i].element[0], this.currentItem[0])) {538 this.containers[i].propagate("update", e, this, noPropagation);539 this.containers[i].propagate("receive", e, this, noPropagation);540 }541 };542 };543 544 //Post events to containers545 for (var i = this.containers.length - 1; i >= 0; i--){546 this.containers[i].propagate("deactivate", e, this, noPropagation);547 if(this.containers[i].containerCache.over) {548 this.containers[i].propagate("out", e, this);549 this.containers[i].containerCache.over = 0;550 }551 }552 553 this.dragging = false;554 if(this.cancelHelperRemoval) return false;555 $(this.currentItem).css('visibility', '');556 if(this.placeholder) this.placeholder.remove();557 this.helper.remove();558 559 return true;560 561 },562 rearrange: function(e, i, a) {563 a ? a.append(this.currentItem) : i.item[this.direction == 'down' ? 'before' : 'after'](this.currentItem);564 this.refreshPositions(true); //Precompute after each DOM insertion, NOT on mousemove565 if(this.options.placeholder) this.options.placeholder.update.call(this.element, this.currentItem, this.placeholder);566 }567 }));568 569 $.extend($.ui.sortable, {570 getter: "serialize toArray",571 defaults: {572 tolerance: "guess",573 distance: 0,574 delay: 0,575 cancel: ":input,button",576 items: '> *',577 zIndex: 1000,578 dropOnEmpty: true,579 appendTo: "parent"580 }581 });582 583 /*584 * Sortable Extensions585 */586 587 $.ui.plugin.add("sortable", "cursor", {588 start: function(e, ui) {589 var t = $('body');590 if (t.css("cursor")) ui.options._cursor = t.css("cursor");591 t.css("cursor", ui.options.cursor);592 },593 stop: function(e, ui) {594 if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);595 }596 });597 598 $.ui.plugin.add("sortable", "zIndex", {599 start: function(e, ui) {600 var t = ui.helper;601 if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");602 t.css('zIndex', ui.options.zIndex);603 },604 stop: function(e, ui) {605 if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);606 }607 });608 609 $.ui.plugin.add("sortable", "opacity", {610 start: function(e, ui) {611 var t = ui.helper;612 if(t.css("opacity")) ui.options._opacity = t.css("opacity");613 t.css('opacity', ui.options.opacity);614 },615 stop: function(e, ui) {616 if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);617 }618 });619 620 $.ui.plugin.add("sortable", "scroll", {621 start: function(e, ui) {622 var o = ui.options;623 var i = $(this).data("sortable");624 o.scrollSensitivity = o.scrollSensitivity || 20;625 o.scrollSpeed = o.scrollSpeed || 20;626 627 i.overflowY = function(el) {628 do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);629 return $(document);630 }(i.currentItem);631 i.overflowX = function(el) {632 do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);633 return $(document);634 }(i.currentItem);635 636 if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();637 if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();638 639 },640 sort: function(e, ui) {641 642 var o = ui.options;643 var i = $(this).data("sortable");644 645 if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {646 if((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity)647 i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;648 if(e.pageY - i.overflowYOffset.top < o.scrollSensitivity)649 i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;650 } else {651 if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)652 $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);653 if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)654 $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);655 }656 657 if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {658 if((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity)659 i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;660 if(e.pageX - i.overflowXOffset.left < o.scrollSensitivity)661 i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;662 } else {663 if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)664 $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);665 if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)666 $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);667 }668 669 }670 });671 672 })(jQuery); -
trunk/wp-includes/js/jquery/ui.tabs.js
r8032 r8064 1 /* 2 * jQuery UI Tabs 3 * 4 * Copyright (c) 2007, 2008 Klaus Hartl (stilbuero.de) 5 * Dual licensed under the MIT (MIT-LICENSE.txt) 6 * and GPL (GPL-LICENSE.txt) licenses. 7 * 8 * http://docs.jquery.com/UI/Tabs 9 * 10 * Depends: 11 * ui.core.js 12 * 13 * Revision: $Id: ui.tabs.js 5641 2008-05-20 02:53:23Z scott.gonzalez $ 14 */ 15 ;(function($) { 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}('(4(A){A.39("8.3",{38:4(){2.c.u+=".3";2.1e(1c)},37:4(B,C){5((/^7/).1Z(B)){2.16(C)}m{2.c[B]=C;2.1e()}},i:4(){f 2.$3.i},1E:4(B){f B.24&&B.24.13(/\\s/g,"23").13(/[^A-36-35-9\\-23:\\.]/g,"")||2.c.1Q+A.e(B)},8:4(C,B){f{c:2.c,34:C,1M:B}},1e:4(O){2.$h=A("1i:33(a[n])",2.k);2.$3=2.$h.1s(4(){f A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.V(4(R,Q){5(Q.t&&Q.t.13("#","")){P.$b=P.$b.1b(Q.t)}m{5(A(Q).12("n")!="#"){A.e(Q,"n.3",Q.n);A.e(Q,"p.3",Q.n);6 T=P.1E(Q);Q.n="#"+T;6 S=A("#"+T);5(!S.i){S=A(D.1x).12("1f",T).l(D.18).32(P.$b[R-1]||P.k);S.e("1a.3",1c)}P.$b=P.$b.1b(S)}m{D.d.1U(R+1)}}});5(O){2.k.l(D.1w);2.$b.V(4(){6 Q=A(2);Q.l(D.18)});5(D.7===1p){5(1J.t){2.$3.V(4(S,Q){5(Q.t==1J.t){D.7=S;5(A.W.1g||A.W.31){6 R=A(1J.t),T=R.12("1f");R.12("1f","");1z(4(){R.12("1f",T)},30)}2Z(0,0);f o}})}m{5(D.Y){6 J=2Y(A.Y("8-3"+A.e(P.k)),10);5(J&&P.$3[J]){D.7=J}}m{5(P.$h.z("."+D.j).i){D.7=P.$h.Z(P.$h.z("."+D.j)[0])}}}}D.7=D.7===v||D.7!==1p?D.7:0;D.d=A.2X(D.d.2W(A.1s(2.$h.z("."+D.U),4(R,Q){f P.$h.Z(R)}))).1T();5(A.1r(D.7,D.d)!=-1){D.d.2V(A.1r(D.7,D.d),1)}2.$b.l(D.w);2.$h.q(D.j);5(D.7!==v){2.$b.r(D.7).1G().q(D.w);2.$h.r(D.7).l(D.j);6 K=4(){A(P.k).y("20",[P.8(P.$3[D.7],P.$b[D.7])],D.1G)};5(A.e(2.$3[D.7],"p.3")){2.p(D.7,K)}m{K()}}A(2U).15("2T",4(){P.$3.14(".3");P.$h=P.$3=P.$b=v})}2S(6 G=0,N;N=2.$h[G];G++){A(N)[A.1r(G,D.d)!=-1&&!A(N).11(D.j)?"l":"q"](D.U)}5(D.x===o){2.$3.1m("x.3")}6 C,I,B={"2R-2Q":0,1I:1},E="2P";5(D.X&&D.X.2O==2N){C=D.X[0]||B,I=D.X[1]||B}m{C=I=D.X||B}6 H={1q:"",2M:"",2L:""};5(!A.W.1g){H.1H=""}4 M(R,Q,S){Q.22(C,C.1I||E,4(){Q.l(D.w).1d(H);5(A.W.1g&&C.1H){Q[0].21.z=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1d("1q","1D")}S.22(I,I.1I||E,4(){S.q(D.w).1d(H);5(A.W.1g&&I.1H){S[0].21.z=""}A(P.k).y("20",[P.8(R,S[0])],D.1G)})}4 F(R,T,Q,S){T.l(D.j).2K().q(D.j);M(R,Q,S)}2.$3.14(".3").15(D.u,4(){6 T=A(2).2J("1i:r(0)"),Q=P.$b.z(":2I"),S=A(2.t);5((T.11(D.j)&&!D.1h)||T.11(D.U)||A(2).11(D.17)||A(P.k).y("2H",[P.8(2,S[0])],D.16)===o){2.1t();f o}P.c.7=P.$3.Z(2);5(D.1h){5(T.11(D.j)){P.c.7=v;T.q(D.j);P.$b.1F();M(2,Q);2.1t();f o}m{5(!Q.i){P.$b.1F();6 R=2;P.p(P.$3.Z(2),4(){T.l(D.j).l(D.1v);L(R,S)});2.1t();f o}}}5(D.Y){A.Y("8-3"+A.e(P.k),P.c.7,D.Y)}P.$b.1F();5(S.i){6 R=2;P.p(P.$3.Z(2),Q.i?4(){F(R,T,Q,S)}:4(){T.l(D.j);L(R,S)})}m{2G"1K 2F 2E: 2D 2C 2B."}5(A.W.1g){2.1t()}f o});5(!(/^1y/).1Z(D.u)){2.$3.15("1y.3",4(){f o})}},1b:4(E,D,C){5(C==1p){C=2.$3.i}6 G=2.c;6 I=A(G.1P.13(/#\\{n\\}/g,E).13(/#\\{1j\\}/g,D));I.e("1a.3",1c);6 H=E.2A("#")==0?E.13("#",""):2.1E(A("a:2z-2y",I)[0]);6 F=A("#"+H);5(!F.i){F=A(G.1x).12("1f",H).l(G.w).e("1a.3",1c)}F.l(G.18);5(C>=2.$h.i){I.1Y(2.k);F.1Y(2.k[0].2x)}m{I.1X(2.$h[C]);F.1X(2.$b[C])}G.d=A.1s(G.d,4(K,J){f K>=C?++K:K});2.1e();5(2.$3.i==1){I.l(G.j);F.q(G.w);6 B=A.e(2.$3[0],"p.3");5(B){2.p(C,B)}}2.k.y("2w",[2.8(2.$3[C],2.$b[C])],G.1b)},19:4(B){6 D=2.c,E=2.$h.r(B).19(),C=2.$b.r(B).19();5(E.11(D.j)&&2.$3.i>1){2.16(B+(B+1<2.$3.i?1:-1))}D.d=A.1s(A.1W(D.d,4(G,F){f G!=B}),4(G,F){f G>=B?--G:G});2.1e();2.k.y("2v",[2.8(E.1C("a")[0],C[0])],D.19)},1V:4(B){6 C=2.c;5(A.1r(B,C.d)==-1){f}6 D=2.$h.r(B).q(C.U);5(A.W.2u){D.1d("1q","2t-1D");1z(4(){D.1d("1q","1D")},0)}C.d=A.1W(C.d,4(F,E){f F!=B});2.k.y("2s",[2.8(2.$3[B],2.$b[B])],C.1V)},1S:4(C){6 B=2,D=2.c;5(C!=D.7){2.$h.r(C).l(D.U);D.d.1U(C);D.d.1T();2.k.y("2r",[2.8(2.$3[C],2.$b[C])],D.1S)}},16:4(B){5(2q B=="2p"){B=2.$3.Z(2.$3.z("[n$="+B+"]")[0])}2.$3.r(B).2o(2.c.u)},p:4(G,K){6 L=2,D=2.c,E=2.$3.r(G),J=E[0],H=K==1p||K===o,B=E.e("p.3");K=K||4(){};5(!B||!H&&A.e(J,"x.3")){K();f}6 M=4(N){6 O=A(N),P=O.1C("*:2n");f P.i&&P||O};6 C=4(){L.$3.z("."+D.17).q(D.17).V(4(){5(D.1l){M(2).2m().1o(M(2).e("1j.3"))}});L.1n=v};5(D.1l){6 I=M(J).1o();M(J).2l("<1B></1B>").1C("1B").e("1j.3",I).1o(D.1l)}6 F=A.1L({},D.1k,{1R:B,1A:4(O,N){A(J.t).1o(O);C();5(D.x){A.e(J,"x.3",1c)}A(L.k).y("2k",[L.8(L.$3[G],L.$b[G])],D.p);D.1k.1A&&D.1k.1A(O,N);K()}});5(2.1n){2.1n.2j();C()}E.l(D.17);1z(4(){L.1n=A.2i(F)},0)},1R:4(C,B){2.$3.r(C).1m("x.3").e("p.3",B)},1a:4(){6 B=2.c;2.k.14(".3").q(B.1w).1m("3");2.$3.V(4(){6 C=A.e(2,"n.3");5(C){2.n=C}6 D=A(2).14(".3");A.V(["n","p","x"],4(E,F){D.1m(F+".3")})});2.$h.1b(2.$b).V(4(){5(A.e(2,"1a.3")){A(2).19()}m{A(2).q([B.j,B.1v,B.U,B.18,B.w].2h(" "))}})}});A.8.3.2g={1h:o,u:"1y",d:[],Y:v,1l:"2fe;",x:o,1Q:"8-3-",1k:{},X:v,1P:\'<1i><a n="#{n}"><1O>#{1j}</1O></a></1i>\',1x:"<1N></1N>",1w:"8-3-2d",j:"8-3-7",1v:"8-3-1h",U:"8-3-d",18:"8-3-1M",w:"8-3-2c",17:"8-3-2b"};A.8.3.2a="i";A.1L(A.8.3.29,{1u:v,28:4(C,F){F=F||o;6 B=2,E=2.c.7;4 G(){B.1u=27(4(){E=++E<B.$3.i?E:0;B.16(E)},C)}4 D(H){5(!H||H.26){25(B.1u)}}5(C){G();5(!F){2.$3.15(2.c.u,D)}m{2.$3.15(2.c.u,4(){D();E=B.c.7;G()})}}m{D();2.$3.14(2.c.u,D)}}})})(1K)',62,196,'||this|tabs|function|if|var|selected|ui|||panels|options|disabled|data|return||lis|length|selectedClass|element|addClass|else|href|false|load|removeClass|eq||hash|event|null|hideClass|cache|triggerHandler|filter|||||||||||||||||||||disabledClass|each|browser|fx|cookie|index||hasClass|attr|replace|unbind|bind|select|loadingClass|panelClass|remove|destroy|add|true|css|tabify|id|msie|unselect|li|label|ajaxOptions|spinner|removeData|xhr|html|undefined|display|inArray|map|blur|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|disable|sort|push|enable|grep|insertBefore|appendTo|test|tabsshow|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|join|ajax|abort|tabsload|wrapInner|parent|last|trigger|string|typeof|tabsdisable|tabsenable|inline|safari|tabsremove|tabsadd|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|tabsselect|visible|parents|siblings|height|overflow|Array|constructor|normal|width|min|for|unload|window|splice|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|z0|Za|setData|init|widget'.split('|'),0,{})) 16 2 17 $.widget("ui.tabs", {18 init: function() {19 this.options.event += '.tabs'; // namespace event20 21 // create tabs22 this.tabify(true);23 },24 setData: function(key, value) {25 if ((/^selected/).test(key))26 this.select(value);27 else {28 this.options[key] = value;29 this.tabify();30 }31 },32 length: function() {33 return this.$tabs.length;34 },35 tabId: function(a) {36 return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')37 || this.options.idPrefix + $.data(a);38 },39 ui: function(tab, panel) {40 return {41 instance: this,42 options: this.options,43 tab: tab,44 panel: panel45 };46 },47 tabify: function(init) {48 49 this.$lis = $('li:has(a[href])', this.element);50 this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });51 this.$panels = $([]);52 53 var self = this, o = this.options;54 55 this.$tabs.each(function(i, a) {56 // inline tab57 if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash58 self.$panels = self.$panels.add(a.hash);59 // remote tab60 else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"61 $.data(a, 'href.tabs', a.href); // required for restore on destroy62 $.data(a, 'load.tabs', a.href); // mutable63 var id = self.tabId(a);64 a.href = '#' + id;65 var $panel = $('#' + id);66 if (!$panel.length) {67 $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)68 .insertAfter( self.$panels[i - 1] || self.element );69 $panel.data('destroy.tabs', true);70 }71 self.$panels = self.$panels.add( $panel );72 }73 // invalid tab href74 else75 o.disabled.push(i + 1);76 });77 78 if (init) {79 80 // attach necessary classes for styling if not present81 this.element.addClass(o.navClass);82 this.$panels.each(function() {83 var $this = $(this);84 $this.addClass(o.panelClass);85 });86 87 // Selected tab88 // use "selected" option or try to retrieve:89 // 1. from fragment identifier in url90 // 2. from cookie91 // 3. from selected class attribute on <li>92 if (o.selected === undefined) {93 if (location.hash) {94 this.$tabs.each(function(i, a) {95 if (a.hash == location.hash) {96 o.selected = i;97 // prevent page scroll to fragment98 if ($.browser.msie || $.browser.opera) { // && !o.remote99 var $toShow = $(location.hash), toShowId = $toShow.attr('id');100 $toShow.attr('id', '');101 setTimeout(function() {102 $toShow.attr('id', toShowId); // restore id103 }, 500);104 }105 scrollTo(0, 0);106 return false; // break107 }108 });109 }110 else if (o.cookie) {111 var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10);112 if (index && self.$tabs[index])113 o.selected = index;114 }115 else if (self.$lis.filter('.' + o.selectedClass).length)116 o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );117 }118 o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default119 120 // Take disabling tabs via class attribute from HTML121 // into account and update option properly.122 // A selected tab cannot become disabled.123 o.disabled = $.unique(o.disabled.concat(124 $.map(this.$lis.filter('.' + o.disabledClass),125 function(n, i) { return self.$lis.index(n); } )126 )).sort();127 if ($.inArray(o.selected, o.disabled) != -1)128 o.disabled.splice($.inArray(o.selected, o.disabled), 1);129 130 // highlight selected tab131 this.$panels.addClass(o.hideClass);132 this.$lis.removeClass(o.selectedClass);133 if (o.selected !== null) {134 this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before135 this.$lis.eq(o.selected).addClass(o.selectedClass);136 137 // seems to be expected behavior that the show callback is fired138 var onShow = function() {139 $(self.element).triggerHandler('tabsshow',140 [self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show);141 };142 143 // load if remote tab144 if ($.data(this.$tabs[o.selected], 'load.tabs'))145 this.load(o.selected, onShow);146 // just trigger show event147 else148 onShow();149 150 }151 152 // clean up to avoid memory leaks in certain versions of IE 6153 $(window).bind('unload', function() {154 self.$tabs.unbind('.tabs');155 self.$lis = self.$tabs = self.$panels = null;156 });157 158 }159 160 // disable tabs161 for (var i = 0, li; li = this.$lis[i]; i++)162 $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);163 164 // reset cache if switching from cached to not cached165 if (o.cache === false)166 this.$tabs.removeData('cache.tabs');167 168 // set up animations169 var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';170 if (o.fx && o.fx.constructor == Array)171 hideFx = o.fx[0] || baseFx, showFx = o.fx[1] || baseFx;172 else173 hideFx = showFx = o.fx || baseFx;174 175 // reset some styles to maintain print style sheets etc.176 var resetCSS = { display: '', overflow: '', height: '' };177 if (!$.browser.msie) // not in IE to prevent ClearType font issue178 resetCSS.opacity = '';179 180 // Hide a tab, animation prevents browser scrolling to fragment,181 // $show is optional.182 function hideTab(clicked, $hide, $show) {183 $hide.animate(hideFx, hideFx.duration || baseDuration, function() { //184 $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.185 if ($.browser.msie && hideFx.opacity)186 $hide[0].style.filter = '';187 if ($show)188 showTab(clicked, $show, $hide);189 });190 }191 192 // Show a tab, animation prevents browser scrolling to fragment,193 // $hide is optional.194 function showTab(clicked, $show, $hide) {195 if (showFx === baseFx)196 $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels197 $show.animate(showFx, showFx.duration || baseDuration, function() {198 $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.199 if ($.browser.msie && showFx.opacity)200 $show[0].style.filter = '';201 202 // callback203 $(self.element).triggerHandler('tabsshow',204 [self.ui(clicked, $show[0])], o.show);205 206 });207 }208 209 // switch a tab210 function switchTab(clicked, $li, $hide, $show) {211 /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click212 $.ajaxHistory.update(clicked.hash);213 }*/214 $li.addClass(o.selectedClass)215 .siblings().removeClass(o.selectedClass);216 hideTab(clicked, $hide, $show);217 }218 219 // attach tab event handler, unbind to avoid duplicates from former tabifying...220 this.$tabs.unbind('.tabs').bind(o.event, function() {221 222 //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click223 var $li = $(this).parents('li:eq(0)'),224 $hide = self.$panels.filter(':visible'),225 $show = $(this.hash);226 227 // If tab is already selected and not unselectable or tab disabled or228 // or is already loading or click callback returns false stop here.229 // Check if click handler returns false last so that it is not executed230 // for a disabled or loading tab!231 if (($li.hasClass(o.selectedClass) && !o.unselect)232 || $li.hasClass(o.disabledClass)233 || $(this).hasClass(o.loadingClass)234 || $(self.element).triggerHandler('tabsselect', [self.ui(this, $show[0])], o.select) === false235 ) {236 this.blur();237 return false;238 }239 240 self.options.selected = self.$tabs.index(this);241 242 // if tab may be closed243 if (o.unselect) {244 if ($li.hasClass(o.selectedClass)) {245 self.options.selected = null;246 $li.removeClass(o.selectedClass);247 self.$panels.stop();248 hideTab(this, $hide);249 this.blur();250 return false;251 } else if (!$hide.length) {252 self.$panels.stop();253 var a = this;254 self.load(self.$tabs.index(this), function() {255 $li.addClass(o.selectedClass).addClass(o.unselectClass);256 showTab(a, $show);257 });258 this.blur();259 return false;260 }261 }262 263 if (o.cookie)264 $.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);265 266 // stop possibly running animations267 self.$panels.stop();268 269 // show new tab270 if ($show.length) {271 272 // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled273 /*if ($.browser.msie && o.bookmarkable) {274 var showId = this.hash.replace('#', '');275 $show.attr('id', '');276 setTimeout(function() {277 $show.attr('id', showId); // restore id278 }, 0);279 }*/280 281 var a = this;282 self.load(self.$tabs.index(this), $hide.length ?283 function() {284 switchTab(a, $li, $hide, $show);285 } :286 function() {287 $li.addClass(o.selectedClass);288 showTab(a, $show);289 }290 );291 292 // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash293 /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;294 var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;295 setTimeout(function() {296 scrollTo(scrollX, scrollY);297 }, 0);*/298 299 } else300 throw 'jQuery UI Tabs: Mismatching fragment identifier.';301 302 // Prevent IE from keeping other link focussed when using the back button303 // and remove dotted border from clicked link. This is controlled in modern304 // browsers via CSS, also blur removes focus from address bar in Firefox305 // which can become a usability and annoying problem with tabsRotate.306 if ($.browser.msie)307 this.blur();308 309 //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE310 return false;311 312 });313 314 // disable click if event is configured to something else315 if (!(/^click/).test(o.event))316 this.$tabs.bind('click.tabs', function() { return false; });317 318 },319 add: function(url, label, index) {320 if (index == undefined)321 index = this.$tabs.length; // append by default322 323 var o = this.options;324 var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));325 $li.data('destroy.tabs', true);326 327 var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );328 329 // try to find an existing element before creating a new one330 var $panel = $('#' + id);331 if (!$panel.length) {332 $panel = $(o.panelTemplate).attr('id', id)333 .addClass(o.hideClass)334 .data('destroy.tabs', true);335 }336 $panel.addClass(o.panelClass);337 if (index >= this.$lis.length) {338 $li.appendTo(this.element);339 $panel.appendTo(this.element[0].parentNode);340 } else {341 $li.insertBefore(this.$lis[index]);342 $panel.insertBefore(this.$panels[index]);343 }344 345 o.disabled = $.map(o.disabled,346 function(n, i) { return n >= index ? ++n : n });347 348 this.tabify();349 350 if (this.$tabs.length == 1) {351 $li.addClass(o.selectedClass);352 $panel.removeClass(o.hideClass);353 var href = $.data(this.$tabs[0], 'load.tabs');354 if (href)355 this.load(index, href);356 }357 358 // callback359 this.element.triggerHandler('tabsadd',360 [this.ui(this.$tabs[index], this.$panels[index])], o.add361 );362 },363 remove: function(index) {364 var o = this.options, $li = this.$lis.eq(index).remove(),365 $panel = this.$panels.eq(index).remove();366 367 // If selected tab was removed focus tab to the right or368 // in case the last tab was removed the tab to the left.369 if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)370 this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));371 372 o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),373 function(n, i) { return n >= index ? --n : n });374 375 this.tabify();376 377 // callback378 this.element.triggerHandler('tabsremove',379 [this.ui($li.find('a')[0], $panel[0])], o.remove380 );381 },382 enable: function(index) {383 var o = this.options;384 if ($.inArray(index, o.disabled) == -1)385 return;386 387 var $li = this.$lis.eq(index).removeClass(o.disabledClass);388 if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...389 $li.css('display', 'inline-block');390 setTimeout(function() {391 $li.css('display', 'block');392 }, 0);393 }394 395 o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });396 397 // callback398 this.element.triggerHandler('tabsenable',399 [this.ui(this.$tabs[index], this.$panels[index])], o.enable400 );401 402 },403 disable: function(index) {404 var self = this, o = this.options;405 if (index != o.selected) { // cannot disable already selected tab406 this.$lis.eq(index).addClass(o.disabledClass);407 408 o.disabled.push(index);409 o.disabled.sort();410 411 // callback412 this.element.triggerHandler('tabsdisable',413 [this.ui(this.$tabs[index], this.$panels[index])], o.disable414 );415 }416 },417 select: function(index) {418 if (typeof index == 'string')419 index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );420 this.$tabs.eq(index).trigger(this.options.event);421 },422 load: function(index, callback) { // callback is for internal usage only423 424 var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],425 bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');426 427 callback = callback || function() {};428 429 // no remote or from cache - just finish with callback430 if (!url || !bypassCache && $.data(a, 'cache.tabs')) {431 callback();432 return;433 }434 435 // load remote from here on436 437 var inner = function(parent) {438 var $parent = $(parent), $inner = $parent.find('*:last');439 return $inner.length && $inner || $parent;440 };441 var cleanup = function() {442 self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass)443 .each(function() {444 if (o.spinner)445 inner(this).parent().html(inner(this).data('label.tabs'));446 });447 self.xhr = null;448 };449 450 if (o.spinner) {451 var label = inner(a).html();452 inner(a).wrapInner('<em></em>')453 .find('em').data('label.tabs', label).html(o.spinner);454 }455 456 var ajaxOptions = $.extend({}, o.ajaxOptions, {457 url: url,458 success: function(r, s) {459 $(a.hash).html(r);460 cleanup();461 462 if (o.cache)463 $.data(a, 'cache.tabs', true); // if loaded once do not load them again464 465 // callbacks466 $(self.element).triggerHandler('tabsload',467 [self.ui(self.$tabs[index], self.$panels[index])], o.load468 );469 o.ajaxOptions.success && o.ajaxOptions.success(r, s);470 471 // This callback is required because the switch has to take472 // place after loading has completed. Call last in order to473 // fire load before show callback...474 callback();475 }476 });477 if (this.xhr) {478 // terminate pending requests from other tabs and restore tab label479 this.xhr.abort();480 cleanup();481 }482 $a.addClass(o.loadingClass);483 setTimeout(function() { // timeout is again required in IE, "wait" for id being restored484 self.xhr = $.ajax(ajaxOptions);485 }, 0);486 487 },488 url: function(index, url) {489 this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);490 },491 destroy: function() {492 var o = this.options;493 this.element.unbind('.tabs')494 .removeClass(o.navClass).removeData('tabs');495 this.$tabs.each(function() {496 var href = $.data(this, 'href.tabs');497 if (href)498 this.href = href;499 var $this = $(this).unbind('.tabs');500 $.each(['href', 'load', 'cache'], function(i, prefix) {501 $this.removeData(prefix + '.tabs');502 });503 });504 this.$lis.add(this.$panels).each(function() {505 if ($.data(this, 'destroy.tabs'))506 $(this).remove();507 else508 $(this).removeClass([o.selectedClass, o.unselectClass,509 o.disabledClass, o.panelClass, o.hideClass].join(' '));510 });511 }512 });513 514 $.ui.tabs.defaults = {515 // basic setup516 unselect: false,517 event: 'click',518 disabled: [],519 cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }520 // TODO history: false,521 522 // Ajax523 spinner: 'Loading…',524 cache: false,525 idPrefix: 'ui-tabs-',526 ajaxOptions: {},527 528 // animations529 fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }530 531 // templates532 tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',533 panelTemplate: '<div></div>',534 535 // CSS classes536 navClass: 'ui-tabs-nav',537 selectedClass: 'ui-tabs-selected',538 unselectClass: 'ui-tabs-unselect',539 disabledClass: 'ui-tabs-disabled',540 panelClass: 'ui-tabs-panel',541 hideClass: 'ui-tabs-hide',542 loadingClass: 'ui-tabs-loading'543 };544 545 $.ui.tabs.getter = "length";546 547 /*548 * Tabs Extensions549 */550 551 /*552 * Rotate553 */554 $.extend($.ui.tabs.prototype, {555 rotation: null,556 rotate: function(ms, continuing) {557 558 continuing = continuing || false;559 560 var self = this, t = this.options.selected;561 562 function start() {563 self.rotation = setInterval(function() {564 t = ++t < self.$tabs.length ? t : 0;565 self.select(t);566 }, ms);567 }568 569 function stop(e) {570 if (!e || e.clientX) { // only in case of a true click571 clearInterval(self.rotation);572 }573 }574 575 // start interval576 if (ms) {577 start();578 if (!continuing)579 this.$tabs.bind(this.options.event, stop);580 else581 this.$tabs.bind(this.options.event, function() {582 stop();583 t = self.options.selected;584 start();585 });586 }587 // stop interval588 else {589 stop();590 this.$tabs.unbind(this.options.event, stop);591 }592 }593 });594 595 })(jQuery); -
trunk/wp-includes/script-loader.php
r8058 r8064 99 99 ) ); 100 100 101 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5 b4' );102 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5 b4' );103 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5 b4' );101 $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5' ); 102 $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5' ); 103 $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5' ); 104 104 105 105 if ( is_admin() ) {
Note: See TracChangeset
for help on using the changeset viewer.