2014-08-18 03:13:16 +02:00
|
|
|
window.wp=window.wp||{},jQuery(document).ready(function(a){function b(a){var b,c,d,e,f,g=jQuery.ui.keyCode,h=a.keyCode,i=document.createRange(),j=w[0].selectionStart,k=w[0].selectionEnd,l=x[0].firstChild,m=o.height(),n=10;if(!j||!k||j===k){try{i.setStart(l,j),i.setEnd(l,k+1)}catch(p){}b=i.getBoundingClientRect(),b.height&&(c=b.top-n,d=c+b.height+n,e=q.outerHeight()+u.outerHeight()+v.outerHeight(),f=m-y.outerHeight(),e>c&&(h===g.UP||h===g.LEFT||h===g.BACKSPACE)?window.scrollTo(window.pageXOffset,c+window.pageYOffset-e):d>f&&window.scrollTo(window.pageXOffset,d+window.pageYOffset-f))}}function c(){if(!m||m.isHidden()){var a,b=w.height();x.width(w.width()-22),x.text(w.val()+" "),a=x.height(),M>a&&(a=M),a!==b&&(w.height(a),d())}}function d(a){if(!C||!C.settings.visible){var b,c,d,e,f,g,h,i,n,s,D,E=y.outerHeight(),K=o.scrollTop(),N=o.height(),O=o.width(),P=O>600?q.height():0,Q="scroll"!==a,R=m&&!m.isHidden(),S=M,T=B.offset().top,U=1,V=t.width(),W=z.height();R?(b=j,c=k):(b=v,c=w),g=u.outerHeight(),h=b.parent().offset().top,i=b.outerHeight(),n=c.offset().top,s=c.outerHeight(),D=R?l.outerHeight():0,f=R?M+i:M+20,f=s>f+5,f?((!F||Q)&&K>=h-g-P&&h-g-P+s-S>=K?(F=!0,b.css({position:"fixed",top:P+g,width:V-2*U-(R?0:b.outerWidth()-b.width()),borderTop:"1px solid #e5e5e5"}),u.css({position:"fixed",top:P,width:V})):(F||Q)&&(h-g-P>=K?(F=!1,b.css({position:"absolute",top:0,borderTop:"none",width:V-2*U-(R?0:b.outerWidth()-b.width())}),u.css({position:"absolute",top:0,width:V})):K>=h-g-P+s-S&&(F=!1,b.css({position:"absolute",top:s-S,width:V-2*U-(R?0:b.outerWidth()-b.width())}),u.css({position:"absolute",top:s-S+U,width:V}))),(!G||Q)&&n+s+E+D+U>=K+N?(G=!0,y.css({position:"fixed",bottom:0,width:V,borderTop:"1px solid #dedede"})):(G||Q)&&K+N>n+s+E+D-U&&(G=!1,y.css({position:"relative",bottom:"auto",width:"100%",borderTop:"none"}))):Q&&(b.css({position:"absolute",top:0,borderTop:"none",width:V-2*U-(R?0:b.outerWidth()-b.width())}),u.css({position:"absolute",top:0,width:V}),y.css({position:"relative",bottom:"auto",width:"100%",borderTop:"none"})),A.width()<300&&O>600&&p.height()>z.height()+T+120&&s>N?(W>N||H||I?T>=K+L?(z.attr("style",""),H=I=!1):K>J?H?(H=!1,d=z.offset().top-P,e=r.offset().top,d+W+20>e&&(d=e-W-20),z.css({position:"absolute",top:d,bottom:""})):!I&&W+z.offset().top+20<K+N&&(I=!0,z.css({position:"fixed",top:"auto",bottom:"20px"})):J>K&&(I?(I=!1,d=z.offset().top-20,e=r.offset().top,d+W+20>e&&(d=e-W-20),z.css({position:"absolute",top:d,bottom:""})):!H&&z.offset().top>=K+L&&(H=!0,z.css({position:"fixed",top:L,bottom:""}))):(K>=T-L?z.css({position:"fixed",top:L}):z.attr("style",""),H=I=!1),J=K):(z.attr("style",""),H=I=!1),Q&&(t.css({paddingTop:u.outerHeight()}),R?k.css({paddingTop:j.outerHeight()}):(w.css({marginTop:v.outerHeight()}),x.width(V-20-2*U)))}}function e(){c(),d()}function f(a){for(var b=1;6>b;b++)setTimeout(a,500*b)}function g(){clearTimeout(n),n=setTimeout(d,100)}function h(){window.pageYOffset&&window.pageYOffset>K&&window.scrollTo(window.pageXOffset,0),s.addClass("wp-editor-expand"),o.on("scroll.editor-expand resize.editor-expand",function(a){d(a.type),g()}),p.on("wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand",d).on("postbox-toggled.editor-expand",function(){!H&&!I&&window.pageYOffset>20&&(I=!0,window.scrollBy(0,-1),d(),window.scrollBy(0,1)),d()}),w.on("focus.editor-expand input.editor-expand propertychange.editor-expand",c),w.on("keyup.editor-expand",b),D(),C&&C.pubsub.subscribe("hidden",e),m&&(m.settings.wp_autoresize_on=!0,m.execCommand("wpAutoResizeOn"),m.isHidden()||m.execCommand("wpAutoResize")),(!m||m.isHidden())&&c(),d()}function i(){var b=window.getUserSetting("ed_size");window.pageYOffset&&window.pageYOffset>K&&window.scrollTo(window.pageXOffset,0),s.removeClass("wp-editor-expand"),o.off(".editor-expand"),p.off(".editor-expand"),w.off(".editor-expand"),E(),C&&C.pubsub.unsubscribe("hidden",e),a.each([j,v,u,y,t,k,w,z],function(a,b){b&&b.attr("style","")}),F=G=H=I=!1,m&&(m.settings.wp_autoresize_on=!1,m.execCommand("wpAutoResizeOff"),m.isHidden()||(w.hide(),b
|